From fc9ced76ab8af54956f97e2329d4c6a1ec16c9be Mon Sep 17 00:00:00 2001 From: Gurge44 Date: Mon, 25 May 2026 12:07:03 +0200 Subject: [PATCH] add check --- Patches/CheckGameEndPatch.cs | 57 ++++++++++++++++++----------------- Patches/OnGameStartedPatch.cs | 2 +- 2 files changed, 31 insertions(+), 28 deletions(-) diff --git a/Patches/CheckGameEndPatch.cs b/Patches/CheckGameEndPatch.cs index 5acfed82e..9682452c0 100644 --- a/Patches/CheckGameEndPatch.cs +++ b/Patches/CheckGameEndPatch.cs @@ -678,43 +678,46 @@ internal static class GameEndChecker if (CustomTeamManager.CheckCustomTeamGameEnd()) return true; - bool allAliveAreLovers = true; - for (int aliveIndex = 0; aliveIndex < aapc.Count; aliveIndex++) + if (Main.LoversPlayers.Count > 0 && CustomRoles.Lovers.IsEnable()) { - bool found = false; - int id = aapc[aliveIndex].PlayerId; - for (int loverIndex = 0; loverIndex < Main.LoversPlayers.Count; loverIndex++) + bool allAliveAreLovers = true; + for (int aliveIndex = 0; aliveIndex < aapc.Count; aliveIndex++) { - if (Main.LoversPlayers[loverIndex].PlayerId == id) + bool found = false; + int id = aapc[aliveIndex].PlayerId; + for (int loverIndex = 0; loverIndex < Main.LoversPlayers.Count; loverIndex++) { - found = true; + if (Main.LoversPlayers[loverIndex].PlayerId == id) + { + found = true; + break; + } + } + if (!found) + { + allAliveAreLovers = false; break; } } - if (!found) + if (allAliveAreLovers) { - allAliveAreLovers = false; - break; - } - } - if (allAliveAreLovers) - { - bool allCrew = true; - for (int loverIndex = 0; loverIndex < Main.LoversPlayers.Count; loverIndex++) - { - if (!Main.LoversPlayers[loverIndex].Is(Team.Crewmate)) + bool allCrew = true; + for (int loverIndex = 0; loverIndex < Main.LoversPlayers.Count; loverIndex++) { - allCrew = false; - break; + if (!Main.LoversPlayers[loverIndex].Is(Team.Crewmate)) + { + allCrew = false; + break; + } } - } - if (!allCrew || !Lovers.CrewLoversWinWithCrew.GetBool()) - { - ResetAndSetWinner(CustomWinner.Lovers); - for (int i = 0; i < Main.LoversPlayers.Count; i++) - WinnerIds.Add(Main.LoversPlayers[i].PlayerId); + if (!allCrew || !Lovers.CrewLoversWinWithCrew.GetBool()) + { + ResetAndSetWinner(CustomWinner.Lovers); + for (int i = 0; i < Main.LoversPlayers.Count; i++) + WinnerIds.Add(Main.LoversPlayers[i].PlayerId); - return true; + return true; + } } } diff --git a/Patches/OnGameStartedPatch.cs b/Patches/OnGameStartedPatch.cs index 1ba5e635d..01d1ddcdd 100644 --- a/Patches/OnGameStartedPatch.cs +++ b/Patches/OnGameStartedPatch.cs @@ -168,7 +168,7 @@ internal static class ChangeRoleSettings RoleTypes.Viper }.Do(x => Main.NormalOptions.roleOptions.SetRoleRate(x, 0, 0)); - if (Main.NormalOptions.MapId > 5 && !(Main.NormalOptions.MapId == 6 && SubmergedCompatibility.Loaded)) + if (Main.NormalOptions.MapId > 5 && !(Main.NormalOptions.MapId == 6 && SubmergedCompatibility.Loaded) && !Main.LIMap) { Logger.SendInGame(GetString("UnsupportedMap"), Color.red); ErrorText.Instance.AddError(ErrorCode.UnsupportedMap);