From b0e39574f43558af577f679cbf0f8da38673d34c Mon Sep 17 00:00:00 2001 From: Gurge44 Date: Tue, 16 Dec 2025 09:21:14 +0100 Subject: [PATCH] reduce cno delay & altruist prevents game end during revival --- CTA/CustomTeamAssigner/CustomRoles.cs | 4 ++++ EHR.csproj | 4 ++-- Modules/CustomNetObject.cs | 8 ++++---- Modules/RPC.cs | 8 ++++---- Patches/CheckGameEndPatch.cs | 2 +- Patches/IntroPatch.cs | 4 ++++ Patches/NotificationPopperPatch.cs | 3 +-- Roles/Crewmate/Adventurer.cs | 8 +++++++- Roles/Crewmate/Altruist.cs | 16 +++++++++++----- Roles/Crewmate/Crusader.cs | 8 +++++++- Roles/Crewmate/Dad.cs | 8 +++++++- Roles/Crewmate/Decryptor.cs | 8 +++++++- Roles/Crewmate/Dictator.cs | 8 +++++++- Roles/Crewmate/Drainer.cs | 8 +++++++- Roles/Crewmate/Imitator.cs | 8 +++++++- Roles/Crewmate/Judge.cs | 9 +++++++-- Roles/Crewmate/Mayor.cs | 8 +++++++- Roles/Crewmate/Negotiator.cs | 8 +++++++- Roles/Crewmate/NiceGuesser.cs | 8 +++++++- Roles/Crewmate/Randomizer.cs | 8 +++++++- Roles/Crewmate/Retributionist.cs | 8 +++++++- Roles/Crewmate/Sentinel.cs | 8 +++++++- Roles/Crewmate/Sheriff.cs | 8 +++++++- Roles/Crewmate/Speedrunner.cs | 8 +++++++- Roles/Crewmate/Swapper.cs | 8 +++++++- Roles/Crewmate/Telekinetic.cs | 8 +++++++- Roles/Crewmate/TimeMaster.cs | 8 +++++++- Roles/Crewmate/Tornado.cs | 8 +++++++- Roles/Crewmate/Veteran.cs | 8 +++++++- Roles/Crewmate/Vigilante.cs | 8 +++++++- Roles/Neutral/PlagueBearer.cs | 2 ++ Roles/RoleBase.cs | 2 +- 32 files changed, 188 insertions(+), 42 deletions(-) diff --git a/CTA/CustomTeamAssigner/CustomRoles.cs b/CTA/CustomTeamAssigner/CustomRoles.cs index dee131399..019722aa7 100644 --- a/CTA/CustomTeamAssigner/CustomRoles.cs +++ b/CTA/CustomTeamAssigner/CustomRoles.cs @@ -161,6 +161,7 @@ public enum CustomRoles Battery, Beacon, Benefactor, + Bestower, Bodyguard, CameraMan, Captain, @@ -375,7 +376,9 @@ public enum CustomRoles Sidekick, Simon, Slenderman, + SoulCollector, SoulHunter, + Spider, Spirit, Spiritcaller, Sprayer, @@ -414,6 +417,7 @@ public enum CustomRoles Enchanter, Goddess, Illusionist, + MoonDancer, Poache, PotionMaster, Reaper, diff --git a/EHR.csproj b/EHR.csproj index 3ea6601bd..307458e3a 100644 --- a/EHR.csproj +++ b/EHR.csproj @@ -8,8 +8,8 @@ EHR Gurge44 preview - D:\SteamLibrary\steamapps\common\Among Us - + + C:\Program Files\Epic Games\AmongUs true True $(MSBuildProjectName) diff --git a/Modules/CustomNetObject.cs b/Modules/CustomNetObject.cs index 88286e791..4fdc1cc35 100644 --- a/Modules/CustomNetObject.cs +++ b/Modules/CustomNetObject.cs @@ -166,18 +166,18 @@ namespace EHR { if (GameStates.IsEnded || !AmongUsClient.Instance.AmHost) return; - Logger.Info($" Create Custom Net Object {GetType().Name} (ID {MaxId + 1}) at {position} - Time since game start: {Utils.TimeStamp - Utils.GameStartTimeStamp}s", "CNO.CreateNetObject"); + Logger.Info($" Create Custom Net Object {GetType().Name} (ID {MaxId + 1}) at {position} - Time since game start: {Utils.TimeStamp - IntroCutsceneDestroyPatch.IntroDestroyTS}s", "CNO.CreateNetObject"); - if (!GameStates.InGame || !Main.IntroDestroyed || Utils.TimeStamp - Utils.GameStartTimeStamp < 40) + if (!GameStates.InGame || !Main.IntroDestroyed || Utils.TimeStamp - IntroCutsceneDestroyPatch.IntroDestroyTS < 10) { - if (GameStates.InGame && (!Main.IntroDestroyed || Utils.TimeStamp - Utils.GameStartTimeStamp < 40)) + if (GameStates.InGame && (!Main.IntroDestroyed || Utils.TimeStamp - IntroCutsceneDestroyPatch.IntroDestroyTS < 10)) { Main.Instance.StartCoroutine(CoRoutine()); System.Collections.IEnumerator CoRoutine() { Logger.Info("Delaying CNO Spawn", "CustomNetObject.CreateNetObject"); - while (GameStates.InGame && !GameStates.IsEnded && (!Main.IntroDestroyed || Utils.TimeStamp - Utils.GameStartTimeStamp < 40)) yield return null; + while (GameStates.InGame && !GameStates.IsEnded && (!Main.IntroDestroyed || Utils.TimeStamp - IntroCutsceneDestroyPatch.IntroDestroyTS < 10)) yield return null; yield return new WaitForSeconds(3f); if (!GameStates.InGame || GameStates.IsEnded || GameStates.IsMeeting || ExileController.Instance || AntiBlackout.SkipTasks) yield break; CreateNetObject(sprite, position); diff --git a/Modules/RPC.cs b/Modules/RPC.cs index 80337659c..f3237a072 100644 --- a/Modules/RPC.cs +++ b/Modules/RPC.cs @@ -626,18 +626,18 @@ internal static class RPCHandlerPatch case CustomRPC.NotificationPopper: { byte typeId = reader.ReadByte(); - int item = reader.ReadPackedInt32(); + int index = reader.ReadPackedInt32(); int customRole = reader.ReadPackedInt32(); bool playSound = reader.ReadBoolean(); - OptionItem key = OptionItem.AllOptions[item]; + OptionItem key = OptionItem.FastOptions[index]; switch (typeId) { case 0: - NotificationPopperPatch.AddSettingsChangeMessage(item, key, playSound); + NotificationPopperPatch.AddSettingsChangeMessage(index, key, playSound); break; case 1: - NotificationPopperPatch.AddRoleSettingsChangeMessage(item, key, (CustomRoles)customRole, playSound); + NotificationPopperPatch.AddRoleSettingsChangeMessage(index, key, (CustomRoles)customRole, playSound); break; } diff --git a/Patches/CheckGameEndPatch.cs b/Patches/CheckGameEndPatch.cs index b726414d3..a6a3d155a 100644 --- a/Patches/CheckGameEndPatch.cs +++ b/Patches/CheckGameEndPatch.cs @@ -617,7 +617,7 @@ internal static class GameEndChecker foreach (PlayerState playerState in statesCoutingAsCrew) { if (playerState.IsDead || !Options.CrewAdvancedGameEndCheckingSettings.TryGetValue(playerState.MainRole, out var option) || !option.GetBool()) continue; - playerState.Role.ManipulateGameEndCheckCrew(out bool keepGameGoing, out int countsAs); + playerState.Role.ManipulateGameEndCheckCrew(playerState, out bool keepGameGoing, out int countsAs); crewKeepsGameGoing |= keepGameGoing; crew += countsAs - 1; } diff --git a/Patches/IntroPatch.cs b/Patches/IntroPatch.cs index cf5079bda..4c279b7f6 100644 --- a/Patches/IntroPatch.cs +++ b/Patches/IntroPatch.cs @@ -1117,10 +1117,14 @@ internal static class BeginImpostorPatch internal static class IntroCutsceneDestroyPatch { public static bool PreventKill; + public static long IntroDestroyTS; + public static void Postfix( /*IntroCutscene __instance*/) { if (!GameStates.IsInGame) return; + IntroDestroyTS = Utils.TimeStamp; + Main.IntroDestroyed = true; PreventKill = true; LateTask.New(() => PreventKill = false, 10f, "PreventKillReset"); diff --git a/Patches/NotificationPopperPatch.cs b/Patches/NotificationPopperPatch.cs index 3ef0c3273..e0a433dc7 100644 --- a/Patches/NotificationPopperPatch.cs +++ b/Patches/NotificationPopperPatch.cs @@ -72,8 +72,7 @@ internal static class NotificationPopperPatch private static void SendRpc(byte typeId, int index, CustomRoles customRole = CustomRoles.NotAssigned, bool playSound = true) { - if (Options.HideGameSettings.GetBool()) return; - + if (!AmongUsClient.Instance.AmHost || Options.HideGameSettings.GetBool()) return; Utils.SendRPC(CustomRPC.NotificationPopper, typeId, index, (int)customRole, playSound); } } \ No newline at end of file diff --git a/Roles/Crewmate/Adventurer.cs b/Roles/Crewmate/Adventurer.cs index 7c34ff5da..a669a477a 100644 --- a/Roles/Crewmate/Adventurer.cs +++ b/Roles/Crewmate/Adventurer.cs @@ -442,8 +442,14 @@ internal class Adventurer : RoleBase return finalText; } - public override void ManipulateGameEndCheckCrew(out bool keepGameGoing, out int countsAs) + public override void ManipulateGameEndCheckCrew(PlayerState playerState, out bool keepGameGoing, out int countsAs) { + if (playerState.IsDead) + { + base.ManipulateGameEndCheckCrew(playerState, out keepGameGoing, out countsAs); + return; + } + keepGameGoing = true; countsAs = 1; } diff --git a/Roles/Crewmate/Altruist.cs b/Roles/Crewmate/Altruist.cs index 324ad3c22..615b875d5 100644 --- a/Roles/Crewmate/Altruist.cs +++ b/Roles/Crewmate/Altruist.cs @@ -70,6 +70,11 @@ public class Altruist : RoleBase { if (!RevivingMode || target.Disconnected || target.Object.IsAlive() || target.Object.Is(CustomRoles.Disregarded)) return true; + RevivingMode = false; + ReviveTarget = target.PlayerId; + ReviveStartTS = Utils.TimeStamp; + ReviveTargetPos = reporter.Pos(); + PlayerState state = Main.PlayerStates[reporter.PlayerId]; state.deathReason = PlayerState.DeathReason.Sacrifice; state.RealKiller = (DateTime.Now, target.PlayerId); @@ -77,11 +82,6 @@ public class Altruist : RoleBase reporter.RpcExileV2(); Utils.AfterPlayerDeathTasks(reporter); - RevivingMode = false; - ReviveTarget = target.PlayerId; - ReviveStartTS = Utils.TimeStamp; - ReviveTargetPos = reporter.Pos(); - return false; } @@ -166,4 +166,10 @@ public class Altruist : RoleBase { return !IsThisRole(pc) || pc.Is(CustomRoles.Nimble) || pc.GetClosestVent()?.Id == ventId; } + + public override void ManipulateGameEndCheckCrew(PlayerState playerState, out bool keepGameGoing, out int countsAs) + { + keepGameGoing = ReviveStartTS != 0; + countsAs = 1; + } } diff --git a/Roles/Crewmate/Crusader.cs b/Roles/Crewmate/Crusader.cs index eb730ce80..51490e67c 100644 --- a/Roles/Crewmate/Crusader.cs +++ b/Roles/Crewmate/Crusader.cs @@ -85,8 +85,14 @@ public class Crusader : RoleBase return false; } - public override void ManipulateGameEndCheckCrew(out bool keepGameGoing, out int countsAs) + public override void ManipulateGameEndCheckCrew(PlayerState playerState, out bool keepGameGoing, out int countsAs) { + if (playerState.IsDead) + { + base.ManipulateGameEndCheckCrew(playerState, out keepGameGoing, out countsAs); + return; + } + keepGameGoing = false; countsAs = 2; } diff --git a/Roles/Crewmate/Dad.cs b/Roles/Crewmate/Dad.cs index ed81fa4cf..206437a4e 100644 --- a/Roles/Crewmate/Dad.cs +++ b/Roles/Crewmate/Dad.cs @@ -473,8 +473,14 @@ public class Dad : RoleBase return !IsThisRole(pc) || pc.Is(CustomRoles.Nimble) || pc.GetClosestVent()?.Id == ventId; } - public override void ManipulateGameEndCheckCrew(out bool keepGameGoing, out int countsAs) + public override void ManipulateGameEndCheckCrew(PlayerState playerState, out bool keepGameGoing, out int countsAs) { + if (playerState.IsDead) + { + base.ManipulateGameEndCheckCrew(playerState, out keepGameGoing, out countsAs); + return; + } + keepGameGoing = true; countsAs = 1; } diff --git a/Roles/Crewmate/Decryptor.cs b/Roles/Crewmate/Decryptor.cs index 372c0e493..514a96e2e 100644 --- a/Roles/Crewmate/Decryptor.cs +++ b/Roles/Crewmate/Decryptor.cs @@ -154,8 +154,14 @@ public class Decryptor : RoleBase }; } - public override void ManipulateGameEndCheckCrew(out bool keepGameGoing, out int countsAs) + public override void ManipulateGameEndCheckCrew(PlayerState playerState, out bool keepGameGoing, out int countsAs) { + if (playerState.IsDead) + { + base.ManipulateGameEndCheckCrew(playerState, out keepGameGoing, out countsAs); + return; + } + keepGameGoing = GuessMode.GetValue() == 2; countsAs = 1; } diff --git a/Roles/Crewmate/Dictator.cs b/Roles/Crewmate/Dictator.cs index f5218c4fc..f476203e3 100644 --- a/Roles/Crewmate/Dictator.cs +++ b/Roles/Crewmate/Dictator.cs @@ -18,8 +18,14 @@ internal class Dictator : RoleBase public override void Add(byte playerId) { } - public override void ManipulateGameEndCheckCrew(out bool keepGameGoing, out int countsAs) + public override void ManipulateGameEndCheckCrew(PlayerState playerState, out bool keepGameGoing, out int countsAs) { + if (playerState.IsDead) + { + base.ManipulateGameEndCheckCrew(playerState, out keepGameGoing, out countsAs); + return; + } + keepGameGoing = true; countsAs = 1; } diff --git a/Roles/Crewmate/Drainer.cs b/Roles/Crewmate/Drainer.cs index c70340e79..eb4168bae 100644 --- a/Roles/Crewmate/Drainer.cs +++ b/Roles/Crewmate/Drainer.cs @@ -128,8 +128,14 @@ public class Drainer : RoleBase return !IsThisRole(pc) || pc.Is(CustomRoles.Nimble) || pc.GetClosestVent()?.Id == ventId; } - public override void ManipulateGameEndCheckCrew(out bool keepGameGoing, out int countsAs) + public override void ManipulateGameEndCheckCrew(PlayerState playerState, out bool keepGameGoing, out int countsAs) { + if (playerState.IsDead) + { + base.ManipulateGameEndCheckCrew(playerState, out keepGameGoing, out countsAs); + return; + } + keepGameGoing = true; countsAs = 1; } diff --git a/Roles/Crewmate/Imitator.cs b/Roles/Crewmate/Imitator.cs index d7cb70e18..ea1ef5c43 100644 --- a/Roles/Crewmate/Imitator.cs +++ b/Roles/Crewmate/Imitator.cs @@ -116,8 +116,14 @@ public class Imitator : RoleBase } } - public override void ManipulateGameEndCheckCrew(out bool keepGameGoing, out int countsAs) + public override void ManipulateGameEndCheckCrew(PlayerState playerState, out bool keepGameGoing, out int countsAs) { + if (playerState.IsDead) + { + base.ManipulateGameEndCheckCrew(playerState, out keepGameGoing, out countsAs); + return; + } + keepGameGoing = true; countsAs = 1; } diff --git a/Roles/Crewmate/Judge.cs b/Roles/Crewmate/Judge.cs index 6dcdc0c76..089301f07 100644 --- a/Roles/Crewmate/Judge.cs +++ b/Roles/Crewmate/Judge.cs @@ -324,10 +324,15 @@ public class Judge : RoleBase } } - public override void ManipulateGameEndCheckCrew(out bool keepGameGoing, out int countsAs) + public override void ManipulateGameEndCheckCrew(PlayerState playerState, out bool keepGameGoing, out int countsAs) { + if (playerState.IsDead) + { + base.ManipulateGameEndCheckCrew(playerState, out keepGameGoing, out countsAs); + return; + } + keepGameGoing = true; countsAs = 1; } - } diff --git a/Roles/Crewmate/Mayor.cs b/Roles/Crewmate/Mayor.cs index 5e0785cd0..56fc11c17 100644 --- a/Roles/Crewmate/Mayor.cs +++ b/Roles/Crewmate/Mayor.cs @@ -142,8 +142,14 @@ internal class Mayor : RoleBase return !IsThisRole(pc) || pc.Is(CustomRoles.Nimble) || pc.GetClosestVent()?.Id == ventId; } - public override void ManipulateGameEndCheckCrew(out bool keepGameGoing, out int countsAs) + public override void ManipulateGameEndCheckCrew(PlayerState playerState, out bool keepGameGoing, out int countsAs) { + if (playerState.IsDead) + { + base.ManipulateGameEndCheckCrew(playerState, out keepGameGoing, out countsAs); + return; + } + keepGameGoing = false; countsAs = 1 + MayorAdditionalVote.GetInt() + TaskVotes; } diff --git a/Roles/Crewmate/Negotiator.cs b/Roles/Crewmate/Negotiator.cs index 19ff90f28..6666efb20 100644 --- a/Roles/Crewmate/Negotiator.cs +++ b/Roles/Crewmate/Negotiator.cs @@ -169,8 +169,14 @@ public class Negotiator : RoleBase LowSpeed } - public override void ManipulateGameEndCheckCrew(out bool keepGameGoing, out int countsAs) + public override void ManipulateGameEndCheckCrew(PlayerState playerState, out bool keepGameGoing, out int countsAs) { + if (playerState.IsDead) + { + base.ManipulateGameEndCheckCrew(playerState, out keepGameGoing, out countsAs); + return; + } + keepGameGoing = true; countsAs = 1; } diff --git a/Roles/Crewmate/NiceGuesser.cs b/Roles/Crewmate/NiceGuesser.cs index 16cf9ce3b..320269895 100644 --- a/Roles/Crewmate/NiceGuesser.cs +++ b/Roles/Crewmate/NiceGuesser.cs @@ -30,8 +30,14 @@ internal class NiceGuesser : RoleBase public override void Add(byte playerId) { } - public override void ManipulateGameEndCheckCrew(out bool keepGameGoing, out int countsAs) + public override void ManipulateGameEndCheckCrew(PlayerState playerState, out bool keepGameGoing, out int countsAs) { + if (playerState.IsDead) + { + base.ManipulateGameEndCheckCrew(playerState, out keepGameGoing, out countsAs); + return; + } + keepGameGoing = true; countsAs = 1; } diff --git a/Roles/Crewmate/Randomizer.cs b/Roles/Crewmate/Randomizer.cs index 5fc036757..9a1df74fd 100644 --- a/Roles/Crewmate/Randomizer.cs +++ b/Roles/Crewmate/Randomizer.cs @@ -795,8 +795,14 @@ internal class Randomizer : RoleBase catch (Exception ex) { Logger.Exception(ex, "Randomizer"); } } - public override void ManipulateGameEndCheckCrew(out bool keepGameGoing, out int countsAs) + public override void ManipulateGameEndCheckCrew(PlayerState playerState, out bool keepGameGoing, out int countsAs) { + if (playerState.IsDead) + { + base.ManipulateGameEndCheckCrew(playerState, out keepGameGoing, out countsAs); + return; + } + keepGameGoing = true; countsAs = 1; } diff --git a/Roles/Crewmate/Retributionist.cs b/Roles/Crewmate/Retributionist.cs index 6fd1554dd..b39b797e8 100644 --- a/Roles/Crewmate/Retributionist.cs +++ b/Roles/Crewmate/Retributionist.cs @@ -163,8 +163,14 @@ public class Retributionist : RoleBase } } - public override void ManipulateGameEndCheckCrew(out bool keepGameGoing, out int countsAs) + public override void ManipulateGameEndCheckCrew(PlayerState playerState, out bool keepGameGoing, out int countsAs) { + if (playerState.IsDead) + { + base.ManipulateGameEndCheckCrew(playerState, out keepGameGoing, out countsAs); + return; + } + keepGameGoing = GameStates.IsInTask || Notified; countsAs = 1; } diff --git a/Roles/Crewmate/Sentinel.cs b/Roles/Crewmate/Sentinel.cs index 00c1fe4b9..a34462b14 100644 --- a/Roles/Crewmate/Sentinel.cs +++ b/Roles/Crewmate/Sentinel.cs @@ -220,8 +220,14 @@ internal class Sentinel : RoleBase return !IsThisRole(pc) || pc.Is(CustomRoles.Nimble) || pc.GetClosestVent()?.Id == ventId; } - public override void ManipulateGameEndCheckCrew(out bool keepGameGoing, out int countsAs) + public override void ManipulateGameEndCheckCrew(PlayerState playerState, out bool keepGameGoing, out int countsAs) { + if (playerState.IsDead) + { + base.ManipulateGameEndCheckCrew(playerState, out keepGameGoing, out countsAs); + return; + } + keepGameGoing = true; countsAs = 1; } diff --git a/Roles/Crewmate/Sheriff.cs b/Roles/Crewmate/Sheriff.cs index a26e90f8a..9a9975d0d 100644 --- a/Roles/Crewmate/Sheriff.cs +++ b/Roles/Crewmate/Sheriff.cs @@ -186,8 +186,14 @@ public class Sheriff : RoleBase return ShowShotLimit.GetBool() ? base.GetProgressText(playerId, comms) : Utils.GetTaskCount(playerId, comms); } - public override void ManipulateGameEndCheckCrew(out bool keepGameGoing, out int countsAs) + public override void ManipulateGameEndCheckCrew(PlayerState playerState, out bool keepGameGoing, out int countsAs) { + if (playerState.IsDead) + { + base.ManipulateGameEndCheckCrew(playerState, out keepGameGoing, out countsAs); + return; + } + keepGameGoing = true; countsAs = 1; } diff --git a/Roles/Crewmate/Speedrunner.cs b/Roles/Crewmate/Speedrunner.cs index 582bc704f..d24342912 100644 --- a/Roles/Crewmate/Speedrunner.cs +++ b/Roles/Crewmate/Speedrunner.cs @@ -92,8 +92,14 @@ internal class Speedrunner : RoleBase return string.Format(notifyString, speedrunnerName, ts.RemainingTasksCount); } - public override void ManipulateGameEndCheckCrew(out bool keepGameGoing, out int countsAs) + public override void ManipulateGameEndCheckCrew(PlayerState playerState, out bool keepGameGoing, out int countsAs) { + if (playerState.IsDead) + { + base.ManipulateGameEndCheckCrew(playerState, out keepGameGoing, out countsAs); + return; + } + keepGameGoing = true; countsAs = 1; } diff --git a/Roles/Crewmate/Swapper.cs b/Roles/Crewmate/Swapper.cs index 4f54236de..e4bfcdcdb 100644 --- a/Roles/Crewmate/Swapper.cs +++ b/Roles/Crewmate/Swapper.cs @@ -334,8 +334,14 @@ public class Swapper : RoleBase } } - public override void ManipulateGameEndCheckCrew(out bool keepGameGoing, out int countsAs) + public override void ManipulateGameEndCheckCrew(PlayerState playerState, out bool keepGameGoing, out int countsAs) { + if (playerState.IsDead) + { + base.ManipulateGameEndCheckCrew(playerState, out keepGameGoing, out countsAs); + return; + } + keepGameGoing = true; countsAs = 1; } diff --git a/Roles/Crewmate/Telekinetic.cs b/Roles/Crewmate/Telekinetic.cs index cbbfc8d5c..338867c85 100644 --- a/Roles/Crewmate/Telekinetic.cs +++ b/Roles/Crewmate/Telekinetic.cs @@ -226,8 +226,14 @@ public class Telekinetic : RoleBase Doors } - public override void ManipulateGameEndCheckCrew(out bool keepGameGoing, out int countsAs) + public override void ManipulateGameEndCheckCrew(PlayerState playerState, out bool keepGameGoing, out int countsAs) { + if (playerState.IsDead) + { + base.ManipulateGameEndCheckCrew(playerState, out keepGameGoing, out countsAs); + return; + } + keepGameGoing = true; countsAs = 1; } diff --git a/Roles/Crewmate/TimeMaster.cs b/Roles/Crewmate/TimeMaster.cs index cc51c5f45..03911a0d3 100644 --- a/Roles/Crewmate/TimeMaster.cs +++ b/Roles/Crewmate/TimeMaster.cs @@ -233,8 +233,14 @@ internal class TimeMaster : RoleBase return !IsThisRole(pc) || pc.Is(CustomRoles.Nimble) || pc.GetClosestVent()?.Id == ventId; } - public override void ManipulateGameEndCheckCrew(out bool keepGameGoing, out int countsAs) + public override void ManipulateGameEndCheckCrew(PlayerState playerState, out bool keepGameGoing, out int countsAs) { + if (playerState.IsDead) + { + base.ManipulateGameEndCheckCrew(playerState, out keepGameGoing, out countsAs); + return; + } + keepGameGoing = false; countsAs = 1; int length = TimeMasterRewindTimeLength.GetInt(); diff --git a/Roles/Crewmate/Tornado.cs b/Roles/Crewmate/Tornado.cs index d0ffb30aa..4390f27a7 100644 --- a/Roles/Crewmate/Tornado.cs +++ b/Roles/Crewmate/Tornado.cs @@ -174,8 +174,14 @@ internal class Tornado : RoleBase return string.Join(hud ? "\n" : ", ", Tornados.Select(x => $"Tornado {GetFormattedRoomName(x.Key.RoomName)} {GetFormattedVectorText(x.Key.Location)} ({(int)(TornadoDuration.GetInt() - (TimeStamp - x.Value) + 1)}s)")); } - public override void ManipulateGameEndCheckCrew(out bool keepGameGoing, out int countsAs) + public override void ManipulateGameEndCheckCrew(PlayerState playerState, out bool keepGameGoing, out int countsAs) { + if (playerState.IsDead) + { + base.ManipulateGameEndCheckCrew(playerState, out keepGameGoing, out countsAs); + return; + } + keepGameGoing = true; countsAs = 1; } diff --git a/Roles/Crewmate/Veteran.cs b/Roles/Crewmate/Veteran.cs index 82933e5b9..12b370678 100644 --- a/Roles/Crewmate/Veteran.cs +++ b/Roles/Crewmate/Veteran.cs @@ -156,8 +156,14 @@ internal class Veteran : RoleBase return !IsThisRole(pc) || pc.Is(CustomRoles.Nimble) || pc.GetClosestVent()?.Id == ventId; } - public override void ManipulateGameEndCheckCrew(out bool keepGameGoing, out int countsAs) + public override void ManipulateGameEndCheckCrew(PlayerState playerState, out bool keepGameGoing, out int countsAs) { + if (playerState.IsDead) + { + base.ManipulateGameEndCheckCrew(playerState, out keepGameGoing, out countsAs); + return; + } + keepGameGoing = true; countsAs = 1; } diff --git a/Roles/Crewmate/Vigilante.cs b/Roles/Crewmate/Vigilante.cs index 63304a2c9..5a56caa2b 100644 --- a/Roles/Crewmate/Vigilante.cs +++ b/Roles/Crewmate/Vigilante.cs @@ -111,8 +111,14 @@ public class Vigilante : RoleBase }, 0.2f, log: false); } - public override void ManipulateGameEndCheckCrew(out bool keepGameGoing, out int countsAs) + public override void ManipulateGameEndCheckCrew(PlayerState playerState, out bool keepGameGoing, out int countsAs) { + if (playerState.IsDead) + { + base.ManipulateGameEndCheckCrew(playerState, out keepGameGoing, out countsAs); + return; + } + keepGameGoing = PlayerIdList.Exists(x => !Killed.Contains(x)); countsAs = 1; } diff --git a/Roles/Neutral/PlagueBearer.cs b/Roles/Neutral/PlagueBearer.cs index 976d458c0..a3664b55c 100644 --- a/Roles/Neutral/PlagueBearer.cs +++ b/Roles/Neutral/PlagueBearer.cs @@ -121,6 +121,8 @@ public class PlagueBearer : RoleBase { if (IsPlagued(killer.PlayerId, target.PlayerId)) { + killer.ResetKillCooldown(); + killer.SetKillCooldown(PlagueBearerCDOpt.GetFloat()); killer.Notify(GetString("PlagueBearerAlreadyPlagued")); return false; } diff --git a/Roles/RoleBase.cs b/Roles/RoleBase.cs index 1bb5faffe..3215fc477 100644 --- a/Roles/RoleBase.cs +++ b/Roles/RoleBase.cs @@ -196,7 +196,7 @@ public abstract class RoleBase : IComparable return seerRole.IsNK() && seerRole == target.GetCustomRole() && seer.GetTeam() == target.GetTeam(); } - public virtual void ManipulateGameEndCheckCrew(out bool keepGameGoing, out int countsAs) + public virtual void ManipulateGameEndCheckCrew(PlayerState playerState, out bool keepGameGoing, out int countsAs) { keepGameGoing = false; countsAs = 1;