diff --git a/Modules/AntiBlackout.cs b/Modules/AntiBlackout.cs index 592958b44..0e4743c5d 100644 --- a/Modules/AntiBlackout.cs +++ b/Modules/AntiBlackout.cs @@ -303,9 +303,10 @@ private static void ResetAllCooldown() { seer.RpcResetAbilityCooldown(); seer.ResetKillCooldown(); + seer.SetKillCooldown(); - if (Main.AllPlayerKillCooldown.TryGetValue(seer.PlayerId, out var kcd) && kcd >= 2f) - seer.SetKillCooldown(kcd - 2f); + if (Main.AllPlayerKillCooldown.TryGetValue(seer.PlayerId, out var kcd)) + seer.SetKillCooldown(kcd + 1f); } else if (seer.HasGhostRole()) { @@ -315,9 +316,14 @@ private static void ResetAllCooldown() } public static void ResetAfterMeeting() { - SkipTasks = false; - ExilePlayerId = -1; ResetAllCooldown(); + + // add 1 second delay + _ = new LateTask(() => + { + SkipTasks = false; + ExilePlayerId = -1; + }, 1f, "Reset Blackout"); } public static void Reset() { @@ -333,4 +339,4 @@ public static void Reset() public static bool ShowExiledInfo = false; public static string StoreExiledMessage = ""; -} \ No newline at end of file +} diff --git a/Modules/ExtendedPlayerControl.cs b/Modules/ExtendedPlayerControl.cs index 5d46f8d8b..f54430b40 100644 --- a/Modules/ExtendedPlayerControl.cs +++ b/Modules/ExtendedPlayerControl.cs @@ -487,6 +487,11 @@ public static void SetKillCooldown(this PlayerControl player, float time = -1f, if (!player.HasImpKillButton(considerVanillaShift: true)) return; if (player.HasImpKillButton(false) && !player.CanUseKillButton()) return; + if (AntiBlackout.SkipTasks) + { + Logger.Info($"player {player.PlayerId} should reset cooldown ({(time >= 0f ? time : Main.AllPlayerKillCooldown[player.PlayerId])}) while AntiBlackout", "SetKillCooldown"); + } + player.SetKillTimer(CD: time); if (target == null) target = player; if (time >= 0f) Main.AllPlayerKillCooldown[player.PlayerId] = time * 2; diff --git a/Patches/ExilePatch.cs b/Patches/ExilePatch.cs index 110fd29b4..7614d7de4 100644 --- a/Patches/ExilePatch.cs +++ b/Patches/ExilePatch.cs @@ -185,7 +185,7 @@ private static void WrapUpFinalizer(NetworkedPlayerInfo exiled) AntiBlackout.ResetAfterMeeting(); Main.LastMeetingEnded = Utils.GetTimeStamp(); - }, 2f, "Reset Cooldown After Meeting"); + }, 1.9f, "Reset Cooldown After Meeting"); } //This should happen shortly after the Exile Controller wrap up finished for clients diff --git a/Patches/PlayerControlPatch.cs b/Patches/PlayerControlPatch.cs index 7e8b22589..e1e993177 100644 --- a/Patches/PlayerControlPatch.cs +++ b/Patches/PlayerControlPatch.cs @@ -392,6 +392,14 @@ public static bool Prefix(PlayerControl __instance, [HarmonyArgument(0)] PlayerC if (isSucceeded && AmongUsClient.Instance.AmHost && GameStates.IsNormalGame) { + // AntiBlackOut protect is active + if (AntiBlackout.SkipTasks) + { + Logger.Info("Murder while AntiBlackOut protect, the kill was canceled and reseted", "MurderPlayer"); + __instance.SetKillCooldown(); + return false; + } + if (target.shapeshifting) { // During shapeshift animation