diff --git a/CustomRoles.cs b/CustomRoles.cs index f6865fb56..6310723e6 100644 --- a/CustomRoles.cs +++ b/CustomRoles.cs @@ -201,6 +201,7 @@ public enum CustomRoles Electric, Enigma, Escort, + Evader, Express, Farmer, Forensic, diff --git a/Main.cs b/Main.cs index b4259be91..00c82e16d 100644 --- a/Main.cs +++ b/Main.cs @@ -513,6 +513,7 @@ public class Main : BasePlugin { CustomRoles.Vacuum, "#E44CD6" }, { CustomRoles.Carrier, "#5DE2E7" }, { CustomRoles.Transmitter, "#c9a11e" }, + { CustomRoles.Evader, "#A4B1DE" }, { CustomRoles.Bouncer, "#95C8E8" }, { CustomRoles.Operative, "#47f5d2" }, { CustomRoles.Tar, "#8C796B" }, diff --git a/Modules/CustomRolesHelper.cs b/Modules/CustomRolesHelper.cs index 01ffc18c3..9681cc9f8 100644 --- a/Modules/CustomRolesHelper.cs +++ b/Modules/CustomRolesHelper.cs @@ -255,6 +255,7 @@ internal static class CustomRolesHelper CustomRoles.Farmer => CustomRoles.Crewmate, CustomRoles.Captain => CustomRoles.Crewmate, CustomRoles.Transmitter => CustomRoles.Crewmate, + CustomRoles.Evader => CustomRoles.Crewmate, CustomRoles.Bouncer => CustomRoles.Crewmate, CustomRoles.Tar => CustomRoles.Crewmate, CustomRoles.Sensor => CustomRoles.Crewmate, @@ -1371,6 +1372,7 @@ internal static class CustomRolesHelper CustomRoles.CameraMan => RoleOptionType.Crewmate_Miscellaneous, CustomRoles.Carrier => RoleOptionType.Crewmate_Miscellaneous, CustomRoles.Demolitionist => RoleOptionType.Crewmate_Miscellaneous, + CustomRoles.Evader => RoleOptionType.Crewmate_Miscellaneous, CustomRoles.Express => RoleOptionType.Crewmate_Miscellaneous, CustomRoles.LazyGuy => RoleOptionType.Crewmate_Miscellaneous, CustomRoles.Journalist => RoleOptionType.Crewmate_Miscellaneous, diff --git a/Patches/ShipStatusPatch.cs b/Patches/ShipStatusPatch.cs index 2e4f7d382..fb4f5462e 100644 --- a/Patches/ShipStatusPatch.cs +++ b/Patches/ShipStatusPatch.cs @@ -181,7 +181,24 @@ internal static class UpdateSystemPatch break; } case SystemTypes.Sabotage when AmongUsClient.Instance.NetworkMode != NetworkModes.FreePlay: - return SabotageSystemTypeUpdateSystemPatch.CheckSabotage(__instance.Systems[SystemTypes.Sabotage].CastFast(), player, systemType); + { + bool allowed = SabotageSystemTypeUpdateSystemPatch.CheckSabotage(__instance.Systems[SystemTypes.Sabotage].CastFast(), player, systemType); + + if (allowed) + { + List pcs = Main.CachedAlivePlayerControls(); + + for (var index = 0; index < pcs.Count; index++) + { + PlayerControl pc = pcs[index]; + + if (pc.Is(CustomRoles.Evader)) + pc.RpcMakeInvisible(); + } + } + + return allowed; + } case SystemTypes.Security when amount == 1: { bool camerasDisabled = Main.CurrentMap switch @@ -232,12 +249,25 @@ internal static class UpdateSystemPatch { bool petcd = !Options.UsePhantomBasis.GetBool(); - foreach (PlayerControl pc in Main.CachedAlivePlayerControls()) + List pcs = Main.CachedAlivePlayerControls(); + + for (var index = 0; index < pcs.Count; index++) { - if (pc.Is(CustomRoles.Wiper)) + PlayerControl pc = pcs[index]; + + switch (pc.GetCustomRole()) { - if (petcd) pc.AddAbilityCD(); - else pc.RpcResetAbilityCooldown(); + case CustomRoles.Wiper: + { + if (petcd) pc.AddAbilityCD(); + else pc.RpcResetAbilityCooldown(); + break; + } + case CustomRoles.Evader: + { + pc.RpcMakeVisible(); + break; + } } } } diff --git a/Resources/Lang/en_US.json b/Resources/Lang/en_US.json index 03ea76ecf..463e9203b 100644 --- a/Resources/Lang/en_US.json +++ b/Resources/Lang/en_US.json @@ -766,6 +766,9 @@ "EscortBlockDuration": "Role-Block Duration", "EscortKillButtonText": "Role-Block", "EscortTargetHacked": "Target successfully role-blocked", + "Evader": "Evader", + "EvaderInfo": "You're Invisible During Sabotages", + "EvaderInfoLong": "(Crewmates):\\nAs the Evader, you are invisible during sabotages.", "Examiner": "Examiner", "ExaminerInfo": "Gather Info, Solve Murders", "ExaminerInfoLong": "(Crewmates):\\nGrants Detective abilities for crewmate roles.", diff --git a/Roles/Standard/Crewmate/Miscellaneous/Evader.cs b/Roles/Standard/Crewmate/Miscellaneous/Evader.cs new file mode 100644 index 000000000..cba326bb6 --- /dev/null +++ b/Roles/Standard/Crewmate/Miscellaneous/Evader.cs @@ -0,0 +1,23 @@ +namespace EHR.Roles; + +public class Evader : RoleBase +{ + public static bool On; + + public override bool IsEnable => On; + + public override void SetupCustomOption() + { + StartSetup(659800); + } + + public override void Init() + { + On = false; + } + + public override void Add(byte playerId) + { + On = true; + } +} \ No newline at end of file