mirror of
https://github.com/Gurge44/EndlessHostRoles.git
synced 2026-10-20 01:46:25 +00:00
some more features
This commit is contained in:
1 parent
82241231b6
commit
2edad25e6a
6 files changed
+58
-23
No files matched your search
+19
-9
@@ -64,10 +64,12 @@ internal static class CustomHnS
|
||||
ChatDuringGame = new BooleanOptionItem(id + 5, "FFA_ChatDuringGame", false, TabGroup.GameSettings)
|
||||
.SetGameMode(CustomGameMode.HideAndSeek)
|
||||
.SetColor(color);
|
||||
|
||||
|
||||
ShiftAndSeek = new BooleanOptionItem(id + 6, "HNS.ShiftAndSeek", false, TabGroup.GameSettings)
|
||||
.SetGameMode(CustomGameMode.HideAndSeek)
|
||||
.SetColor(color);
|
||||
.SetColor(color)
|
||||
.RegisterUpdateValueEvent((_, _, newValue) => Options.CustomRoleSpawnChances[CustomRoles.Disguiser].SetValue(newValue * (100 / 5)))
|
||||
.SetRunEventOnLoad(true);
|
||||
}
|
||||
|
||||
public static void Init()
|
||||
@@ -82,7 +84,7 @@ internal static class CustomHnS
|
||||
HideAndSeekRoles = types
|
||||
.Select(x => (IHideAndSeekRole)Activator.CreateInstance(x))
|
||||
.Where(x => x != null)
|
||||
.Join(AllHnSRoles, x => x.GetType().Name.ToLower(), x => x.ToString().ToLower(), (Interface, Enum) => (Enum, Interface))
|
||||
.Join(AllHnSRoles.FindAll(role => !ShiftAndSeek.GetBool() ? (role is CustomRoles.Seeker or CustomRoles.Hider || role.GetMode() != 0) : (role == CustomRoles.Disguiser || (role is not (CustomRoles.Seeker or CustomRoles.Locator or CustomRoles.Dasher or CustomRoles.Venter or CustomRoles.Agent) && role.GetMode() != 0))), x => x.GetType().Name.ToLower(), x => x.ToString().ToLower(), (Interface, Enum) => (Enum, Interface))
|
||||
.Where(x => (!x.Enum.OnlySpawnsWithPets() || Options.UsePets.GetBool()) && (x.Enum != CustomRoles.Agent || SeekerNum >= 2) && x.Interface.Count > 0 && (x.Interface.Team == Team.Neutral || x.Interface.Chance > IRandom.Instance.Next(100)))
|
||||
.OrderBy(x => x.Enum is CustomRoles.Seeker or CustomRoles.Hider ? 100 : IRandom.Instance.Next(100))
|
||||
.GroupBy(x => x.Interface.Team)
|
||||
@@ -96,6 +98,9 @@ internal static class CustomHnS
|
||||
Main.AllPlayerKillCooldown.SetAllValues(Seeker.KillCooldown.GetFloat());
|
||||
IsBlindTime = true;
|
||||
Utils.MarkEveryoneDirtySettingsV4();
|
||||
|
||||
float time = Seeker.BlindTime.GetFloat() + 14f;
|
||||
if (PlayersSeeRoles.GetBool()) Main.EnumerateAlivePlayerControls().NotifyPlayers(string.Format(Translator.GetString("HNSSeekers"), string.Join(", ", PlayerRoles.Where(x => x.Value.Interface.Team == Team.Impostor).Select(x => x.Key.ColoredPlayerName()))), time + 3f, setName: false);
|
||||
|
||||
LateTask.New(() =>
|
||||
{
|
||||
@@ -108,15 +113,20 @@ internal static class CustomHnS
|
||||
.Do(x => x.pc.SetKillCooldown());
|
||||
|
||||
LateTask.New(() => Main.Instance.StartCoroutine(Utils.NotifyEveryoneAsync(noCache: false)), 3f, log: false);
|
||||
}, Seeker.BlindTime.GetFloat() + 14f, "Blind Time Expire");
|
||||
}, time, "Blind Time Expire");
|
||||
}
|
||||
|
||||
public static List<CustomRoles> GetAllHnsRoles(IEnumerable<Type> types)
|
||||
public static List<CustomRoles> GetAllHnsRoles(Type[] types)
|
||||
{
|
||||
return types
|
||||
.Select(x => Enum.Parse<CustomRoles>(ignoreCase: true, value: x.Name))
|
||||
.Where(role => !ShiftAndSeek.GetBool() ? (role is CustomRoles.Seeker or CustomRoles.Hider || role.GetMode() != 0) : (role == CustomRoles.Disguiser || (role is not (CustomRoles.Seeker or CustomRoles.Locator or CustomRoles.Dasher or CustomRoles.Venter or CustomRoles.Agent) && role.GetMode() != 0)))
|
||||
.ToList();
|
||||
List<CustomRoles> roles = [];
|
||||
|
||||
foreach (Type type in types)
|
||||
{
|
||||
if (Enum.TryParse(type.Name, ignoreCase: true, out CustomRoles role))
|
||||
roles.Add(role);
|
||||
}
|
||||
|
||||
return roles;
|
||||
}
|
||||
|
||||
private static Type[] CachedHnsTypes;
|
||||
|
||||
Reference in new issue
Block a user