mirror of
https://github.com/Gurge44/EndlessHostRoles.git
synced 2026-10-20 01:46:25 +00:00
fix incorrect win conditions & optimize
This commit is contained in:
1 parent
6d0470308c
commit
d2feee9a61
2 files changed
+16
-12
No files matched your search
@@ -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;
|
||||
|
||||
@@ -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();
|
||||
|
||||
Reference in new issue
Block a user