diff --git a/EHR.sln.DotSettings b/EHR.sln.DotSettings index c408eab5a..9cc2208c6 100644 --- a/EHR.sln.DotSettings +++ b/EHR.sln.DotSettings @@ -16,6 +16,7 @@ HP HUD KCD + LI NB NC NE diff --git a/Modules/Utils.cs b/Modules/Utils.cs index 3d125cac1..ff1c36021 100644 --- a/Modules/Utils.cs +++ b/Modules/Utils.cs @@ -430,8 +430,9 @@ public static class Utils 0 => CustomRoles.ImpostorEHR, 1 => Enum.GetValues().Where(x => x.IsEnable() && x.IsImpostor() && x != CustomRoles.LovingImpostor && !HnSManager.AllHnSRoles.Contains(x)).Shuffle()[0], _ => CustomRoles.LovingImpostor - } + }; } + string RoleText = GetRoleName(isHnsAgentOverride ? CustomRoles.Hider : targetMainRole); Color RoleColor = GetRoleColor(targetMainRole); diff --git a/Patches/IntroPatch.cs b/Patches/IntroPatch.cs index b58e7e37b..41f38b0b2 100644 --- a/Patches/IntroPatch.cs +++ b/Patches/IntroPatch.cs @@ -22,7 +22,7 @@ class SetUpRoleTextPatch // After showing team for non-modded clients update player names. IsInIntro = false; - Utils.NotifyRoles(NoCache: true); + Utils.DoNotifyRoles(NoCache: true); LateTask.New(() => { diff --git a/Patches/OnGameStartedPatch.cs b/Patches/OnGameStartedPatch.cs index 3c647bacf..d56d8c7d4 100644 --- a/Patches/OnGameStartedPatch.cs +++ b/Patches/OnGameStartedPatch.cs @@ -24,7 +24,7 @@ internal class ChangeRoleSettings public static void Postfix(AmongUsClient __instance) { SetUpRoleTextPatch.IsInIntro = true; - Utils.NotifyRoles(NoCache: true); + Utils.DoNotifyRoles(NoCache: true); Main.OverrideWelcomeMsg = string.Empty; try diff --git a/Roles/AddOns/Common/Lovers.cs b/Roles/AddOns/Common/Lovers.cs index b2c806f8a..9f2c7ff7a 100644 --- a/Roles/AddOns/Common/Lovers.cs +++ b/Roles/AddOns/Common/Lovers.cs @@ -30,7 +30,7 @@ namespace EHR.Roles.AddOns.Common "Impostor", "RandomONImpRole", "LovingImpostor" - ] + ]; public AddonTypes Type => AddonTypes.Mixed; @@ -79,7 +79,7 @@ namespace EHR.Roles.AddOns.Common .SetParent(LegacyLovers) .SetValueFormat(OptionFormat.Percent) .SetGameMode(customGameMode); - + LovingImpostorRoleForOtherImps = new StringOptionItem(id + 12, "LIRoleForOtherImps", LIRole, 2, TabGroup.Addons) .SetParent(LovingImpostorSpawnChance) .SetGameMode(customGameMode); diff --git a/Roles/Crewmate/Aid.cs b/Roles/Crewmate/Aid.cs index a43056978..8cd0b6936 100644 --- a/Roles/Crewmate/Aid.cs +++ b/Roles/Crewmate/Aid.cs @@ -1,5 +1,7 @@ using System.Collections.Generic; +using System.Linq; using AmongUs.GameOptions; +using UnityEngine; namespace EHR.Roles.Crewmate { @@ -8,14 +10,15 @@ namespace EHR.Roles.Crewmate private const int Id = 640200; public static Dictionary ShieldedPlayers = []; - public byte TargetId; - public static OptionItem AidDur; public static OptionItem AidCD; public static OptionItem TargetKnowsShield; public static OptionItem UseLimitOpt; public static OptionItem UsePet; - public override bool IsEnable => playerIdList.Count > 0; + private static bool On; + + public byte TargetId; + public override bool IsEnable => On; public static void SetupCustomOption() { @@ -27,7 +30,7 @@ namespace EHR.Roles.Crewmate .SetParent(Options.CustomRoleSpawnChances[CustomRoles.Aid]) .SetValueFormat(OptionFormat.Seconds); TargetKnowsShield = new BooleanOptionItem(Id + 14, "AidTargetKnowsAboutShield", true, TabGroup.CrewmateRoles) - .SetParent(Options.CustomRoleSpawnChances[CustomRoles.Aid]) + .SetParent(Options.CustomRoleSpawnChances[CustomRoles.Aid]); UseLimitOpt = new IntegerOptionItem(Id + 12, "AbilityUseLimit", new(1, 20, 1), 5, TabGroup.CrewmateRoles) .SetParent(Options.CustomRoleSpawnChances[CustomRoles.Aid]) .SetValueFormat(OptionFormat.Times); @@ -36,11 +39,13 @@ namespace EHR.Roles.Crewmate public override void Init() { + On = false; ShieldedPlayers = []; } public override void Add(byte playerId) { + On = true; playerId.SetAbilityUseLimit(UseLimitOpt.GetInt()); TargetId = byte.MaxValue; @@ -85,7 +90,7 @@ namespace EHR.Roles.Crewmate } } - public override void OnCoEnterVent(PlayerPhysics physics, Vent vent) + public override void OnCoEnterVent(PlayerPhysics physics, int ventId) { var pc = physics.myPlayer; if (pc.GetAbilityUseLimit() >= 1 && TargetId != byte.MaxValue) @@ -98,10 +103,10 @@ namespace EHR.Roles.Crewmate TargetId = byte.MaxValue; } - LateTask.New(() => physics.RpcBootFromVent(vent), 0.5f, log: false); + LateTask.New(() => physics.RpcBootFromVent(ventId), 0.5f, log: false); } - public override GetSuffix(PlayerControl seer, PlayerControl target, bool hud = false, bool meeting = false) + public override string GetSuffix(PlayerControl seer, PlayerControl target, bool hud = false, bool meeting = false) { if (seer.PlayerId != target.PlayerId || (seer.IsModClient() && !hud)) return string.Empty; if (TargetKnowsShield.GetBool() && ShieldedPlayers.TryGetValue(seer.PlayerId, out var ts))