mirror of
https://github.com/Gurge44/EndlessHostRoles.git
synced 2026-10-20 01:46:25 +00:00
Merge remote-tracking branch 'origin/main'
This commit is contained in:
commit
eded13c50c
17 files changed
+207
-35
No files matched your search
@@ -372,6 +372,7 @@ public enum CustomRoles
|
||||
Giant,
|
||||
Glow,
|
||||
Gravestone,
|
||||
GA, // Guardian Angel - Ghost role
|
||||
Guesser,
|
||||
Haste,
|
||||
Haunter, // Ghost role
|
||||
|
||||
@@ -787,7 +787,6 @@ internal static class CustomRolesHelper
|
||||
public static bool CheckAddonConflict(CustomRoles role, PlayerControl pc) => role.IsAdditionRole() && (!Main.NeverSpawnTogetherCombos.TryGetValue(pc.GetCustomRole(), out var bannedAddonList) || !bannedAddonList.Contains(role)) && pc.GetCustomRole() is not CustomRoles.GuardianAngelEHR and not CustomRoles.God && !pc.Is(CustomRoles.Madmate) && !pc.Is(CustomRoles.GM) && role is not CustomRoles.Lovers && !pc.Is(CustomRoles.Needy) && (!pc.HasSubRole() || pc.GetCustomSubRoles().Count < Options.NoLimitAddonsNumMax.GetInt()) && (!Options.AddonCanBeSettings.TryGetValue(role, out var o) || ((o.Imp.GetBool() || !pc.GetCustomRole().IsImpostor()) && (o.Neutral.GetBool() || !pc.GetCustomRole().IsNeutral()) && (o.Crew.GetBool() || !pc.IsCrewmate()))) && role switch
|
||||
{
|
||||
CustomRoles.Energetic when !Options.UsePets.GetBool() => false,
|
||||
CustomRoles.Sidekick when pc.Is(CustomRoles.Madmate) => false,
|
||||
CustomRoles.Madmate when pc.Is(CustomRoles.Sidekick) => false,
|
||||
CustomRoles.Autopsy when pc.Is(CustomRoles.Doctor) || pc.Is(CustomRoles.Tracefinder) || pc.Is(CustomRoles.Scientist) || pc.Is(CustomRoles.ScientistEHR) || pc.Is(CustomRoles.Sunnyboy) => false,
|
||||
CustomRoles.Necroview when pc.Is(CustomRoles.Doctor) => false,
|
||||
@@ -842,12 +841,10 @@ internal static class CustomRolesHelper
|
||||
CustomRoles.Loyal when (!pc.GetCustomRole().IsImpostor() && !pc.IsCrewmate()) || pc.Is(CustomRoles.Madmate) => false,
|
||||
CustomRoles.Loyal when pc.GetCustomRole().IsImpostor() && !Options.ImpCanBeLoyal.GetBool() => false,
|
||||
CustomRoles.Seer when pc.Is(CustomRoles.Mortician) => false,
|
||||
CustomRoles.Sidekick when pc.Is(CustomRoles.Madmate) => false,
|
||||
CustomRoles.Onbound when pc.Is(CustomRoles.SuperStar) => false,
|
||||
CustomRoles.Rascal when pc.Is(CustomRoles.SuperStar) || pc.Is(CustomRoles.Madmate) => false,
|
||||
CustomRoles.Madmate when pc.Is(CustomRoles.SuperStar) => false,
|
||||
CustomRoles.Gravestone when pc.Is(CustomRoles.SuperStar) => false,
|
||||
CustomRoles.Sidekick when pc.Is(CustomRoles.Jackal) => false,
|
||||
CustomRoles.Lucky when pc.Is(CustomRoles.Guardian) => false,
|
||||
CustomRoles.Bait when pc.Is(CustomRoles.GuardianAngelEHR) => false,
|
||||
CustomRoles.Bait when pc.Is(CustomRoles.Trapper) => false,
|
||||
@@ -877,10 +874,7 @@ internal static class CustomRolesHelper
|
||||
CustomRoles.Unreportable when pc.Is(CustomRoles.Bait) => false,
|
||||
CustomRoles.Oblivious when pc.Is(CustomRoles.Bloodhound) => false,
|
||||
CustomRoles.Oblivious when pc.Is(CustomRoles.Vulture) => false,
|
||||
CustomRoles.Vulture when pc.Is(CustomRoles.Oblivious) => false,
|
||||
CustomRoles.CopyCat when pc.Is(CustomRoles.Guesser) => false,
|
||||
CustomRoles.DoubleShot when pc.Is(CustomRoles.CopyCat) => false,
|
||||
CustomRoles.CopyCat when pc.Is(CustomRoles.DoubleShot) => false,
|
||||
CustomRoles.Brakar when pc.Is(CustomRoles.Dictator) => false,
|
||||
CustomRoles.Lucky when pc.Is(CustomRoles.Luckey) => false,
|
||||
CustomRoles.Unlucky when pc.Is(CustomRoles.Luckey) => false,
|
||||
|
||||
@@ -70,6 +70,7 @@ public static class DevManager
|
||||
DevUserList.Add(new(code: "radarright#2509", color: "null", tag: "null", isUp: false, isDev: false, deBug: true, colorCmd: false, upName: null));
|
||||
|
||||
// EHR players
|
||||
DevUserList.Add(new(code: "ravenknurl#4562", color: "#008000", tag: "Moderador do FH", isUp: false, isDev: false, deBug: false, colorCmd: false, upName: "RicardoFumante"));
|
||||
DevUserList.Add(new(code: "crustzonal#9589", color: "#00FFFF", tag: "Translator PT-BR", isUp: true, isDev: false, deBug: false, colorCmd: false, upName: "artyleague01"));
|
||||
DevUserList.Add(new(code: "tinedpun#6584", color: "#0000ff", tag: "Translator PT-BR", isUp: true, isDev: false, deBug: false, colorCmd: false, upName: "Dechis"));
|
||||
DevUserList.Add(new(code: "swiftlord#8072", color: "null", tag: "null", isUp: true, isDev: false, deBug: false, colorCmd: false, upName: "But What About"));
|
||||
@@ -83,7 +84,7 @@ public static class DevManager
|
||||
DevUserList.Add(new(code: "akinlaptop#2206", color: "null", tag: "null", isUp: true, isDev: false, deBug: false, colorCmd: false, upName: "MR Carr"));
|
||||
DevUserList.Add(new(code: "fursilty#4676", color: "#0000ff", tag: "arthurzin", isUp: true, isDev: false, deBug: false, colorCmd: false, upName: "arthurzin"));
|
||||
DevUserList.Add(new(code: "stonefuzzy#8673", color: "#035efc", tag: "Ru Translator", isUp: true, isDev: false, deBug: false, colorCmd: false, upName: "HyperAtill"));
|
||||
DevUserList.Add(new(code: "frizzytram#2508", color: "#1C87FF", tag: "RafaelBIT50", isUp: true, isDev: false, deBug: false, colorCmd: false, upName: "RafaelBIT50"));
|
||||
DevUserList.Add(new(code: "frizzytram#2508", color: "#1C87FF", tag: "RafaelBIT50", isUp: false, isDev: false, deBug: false, colorCmd: false, upName: "RafaelBIT50"));
|
||||
DevUserList.Add(new(code: "foggyzing#6238", color: "null", tag: "null", isUp: true, isDev: false, deBug: false, colorCmd: false, upName: "LdZinnn"));
|
||||
DevUserList.Add(new(code: "onsideblur#3929", color: "#fc3a51", tag: "YouTuber", isUp: true, isDev: false, deBug: false, colorCmd: false, upName: "Manelzin"));
|
||||
DevUserList.Add(new(code: "modestspan#7071", color: "null", tag: "null", isUp: true, isDev: false, deBug: false, colorCmd: false, upName: "Shark"));
|
||||
|
||||
+15
-2
@@ -117,7 +117,7 @@ public class PlayerState(byte playerId)
|
||||
|
||||
Role.Add(PlayerId);
|
||||
|
||||
Logger.Info($"ID {PlayerId} => {role}", "SetMainRole");
|
||||
Logger.Info($"ID {PlayerId} ({Utils.GetPlayerById(PlayerId)?.GetRealName()}) => {role}", "SetMainRole");
|
||||
|
||||
if (!AmongUsClient.Instance.AmHost) return;
|
||||
|
||||
@@ -243,6 +243,12 @@ public class PlayerState(byte playerId)
|
||||
if (SubRoles.Contains(role))
|
||||
SubRoles.Remove(role);
|
||||
|
||||
if (role is CustomRoles.Flashman or CustomRoles.Dynamo)
|
||||
{
|
||||
Main.AllPlayerSpeed[PlayerId] = Main.RealOptionsData.GetFloat(FloatOptionNames.PlayerSpeedMod);
|
||||
Utils.GetPlayerById(PlayerId).MarkDirtySettings();
|
||||
}
|
||||
|
||||
Utils.SendRPC(CustomRPC.RemoveSubRole, PlayerId, 1, (int)role);
|
||||
}
|
||||
|
||||
@@ -335,7 +341,14 @@ public class TaskState
|
||||
if (Math.Abs(add - float.MaxValue) > 0.5f && add > 0) player.RpcIncreaseAbilityUseLimitBy(add);
|
||||
}
|
||||
|
||||
Main.PlayerStates[player.PlayerId].Role.OnTaskComplete(player, CompletedTasksCount, AllTasksCount);
|
||||
try
|
||||
{
|
||||
Main.PlayerStates[player.PlayerId].Role.OnTaskComplete(player, CompletedTasksCount, AllTasksCount);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
Utils.ThrowException(e);
|
||||
}
|
||||
|
||||
var addons = Main.PlayerStates[player.PlayerId].SubRoles;
|
||||
|
||||
|
||||
@@ -398,6 +398,7 @@ public static class Options
|
||||
public static OptionItem ScientistCD;
|
||||
|
||||
public static OptionItem DisableTaskWinIfAllCrewsAreDead;
|
||||
public static OptionItem DisableTaskWinIfAllCrewsAreConverted;
|
||||
|
||||
// Task Management
|
||||
public static OptionItem DisableShortTasks;
|
||||
@@ -1460,6 +1461,9 @@ public static class Options
|
||||
DisableTaskWinIfAllCrewsAreDead = new BooleanOptionItem(22651, "DisableTaskWinIfAllCrewsAreDead", false, TabGroup.GameSettings)
|
||||
.SetGameMode(CustomGameMode.Standard)
|
||||
.SetColor(new Color32(255, 153, 153, byte.MaxValue));
|
||||
DisableTaskWinIfAllCrewsAreConverted = new BooleanOptionItem(22652, "DisableTaskWinIfAllCrewsAreConverted", false, TabGroup.GameSettings)
|
||||
.SetGameMode(CustomGameMode.Standard)
|
||||
.SetColor(new Color32(255, 153, 153, byte.MaxValue));
|
||||
|
||||
LoadingPercentage = 74;
|
||||
|
||||
|
||||
@@ -700,6 +700,7 @@ class GameEndChecker
|
||||
reason = GameOverReason.ImpostorByKill;
|
||||
if (Options.DisableTaskWin.GetBool() || TaskState.InitialTotalTasks == 0) return false;
|
||||
if (Options.DisableTaskWinIfAllCrewsAreDead.GetBool() && !Main.AllAlivePlayerControls.Any(x => x.Is(CustomRoleTypes.Crewmate))) return false;
|
||||
if (Options.DisableTaskWinIfAllCrewsAreConverted.GetBool() && Main.AllPlayerControls.Where(x => x.Is(Team.Crewmate) && x.GetRoleTypes() is RoleTypes.Crewmate or RoleTypes.Engineer or RoleTypes.Scientist or RoleTypes.CrewmateGhost or RoleTypes.GuardianAngel).All(x => x.GetCustomSubRoles().Any(y => y.IsConverted()))) return false;
|
||||
|
||||
if (GameData.Instance.TotalTasks <= GameData.Instance.CompletedTasks)
|
||||
{
|
||||
|
||||
@@ -328,6 +328,8 @@ class CheckMurderPatch
|
||||
|
||||
if (killer.Is(CustomRoles.Refugee) && target.Is(CustomRoleTypes.Impostor)) return false;
|
||||
|
||||
if (GhostRolesManager.AssignedGhostRoles.TryGetValue(target.PlayerId, out var ghostRole) && ghostRole.Instance is GA ga && ga.ProtectionList.Contains(target.PlayerId)) return false;
|
||||
|
||||
if (SoulHunter.IsSoulHunterTarget(killer.PlayerId) && target.Is(CustomRoles.SoulHunter))
|
||||
{
|
||||
killer.Notify(GetString("SoulHunterTargetNotifyNoKill"));
|
||||
@@ -1801,7 +1803,7 @@ class CoEnterVentPatch
|
||||
try
|
||||
{
|
||||
LateTask.New(() => { __instance.RpcBootFromVent(id); }, 0.5f, "CannotUseVentBootFromVent2");
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
catch
|
||||
{
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using AmongUs.GameOptions;
|
||||
using BepInEx;
|
||||
using EHR.Modules;
|
||||
using EHR.Neutral;
|
||||
@@ -291,7 +292,7 @@ class CheckTaskCompletionPatch
|
||||
{
|
||||
public static bool Prefix(ref bool __result)
|
||||
{
|
||||
if (Options.DisableTaskWin.GetBool() || Options.NoGameEnd.GetBool() || TaskState.InitialTotalTasks == 0 || (Options.DisableTaskWinIfAllCrewsAreDead.GetBool() && !Main.AllAlivePlayerControls.Any(x => x.Is(CustomRoleTypes.Crewmate))) || Options.CurrentGameMode != CustomGameMode.Standard)
|
||||
if (Options.DisableTaskWin.GetBool() || Options.NoGameEnd.GetBool() || TaskState.InitialTotalTasks == 0 || (Options.DisableTaskWinIfAllCrewsAreDead.GetBool() && !Main.AllAlivePlayerControls.Any(x => x.Is(CustomRoleTypes.Crewmate))) || (Options.DisableTaskWinIfAllCrewsAreConverted.GetBool() && Main.AllPlayerControls.Where(x => x.Is(Team.Crewmate) && x.GetRoleTypes() is RoleTypes.Crewmate or RoleTypes.Engineer or RoleTypes.Scientist or RoleTypes.CrewmateGhost or RoleTypes.GuardianAngel).All(x => x.GetCustomSubRoles().Any(y => y.IsConverted()))) || Options.CurrentGameMode != CustomGameMode.Standard)
|
||||
{
|
||||
__result = false;
|
||||
return false;
|
||||
|
||||
@@ -985,6 +985,7 @@
|
||||
"GhostIgnoreTasks": "Ghosts Exempt From Tasks",
|
||||
"DisableTaskWin": "Disable Task Win",
|
||||
"DisableTaskWinIfAllCrewsAreDead": "Disable Task Win If All <#8cffff>Crewmates</color> Are Dead",
|
||||
"DisableTaskWinIfAllCrewsAreConverted": "Disable Task Win If All <#8cffff>Crewmates</color> Are <#ffab1b>Converted</color>",
|
||||
"CanSabotage": "Can Sabotage",
|
||||
"HideGameSettings": "Hide Game Settings",
|
||||
"DIYGameSettings": "Enable only custom /n messages",
|
||||
@@ -2659,6 +2660,18 @@
|
||||
"Sentry.Notify.Shapeshifted": "{0} shapeshifted into {1} in your monitored room",
|
||||
"Sentry.Notify.Vented": "{0} vented in your monitored room",
|
||||
"Sentry.Notify.InvalidRoom": "You are not in a room",
|
||||
"Sentry.UsableDevicesForInfoView": "Devices Players Can Use to Get Info About Monitored Room",
|
||||
"Sentry.AdditionalDevicesForInfoView": "Map-Specific Devices Players Can Use to Get Info About Monitored Room",
|
||||
"Sentry.TeamsCanSeeInfo.Crewmate": "<#8cffff>Crewmates Can See the Info</color>",
|
||||
"Sentry.TeamsCanSeeInfo.Impostor": "<#ff1919>Impostors Can See the Info</color>",
|
||||
"Sentry.TeamsCanSeeInfo.NK": "<#ffab1b>Neutral</color> <#ff1919>Killers</color> Can See the Info</color>",
|
||||
"Sentry.TeamsCanSeeInfo.NNK": "<#ffff00>Non-Killing</color> <#ffab1b>Neutrals</color> Can See the Info</color>",
|
||||
"Cameras": "Cameras",
|
||||
"Admin": "Admin",
|
||||
"CamerasAndAdmin": "Cameras & Admin",
|
||||
"DoorLog": "Door Log",
|
||||
"Binoculars": "Binoculars",
|
||||
"DoorLogAndBinoculars": "Door Log & Binoculars",
|
||||
"Dynamo": "Dynamo",
|
||||
"DynamoInfo": "You get faster by walking",
|
||||
"DynamoInfoLong": "(Add-ons):\\nAs the Dynamo, you get faster by walking. The longer you walk, the faster you get. Stopping will reset your speed.",
|
||||
|
||||
@@ -958,13 +958,13 @@
|
||||
"SuffixMode": "Sufixo",
|
||||
"SuffixMode.None": "Nenhum",
|
||||
"SuffixMode.Version": "Versão",
|
||||
"SuffixMode.Streaming": "Transmitindo",
|
||||
"SuffixMode.Streaming": "Ao Vivo",
|
||||
"SuffixMode.Recording": "Gravando",
|
||||
"SuffixMode.RoomHost": "Anfitrião",
|
||||
"SuffixMode.OriginalName": "Nome",
|
||||
"SuffixMode.DoNotKillMe": "Não me mate",
|
||||
"SuffixMode.NoAndroidPlz": "Sem Celulares",
|
||||
"SuffixMode.AutoHost": "Auto-Anfitrião",
|
||||
"SuffixMode.AutoHost": "Auto-Moderação",
|
||||
"SuffixModeText.DoNotKillMe": "Não me mate!",
|
||||
"SuffixModeText.NoAndroidPlz": "Sem Celulares, ok?",
|
||||
"SuffixModeText.AutoHost": "Hospedando",
|
||||
|
||||
@@ -0,0 +1,37 @@
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace EHR.Roles.AddOns.GhostRoles
|
||||
{
|
||||
public class GA : IGhostRole, ISettingHolder
|
||||
{
|
||||
private static OptionItem ProtectDuration;
|
||||
private static OptionItem CD;
|
||||
|
||||
public HashSet<byte> ProtectionList = [];
|
||||
|
||||
public Team Team => Team.Crewmate;
|
||||
public int Cooldown => CD.GetInt();
|
||||
|
||||
public void OnProtect(PlayerControl pc, PlayerControl target)
|
||||
{
|
||||
if (ProtectionList.Add(target.PlayerId))
|
||||
LateTask.New(() => ProtectionList.Remove(target.PlayerId), ProtectDuration.GetFloat());
|
||||
}
|
||||
|
||||
public void OnAssign(PlayerControl pc)
|
||||
{
|
||||
ProtectionList = [];
|
||||
}
|
||||
|
||||
public void SetupCustomOption()
|
||||
{
|
||||
Options.SetupRoleOptions(649600, TabGroup.OtherRoles, CustomRoles.GA, zeroOne: true);
|
||||
ProtectDuration = new IntegerOptionItem(649602, "BKProtectDuration", new(1, 90, 1), 5, TabGroup.OtherRoles)
|
||||
.SetParent(Options.CustomRoleSpawnChances[CustomRoles.GA])
|
||||
.SetValueFormat(OptionFormat.Seconds);
|
||||
CD = new IntegerOptionItem(649603, "AbilityCooldown", new(0, 60, 1), 30, TabGroup.OtherRoles)
|
||||
.SetParent(Options.CustomRoleSpawnChances[CustomRoles.GA])
|
||||
.SetValueFormat(OptionFormat.Seconds);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -62,7 +62,7 @@ public class CopyCat : RoleBase
|
||||
void ResetRole()
|
||||
{
|
||||
var role = CopyCatPC.GetCustomRole();
|
||||
// Remove the settings for current role
|
||||
// Remove settings for current role
|
||||
switch (role)
|
||||
{
|
||||
case CustomRoles.Cleanser:
|
||||
@@ -95,7 +95,7 @@ public class CopyCat : RoleBase
|
||||
Instances.Do(x => x.ResetRole());
|
||||
}
|
||||
|
||||
private static bool BlacklList(CustomRoles role) => role is
|
||||
private static bool BlackList(CustomRoles role) => role is
|
||||
CustomRoles.CopyCat or
|
||||
// can't copy due to vent cooldown
|
||||
CustomRoles.Grenadier or
|
||||
@@ -111,7 +111,7 @@ public class CopyCat : RoleBase
|
||||
{
|
||||
CustomRoles role = tpc.GetCustomRole();
|
||||
|
||||
if (BlacklList(role))
|
||||
if (BlackList(role))
|
||||
{
|
||||
pc.Notify(GetString("CopyCatCanNotCopy"));
|
||||
SetKillCooldown(pc.PlayerId);
|
||||
|
||||
@@ -64,8 +64,9 @@ namespace EHR.Roles.Crewmate
|
||||
{
|
||||
if (!Player.IsAlive() || (MyTaskState.CompletedTasksCount < TaskTrigger && !MyTaskState.IsTaskFinished)) return;
|
||||
|
||||
var Impostors = Main.AllAlivePlayerControls.Where(pc => pc.Is(CustomRoleTypes.Impostor)).ToArray();
|
||||
var target = Impostors.RandomElement();
|
||||
var impostors = Main.AllAlivePlayerControls.Where(pc => pc.Is(CustomRoleTypes.Impostor)).ToArray();
|
||||
var target = impostors.RandomElement();
|
||||
if (target == null) return;
|
||||
|
||||
var pos = target.Pos();
|
||||
LocateArrow.Add(Player.PlayerId, pos);
|
||||
|
||||
+101
-10
@@ -1,7 +1,9 @@
|
||||
using System.Collections.Generic;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using EHR.Modules;
|
||||
using HarmonyLib;
|
||||
using UnityEngine;
|
||||
|
||||
namespace EHR.Roles.Impostor
|
||||
{
|
||||
@@ -13,9 +15,12 @@ namespace EHR.Roles.Impostor
|
||||
private static OptionItem ShowInfoDuration;
|
||||
private static OptionItem PlayersKnowAboutCamera;
|
||||
private static OptionItem CannotSeeInfoDuringComms;
|
||||
private static OptionItem UsableDevicesForInfoView;
|
||||
private static OptionItem AdditionalDevicesForInfoView;
|
||||
private static OptionItem AbilityUseLimit;
|
||||
public static OptionItem AbilityUseGainWithEachTaskCompleted;
|
||||
public static OptionItem AbilityChargesWhenFinishedTasks;
|
||||
private static Dictionary<SimpleRoleOptionType, OptionItem> TeamsCanSeeInfo;
|
||||
|
||||
private readonly HashSet<byte> LastNotified = [];
|
||||
|
||||
@@ -25,25 +30,52 @@ namespace EHR.Roles.Impostor
|
||||
private PlayerControl SentryPC;
|
||||
public override bool IsEnable => On;
|
||||
|
||||
private static Vector2[] AvailableDevices = [];
|
||||
|
||||
enum UsableDevicesStrings
|
||||
{
|
||||
None,
|
||||
Cameras,
|
||||
Admin,
|
||||
CamerasAndAdmin
|
||||
}
|
||||
|
||||
enum AdditionalDevicesStrings
|
||||
{
|
||||
None,
|
||||
DoorLog,
|
||||
Binoculars,
|
||||
DoorLogAndBinoculars
|
||||
}
|
||||
|
||||
public static void SetupCustomOption()
|
||||
{
|
||||
const int id = 11370;
|
||||
Options.SetupRoleOptions(id, TabGroup.CrewmateRoles, CustomRoles.Sentry);
|
||||
ShowInfoCooldown = new IntegerOptionItem(id + 2, "AbilityCooldown", new(1, 60, 1), 15, TabGroup.CrewmateRoles)
|
||||
int id = 11370;
|
||||
Options.SetupRoleOptions(id++, TabGroup.CrewmateRoles, CustomRoles.Sentry);
|
||||
ShowInfoCooldown = new IntegerOptionItem(++id, "AbilityCooldown", new(1, 60, 1), 15, TabGroup.CrewmateRoles)
|
||||
.SetParent(Options.CustomRoleSpawnChances[CustomRoles.Sentry])
|
||||
.SetValueFormat(OptionFormat.Seconds);
|
||||
ShowInfoDuration = new IntegerOptionItem(id + 3, "Sentry.ShowInfoDuration", new(1, 60, 1), 5, TabGroup.CrewmateRoles)
|
||||
ShowInfoDuration = new IntegerOptionItem(++id, "Sentry.ShowInfoDuration", new(1, 60, 1), 5, TabGroup.CrewmateRoles)
|
||||
.SetParent(Options.CustomRoleSpawnChances[CustomRoles.Sentry])
|
||||
.SetValueFormat(OptionFormat.Seconds);
|
||||
PlayersKnowAboutCamera = new BooleanOptionItem(id + 4, "Sentry.PlayersKnowAboutCamera", true, TabGroup.CrewmateRoles)
|
||||
PlayersKnowAboutCamera = new BooleanOptionItem(++id, "Sentry.PlayersKnowAboutCamera", true, TabGroup.CrewmateRoles)
|
||||
.SetParent(Options.CustomRoleSpawnChances[CustomRoles.Sentry]);
|
||||
CannotSeeInfoDuringComms = new BooleanOptionItem(id + 5, "Sentry.CannotSeeInfoDuringComms", true, TabGroup.CrewmateRoles)
|
||||
CannotSeeInfoDuringComms = new BooleanOptionItem(++id, "Sentry.CannotSeeInfoDuringComms", true, TabGroup.CrewmateRoles)
|
||||
.SetParent(Options.CustomRoleSpawnChances[CustomRoles.Sentry]);
|
||||
AbilityUseLimit = new IntegerOptionItem(id + 6, "AbilityUseLimit", new(0, 20, 1), 0, TabGroup.CrewmateRoles)
|
||||
UsableDevicesForInfoView = new StringOptionItem(++id, "Sentry.UsableDevicesForInfoView", Enum.GetNames<UsableDevicesStrings>(), 0, TabGroup.CrewmateRoles)
|
||||
.SetParent(Options.CustomRoleSpawnChances[CustomRoles.Sentry]);
|
||||
AbilityUseGainWithEachTaskCompleted = new FloatOptionItem(id + 7, "AbilityUseGainWithEachTaskCompleted", new(0f, 5f, 0.05f), 1f, TabGroup.CrewmateRoles)
|
||||
AdditionalDevicesForInfoView = new StringOptionItem(++id, "Sentry.AdditionalDevicesForInfoView", Enum.GetNames<AdditionalDevicesStrings>(), 0, TabGroup.CrewmateRoles)
|
||||
.SetParent(UsableDevicesForInfoView);
|
||||
Enum.GetValues<SimpleRoleOptionType>().Do(x =>
|
||||
{
|
||||
TeamsCanSeeInfo[x] = new BooleanOptionItem(++id, "Sentry.TeamsCanSeeInfo." + x, true, TabGroup.CrewmateRoles)
|
||||
.SetParent(Options.CustomRoleSpawnChances[CustomRoles.Sentry]);
|
||||
});
|
||||
AbilityUseLimit = new IntegerOptionItem(++id, "AbilityUseLimit", new(0, 20, 1), 0, TabGroup.CrewmateRoles)
|
||||
.SetParent(Options.CustomRoleSpawnChances[CustomRoles.Sentry]);
|
||||
AbilityChargesWhenFinishedTasks = new FloatOptionItem(id + 8, "AbilityChargesWhenFinishedTasks", new(0f, 5f, 0.05f), 0.2f, TabGroup.CrewmateRoles)
|
||||
AbilityUseGainWithEachTaskCompleted = new FloatOptionItem(++id, "AbilityUseGainWithEachTaskCompleted", new(0f, 5f, 0.05f), 1f, TabGroup.CrewmateRoles)
|
||||
.SetParent(Options.CustomRoleSpawnChances[CustomRoles.Sentry]);
|
||||
AbilityChargesWhenFinishedTasks = new FloatOptionItem(++id, "AbilityChargesWhenFinishedTasks", new(0f, 5f, 0.05f), 0.2f, TabGroup.CrewmateRoles)
|
||||
.SetParent(Options.CustomRoleSpawnChances[CustomRoles.Sentry]);
|
||||
}
|
||||
|
||||
@@ -59,6 +91,32 @@ namespace EHR.Roles.Impostor
|
||||
public override void Init()
|
||||
{
|
||||
On = false;
|
||||
AvailableDevices = DisableDevice.DevicePos.Where(x =>
|
||||
{
|
||||
var correctMap = x.Key.Contains(Main.CurrentMap.ToString(), StringComparison.OrdinalIgnoreCase);
|
||||
var devicesOpt = (UsableDevicesStrings)UsableDevicesForInfoView.GetValue();
|
||||
var enabled = devicesOpt switch
|
||||
{
|
||||
UsableDevicesStrings.None => false,
|
||||
UsableDevicesStrings.Cameras => x.Key.Contains("Camera") && !x.Key.Contains("Fungle"),
|
||||
UsableDevicesStrings.Admin => x.Key.Contains("Admin"),
|
||||
UsableDevicesStrings.CamerasAndAdmin => x.Key.Contains("Camera") || x.Key.Contains("Admin"),
|
||||
_ => false
|
||||
};
|
||||
if (!enabled && devicesOpt != UsableDevicesStrings.None)
|
||||
{
|
||||
enabled |= (AdditionalDevicesStrings)AdditionalDevicesForInfoView.GetValue() switch
|
||||
{
|
||||
AdditionalDevicesStrings.None => false,
|
||||
AdditionalDevicesStrings.DoorLog => x.Key.Contains("DoorLog"),
|
||||
AdditionalDevicesStrings.Binoculars => x.Key.Contains("Camera") && x.Key.Contains("Fungle"),
|
||||
AdditionalDevicesStrings.DoorLogAndBinoculars => x.Key.Contains("DoorLog") || (x.Key.Contains("Camera") && x.Key.Contains("Fungle")),
|
||||
_ => false
|
||||
};
|
||||
}
|
||||
|
||||
return correctMap && enabled;
|
||||
}).Select(x => x.Value).ToArray();
|
||||
}
|
||||
|
||||
public override void OnPet(PlayerControl pc)
|
||||
@@ -205,6 +263,39 @@ namespace EHR.Roles.Impostor
|
||||
}
|
||||
}
|
||||
|
||||
private Dictionary<byte, long> LastInfoSend = [];
|
||||
|
||||
public override void OnCheckPlayerPosition(PlayerControl pc)
|
||||
{
|
||||
var usableDevices = (UsableDevicesStrings)UsableDevicesForInfoView.GetValue();
|
||||
var additionalDevices = (AdditionalDevicesStrings)AdditionalDevicesForInfoView.GetValue();
|
||||
|
||||
if (usableDevices == UsableDevicesStrings.None) return;
|
||||
|
||||
if (LastInfoSend.TryGetValue(pc.PlayerId, out var ts) && ts == Utils.TimeStamp) return;
|
||||
LastInfoSend[pc.PlayerId] = Utils.TimeStamp;
|
||||
|
||||
if (!CheckTeam(pc)) return;
|
||||
|
||||
var pos = pc.Pos();
|
||||
var range = DisableDevice.UsableDistance();
|
||||
if (!AvailableDevices.Any(x => Vector2.Distance(pos, x) <= range)) return;
|
||||
|
||||
DisplayRoomInfo(pc);
|
||||
}
|
||||
|
||||
static bool CheckTeam(PlayerControl pc)
|
||||
{
|
||||
SimpleRoleOptionType team = pc.GetTeam() switch
|
||||
{
|
||||
Team.Crewmate => SimpleRoleOptionType.Crewmate,
|
||||
Team.Impostor => SimpleRoleOptionType.Impostor,
|
||||
Team.Neutral => pc.IsNeutralKiller() ? SimpleRoleOptionType.NK : SimpleRoleOptionType.NNK,
|
||||
_ => SimpleRoleOptionType.Crewmate
|
||||
};
|
||||
return TeamsCanSeeInfo[team].GetBool();
|
||||
}
|
||||
|
||||
public override void AfterMeetingTasks()
|
||||
{
|
||||
DeadBodiesInRoom.Clear();
|
||||
|
||||
@@ -72,7 +72,13 @@ namespace EHR.Roles.Impostor
|
||||
if (Main.PlayerStates[kkId].Role is Kamikaze { IsEnable: true } kk)
|
||||
{
|
||||
var kamikazePc = GetPlayerById(kk.KamikazeId);
|
||||
if (kamikazePc.IsAlive()) continue;
|
||||
if (kamikazePc == null)
|
||||
{
|
||||
LateTask.New(() => PlayerIdList.Remove(kkId), 0.001f, log: false);
|
||||
continue;
|
||||
}
|
||||
|
||||
if (kamikazePc.IsAlive() || kk.MarkedPlayers.Count == 0) continue;
|
||||
|
||||
foreach (var id in kk.MarkedPlayers)
|
||||
{
|
||||
|
||||
@@ -29,16 +29,22 @@ public class Totocalcio : RoleBase
|
||||
public static void SetupCustomOption()
|
||||
{
|
||||
SetupSingleRoleOptions(Id, TabGroup.NeutralRoles, CustomRoles.Totocalcio);
|
||||
MaxBetTimes = new IntegerOptionItem(Id + 10, "TotocalcioMaxBetTimes", new(1, 5, 1), 3, TabGroup.NeutralRoles).SetParent(CustomRoleSpawnChances[CustomRoles.Totocalcio])
|
||||
MaxBetTimes = new IntegerOptionItem(Id + 10, "TotocalcioMaxBetTimes", new(1, 5, 1), 3, TabGroup.NeutralRoles)
|
||||
.SetParent(CustomRoleSpawnChances[CustomRoles.Totocalcio])
|
||||
.SetValueFormat(OptionFormat.Times);
|
||||
BetCooldown = new FloatOptionItem(Id + 12, "TotocalcioBetCooldown", new(0f, 60f, 0.5f), 10f, TabGroup.NeutralRoles).SetParent(CustomRoleSpawnChances[CustomRoles.Totocalcio])
|
||||
BetCooldown = new FloatOptionItem(Id + 12, "TotocalcioBetCooldown", new(0f, 60f, 0.5f), 10f, TabGroup.NeutralRoles)
|
||||
.SetParent(CustomRoleSpawnChances[CustomRoles.Totocalcio])
|
||||
.SetValueFormat(OptionFormat.Seconds);
|
||||
BetCooldownIncrese = new FloatOptionItem(Id + 14, "TotocalcioBetCooldownIncrese", new(0f, 60f, 1f), 10f, TabGroup.NeutralRoles).SetParent(CustomRoleSpawnChances[CustomRoles.Totocalcio])
|
||||
BetCooldownIncrese = new FloatOptionItem(Id + 14, "TotocalcioBetCooldownIncrese", new(0f, 60f, 1f), 10f, TabGroup.NeutralRoles)
|
||||
.SetParent(CustomRoleSpawnChances[CustomRoles.Totocalcio])
|
||||
.SetValueFormat(OptionFormat.Seconds);
|
||||
MaxBetCooldown = new FloatOptionItem(Id + 16, "TotocalcioMaxBetCooldown", new(0f, 180f, 0.5f), 70f, TabGroup.NeutralRoles).SetParent(CustomRoleSpawnChances[CustomRoles.Totocalcio])
|
||||
MaxBetCooldown = new FloatOptionItem(Id + 16, "TotocalcioMaxBetCooldown", new(0f, 180f, 0.5f), 70f, TabGroup.NeutralRoles)
|
||||
.SetParent(CustomRoleSpawnChances[CustomRoles.Totocalcio])
|
||||
.SetValueFormat(OptionFormat.Seconds);
|
||||
KnowTargetRole = new BooleanOptionItem(Id + 18, "TotocalcioKnowTargetRole", true, TabGroup.NeutralRoles).SetParent(CustomRoleSpawnChances[CustomRoles.Totocalcio]);
|
||||
BetTargetKnowTotocalcio = new BooleanOptionItem(Id + 20, "TotocalcioBetTargetKnowTotocalcio", true, TabGroup.NeutralRoles).SetParent(CustomRoleSpawnChances[CustomRoles.Totocalcio]);
|
||||
KnowTargetRole = new BooleanOptionItem(Id + 18, "TotocalcioKnowTargetRole", true, TabGroup.NeutralRoles)
|
||||
.SetParent(CustomRoleSpawnChances[CustomRoles.Totocalcio]);
|
||||
BetTargetKnowTotocalcio = new BooleanOptionItem(Id + 20, "TotocalcioBetTargetKnowTotocalcio", true, TabGroup.NeutralRoles)
|
||||
.SetParent(CustomRoleSpawnChances[CustomRoles.Totocalcio]);
|
||||
}
|
||||
|
||||
public override void Init()
|
||||
|
||||
Reference in new issue
Block a user