From 55f18c79518852011c550df0c629f30e5c6bf37d Mon Sep 17 00:00:00 2001 From: Gurge44 Date: Mon, 9 Mar 2026 09:58:11 +0100 Subject: [PATCH] some fixes --- Modules/AntiBlackout.cs | 2 +- Modules/CustomRpcSender.cs | 4 +++- Modules/ExtendedPlayerControl.cs | 2 +- .../PlayerGameOptionsSender.cs | 17 +++++++++++------ Patches/ExilePatch.cs | 5 +++-- Patches/HudPatch.cs | 2 +- Patches/MeetingHudPatch.cs | 13 ++++++++----- Patches/PlayerControlPatch.cs | 4 +++- Patches/PlayerJoinAndLeftPatch.cs | 4 ++-- Resources/Lang/en_US.jsonc | 1 + Roles/Standard/Addons/Common/Allergic.cs | 3 +-- Roles/Standard/Addons/Common/Asthmatic.cs | 5 +++-- Roles/Standard/Crewmate/Investigate/Imitator.cs | 2 +- Roles/Standard/Impostor/Killing/Witch.cs | 4 +--- Roles/Standard/Impostor/Support/Devourer.cs | 3 +++ Roles/Standard/Neutral/Benign/Hater.cs | 2 -- Roles/Standard/Neutral/Killing/Simon.cs | 10 ++++++++-- Roles/Standard/Neutral/Killing/Slenderman.cs | 8 +++++--- Roles/Standard/Neutral/Killing/Virus.cs | 4 ++-- 19 files changed, 58 insertions(+), 37 deletions(-) diff --git a/Modules/AntiBlackout.cs b/Modules/AntiBlackout.cs index 5eca138af..f9cc50476 100644 --- a/Modules/AntiBlackout.cs +++ b/Modules/AntiBlackout.cs @@ -91,7 +91,7 @@ public static class AntiBlackout PlayerControl target = targetId.GetPlayer(); if (!seer || !target || (seerId == targetId && seer.AmOwner && Utils.TempReviveHostRunning)) continue; - if (target.IsAlive()) target.RpcSetRoleDesync(roleType, seer.OwnerId); + if (target.IsAlive() && !Main.AfterMeetingDeathPlayers.ContainsKey(targetId) && Main.LastVotedPlayerInfo != target.Data) target.RpcSetRoleDesync(roleType, seer.OwnerId); else target.RpcSetRoleDesync(GhostRolesManager.AssignedGhostRoles.TryGetValue(targetId, out var ghostRole) ? ghostRole.Instance.RoleTypes : seerId == targetId && !(target.Is(CustomRoleTypes.Impostor) && Options.DeadImpCantSabotage.GetBool()) && Main.PlayerStates.TryGetValue(targetId, out var state) && state.Role.CanUseSabotage(target) ? RoleTypes.ImpostorGhost : RoleTypes.CrewmateGhost, seer.OwnerId); } catch (Exception e) { Utils.ThrowException(e); } diff --git a/Modules/CustomRpcSender.cs b/Modules/CustomRpcSender.cs index 1e74761cf..e32fe66db 100644 --- a/Modules/CustomRpcSender.cs +++ b/Modules/CustomRpcSender.cs @@ -711,7 +711,9 @@ public static class CustomRpcSenderExtensions public static bool RpcExileV2(this CustomRpcSender sender, PlayerControl player) { - sender.RpcSetRole(player, player.GetGhostRoleBasis()); + RoleTypes basis = player.GetGhostRoleBasis(); + if (AmongUsClient.Instance.AmClient) try { player.SetRole(basis); } catch { } + sender.RpcSetRole(player, basis); FixedUpdatePatch.LoversSuicide(player.PlayerId); return true; } diff --git a/Modules/ExtendedPlayerControl.cs b/Modules/ExtendedPlayerControl.cs index 4ccd1c81c..c99643bf5 100644 --- a/Modules/ExtendedPlayerControl.cs +++ b/Modules/ExtendedPlayerControl.cs @@ -399,7 +399,7 @@ internal static class ExtendedPlayerControl try { if (!AmongUsClient.Instance.AmHost) return; - if (AmongUsClient.Instance.AmClient) try { player.StartCoroutine(player.CoSetRole(roleTypes, true)); } catch { } + if (AmongUsClient.Instance.AmClient) try { player.SetRole(roleTypes); } catch { } MessageWriter writer = AmongUsClient.Instance.StartRpcImmediately(player.NetId, (byte)RpcCalls.SetRole, SendOption.Reliable); writer.Write((ushort)roleTypes); writer.Write(true); diff --git a/Modules/GameOptionsSender/PlayerGameOptionsSender.cs b/Modules/GameOptionsSender/PlayerGameOptionsSender.cs index 797792e7b..c34ed1ac8 100644 --- a/Modules/GameOptionsSender/PlayerGameOptionsSender.cs +++ b/Modules/GameOptionsSender/PlayerGameOptionsSender.cs @@ -1,5 +1,6 @@ using System; using System.Collections; +using System.Collections.Generic; using System.Linq; using AmongUs.GameOptions; using EHR.Roles; @@ -276,6 +277,10 @@ public sealed class PlayerGameOptionsSender(PlayerControl player) : GameOptionsS case CustomGameMode.Standard: { President.OnAnyoneApplyGameOptions(opt); + + float playerSpeed = Main.AllPlayerSpeed.GetValueOrDefault(player.PlayerId); + bool frozen = Mathf.Approximately(playerSpeed, Main.MinSpeed); + bool inverted = playerSpeed < 0f; foreach (CustomRoles subRole in state.SubRoles) { @@ -292,19 +297,19 @@ public sealed class PlayerGameOptionsSender(PlayerControl player) : GameOptionsS opt.SetBool(BoolOptionNames.AnonymousVotes, false); break; } - case CustomRoles.Flash: + case CustomRoles.Flash when !frozen: { - Main.AllPlayerSpeed[player.PlayerId] = Options.FlashSpeed.GetFloat(); + Main.AllPlayerSpeed[player.PlayerId] = inverted ? -Options.FlashSpeed.GetFloat() : Options.FlashSpeed.GetFloat(); break; } - case CustomRoles.Giant: + case CustomRoles.Giant when !frozen: { - Main.AllPlayerSpeed[player.PlayerId] = Options.GiantSpeed.GetFloat(); + Main.AllPlayerSpeed[player.PlayerId] = inverted ? -Options.GiantSpeed.GetFloat() : Options.GiantSpeed.GetFloat(); break; } - case CustomRoles.Mare when Options.MareHasIncreasedSpeed.GetBool(): + case CustomRoles.Mare when !frozen && Options.MareHasIncreasedSpeed.GetBool(): { - Main.AllPlayerSpeed[player.PlayerId] = Options.MareSpeedDuringLightsOut.GetFloat(); + Main.AllPlayerSpeed[player.PlayerId] = inverted ? -Options.MareSpeedDuringLightsOut.GetFloat() : Options.MareSpeedDuringLightsOut.GetFloat(); break; } case CustomRoles.Sleep when player.IsAlive() && Utils.IsActive(SystemTypes.Electrical): diff --git a/Patches/ExilePatch.cs b/Patches/ExilePatch.cs index ce2b92df9..d57b2b7ad 100644 --- a/Patches/ExilePatch.cs +++ b/Patches/ExilePatch.cs @@ -103,15 +103,16 @@ internal static class ExileControllerWrapUpPatch GameEndChecker.CheckCustomEndCriteria(); } - if (exiled == null) return; + if (!exiled) return; PlayerControl exiledPlayer = exiled.Object; LateTask.New(() => { - if (!GameStates.IsEnded && exiledPlayer != null) + if (!GameStates.IsEnded && exiledPlayer) { exiledPlayer.RpcExileV2(); Utils.AfterPlayerDeathTasks(exiledPlayer, true); + if (exiledPlayer.IsAlive()) Main.PlayerStates[exiledPlayer.PlayerId].SetDead(); } }, 3.5f, "AfterPlayerDeathTasks For Exiled Player"); } diff --git a/Patches/HudPatch.cs b/Patches/HudPatch.cs index 284d90f02..90a96a08b 100644 --- a/Patches/HudPatch.cs +++ b/Patches/HudPatch.cs @@ -253,7 +253,7 @@ internal static class HudManagerPatch break; } - if (role.PetActivatedAbility() && Options.CurrentGameMode == CustomGameMode.Standard && player.GetRoleTypes() != RoleTypes.Engineer && !role.OnlySpawnsWithPets() && !role.AlwaysUsesPhantomBase() && !player.GetCustomSubRoles().Any(StartGameHostPatch.BasisChangingAddons.ContainsKey) && role is not CustomRoles.Changeling and not CustomRoles.Ninja and not CustomRoles.Duality and not CustomRoles.Witch and not CustomRoles.Silencer && (!role.SimpleAbilityTrigger() || !Options.UsePhantomBasis.GetBool() || !(player.IsNeutralKiller() && Options.UsePhantomBasisForNKs.GetBool())) && !(Options.UseMeetingShapeshift.GetBool() && player.UsesMeetingShapeshift()) && !role.ToString().EndsWith("EHR") && !role.IsVanilla()) + if (role.PetActivatedAbility() && Options.CurrentGameMode == CustomGameMode.Standard && player.GetRoleTypes() != RoleTypes.Engineer && !role.OnlySpawnsWithPets() && !role.AlwaysUsesPhantomBase() && !player.GetCustomSubRoles().Any(StartGameHostPatch.BasisChangingAddons.ContainsKey) && role is not CustomRoles.Changeling and not CustomRoles.Ninja and not CustomRoles.Duality and not CustomRoles.Witch and not CustomRoles.HexMaster and not CustomRoles.Silencer && (!role.SimpleAbilityTrigger() || !Options.UsePhantomBasis.GetBool() || !(player.IsNeutralKiller() && Options.UsePhantomBasisForNKs.GetBool())) && !(Options.UseMeetingShapeshift.GetBool() && player.UsesMeetingShapeshift()) && !role.ToString().EndsWith("EHR") && !role.IsVanilla()) __instance.AbilityButton?.Hide(); if (!LowerInfoText) diff --git a/Patches/MeetingHudPatch.cs b/Patches/MeetingHudPatch.cs index c28f186db..b5933d652 100644 --- a/Patches/MeetingHudPatch.cs +++ b/Patches/MeetingHudPatch.cs @@ -563,11 +563,14 @@ internal static class CheckForEndVotingPatch { try { - if (Witch.PlayerIdList.Count > 0) Witch.OnCheckForEndVoting(deathReason, playerIds); - if (Virus.PlayerIdList.Count > 0) Virus.OnCheckForEndVoting(deathReason, playerIds); - if (deathReason == PlayerState.DeathReason.Vote) Gaslighter.OnExile(playerIds); - if (Wasp.On && deathReason == PlayerState.DeathReason.Vote) Wasp.OnExile(playerIds); - if (CustomRoles.SpellCaster.RoleExist() && deathReason == PlayerState.DeathReason.Vote) SpellCaster.OnExile(playerIds); + if (deathReason == PlayerState.DeathReason.Vote) + { + if (Witch.PlayerIdList.Count > 0) Witch.OnCheckForEndVoting(playerIds); + if (Virus.PlayerIdList.Count > 0) Virus.OnCheckForEndVoting(playerIds); + Gaslighter.OnExile(playerIds); + if (Wasp.On) Wasp.OnExile(playerIds); + if (CustomRoles.SpellCaster.RoleExist()) SpellCaster.OnExile(playerIds); + } foreach (byte playerId in playerIds) { diff --git a/Patches/PlayerControlPatch.cs b/Patches/PlayerControlPatch.cs index b42583dd2..e5a564191 100644 --- a/Patches/PlayerControlPatch.cs +++ b/Patches/PlayerControlPatch.cs @@ -1688,7 +1688,6 @@ internal static class FixedUpdatePatch if (subRoles.Contains(CustomRoles.Spurt)) Spurt.OnFixedUpdate(player); if (subRoles.Contains(CustomRoles.Damocles)) Damocles.Update(player); if (subRoles.Contains(CustomRoles.Stressed)) Stressed.Update(player); - if (subRoles.Contains(CustomRoles.Asthmatic)) Asthmatic.OnFixedUpdate(); if (subRoles.Contains(CustomRoles.Disco)) Disco.OnFixedUpdate(player); if (subRoles.Contains(CustomRoles.Clumsy)) Clumsy.OnFixedUpdate(player); if (subRoles.Contains(CustomRoles.Sonar)) Sonar.OnFixedUpdate(player); @@ -1697,6 +1696,9 @@ internal static class FixedUpdatePatch if (subRoles.Contains(CustomRoles.Allergic)) Allergic.OnFixedUpdate(player); } } + + if (self && inTask && alive && !lowLoad) + Asthmatic.OnFixedUpdate(); if (!lowLoad && Options.UsePets.GetBool() && inTask && (!LastUpdate.TryGetValue(playerId, out long lastPetNotify) || lastPetNotify < now)) { diff --git a/Patches/PlayerJoinAndLeftPatch.cs b/Patches/PlayerJoinAndLeftPatch.cs index 6c59b1721..7ed4387e4 100644 --- a/Patches/PlayerJoinAndLeftPatch.cs +++ b/Patches/PlayerJoinAndLeftPatch.cs @@ -483,8 +483,6 @@ internal static class OnPlayerJoinedPatch { if (!AmongUsClient.Instance.AmHost) return; - Utils.DirtyName.Add(PlayerControl.LocalPlayer.PlayerId); - if (Options.KickSlowJoiningPlayers.GetBool() && ((!client.IsDisconnected() && client.Character.Data.IsIncomplete) || ((client.Character.Data.DefaultOutfit.ColorId < 0 || Palette.PlayerColors.Length <= client.Character.Data.DefaultOutfit.ColorId) && PlayerControl.AllPlayerControls.Count <= 15))) { Logger.SendInGame(GetString("Error.InvalidColor") + $" {client.Id}/{client.PlayerName}", Color.yellow); @@ -531,6 +529,8 @@ internal static class OnPlayerJoinedPatch if (GameStates.IsLobby && !OnGameJoinedPatch.JoiningGame) LateTask.New(Options.AutoSetFactionMinMaxSettings, 2f, log: false); + + LateTask.New(() => Utils.DirtyName.Add(PlayerControl.LocalPlayer.PlayerId), 1f); } } } diff --git a/Resources/Lang/en_US.jsonc b/Resources/Lang/en_US.jsonc index e343dbb1d..2f5c8b92b 100644 --- a/Resources/Lang/en_US.jsonc +++ b/Resources/Lang/en_US.jsonc @@ -3120,6 +3120,7 @@ "SlendermanInfoLong": "(Neutrals):\\nAs the Slenderman, whenever someone gets close to you, they will be blinded until they move away from you.\\n\\nKill everyone to win!", "Slenderman.AfterMeetingBlindCooldown": "Blinding Cooldown After Meetings", "Slenderman.BlindRange": "Blinding Range", + "Slenderman.AffectsPlayersInVents": "Blinding Affects Players Inside Vents", "SoulCollector": "Soul Collector", "SoulCollectorInfo": "You Kill Without Any Notice", "SoulCollectorInfoLong": "(Neutrals):\\nAs the Soul Collector, when you kill someone, everyone other than you and your target will see the target as a living player. Your targets fully die when a meeting gets called.\\nKill everyone to win!", diff --git a/Roles/Standard/Addons/Common/Allergic.cs b/Roles/Standard/Addons/Common/Allergic.cs index 4548bffd9..49b251f30 100644 --- a/Roles/Standard/Addons/Common/Allergic.cs +++ b/Roles/Standard/Addons/Common/Allergic.cs @@ -55,7 +55,7 @@ public class Allergic : IAddon PlayerControl target = targetId.GetPlayer(); - if (target == null || !target.IsAlive() || !FastVector2.DistanceWithinRange(pc.Pos(), target.Pos(), Range.GetFloat())) + if (!target || !target.IsAlive() || !FastVector2.DistanceWithinRange(pc.Pos(), target.Pos(), Range.GetFloat())) { if (AllergyMaxTS.Remove(pc.PlayerId)) { @@ -76,7 +76,6 @@ public class Allergic : IAddon if (Utils.TimeStamp >= endTS) { - AllergicPlayers.Remove(pc.PlayerId); AllergyMaxTS.Remove(pc.PlayerId); pc.Suicide(PlayerState.DeathReason.Allergy, target); } diff --git a/Roles/Standard/Addons/Common/Asthmatic.cs b/Roles/Standard/Addons/Common/Asthmatic.cs index bd583148d..a72b71ff6 100644 --- a/Roles/Standard/Addons/Common/Asthmatic.cs +++ b/Roles/Standard/Addons/Common/Asthmatic.cs @@ -69,7 +69,6 @@ internal class Asthmatic : IAddon LateTask.New(() => { var r = IRandom.Instance; - long now = Utils.TimeStamp; foreach (PlayerControl pc in Main.EnumerateAlivePlayerControls()) { @@ -81,11 +80,13 @@ internal class Asthmatic : IAddon public static void OnFixedUpdate() { + if (Timers.Count == 0) return; + foreach (KeyValuePair kvp in Timers.ToArray()) { PlayerState state = Main.PlayerStates[kvp.Key]; - if (state.IsDead || !state.SubRoles.Contains(CustomRoles.Asthmatic)) + if (state.IsDead || !state.SubRoles.Contains(CustomRoles.Asthmatic) || state.MainRole == CustomRoles.Pestilence) { state.RemoveSubRole(CustomRoles.Asthmatic); Timers.Remove(kvp.Key); diff --git a/Roles/Standard/Crewmate/Investigate/Imitator.cs b/Roles/Standard/Crewmate/Investigate/Imitator.cs index e89022953..3bf57221b 100644 --- a/Roles/Standard/Crewmate/Investigate/Imitator.cs +++ b/Roles/Standard/Crewmate/Investigate/Imitator.cs @@ -41,7 +41,7 @@ public class Imitator : RoleBase { PlayerControl pc = id.GetPlayer(); - if (pc != null && pc.IsAlive() && ImitatingRole.TryGetValue(id, out CustomRoles role) && !pc.Is(role)) + if (pc && pc.IsAlive() && ImitatingRole.TryGetValue(id, out CustomRoles role) && !pc.Is(role)) { Main.AbilityUseLimit.Remove(pc.PlayerId); Utils.SendRPC(CustomRPC.RemoveAbilityUseLimit, pc.PlayerId); diff --git a/Roles/Standard/Impostor/Killing/Witch.cs b/Roles/Standard/Impostor/Killing/Witch.cs index 211d2df45..76ba3a33b 100644 --- a/Roles/Standard/Impostor/Killing/Witch.cs +++ b/Roles/Standard/Impostor/Killing/Witch.cs @@ -248,12 +248,10 @@ public class Witch : RoleBase return false; } - public static void OnCheckForEndVoting(PlayerState.DeathReason deathReason, params byte[] exileIds) + public static void OnCheckForEndVoting(params byte[] exileIds) { try { - if (deathReason != PlayerState.DeathReason.Vote) return; - foreach (byte id in exileIds) { if (PlayerIdList.Contains(id)) diff --git a/Roles/Standard/Impostor/Support/Devourer.cs b/Roles/Standard/Impostor/Support/Devourer.cs index c53549770..9c6a2a457 100644 --- a/Roles/Standard/Impostor/Support/Devourer.cs +++ b/Roles/Standard/Impostor/Support/Devourer.cs @@ -1,6 +1,7 @@ using System.Collections.Generic; using System.Linq; using AmongUs.GameOptions; +using EHR.Modules; using Hazel; using static EHR.Options; using static EHR.Translator; @@ -128,6 +129,8 @@ public class Devourer : RoleBase private static void SetSkin(PlayerControl target, NetworkedPlayerInfo.PlayerOutfit outfit) { + if (UsePets.GetBool()) outfit.PetId = PetsHelper.GetPetId(); + var sender = CustomRpcSender.Create($"Devourer.RpcSetSkin({target.Data.PlayerName})", SendOption.Reliable); target.SetColor(outfit.ColorId); diff --git a/Roles/Standard/Neutral/Benign/Hater.cs b/Roles/Standard/Neutral/Benign/Hater.cs index e02765e99..9c73ea858 100644 --- a/Roles/Standard/Neutral/Benign/Hater.cs +++ b/Roles/Standard/Neutral/Benign/Hater.cs @@ -84,8 +84,6 @@ public class Hater : RoleBase public override bool OnCheckMurder(PlayerControl killer, PlayerControl target) { - if (killer == null || target == null) return false; - if (killer.PlayerId == target.PlayerId) return true; if (target.GetCustomSubRoles().Any(x => x.IsConverted() || x == CustomRoles.Madmate) diff --git a/Roles/Standard/Neutral/Killing/Simon.cs b/Roles/Standard/Neutral/Killing/Simon.cs index 39a66b727..44f3ac485 100644 --- a/Roles/Standard/Neutral/Killing/Simon.cs +++ b/Roles/Standard/Neutral/Killing/Simon.cs @@ -22,6 +22,7 @@ public class Simon : RoleBase public static List Instances = []; private static OptionItem KillCooldown; + private static OptionItem AbilityCooldown; private static OptionItem HasImpostorVision; private bool DoMode; @@ -39,6 +40,10 @@ public class Simon : RoleBase .SetParent(CustomRoleSpawnChances[CustomRoles.Simon]) .SetValueFormat(OptionFormat.Seconds); + AbilityCooldown = new FloatOptionItem(Id + 3, "AbilityCooldown", new(0f, 180f, 0.5f), 5f, TabGroup.NeutralRoles) + .SetParent(CustomRoleSpawnChances[CustomRoles.Simon]) + .SetValueFormat(OptionFormat.Seconds); + HasImpostorVision = new BooleanOptionItem(Id + 4, "ImpostorVision", true, TabGroup.NeutralRoles) .SetParent(CustomRoleSpawnChances[CustomRoles.Simon]); } @@ -95,6 +100,7 @@ public class Simon : RoleBase MarkedPlayers[target.PlayerId] = (DoMode, Main.PlayerStates[target.PlayerId].Role.CanUseKillButton(target) ? Instruction.Kill : target.GetTaskState().HasTasks ? Instruction.Task : Instruction.None); Utils.SendRPC(CustomRPC.SyncRoleData, killer.PlayerId, 3, target.PlayerId, DoMode, (int)MarkedPlayers[target.PlayerId].Instruction); Utils.NotifyRoles(SpecifySeer: killer, SpecifyTarget: target); + killer.SetKillCooldown(AbilityCooldown.GetFloat()); }); } @@ -111,7 +117,7 @@ public class Simon : RoleBase foreach (KeyValuePair kvp in MarkedPlayers) { PlayerControl player = Utils.GetPlayerById(kvp.Key); - if (player == null || !player.IsAlive()) continue; + if (!player || !player.IsAlive()) continue; player.Notify(Translator.GetString(GetNotify(kvp.Value.Instruction, kvp.Value.DoAction, false)), 300f); } @@ -168,7 +174,7 @@ public class Simon : RoleBase if (!kvp.Value.DoAction || kvp.Value.Instruction == Instruction.None) continue; PlayerControl pc = Utils.GetPlayerById(kvp.Key); - if (pc == null || !pc.IsAlive()) continue; + if (!pc || !pc.IsAlive()) continue; pc.Suicide(); } diff --git a/Roles/Standard/Neutral/Killing/Slenderman.cs b/Roles/Standard/Neutral/Killing/Slenderman.cs index 317042d1e..ef3bcba44 100644 --- a/Roles/Standard/Neutral/Killing/Slenderman.cs +++ b/Roles/Standard/Neutral/Killing/Slenderman.cs @@ -17,6 +17,7 @@ public class Slenderman : RoleBase private static OptionItem ImpostorVision; private static OptionItem BlindRange; private static OptionItem AfterMeetingBlindCooldown; + private static OptionItem AffectsPlayersInVents; private HashSet Blinded; private PlayerControl SlendermanPC; @@ -29,7 +30,8 @@ public class Slenderman : RoleBase .AutoSetupOption(ref CanVent, true) .AutoSetupOption(ref ImpostorVision, true) .AutoSetupOption(ref BlindRange, 4f, new FloatValueRule(0.25f, 10f, 0.25f), OptionFormat.Multiplier) - .AutoSetupOption(ref AfterMeetingBlindCooldown, 8, new IntegerValueRule(0, 60, 1), OptionFormat.Seconds); + .AutoSetupOption(ref AfterMeetingBlindCooldown, 8, new IntegerValueRule(0, 60, 1), OptionFormat.Seconds) + .AutoSetupOption(ref AffectsPlayersInVents, false); } public override void Init() @@ -74,9 +76,9 @@ public class Slenderman : RoleBase public override void OnCheckPlayerPosition(PlayerControl pc) { - if (pc.Is(CustomRoles.Slenderman)) return; + if (pc.Is(CustomRoles.Slenderman) || (pc.inVent && !AffectsPlayersInVents.GetBool())) return; - if (MeetingCooldownEndTS > Utils.TimeStamp || SlendermanPC == null || !SlendermanPC.IsAlive()) + if (MeetingCooldownEndTS > Utils.TimeStamp || !SlendermanPC || !SlendermanPC.IsAlive()) { Blinded.Clear(); return; diff --git a/Roles/Standard/Neutral/Killing/Virus.cs b/Roles/Standard/Neutral/Killing/Virus.cs index ba77cb391..8bd2df5bd 100644 --- a/Roles/Standard/Neutral/Killing/Virus.cs +++ b/Roles/Standard/Neutral/Killing/Virus.cs @@ -144,14 +144,14 @@ public class Virus : RoleBase Logger.Info("Add-on assigned:" + target.Data?.PlayerName + " = " + target.GetCustomRole() + " + " + CustomRoles.Contagious, "Assign " + CustomRoles.Contagious); } - public static void OnCheckForEndVoting(PlayerState.DeathReason deathReason, params byte[] exileIds) + public static void OnCheckForEndVoting(params byte[] exileIds) { try { if (!KillInfectedPlayerAfterMeeting.GetBool()) return; PlayerControl virus = Main.EnumerateAlivePlayerControls().FirstOrDefault(a => a.GetCustomRole() == CustomRoles.Virus); - if (virus == null || deathReason != PlayerState.DeathReason.Vote) return; + if (!virus) return; if (exileIds.Contains(virus.PlayerId)) {