Add Shifter, Fix bugs

This commit is contained in:
Gurge44 committed 2024-05-18 13:13:43 +02:00
1 parent f1b05d35b0
commit 20de8bd597
19 files changed
+212 -60

No files matched your search

+6 -9
View File
@@ -35,6 +35,8 @@ namespace EHR.Modules
IGhostRole instance = CreateGhostRoleInstance(suitableRole);
instance.OnAssign(pc);
AssignedGhostRoles[pc.PlayerId] = (suitableRole, instance);
if (suitableRole == CustomRoles.Haunter) GhostRoles.Remove(suitableRole);
}
public static void SpecificAssignGhostRole(byte id, CustomRoles role, bool set)
@@ -57,16 +59,11 @@ namespace EHR.Modules
if (pc.IsAlive() || pc.GetCountTypes() is CountTypes.None or CountTypes.OutOfGame || pc.Is(CustomRoles.EvilSpirit)) return false;
var suitableRole = GetSuitableGhostRole(pc);
switch (suitableRole)
return suitableRole switch
{
case CustomRoles.Specter when IsPartnerPickedRole():
return false;
case CustomRoles.Haunter:
GhostRoles.Remove(CustomRoles.Haunter);
break;
}
return suitableRole.IsGhostRole() && !AssignedGhostRoles.Any(x => x.Key == pc.PlayerId || x.Value.Role == suitableRole);
CustomRoles.Specter when IsPartnerPickedRole() => false,
_ => suitableRole.IsGhostRole() && !AssignedGhostRoles.Any(x => x.Key == pc.PlayerId || x.Value.Role == suitableRole)
};
bool IsPartnerPickedRole() => Main.PlayerStates[pc.PlayerId].Role switch
{