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
+2
-13
@@ -212,8 +212,6 @@ public static class Deathrace
|
||||
SmokeSpeedReduction = SmokeSpeedReductionOption.GetFloat();
|
||||
EnergyDrinkSpeedIncreasement = EnergyDrinkSpeedIncreasementOption.GetFloat();
|
||||
PowerUpPickupRange = PowerUpPickupRangeOption.GetFloat();
|
||||
|
||||
Main.AllPlayerSpeed.SetAllValues(Main.MinSpeed);
|
||||
}
|
||||
|
||||
public static IEnumerator GameStart()
|
||||
@@ -260,14 +258,6 @@ public static class Deathrace
|
||||
yield return new WaitForSecondsRealtime(4f);
|
||||
NameNotifyManager.Reset();
|
||||
}
|
||||
|
||||
if (Main.CurrentMap == MapNames.Airship)
|
||||
players.MassTP(new RandomSpawn.AirshipSpawnMap().Positions[Clockwise ? Track[^1] : Track[0]]);
|
||||
}
|
||||
else if (Main.CurrentMap == MapNames.Airship)
|
||||
{
|
||||
yield return new WaitForSecondsRealtime(3f);
|
||||
players.MassTP(new RandomSpawn.AirshipSpawnMap().Positions[Clockwise ? Track[^1] : Track[0]]);
|
||||
}
|
||||
|
||||
for (var i = 5; i > 0; i--)
|
||||
@@ -277,12 +267,11 @@ public static class Deathrace
|
||||
yield return new WaitForSecondsRealtime(1f);
|
||||
}
|
||||
|
||||
players.MassTP(RandomSpawn.SpawnMap.GetSpawnMap().Positions[Clockwise ? Track[^1] : Track[0]]);
|
||||
|
||||
NameNotifyManager.Reset();
|
||||
Utils.NotifyRoles();
|
||||
|
||||
Main.AllPlayerSpeed.SetAllValues(Main.RealOptionsData.GetFloat(FloatOptionNames.PlayerSpeedMod));
|
||||
Utils.SyncAllSettings();
|
||||
|
||||
GameGoing = true;
|
||||
}
|
||||
|
||||
|
||||
@@ -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]);
|
||||
}
|
||||
|
||||
|
||||
@@ -153,9 +153,32 @@ public static class MatchInfoGuidePatch
|
||||
|
||||
private static void SetAlternativeText(MatchInfoGuide __instance)
|
||||
{
|
||||
CustomGameMode currentGameMode = Options.CurrentGameMode;
|
||||
var tmp = __instance.rolesEnabledMessage.GetComponent<TextMeshPro>();
|
||||
tmp.DestroyTranslator();
|
||||
tmp.text = currentGameMode == CustomGameMode.Standard ? TranslationController.Instance.GetString(StringNames.MatchInfoGuideNoRolesMessage) : Translator.GetString(Main.HasPlayedGM.ContainsKey(currentGameMode) ? $"GameModeTutorial.{currentGameMode}" : $"ModeDescribe.{currentGameMode}");
|
||||
tmp.text = GetGameModeDescription();
|
||||
}
|
||||
|
||||
private static string GetGameModeDescription()
|
||||
{
|
||||
CustomGameMode currentGameMode = Options.CurrentGameMode;
|
||||
|
||||
if (currentGameMode == CustomGameMode.Standard)
|
||||
return TranslationController.Instance.GetString(StringNames.MatchInfoGuideNoRolesMessage);
|
||||
|
||||
if (Main.HasPlayedGM.ContainsKey(currentGameMode))
|
||||
return Translator.GetString($"GameModeTutorial.{currentGameMode}");
|
||||
|
||||
string description = "<size=80%>";
|
||||
description += Translator.GetString($"ModeDescribe.{currentGameMode}").Replace('\n', ' ').Replace(" ", " ");
|
||||
|
||||
for (int i = 80; i < description.Length; i += 80)
|
||||
{
|
||||
int index = description.LastIndexOf(' ', i);
|
||||
if (index == -1) continue;
|
||||
description = description.Remove(index, 1).Insert(index, "\n");
|
||||
}
|
||||
|
||||
description += "</size>";
|
||||
return description;
|
||||
}
|
||||
}
|
||||
@@ -485,8 +485,8 @@ public static class SabotageSystemTypeUpdateSystemPatch
|
||||
|
||||
try
|
||||
{
|
||||
if (Main.PlayerStates.TryGetValue(player.PlayerId, out PlayerState state))
|
||||
state.Role.OnSabotage(player);
|
||||
if (Main.PlayerStates.TryGetValue(player.PlayerId, out PlayerState state) && !state.Role.OnSabotage(player))
|
||||
return false;
|
||||
}
|
||||
catch (Exception e) { Utils.ThrowException(e); }
|
||||
}
|
||||
|
||||
@@ -4587,7 +4587,7 @@
|
||||
"HotPotato": "HOT POTATO",
|
||||
"ModeHotPotato": "Gamemode: Hot Potato",
|
||||
"ModeDescribe.HotPotato": "In the Hot Potato gamemode, one player always has the hot potato, and they can pass it to anyone by going near someone. Each X seconds (X is set by the host), the player who holds the hot potato dies. The last player alive wins!\\n\\nNote: You cannot pass the hot potato to the player that just gave it to you (their name is colored in cyan, it means they cannot get the hot potato) unless there are only 2 players left.",
|
||||
"GameModeTutorial.HotPotato": "<size=90%>The current game mode is <#e8cd46>Hot Potato</color>.</size>\\n<size=80%>The person with a black name holds the hot potato.\\nThey can pass it to someone by going near them.\\nThe previous holder's name is colored in cyan, they cannot regain\\nthe hot potato until someone else got it, unless only 2 players remain.\\nWhen the time limit ends, the holder of the hot potato dies, and the timer resets,\\nthe hot potato is assigned to a random player. Be the last player alive to win!</size>",
|
||||
"GameModeTutorial.HotPotato": "<size=90%>The current game mode is <#e8cd46>Hot Potato</color>.</size>\\n<size=80%>Black name = potato holder.\\nCyan name = previous holder. Can't pass it to them unless it's 1v1.\\nTimer expires = current holder dies, potato given to random player.\\nLast one alive wins!",
|
||||
"HotPotato_ExtraTimeOnAirship": "Extra Time on <color=#ed0007>Airship</color>",
|
||||
"HotPotato_ExtraTimeOnFungle": "Extra Time on <color=#ffa646>Fungle</color>",
|
||||
"HotPotato_HolderCanPassViaKillButton": "Holders Pass The Potato Via Kill Button Instead Of Proximity",
|
||||
|
||||
@@ -50,7 +50,7 @@ internal class Bomber : RoleBase
|
||||
BomberDiesInExplosion = new BooleanOptionItem(2032, "BomberDiesInExplosion", false, TabGroup.ImpostorRoles)
|
||||
.SetParent(CustomRoleSpawnChances[CustomRoles.Bomber]);
|
||||
|
||||
NukerChance = new IntegerOptionItem(2033, "NukerChance", new(0, 100, 5), 5, TabGroup.ImpostorRoles)
|
||||
NukerChance = new IntegerOptionItem(2033, "NukerChance", new(0, 100, 5), 0, TabGroup.ImpostorRoles)
|
||||
.SetParent(CustomRoleSpawnChances[CustomRoles.Bomber])
|
||||
.SetValueFormat(OptionFormat.Percent);
|
||||
|
||||
|
||||
Reference in new issue
Block a user