mirror of
https://github.com/Gurge44/EndlessHostRoles.git
synced 2026-10-20 01:46:25 +00:00
/readycheck & bug fixes
This commit is contained in:
1 parent
eebd9935de
commit
110697d3b0
28 files changed
+86
-195
No files matched your search
+1
-1
@@ -7,7 +7,7 @@
|
||||
<Description>EHR</Description>
|
||||
<Authors>Gurge44</Authors>
|
||||
<langVersion>preview</langVersion>
|
||||
<AmongUs>E:\Program Files\AmongUs</AmongUs>
|
||||
<AmongUs>C:\Program Files\Epic Games\AmongUs</AmongUs>
|
||||
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
|
||||
<Optimize>True</Optimize>
|
||||
<AssemblyName>$(MSBuildProjectName)</AssemblyName>
|
||||
|
||||
@@ -307,8 +307,20 @@ static class ExtendedPlayerControl
|
||||
var newRoleType = newCustomRole.GetRoleTypes();
|
||||
RoleTypes remeberRoleType;
|
||||
|
||||
if (Options.CurrentGameMode == CustomGameMode.Speedrun && newCustomRole == CustomRoles.Runner)
|
||||
newRoleType = SpeedrunManager.CanKill.Contains(player.PlayerId) ? RoleTypes.Impostor : RoleTypes.Crewmate;
|
||||
newRoleType = Options.CurrentGameMode switch
|
||||
{
|
||||
CustomGameMode.Speedrun when newCustomRole == CustomRoles.Runner => SpeedrunManager.CanKill.Contains(player.PlayerId) ? RoleTypes.Impostor : RoleTypes.Crewmate,
|
||||
CustomGameMode.Standard when StartGameHostPatch.BasisChangingAddons.FindFirst(x => x.Value.Contains(player.PlayerId), out var kvp) => kvp.Key switch
|
||||
{
|
||||
CustomRoles.Bloodlust when newRoleType is RoleTypes.Crewmate or RoleTypes.Engineer or RoleTypes.Scientist => RoleTypes.Impostor,
|
||||
CustomRoles.Nimble when newRoleType is RoleTypes.Crewmate or RoleTypes.Scientist => RoleTypes.Engineer,
|
||||
CustomRoles.Physicist when newRoleType == RoleTypes.Crewmate => RoleTypes.Scientist,
|
||||
CustomRoles.Finder when newRoleType is RoleTypes.Crewmate or RoleTypes.Scientist => RoleTypes.Tracker,
|
||||
CustomRoles.Noisy when newRoleType == RoleTypes.Crewmate => RoleTypes.Noisemaker,
|
||||
_ => newRoleType
|
||||
},
|
||||
_ => newRoleType
|
||||
};
|
||||
|
||||
var oldRoleIsDesync = playerRole.IsDesyncRole();
|
||||
var newRoleIsDesync = newCustomRole.IsDesyncRole();
|
||||
|
||||
@@ -140,7 +140,7 @@ public class PlayerState(byte playerId)
|
||||
|
||||
if (Lyncher.On) Lyncher.Instances.ForEach(x => x.OnRoleChange(PlayerId));
|
||||
if (!role.Is(Team.Impostor)) SubRoles.ToArray().DoIf(x => x.IsImpOnlyAddon(), RemoveSubRole);
|
||||
if (role is CustomRoles.Sidekick or CustomRoles.Necromancer or CustomRoles.Deathknight or CustomRoles.Refugee) RemoveSubRole(CustomRoles.Nimble);
|
||||
if (role is CustomRoles.Sidekick or CustomRoles.Necromancer or CustomRoles.Deathknight or CustomRoles.Refugee) SubRoles.ToArray().DoIf(StartGameHostPatch.BasisChangingAddons.ContainsKey, RemoveSubRole);
|
||||
if (role == CustomRoles.Sidekick && Jackal.Instances.FindFirst(x => x.SidekickId == byte.MaxValue || x.SidekickId.GetPlayer() == null, out var jackal))
|
||||
jackal.SidekickId = PlayerId;
|
||||
|
||||
|
||||
@@ -18,7 +18,7 @@ namespace EHR.Modules
|
||||
public static void Initialize()
|
||||
{
|
||||
AssignedGhostRoles = [];
|
||||
GhostRoles = Enum.GetValues<CustomRoles>().Where(x => x != CustomRoles.EvilSpirit && x.IsGhostRole() && x.IsEnable()).ToList();
|
||||
GhostRoles = Enum.GetValues<CustomRoles>().Where(x => x != CustomRoles.EvilSpirit && x.IsGhostRole() && x.IsEnable() && x.GetMode() != 0).ToList();
|
||||
|
||||
Logger.Msg($"Ghost roles: {GhostRoles.Join()}", "GhostRoles");
|
||||
Haunter.AllHauntedPlayers = [];
|
||||
|
||||
+3
-3
@@ -2027,10 +2027,10 @@ public static class Utils
|
||||
? SeerRealName
|
||||
: seerTeam switch
|
||||
{
|
||||
Team.Impostor when seer.IsMadmate() => $"<font=\"DIN_Pro_Bold_700 SDF\"><size=200%><color=#ff1919>{GetString("YouAreMadmate")}</size></color></font>\n<size=90%>{(showLongInfo ? longInfo : seer.GetRoleInfo()) + mHelp}</size>",
|
||||
Team.Impostor when seer.IsMadmate() => $"<size=200%><color=#ff1919>{GetString("YouAreMadmate")}</size></color>\n<size=90%>{(showLongInfo ? longInfo : seer.GetRoleInfo()) + mHelp}</size>",
|
||||
Team.Impostor => $"\n<size=90%>{(showLongInfo ? longInfo : seer.GetRoleInfo()) + mHelp}</size>",
|
||||
Team.Crewmate => $"<font=\"DIN_Pro_Bold_700 SDF\"><size=200%><color=#8cffff>{GetString("YouAreCrewmate")}</size></color></font>\n<size=90%>{(showLongInfo ? longInfo : seer.GetRoleInfo()) + mHelp}</size>",
|
||||
Team.Neutral => $"<font=\"DIN_Pro_Bold_700 SDF\"><size=200%><color=#ffab1b>{GetString("YouAreNeutral")}</size></color></font>\n<size=90%>{(showLongInfo ? longInfo : seer.GetRoleInfo()) + mHelp}</size>",
|
||||
Team.Crewmate => $"<size=200%><color=#8cffff>{GetString("YouAreCrewmate")}</size></color>\n<size=90%>{(showLongInfo ? longInfo : seer.GetRoleInfo()) + mHelp}</size>",
|
||||
Team.Neutral => $"<size=200%><color=#ffab1b>{GetString("YouAreNeutral")}</size></color>\n<size=90%>{(showLongInfo ? longInfo : seer.GetRoleInfo()) + mHelp}</size>",
|
||||
_ => SeerRealName
|
||||
};
|
||||
}
|
||||
|
||||
@@ -103,6 +103,8 @@ internal static class ChatCommands
|
||||
public static Dictionary<byte, List<CustomRoles>> DraftRoles = [];
|
||||
public static Dictionary<byte, CustomRoles> DraftResult = [];
|
||||
|
||||
private static HashSet<byte> ReadyPlayers = [];
|
||||
|
||||
public static void LoadCommands()
|
||||
{
|
||||
AllCommands =
|
||||
@@ -170,6 +172,8 @@ internal static class ChatCommands
|
||||
new(["unmute", "размут"], "{id}", GetString("CommandDescription.Unmute"), Command.UsageLevels.Host, Command.UsageTimes.Always, UnmuteCommand, true, [GetString("CommandArgs.Unmute.Id")]),
|
||||
new(["draftstart", "ds", "драфтстарт"], "", GetString("CommandDescription.DraftStart"), Command.UsageLevels.Host, Command.UsageTimes.InLobby, DraftStartCommand, true),
|
||||
new(["draft", "драфт"], "{number}", GetString("CommandDescription.Draft"), Command.UsageLevels.Everyone, Command.UsageTimes.InLobby, DraftCommand, true, [GetString("CommandArgs.Draft.Number")]),
|
||||
new(["readycheck", "rc", "готов"], "", GetString("CommandDescription.ReadyCheck"), Command.UsageLevels.Host, Command.UsageTimes.InLobby, ReadyCheckCommand, true),
|
||||
new(["ready", "готов", "г"], "", GetString("CommandDescription.Ready"), Command.UsageLevels.Everyone, Command.UsageTimes.InLobby, ReadyCommand, true),
|
||||
|
||||
// Commands with action handled elsewhere
|
||||
new(["shoot", "guess", "bet", "bt", "st", "угадать", "бт"], "{id} {role}", GetString("CommandDescription.Guess"), Command.UsageLevels.Everyone, Command.UsageTimes.InMeeting, (_, _, _, _) => { }, true, [GetString("CommandArgs.Guess.Id"), GetString("CommandArgs.Guess.Role")]),
|
||||
@@ -298,6 +302,35 @@ internal static class ChatCommands
|
||||
|
||||
// ---------------------------------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
private static void ReadyCheckCommand(ChatController __instance, PlayerControl player, string text, string[] args)
|
||||
{
|
||||
Utils.SendMessage(GetString("ReadyCheckMessage"), title: GetString("ReadyCheckTitle"));
|
||||
ReadyPlayers = [player.PlayerId];
|
||||
Main.Instance.StartCoroutine(Countdown());
|
||||
return;
|
||||
|
||||
System.Collections.IEnumerator Countdown()
|
||||
{
|
||||
var timer = 30f;
|
||||
while (timer > 0f)
|
||||
{
|
||||
if (!GameStates.IsLobby) yield break;
|
||||
if (Main.AllPlayerControls.Select(x => x.PlayerId).All(ReadyPlayers.Contains)) break;
|
||||
timer -= Time.deltaTime;
|
||||
yield return null;
|
||||
}
|
||||
|
||||
var notReadyPlayers = Main.AllPlayerControls.Select(x => x.PlayerId).Except(ReadyPlayers).ToArray();
|
||||
if (notReadyPlayers.Length == 0) Utils.SendMessage("\n", player.PlayerId, GetString("EveryoneReadyTitle"));
|
||||
else Utils.SendMessage(string.Join(", ", notReadyPlayers.Select(x => x.ColoredPlayerName())), player.PlayerId, string.Format(GetString("PlayersNotReadyTitle"), notReadyPlayers.Length));
|
||||
}
|
||||
}
|
||||
|
||||
private static void ReadyCommand(ChatController __instance, PlayerControl player, string text, string[] args)
|
||||
{
|
||||
ReadyPlayers.Add(player.PlayerId);
|
||||
}
|
||||
|
||||
private static void DraftStartCommand(ChatController __instance, PlayerControl player, string text, string[] args)
|
||||
{
|
||||
DraftResult = [];
|
||||
|
||||
+2
-156
@@ -1,167 +1,13 @@
|
||||
using System;
|
||||
using AmongUs.GameOptions;
|
||||
using AmongUs.GameOptions;
|
||||
using HarmonyLib;
|
||||
using TMPro;
|
||||
using UnityEngine;
|
||||
|
||||
// All errors in this file are fake, the build succeeds
|
||||
// https://github.com/CrowdedMods/CrowdedMod/blob/master/src/CrowdedMod/Patches/CreateGameOptionsPatches.cs
|
||||
// https://github.com/CrowdedMods/CrowdedMod/blob/master/src/CrowdedMod
|
||||
namespace EHR.Patches
|
||||
{
|
||||
internal static class Crowded
|
||||
{
|
||||
public const int MaxPlayers = 127;
|
||||
public const int MaxImpostors = 127 / 2;
|
||||
|
||||
[HarmonyPatch(typeof(CreateOptionsPicker), nameof(CreateOptionsPicker.Awake))]
|
||||
public static class CreateOptionsPickerAwake
|
||||
{
|
||||
public static void Postfix(CreateOptionsPicker __instance)
|
||||
{
|
||||
if (__instance.mode != SettingsMode.Host) return;
|
||||
|
||||
{
|
||||
var firstButtonRenderer = __instance.MaxPlayerButtons[0];
|
||||
firstButtonRenderer.GetComponentInChildren<TextMeshPro>().text = "-";
|
||||
firstButtonRenderer.enabled = false;
|
||||
|
||||
var firstButtonButton = firstButtonRenderer.GetComponent<PassiveButton>();
|
||||
firstButtonButton.OnClick.RemoveAllListeners();
|
||||
firstButtonButton.OnClick.AddListener((Action)(() =>
|
||||
{
|
||||
for (var i = 1; i < 11; i++)
|
||||
{
|
||||
var playerButton = __instance.MaxPlayerButtons[i];
|
||||
|
||||
var tmp = playerButton.GetComponentInChildren<TextMeshPro>();
|
||||
var newValue = Mathf.Max(byte.Parse(tmp.text) - 10, byte.Parse(playerButton.name) - 2);
|
||||
tmp.text = newValue.ToString();
|
||||
}
|
||||
|
||||
__instance.UpdateMaxPlayersButtons(__instance.GetTargetOptions());
|
||||
}));
|
||||
Object.Destroy(firstButtonRenderer);
|
||||
|
||||
var lastButtonRenderer = __instance.MaxPlayerButtons[^1];
|
||||
lastButtonRenderer.GetComponentInChildren<TextMeshPro>().text = "+";
|
||||
lastButtonRenderer.enabled = false;
|
||||
|
||||
var lastButtonButton = lastButtonRenderer.GetComponent<PassiveButton>();
|
||||
lastButtonButton.OnClick.RemoveAllListeners();
|
||||
lastButtonButton.OnClick.AddListener((Action)(() =>
|
||||
{
|
||||
for (var i = 1; i < 11; i++)
|
||||
{
|
||||
var playerButton = __instance.MaxPlayerButtons[i];
|
||||
|
||||
var tmp = playerButton.GetComponentInChildren<TextMeshPro>();
|
||||
var newValue = Mathf.Min(byte.Parse(tmp.text) + 10,
|
||||
MaxPlayers - 14 + byte.Parse(playerButton.name));
|
||||
tmp.text = newValue.ToString();
|
||||
}
|
||||
|
||||
__instance.UpdateMaxPlayersButtons(__instance.GetTargetOptions());
|
||||
}));
|
||||
Object.Destroy(lastButtonRenderer);
|
||||
|
||||
for (var i = 1; i < 11; i++)
|
||||
{
|
||||
var playerButton = __instance.MaxPlayerButtons[i].GetComponent<PassiveButton>();
|
||||
var text = playerButton.GetComponentInChildren<TextMeshPro>();
|
||||
|
||||
playerButton.OnClick.RemoveAllListeners();
|
||||
playerButton.OnClick.AddListener((Action)(() =>
|
||||
{
|
||||
var maxPlayers = byte.Parse(text.text);
|
||||
var maxImp = Mathf.Min(__instance.GetTargetOptions().NumImpostors, maxPlayers / 2);
|
||||
__instance.GetTargetOptions().SetInt(Int32OptionNames.NumImpostors, maxImp);
|
||||
__instance.ImpostorButtons[1].TextMesh.text = maxImp.ToString();
|
||||
__instance.SetMaxPlayersButtons(maxPlayers);
|
||||
}));
|
||||
}
|
||||
|
||||
foreach (var button in __instance.MaxPlayerButtons)
|
||||
{
|
||||
button.enabled = button.GetComponentInChildren<TextMeshPro>().text == __instance.GetTargetOptions().MaxPlayers.ToString();
|
||||
}
|
||||
}
|
||||
|
||||
{
|
||||
var secondButton = __instance.ImpostorButtons[1];
|
||||
secondButton.SpriteRenderer.enabled = false;
|
||||
Object.Destroy(secondButton.transform.FindChild("ConsoleHighlight").gameObject);
|
||||
Object.Destroy(secondButton.PassiveButton);
|
||||
Object.Destroy(secondButton.BoxCollider);
|
||||
|
||||
var secondButtonText = secondButton.TextMesh;
|
||||
secondButtonText.text = __instance.GetTargetOptions().NumImpostors.ToString();
|
||||
|
||||
var firstButton = __instance.ImpostorButtons[0];
|
||||
firstButton.SpriteRenderer.enabled = false;
|
||||
firstButton.TextMesh.text = "-";
|
||||
|
||||
var firstPassiveButton = firstButton.PassiveButton;
|
||||
firstPassiveButton.OnClick.RemoveAllListeners();
|
||||
firstPassiveButton.OnClick.AddListener((Action)(() =>
|
||||
{
|
||||
var newVal = Mathf.Clamp(
|
||||
byte.Parse(secondButtonText.text) - 1,
|
||||
1,
|
||||
__instance.GetTargetOptions().MaxPlayers / 2
|
||||
);
|
||||
__instance.SetImpostorButtons(newVal);
|
||||
secondButtonText.text = newVal.ToString();
|
||||
}));
|
||||
|
||||
var thirdButton = __instance.ImpostorButtons[2];
|
||||
thirdButton.SpriteRenderer.enabled = false;
|
||||
thirdButton.TextMesh.text = "+";
|
||||
|
||||
var thirdPassiveButton = thirdButton.PassiveButton;
|
||||
thirdPassiveButton.OnClick.RemoveAllListeners();
|
||||
thirdPassiveButton.OnClick.AddListener((Action)(() =>
|
||||
{
|
||||
var newVal = Mathf.Clamp(
|
||||
byte.Parse(secondButtonText.text) + 1,
|
||||
1,
|
||||
__instance.GetTargetOptions().MaxPlayers / 2
|
||||
);
|
||||
__instance.SetImpostorButtons(newVal);
|
||||
secondButtonText.text = newVal.ToString();
|
||||
}));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
[HarmonyPatch(typeof(CreateOptionsPicker), nameof(CreateOptionsPicker.UpdateMaxPlayersButtons))]
|
||||
public static class CreateOptionsPickerUpdateMaxPlayersButtons
|
||||
{
|
||||
public static bool Prefix(CreateOptionsPicker __instance, [HarmonyArgument(0)] IGameOptions opts)
|
||||
{
|
||||
if (__instance.CrewArea)
|
||||
{
|
||||
__instance.CrewArea.SetCrewSize(opts.MaxPlayers, opts.NumImpostors);
|
||||
}
|
||||
|
||||
var selectedAsString = opts.MaxPlayers.ToString();
|
||||
for (var i = 1; i < __instance.MaxPlayerButtons.Count - 1; i++)
|
||||
{
|
||||
__instance.MaxPlayerButtons[i].enabled = __instance.MaxPlayerButtons[i].GetComponentInChildren<TextMeshPro>().text == selectedAsString;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
[HarmonyPatch(typeof(CreateOptionsPicker), nameof(CreateOptionsPicker.UpdateImpostorsButtons))]
|
||||
public static class CreateOptionsPickerUpdateImpostorsButtons
|
||||
{
|
||||
public static bool Prefix()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
[HarmonyPatch(typeof(GameOptionsData), nameof(GameOptionsData.AreInvalid))]
|
||||
public static class InvalidOptionsPatches
|
||||
{
|
||||
|
||||
@@ -367,7 +367,7 @@ internal static class StartGameHostPatch
|
||||
{
|
||||
private static AmongUsClient AUClient;
|
||||
|
||||
private static readonly Dictionary<CustomRoles, List<byte>> BasisChangingAddons = [];
|
||||
public static readonly Dictionary<CustomRoles, List<byte>> BasisChangingAddons = [];
|
||||
private static Dictionary<RoleTypes, int> RoleTypeNums = [];
|
||||
|
||||
private static readonly Dictionary<byte, bool> DataDisconnected = [];
|
||||
|
||||
@@ -494,9 +494,6 @@ static class CheckMurderPatch
|
||||
case CustomRoles.Medic:
|
||||
Medic.IsDead(target);
|
||||
break;
|
||||
case CustomRoles.Monarch when killer.Is(CustomRoles.Knighted):
|
||||
Notify("KnightedKillMonarch");
|
||||
return false;
|
||||
case CustomRoles.Gambler when Gambler.IsShielded.ContainsKey(target.PlayerId):
|
||||
Notify("SomeSortOfProtection");
|
||||
killer.SetKillCooldown(time: 5f);
|
||||
|
||||
@@ -1153,6 +1153,10 @@
|
||||
"MenuTitle.GuesserModeRoles": "★ Roles and Add-ons for Guesser Mode ★",
|
||||
"MenuTitle.CTA": "★ Custom Team Assignment ★",
|
||||
"MenuTitle.AFKDetection": "★ AFK Detection ★",
|
||||
"ReadyCheckMessage": "The host is checking how many players are ready to start the game.\\nPlease type <b>/ready</b> to let the host know you're not AFK.",
|
||||
"ReadyCheckTitle": "<#ffff00>★ Ready Check ★</color>",
|
||||
"EveryoneReadyTitle": "<#00ff00>Everyone is ready!</color>",
|
||||
"PlayersNotReadyTitle": "<#ffff00><#ffab1b>{0}</color> players are not ready!</color> They are:",
|
||||
"ShieldPersonDiedFirst": "Shield the person who got killed first in the last game",
|
||||
"SidekickKnowOtherSidekick": "<color=#00b4eb>Sidekicks</color> know each other",
|
||||
"SidekickKnowOtherSidekickRole": "<color=#00b4eb>Sidekicks</color> know the roles of other <color=#00b4eb>Sidekicks</color>",
|
||||
@@ -1701,7 +1705,6 @@
|
||||
"RefugeeKillImpostor": "Renegades cannot kill Impostors",
|
||||
"GAGuarded": "This player is shielded by the Guardian Angel",
|
||||
"TraitorKillImpostor": "As the Traitor, you cannot kill Impostors",
|
||||
"KnightedKillMonarch": "As the Knighted player, you cannot kill the Monarch",
|
||||
"RookieKillRoundOne": "As a Rookie, you cannot kill in the first round",
|
||||
"SocialiteTarget": "The target of the Socialite cannot be killed\\nYou were added to their Guest List",
|
||||
"BodyguardProtected": "The Bodyguard protected your target and died for them",
|
||||
@@ -2256,6 +2259,8 @@
|
||||
"CommandDescription.Unmute": "Unmute someone.",
|
||||
"CommandDescription.DraftStart": "Start drafting, where players may choose their roles for the next game",
|
||||
"CommandDescription.Draft": "Choose a role in the draft",
|
||||
"CommandDescription.ReadyCheck": "Start a ready check (check who is AFK) (results displayed after 30s)",
|
||||
"CommandDescription.Ready": "Mark yourself as ready",
|
||||
"CommandArgs.ChangeSetting.Name": "The setting's name to change (leave blank to view all settings)",
|
||||
"CommandArgs.ChangeSetting.UnknownValue": "(leave blank to view what to put here)",
|
||||
"CommandArgs.Rename.Name": "Your new name",
|
||||
|
||||
@@ -47,7 +47,7 @@ namespace EHR.Neutral
|
||||
|
||||
public override void SetKillCooldown(byte id) => Main.AllPlayerKillCooldown[id] = KillCooldown.GetFloat();
|
||||
public override bool CanUseImpostorVentButton(PlayerControl pc) => CanVent.GetBool();
|
||||
public override bool CanUseSabotage(PlayerControl pc) => pc.IsAlive() && !(UsePhantomBasis.GetBool() && UsePhantomBasisForNKs.GetBool());
|
||||
public override bool CanUseSabotage(PlayerControl pc) => base.CanUseSabotage(pc) || (pc.IsAlive() && !(UsePhantomBasis.GetBool() && UsePhantomBasisForNKs.GetBool()));
|
||||
|
||||
public override void ApplyGameOptions(IGameOptions opt, byte id)
|
||||
{
|
||||
|
||||
@@ -61,7 +61,7 @@ namespace EHR.Neutral
|
||||
|
||||
public override void SetKillCooldown(byte id) => Main.AllPlayerKillCooldown[id] = Stats.KillCooldown;
|
||||
public override bool CanUseImpostorVentButton(PlayerControl pc) => pc.inVent || Stats is { CanVent: true, VentUseLimit: > 0 };
|
||||
public override bool CanUseSabotage(PlayerControl pc) => Stats is { CanSabotage: true, SabotageUseLimit: > 0 };
|
||||
public override bool CanUseSabotage(PlayerControl pc) => base.CanUseSabotage(pc) || Stats is { CanSabotage: true, SabotageUseLimit: > 0 };
|
||||
|
||||
public override void ApplyGameOptions(IGameOptions opt, byte playerId)
|
||||
{
|
||||
|
||||
@@ -49,7 +49,7 @@ namespace EHR.Neutral
|
||||
|
||||
public override void SetKillCooldown(byte id) => Main.AllPlayerKillCooldown[id] = KillCooldown.GetFloat();
|
||||
public override bool CanUseImpostorVentButton(PlayerControl pc) => CanVent.GetBool();
|
||||
public override bool CanUseSabotage(PlayerControl pc) => pc.IsAlive() && !(UsePhantomBasis.GetBool() && UsePhantomBasisForNKs.GetBool());
|
||||
public override bool CanUseSabotage(PlayerControl pc) => base.CanUseSabotage(pc) || (pc.IsAlive() && !(UsePhantomBasis.GetBool() && UsePhantomBasisForNKs.GetBool()));
|
||||
|
||||
public override void ApplyGameOptions(IGameOptions opt, byte id)
|
||||
{
|
||||
|
||||
@@ -31,7 +31,7 @@ namespace EHR.Neutral
|
||||
|
||||
public override bool CanUseSabotage(PlayerControl pc)
|
||||
{
|
||||
return false;
|
||||
return pc.Is(CustomRoles.Mischievous);
|
||||
}
|
||||
|
||||
public override void ApplyGameOptions(IGameOptions opt, byte playerId)
|
||||
|
||||
@@ -96,7 +96,7 @@ public class Jackal : RoleBase
|
||||
|
||||
public override void SetKillCooldown(byte id) => Main.AllPlayerKillCooldown[id] = KillCooldown.GetFloat();
|
||||
public override bool CanUseImpostorVentButton(PlayerControl pc) => CanVent.GetBool();
|
||||
public override bool CanUseSabotage(PlayerControl pc) => CanSabotage.GetBool() && pc.IsAlive();
|
||||
public override bool CanUseSabotage(PlayerControl pc) => base.CanUseSabotage(pc) || (CanSabotage.GetBool() && pc.IsAlive());
|
||||
|
||||
public override void SetButtonTexts(HudManager hud, byte id)
|
||||
{
|
||||
@@ -116,11 +116,11 @@ public class Jackal : RoleBase
|
||||
|
||||
public override bool OnCheckMurder(PlayerControl killer, PlayerControl target)
|
||||
{
|
||||
if (killer.GetAbilityUseLimit() < 1 || !CanBeSidekick(target, out var needBasisChange, out var targetRoleType)) return true;
|
||||
if (killer.GetAbilityUseLimit() < 1 || !CanBeSidekick(target)) return true;
|
||||
|
||||
killer.RpcRemoveAbilityUse();
|
||||
target.RpcSetCustomRole(targetRoleType == RoleTypes.Shapeshifter ? CustomRoles.Recruit : CustomRoles.Sidekick);
|
||||
if (needBasisChange) target.RpcChangeRoleBasis(CustomRoles.Sidekick);
|
||||
target.RpcSetCustomRole(CustomRoles.Sidekick);
|
||||
target.RpcChangeRoleBasis(CustomRoles.Sidekick);
|
||||
SidekickId = target.PlayerId;
|
||||
|
||||
Main.ResetCamPlayerList.Add(target.PlayerId);
|
||||
@@ -139,13 +139,11 @@ public class Jackal : RoleBase
|
||||
return false;
|
||||
}
|
||||
|
||||
private static bool CanBeSidekick(PlayerControl pc, out bool needBasisChange, out RoleTypes targetRoleType)
|
||||
private static bool CanBeSidekick(PlayerControl pc)
|
||||
{
|
||||
targetRoleType = pc.GetRoleTypes();
|
||||
needBasisChange = targetRoleType is not RoleTypes.Impostor and not RoleTypes.Shapeshifter;
|
||||
if (!CanRecruitImpostors.GetBool() && pc.Is(CustomRoleTypes.Impostor)) return false;
|
||||
if (!CanRecruitMadmates.GetBool() && pc.IsMadmate()) return false;
|
||||
return pc != null && !pc.Is(CustomRoles.Sidekick) && !pc.Is(CustomRoles.Recruit) && !pc.Is(CustomRoles.Loyal) && !pc.Is(CustomRoles.Rascal) && !pc.Is(CustomRoles.Charmed) && !pc.Is(CustomRoles.Contagious) && pc.GetCustomRole().IsAbleToBeSidekicked();
|
||||
return pc != null && !pc.Is(CustomRoles.Sidekick) && !pc.IsConverted() && pc.GetCustomRole().IsAbleToBeSidekicked();
|
||||
}
|
||||
|
||||
public override void OnFixedUpdate(PlayerControl pc)
|
||||
@@ -196,7 +194,7 @@ public class Sidekick : RoleBase
|
||||
public override bool CanUseImpostorVentButton(PlayerControl pc) => Jackal.CanVentSK.GetBool();
|
||||
public override void SetKillCooldown(byte id) => Main.AllPlayerKillCooldown[id] = Jackal.KillCooldownSK.GetFloat();
|
||||
public override void ApplyGameOptions(IGameOptions opt, byte id) => opt.SetVision(Jackal.HasImpostorVision.GetBool());
|
||||
public override bool CanUseSabotage(PlayerControl pc) => Jackal.CanSabotageSK.GetBool() && pc.IsAlive();
|
||||
public override bool CanUseSabotage(PlayerControl pc) => base.CanUseSabotage(pc) || (Jackal.CanSabotageSK.GetBool() && pc.IsAlive());
|
||||
|
||||
public override void SetButtonTexts(HudManager __instance, byte id)
|
||||
{
|
||||
|
||||
@@ -103,7 +103,7 @@ public class Magician : RoleBase
|
||||
|
||||
public override void SetKillCooldown(byte id) => Main.AllPlayerKillCooldown[id] = KillCooldown.GetFloat();
|
||||
public override bool CanUseImpostorVentButton(PlayerControl pc) => CanVent.GetBool();
|
||||
public override bool CanUseSabotage(PlayerControl pc) => pc.IsAlive() && !(UsePhantomBasis.GetBool() && UsePhantomBasisForNKs.GetBool());
|
||||
public override bool CanUseSabotage(PlayerControl pc) => base.CanUseSabotage(pc) || (pc.IsAlive() && !(UsePhantomBasis.GetBool() && UsePhantomBasisForNKs.GetBool()));
|
||||
|
||||
public override void ApplyGameOptions(IGameOptions opt, byte id)
|
||||
{
|
||||
|
||||
@@ -48,7 +48,7 @@ public class Maverick : RoleBase
|
||||
public override void ApplyGameOptions(IGameOptions opt, byte id) => opt.SetVision(HasImpostorVision.GetBool());
|
||||
public override bool CanUseImpostorVentButton(PlayerControl pc) => CanVent.GetBool();
|
||||
public override bool CanUseKillButton(PlayerControl pc) => pc.IsAlive();
|
||||
public override bool CanUseSabotage(PlayerControl pc) => false;
|
||||
public override bool CanUseSabotage(PlayerControl pc) => pc.Is(CustomRoles.Mischievous);
|
||||
|
||||
public override string GetProgressText(byte playerId, bool comms)
|
||||
{
|
||||
|
||||
@@ -166,6 +166,6 @@ namespace EHR.Neutral
|
||||
public override bool OnCheckMurder(PlayerControl killer, PlayerControl target) => IsEnable && target != null && InfectedPlayers.Contains(target.PlayerId);
|
||||
public override void AfterMeetingTasks() => Mycologist_.AddAbilityCD(CD.GetInt());
|
||||
public override bool CanUseImpostorVentButton(PlayerControl pc) => true;
|
||||
public override bool CanUseSabotage(PlayerControl pc) => SpreadAction.GetValue() == 1 && pc.IsAlive();
|
||||
public override bool CanUseSabotage(PlayerControl pc) => base.CanUseSabotage(pc) || (SpreadAction.GetValue() == 1 && pc.IsAlive());
|
||||
}
|
||||
}
|
||||
@@ -57,7 +57,7 @@ namespace EHR.Neutral
|
||||
|
||||
public override void SetKillCooldown(byte id) => Main.AllPlayerKillCooldown[id] = Utils.GetPlayerById(id).GetPlainShipRoom() == RoomBoosts[Boost.Cooldown] ? DecreasedKillCooldown.GetFloat() : KillCooldown.GetFloat();
|
||||
public override bool CanUseImpostorVentButton(PlayerControl pc) => pc.inVent || pc.GetAbilityUseLimit() > 0 || pc.GetPlainShipRoom() == RoomBoosts[Boost.Vent];
|
||||
public override bool CanUseSabotage(PlayerControl pc) => pc.GetPlainShipRoom() == RoomBoosts[Boost.Sabotage];
|
||||
public override bool CanUseSabotage(PlayerControl pc) => base.CanUseSabotage(pc) || (pc.GetPlainShipRoom() == RoomBoosts[Boost.Sabotage]);
|
||||
|
||||
public override void ApplyGameOptions(IGameOptions opt, byte id)
|
||||
{
|
||||
|
||||
@@ -34,7 +34,7 @@ namespace EHR.Neutral
|
||||
|
||||
public override bool CanUseSabotage(PlayerControl pc)
|
||||
{
|
||||
return false;
|
||||
return pc.Is(CustomRoles.Mischievous);
|
||||
}
|
||||
|
||||
public override void SetKillCooldown(byte id)
|
||||
|
||||
@@ -66,7 +66,7 @@ namespace EHR.Neutral
|
||||
|
||||
public override bool CanUseSabotage(PlayerControl pc)
|
||||
{
|
||||
return false;
|
||||
return pc.Is(CustomRoles.Mischievous);
|
||||
}
|
||||
|
||||
public override void SetKillCooldown(byte id)
|
||||
|
||||
@@ -63,7 +63,7 @@ namespace EHR.Neutral
|
||||
|
||||
public override void SetKillCooldown(byte id) => Main.AllPlayerKillCooldown[id] = GotRewards.Contains(Reward.DecreasedKillCooldown) ? KillCooldown.GetFloat() / 2f : KillCooldown.GetFloat();
|
||||
public override bool CanUseImpostorVentButton(PlayerControl pc) => CurrentTask.Objective == Objective.VentXTimes || CanVent.GetBool();
|
||||
public override bool CanUseSabotage(PlayerControl pc) => GotRewards.Contains(Reward.Sabotage) || GotRewards.Contains(Reward.Morph);
|
||||
public override bool CanUseSabotage(PlayerControl pc) => base.CanUseSabotage(pc) || (GotRewards.Contains(Reward.Sabotage) || GotRewards.Contains(Reward.Morph));
|
||||
|
||||
public override void ApplyGameOptions(IGameOptions opt, byte id)
|
||||
{
|
||||
|
||||
@@ -55,7 +55,7 @@ namespace EHR.Neutral
|
||||
|
||||
public override void SetKillCooldown(byte id) => Main.AllPlayerKillCooldown[id] = KCD;
|
||||
public override bool CanUseImpostorVentButton(PlayerControl pc) => true;
|
||||
public override bool CanUseSabotage(PlayerControl pc) => !(Options.UsePhantomBasis.GetBool() && Options.UsePhantomBasisForNKs.GetBool());
|
||||
public override bool CanUseSabotage(PlayerControl pc) => base.CanUseSabotage(pc) || (!(Options.UsePhantomBasis.GetBool() && Options.UsePhantomBasisForNKs.GetBool()));
|
||||
|
||||
public override void ApplyGameOptions(IGameOptions opt, byte id)
|
||||
{
|
||||
|
||||
@@ -60,7 +60,7 @@ namespace EHR.Neutral
|
||||
|
||||
public override void SetKillCooldown(byte id) => Main.AllPlayerKillCooldown[id] = KillCooldown.GetFloat();
|
||||
public override bool CanUseImpostorVentButton(PlayerControl pc) => pc.IsAlive();
|
||||
public override bool CanUseSabotage(PlayerControl pc) => !(UsePhantomBasis.GetBool() && UsePhantomBasisForNKs.GetBool());
|
||||
public override bool CanUseSabotage(PlayerControl pc) => base.CanUseSabotage(pc) || (!(UsePhantomBasis.GetBool() && UsePhantomBasisForNKs.GetBool()));
|
||||
|
||||
public override void ApplyGameOptions(IGameOptions opt, byte id)
|
||||
{
|
||||
|
||||
@@ -81,7 +81,7 @@ namespace EHR.Neutral
|
||||
|
||||
public override void SetKillCooldown(byte id) => Main.AllPlayerKillCooldown[id] = KillCooldown.GetFloat();
|
||||
public override bool CanUseImpostorVentButton(PlayerControl pc) => CanVent.GetBool();
|
||||
public override bool CanUseSabotage(PlayerControl pc) => pc.IsAlive() && !(UsePhantomBasis.GetBool() && UsePhantomBasisForNKs.GetBool());
|
||||
public override bool CanUseSabotage(PlayerControl pc) => base.CanUseSabotage(pc) || (pc.IsAlive() && !(UsePhantomBasis.GetBool() && UsePhantomBasisForNKs.GetBool()));
|
||||
|
||||
public override void ApplyGameOptions(IGameOptions opt, byte id)
|
||||
{
|
||||
|
||||
@@ -66,7 +66,7 @@ namespace EHR.Neutral
|
||||
|
||||
public override bool CanUseSabotage(PlayerControl pc)
|
||||
{
|
||||
return pc.IsAlive() && !(Options.UsePhantomBasis.GetBool() && Options.UsePhantomBasisForNKs.GetBool());
|
||||
return base.CanUseSabotage(pc) || (pc.IsAlive() && !(Options.UsePhantomBasis.GetBool() && Options.UsePhantomBasisForNKs.GetBool()));
|
||||
}
|
||||
|
||||
public override void ApplyGameOptions(IGameOptions opt, byte playerId)
|
||||
|
||||
@@ -43,5 +43,5 @@ public class Traitor : RoleBase
|
||||
public override void SetKillCooldown(byte id) => Main.AllPlayerKillCooldown[id] = KillCooldown.GetFloat();
|
||||
public override void ApplyGameOptions(IGameOptions opt, byte id) => opt.SetVision(HasImpostorVision.GetBool());
|
||||
public override bool CanUseImpostorVentButton(PlayerControl pc) => CanVent.GetBool();
|
||||
public override bool CanUseSabotage(PlayerControl pc) => CanSabotage.GetBool() && pc.IsAlive();
|
||||
public override bool CanUseSabotage(PlayerControl pc) => base.CanUseSabotage(pc) || (CanSabotage.GetBool() && pc.IsAlive());
|
||||
}
|
||||
@@ -89,7 +89,7 @@ public class WeaponMaster : RoleBase
|
||||
|
||||
public override void SetKillCooldown(byte id) => Main.AllPlayerKillCooldown[id] = KillCooldown.GetFloat();
|
||||
public override bool CanUseImpostorVentButton(PlayerControl pc) => CanVent.GetBool();
|
||||
public override bool CanUseSabotage(PlayerControl pc) => pc.IsAlive() && !(UsePhantomBasis.GetBool() && UsePhantomBasisForNKs.GetBool());
|
||||
public override bool CanUseSabotage(PlayerControl pc) => base.CanUseSabotage(pc) || (pc.IsAlive() && !(UsePhantomBasis.GetBool() && UsePhantomBasisForNKs.GetBool()));
|
||||
|
||||
public override void ApplyGameOptions(IGameOptions opt, byte id)
|
||||
{
|
||||
|
||||
Reference in new issue
Block a user