fix incorrect win conditions & optimize

This commit is contained in:
Gurge44 committed 2024-03-04 19:46:25 +01:00
1 parent 6d0470308c
commit d2feee9a61
2 files changed
+16 -12

No files matched your search

+2 -1
View File
@@ -1351,8 +1351,9 @@ internal static class CustomRolesHelper
CustomRoles.Refugee => CountTypes.Impostor,
CustomRoles.Glitch => CountTypes.Glitch,
CustomRoles.Spiritcaller => CountTypes.Spiritcaller,
CustomRoles.DarkHide => DarkHide.SnatchesWin.GetBool() ? CountTypes.Crew : CountTypes.DarkHide,
_ => role.IsImpostorTeam() ? CountTypes.Impostor : CountTypes.Crew,
_ => role.Is(Team.Impostor) ? CountTypes.Impostor : CountTypes.Crew
};
public static bool HasSubRole(this PlayerControl pc) => Main.PlayerStates[pc.PlayerId].SubRoles.Count > 0;
+14 -11
View File
@@ -344,7 +344,7 @@ class GameEndChecker
foreach (var role in EnumHelper.GetAllValues<CustomRoles>())
{
if (!role.IsNK() || role.IsMadmate() || role is CustomRoles.Sidekick || (role == CustomRoles.Arsonist && !Options.ArsonistCanIgniteAnytime.GetBool())) continue;
if (!role.IsNK() || role.IsMadmate() || role is CustomRoles.Sidekick || (role == CustomRoles.Arsonist && !Options.ArsonistCanIgniteAnytime.GetBool()) || (role == CustomRoles.DarkHide && DarkHide.SnatchesWin.GetBool())) continue;
CustomRoles? keyRole = role.IsRecruitingRole() ? null : role;
CustomWinner keyWinner = (CustomWinner)role;
@@ -353,17 +353,20 @@ class GameEndChecker
roleCounts[(keyRole, keyWinner)] = value;
}
foreach (PlayerControl x in Main.AllAlivePlayerControls)
if (CustomRoles.DualPersonality.IsEnable())
{
CustomRoles role = x.GetCustomRole();
if ((x.Is(CustomRoles.Madmate) && x.Is(CustomRoles.DualPersonality)) ||
(role.IsImpostor() && x.Is(CustomRoles.DualPersonality))) Imp++;
if (role.IsCrewmate() && x.Is(CustomRoles.DualPersonality)) Crew++;
if (x.Is(CustomRoles.Charmed) && x.Is(CustomRoles.DualPersonality)) roleCounts[(null, CustomWinner.Succubus)]++;
if (x.Is(CustomRoles.Undead) && x.Is(CustomRoles.DualPersonality)) roleCounts[(null, CustomWinner.Necromancer)]++;
if (x.Is(CustomRoles.Sidekick) && x.Is(CustomRoles.DualPersonality)) roleCounts[(null, CustomWinner.Jackal)]++;
if (x.Is(CustomRoles.Recruit) && x.Is(CustomRoles.DualPersonality)) roleCounts[(null, CustomWinner.Jackal)]++;
if (x.Is(CustomRoles.Contagious) && x.Is(CustomRoles.DualPersonality)) roleCounts[(null, CustomWinner.Virus)]++;
foreach (PlayerControl x in Main.AllAlivePlayerControls)
{
CustomRoles role = x.GetCustomRole();
if ((x.Is(CustomRoles.Madmate) && x.Is(CustomRoles.DualPersonality)) ||
(role.IsImpostor() && x.Is(CustomRoles.DualPersonality))) Imp++;
if (role.IsCrewmate() && x.Is(CustomRoles.DualPersonality)) Crew++;
if (x.Is(CustomRoles.Charmed) && x.Is(CustomRoles.DualPersonality)) roleCounts[(null, CustomWinner.Succubus)]++;
if (x.Is(CustomRoles.Undead) && x.Is(CustomRoles.DualPersonality)) roleCounts[(null, CustomWinner.Necromancer)]++;
if (x.Is(CustomRoles.Sidekick) && x.Is(CustomRoles.DualPersonality)) roleCounts[(null, CustomWinner.Jackal)]++;
if (x.Is(CustomRoles.Recruit) && x.Is(CustomRoles.DualPersonality)) roleCounts[(null, CustomWinner.Jackal)]++;
if (x.Is(CustomRoles.Contagious) && x.Is(CustomRoles.DualPersonality)) roleCounts[(null, CustomWinner.Virus)]++;
}
}
int totalNKAlive = roleCounts.Values.Sum();