mirror of
https://github.com/Gurge44/EndlessHostRoles.git
synced 2026-10-20 01:46:25 +00:00
more fixes
This commit is contained in:
1 parent
47f7eb0c2b
commit
f84b5cc909
7 files changed
+49
-23
No files matched your search
@@ -1737,16 +1737,22 @@ internal static class CustomRolesHelper
|
||||
|
||||
public int GetMode()
|
||||
{
|
||||
return Options.GetRoleSpawnMode(role);
|
||||
return role switch
|
||||
{
|
||||
CustomRoles.Nuker => !CustomRoles.Bomber.IsEnable() ? 0 : Bomber.NukerChance.GetInt(),
|
||||
CustomRoles.Bard => !CustomRoles.Arrogance.IsEnable() ? 0 : Arrogance.BardChance.GetInt(),
|
||||
CustomRoles.Sunnyboy => !CustomRoles.Jester.IsEnable() ? 0 : Jester.SunnyboyChance.GetInt(),
|
||||
_ => Options.GetRoleSpawnMode(role)
|
||||
};
|
||||
}
|
||||
|
||||
public bool IsEnable()
|
||||
{
|
||||
return role switch
|
||||
{
|
||||
CustomRoles.Nuker => Bomber.NukerChance.GetInt() > 0,
|
||||
CustomRoles.Bard => Arrogance.BardChance.GetInt() > 0,
|
||||
CustomRoles.Sunnyboy => Jester.SunnyboyChance.GetInt() > 0,
|
||||
CustomRoles.Nuker => CustomRoles.Bomber.IsEnable() && Bomber.NukerChance.GetInt() > 0,
|
||||
CustomRoles.Bard => CustomRoles.Arrogance.IsEnable() && Arrogance.BardChance.GetInt() > 0,
|
||||
CustomRoles.Sunnyboy => CustomRoles.Jester.IsEnable() && Jester.SunnyboyChance.GetInt() > 0,
|
||||
_ => role.GetCount() > 0
|
||||
};
|
||||
}
|
||||
|
||||
@@ -42,7 +42,11 @@ public static class CollectionExtensions
|
||||
/// <param name="value"></param>
|
||||
public void SetAllValues(TValue value)
|
||||
{
|
||||
#if IL2CPP
|
||||
foreach (TKey key in dictionary.Keys)
|
||||
#else
|
||||
foreach (TKey key in dictionary.Keys.ToArray())
|
||||
#endif
|
||||
dictionary[key] = value;
|
||||
}
|
||||
|
||||
@@ -52,7 +56,11 @@ public static class CollectionExtensions
|
||||
/// <param name="adjust">The function to adjust the values with</param>
|
||||
public void AdjustAllValues(Func<TValue, TValue> adjust)
|
||||
{
|
||||
#if IL2CPP
|
||||
foreach (TKey key in dictionary.Keys)
|
||||
#else
|
||||
foreach (TKey key in dictionary.Keys.ToArray())
|
||||
#endif
|
||||
dictionary[key] = adjust(dictionary[key]);
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user