diff --git a/EHR.sln.DotSettings b/EHR.sln.DotSettings
index 83fbb799c..c408eab5a 100644
--- a/EHR.sln.DotSettings
+++ b/EHR.sln.DotSettings
@@ -2,6 +2,7 @@
xmlns:s="clr-namespace:System;assembly=mscorlib"
xmlns:wpf="http://schemas.microsoft.com/winfx/2006/xaml/presentation">
SOLUTION
+ ATK
AU
CD
CK
@@ -12,6 +13,7 @@
FFF
FPS
GM
+ HP
HUD
KCD
NB
diff --git a/GameMode/SoloKombatManager.cs b/GameMode/SoloKombatManager.cs
index 74878f7d5..4d9c28921 100644
--- a/GameMode/SoloKombatManager.cs
+++ b/GameMode/SoloKombatManager.cs
@@ -14,37 +14,20 @@ internal static class SoloKombatManager
{
private static Dictionary PlayerHPMax = [];
private static Dictionary PlayerHP = [];
- private static Dictionary PlayerHPReco = [];
- private static Dictionary PlayerATK = [];
- private static Dictionary PlayerDF = [];
+ public static Dictionary PlayerHPReco = [];
+ public static Dictionary PlayerATK = [];
+ public static Dictionary PlayerDF = [];
- private static Dictionary originalSpeed = [];
- public static Dictionary KBScore = [];
+ private static Dictionary OriginalSpeed = [];
+ private static Dictionary KBScore = [];
public static int RoundTime;
- //Options
- public static OptionItem KB_GameTime;
- public static OptionItem KB_ATKCooldown;
- public static OptionItem KB_HPMax;
- public static OptionItem KB_ATK;
- public static OptionItem KB_RecoverAfterSecond;
- public static OptionItem KB_RecoverPerSecond;
- public static OptionItem KB_ResurrectionWaitingTime;
- public static OptionItem KB_KillBonusMultiplier;
- public static OptionItem KB_BootVentWhenDead;
-
- public static Dictionary NameNotify = [];
+ private static readonly Dictionary NameNotify = [];
private static Dictionary BackCountdown = [];
private static Dictionary LastHurt = [];
- public static bool SoloAlive(this PlayerControl pc) => pc.HP() > 0f;
-
- public static float HPMAX(this PlayerControl pc) => PlayerHPMax[pc.PlayerId];
- public static float HP(this PlayerControl pc) => PlayerHP[pc.PlayerId];
- public static float HPRECO(this PlayerControl pc) => PlayerHPReco[pc.PlayerId];
- public static float ATK(this PlayerControl pc) => PlayerATK[pc.PlayerId];
- public static float DF(this PlayerControl pc) => PlayerDF[pc.PlayerId];
+ public static bool SoloAlive(this PlayerControl pc) => PlayerHP[pc.PlayerId] > 0f;
public static void SetupCustomOption()
{
@@ -97,7 +80,7 @@ internal static class SoloKombatManager
PlayerDF = [];
LastHurt = [];
- originalSpeed = [];
+ OriginalSpeed = [];
BackCountdown = [];
KBScore = [];
RoundTime = KB_GameTime.GetInt() + 8;
@@ -160,13 +143,11 @@ internal static class SoloKombatManager
KBScore[PlayerId] = reader.ReadInt32();
}
- public static void SendRPCSyncNameNotify(PlayerControl pc)
+ private static void SendRPCSyncNameNotify(PlayerControl pc)
{
if (pc.AmOwner || !pc.IsModClient()) return;
MessageWriter writer = AmongUsClient.Instance.StartRpcImmediately(PlayerControl.LocalPlayer.NetId, (byte)CustomRPC.SyncKBNameNotify, SendOption.Reliable, pc.GetClientId());
- if (NameNotify.TryGetValue(pc.PlayerId, out (string TEXT, long TIMESTAMP) value))
- writer.Write(value.TEXT);
- else writer.Write("");
+ writer.Write(NameNotify.TryGetValue(pc.PlayerId, out (string TEXT, long TIMESTAMP) value) ? value.TEXT : "");
AmongUsClient.Instance.FinishRpcImmediately(writer);
}
@@ -174,16 +155,16 @@ internal static class SoloKombatManager
{
var name = reader.ReadString();
NameNotify.Remove(PlayerControl.LocalPlayer.PlayerId);
- if (name != null && name != "")
+ if (!string.IsNullOrEmpty(name))
NameNotify.Add(PlayerControl.LocalPlayer.PlayerId, (name, 0));
}
public static string GetDisplayHealth(PlayerControl pc)
- => pc.SoloAlive() ? Utils.ColorString(GetHealthColor(pc), $"{(int)pc.HP()}/{(int)pc.HPMAX()}") : "";
+ => pc.SoloAlive() ? Utils.ColorString(GetHealthColor(pc), $"{(int)PlayerHP[pc.PlayerId]}/{(int)PlayerHPMax[pc.PlayerId]}") : string.Empty;
private static Color32 GetHealthColor(PlayerControl pc)
{
- var x = (int)(pc.HP() / pc.HPMAX() * 10 * 50);
+ var x = (int)(PlayerHP[pc.PlayerId] / PlayerHPMax[pc.PlayerId] * 10 * 50);
int R = 255;
int G = 255;
int B = 0;
@@ -194,7 +175,7 @@ internal static class SoloKombatManager
public static void GetNameNotify(PlayerControl player, ref string name)
{
- if (Options.CurrentGameMode != CustomGameMode.SoloKombat || player == null) return;
+ if (Options.CurrentGameMode != CustomGameMode.SoloKombat || player is null || !player) return;
if (BackCountdown.TryGetValue(player.PlayerId, out int value))
{
name = string.Format(Translator.GetString("KBBackCountDown"), value);
@@ -208,21 +189,12 @@ internal static class SoloKombatManager
}
}
- public static string GetDisplayScore(byte playerId)
- {
- int rank = GetRankOfScore(playerId);
- string score = KBScore.TryGetValue(playerId, out var s) ? $"{s}" : "Invalid";
- string text = string.Format(Translator.GetString("KBDisplayScore"), rank.ToString(), score);
- Color color = Utils.GetRoleColor(CustomRoles.KB_Normal);
- return Utils.ColorString(color, text);
- }
-
public static int GetRankOfScore(byte playerId)
{
try
{
int ms = KBScore[playerId];
- int rank = 1 + KBScore.Values.Where(x => x > ms).Count();
+ int rank = 1 + KBScore.Values.Count(x => x > ms);
rank += KBScore.Where(x => x.Value == ms).ToList().IndexOf(new(playerId, ms));
return rank;
}
@@ -242,8 +214,8 @@ internal static class SoloKombatManager
if (killer == null || target == null || Options.CurrentGameMode != CustomGameMode.SoloKombat) return;
if (!killer.SoloAlive() || !target.SoloAlive() || target.inVent) return;
- var dmg = killer.ATK() - target.DF();
- PlayerHP[target.PlayerId] = Math.Max(0f, target.HP() - dmg);
+ var dmg = PlayerATK[killer.PlayerId] - PlayerDF[target.PlayerId];
+ PlayerHP[target.PlayerId] = Math.Max(0f, PlayerHP[target.PlayerId] - dmg);
if (!target.SoloAlive())
{
@@ -253,7 +225,7 @@ internal static class SoloKombatManager
LastHurt[target.PlayerId] = Utils.TimeStamp;
- killer.SetKillCooldown(1f, target);
+ killer.SetKillCooldown(KB_ATKCooldown.GetFloat(), target);
RPC.PlaySoundRPC(killer.PlayerId, Sounds.KillSound);
RPC.PlaySoundRPC(target.PlayerId, Sounds.KillSound);
if (!target.IsModClient() && !target.AmOwner)
@@ -264,14 +236,14 @@ internal static class SoloKombatManager
Utils.NotifyRoles(SpecifySeer: target, SpecifyTarget: target);
}
- public static void OnPlayerBack(PlayerControl pc)
+ private static void OnPlayerBack(PlayerControl pc)
{
BackCountdown.Remove(pc.PlayerId);
- PlayerHP[pc.PlayerId] = pc.HPMAX();
+ PlayerHP[pc.PlayerId] = PlayerHPMax[pc.PlayerId];
SendRPCSyncKBPlayer(pc.PlayerId);
LastHurt[pc.PlayerId] = Utils.TimeStamp;
- Main.AllPlayerSpeed[pc.PlayerId] = Main.AllPlayerSpeed[pc.PlayerId] - 0.3f + originalSpeed[pc.PlayerId];
+ Main.AllPlayerSpeed[pc.PlayerId] = Main.AllPlayerSpeed[pc.PlayerId] - 0.3f + OriginalSpeed[pc.PlayerId];
pc.MarkDirtySettings();
RPC.PlaySoundRPC(pc.PlayerId, Sounds.TaskComplete);
@@ -280,7 +252,7 @@ internal static class SoloKombatManager
PlayerRandomSpwan(pc);
}
- public static void PlayerRandomSpwan(PlayerControl pc)
+ private static void PlayerRandomSpwan(PlayerControl pc)
{
SpawnMap map;
switch (Main.NormalOptions.MapId)
@@ -300,10 +272,10 @@ internal static class SoloKombatManager
}
}
- public static void OnPlyaerDead(PlayerControl target)
+ private static void OnPlyaerDead(PlayerControl target)
{
- originalSpeed.Remove(target.PlayerId);
- originalSpeed.Add(target.PlayerId, Main.AllPlayerSpeed[target.PlayerId]);
+ OriginalSpeed.Remove(target.PlayerId);
+ OriginalSpeed.Add(target.PlayerId, Main.AllPlayerSpeed[target.PlayerId]);
target.TP(Pelican.GetBlackRoomPS());
Main.AllPlayerSpeed[target.PlayerId] = 0.3f;
@@ -313,7 +285,7 @@ internal static class SoloKombatManager
SendRPCSyncKBBackCountdown(target);
}
- public static void OnPlayerKill(PlayerControl killer)
+ private static void OnPlayerKill(PlayerControl killer)
{
killer.KillFlash();
if (PlayerControl.LocalPlayer.Is(CustomRoles.GM))
@@ -327,24 +299,24 @@ internal static class SoloKombatManager
switch (IRandom.Instance.Next(0, 3))
{
case 0:
- addin = killer.HPMAX() * addRate;
+ addin = PlayerHPMax[killer.PlayerId] * addRate;
PlayerHPMax[killer.PlayerId] += addin;
AddNameNotify(killer, string.Format(Translator.GetString("KB_Buff_HPMax"), addin.ToString("0.0#####")));
break;
case 1:
- addin = killer.HPRECO() * addRate * 2;
+ addin = PlayerHPReco[killer.PlayerId] * addRate * 2;
PlayerHPReco[killer.PlayerId] += addin;
AddNameNotify(killer, string.Format(Translator.GetString("KB_Buff_HPReco"), addin.ToString("0.0#####")));
break;
case 2:
- addin = killer.ATK() * addRate;
+ addin = PlayerATK[killer.PlayerId] * addRate;
PlayerATK[killer.PlayerId] += addin;
AddNameNotify(killer, string.Format(Translator.GetString("KB_Buff_ATK"), addin.ToString("0.0#####")));
break;
}
}
- public static void AddNameNotify(PlayerControl pc, string text, int time = 5)
+ private static void AddNameNotify(PlayerControl pc, string text, int time = 5)
{
NameNotify.Remove(pc.PlayerId);
NameNotify.Add(pc.PlayerId, (text, Utils.TimeStamp + time));
@@ -375,7 +347,6 @@ internal static class SoloKombatManager
if (LastFixedUpdate == Utils.TimeStamp) return;
LastFixedUpdate = Utils.TimeStamp;
- // 减少全局倒计时
RoundTime--;
if (!AmongUsClient.Instance.AmHost) return;
@@ -383,16 +354,14 @@ internal static class SoloKombatManager
foreach (var pc in Main.AllPlayerControls)
{
bool notifyRoles = false;
- // 每秒回复血量
- if (LastHurt[pc.PlayerId] + KB_RecoverAfterSecond.GetInt() < Utils.TimeStamp && pc.HP() < pc.HPMAX() && pc.SoloAlive() && !pc.inVent)
+ if (LastHurt[pc.PlayerId] + KB_RecoverAfterSecond.GetInt() < Utils.TimeStamp && PlayerHP[pc.PlayerId] < PlayerHPMax[pc.PlayerId] && pc.SoloAlive() && !pc.inVent)
{
- PlayerHP[pc.PlayerId] += pc.HPRECO();
- PlayerHP[pc.PlayerId] = Math.Min(pc.HPMAX(), pc.HP());
+ PlayerHP[pc.PlayerId] += PlayerHPReco[pc.PlayerId];
+ PlayerHP[pc.PlayerId] = Math.Min(PlayerHPMax[pc.PlayerId], PlayerHP[pc.PlayerId]);
SendRPCSyncKBPlayer(pc.PlayerId);
notifyRoles = true;
}
- // 复活玩家随机复活(二次确认)
if (pc.SoloAlive() && !pc.inVent)
{
var pos = Pelican.GetBlackRoomPS();
@@ -400,7 +369,6 @@ internal static class SoloKombatManager
if (dis < 1.1f) PlayerRandomSpwan(pc);
}
- // 复活倒计时
if (BackCountdown.ContainsKey(pc.PlayerId))
{
BackCountdown[pc.PlayerId]--;
@@ -410,7 +378,6 @@ internal static class SoloKombatManager
notifyRoles = true;
}
- // 清除过期的提示信息
if (NameNotify.ContainsKey(pc.PlayerId) && NameNotify[pc.PlayerId].TIMESTAMP < Utils.TimeStamp)
{
NameNotify.Remove(pc.PlayerId);
@@ -418,10 +385,23 @@ internal static class SoloKombatManager
notifyRoles = true;
}
- // 必要时刷新玩家名字
if (notifyRoles) Utils.NotifyRoles(SpecifySeer: pc, SpecifyTarget: pc);
}
}
}
}
+
+ // Options
+ // ReSharper disable InconsistentNaming
+ private static OptionItem KB_GameTime;
+ public static OptionItem KB_ATKCooldown;
+ private static OptionItem KB_HPMax;
+ private static OptionItem KB_ATK;
+ private static OptionItem KB_RecoverAfterSecond;
+ private static OptionItem KB_RecoverPerSecond;
+ private static OptionItem KB_ResurrectionWaitingTime;
+ private static OptionItem KB_KillBonusMultiplier;
+
+ private static OptionItem KB_BootVentWhenDead;
+ // ReSharper restore InconsistentNaming
}
\ No newline at end of file
diff --git a/Modules/ExtendedPlayerControl.cs b/Modules/ExtendedPlayerControl.cs
index 0a6080827..7063894fd 100644
--- a/Modules/ExtendedPlayerControl.cs
+++ b/Modules/ExtendedPlayerControl.cs
@@ -75,7 +75,7 @@ static class ExtendedPlayerControl
public static int GetClientId(this PlayerControl player)
{
- if (player == null) return -1;
+ if (player is null || !player) return -1;
var client = player.GetClient();
return client?.Id ?? -1;
}
@@ -90,7 +90,7 @@ static class ExtendedPlayerControl
///
public static CustomRoles GetCustomRole(this PlayerControl player)
{
- if (player == null)
+ if (player is null || !player)
{
var callerMethod = new StackFrame(1, false).GetMethod();
string callerMethodName = callerMethod?.Name;
@@ -104,9 +104,9 @@ static class ExtendedPlayerControl
public static List GetCustomSubRoles(this PlayerControl player)
{
if (GameStates.IsLobby) return [CustomRoles.NotAssigned];
- if (player == null)
+ if (player is null || !player)
{
- Logger.Warn("CustomSubRoleを取得しようとしましたが、対象がnullでした。", "getCustomSubRole");
+ Logger.Warn("The player is null", "GetCustomSubRoles");
return [CustomRoles.NotAssigned];
}
@@ -115,7 +115,7 @@ static class ExtendedPlayerControl
public static CountTypes GetCountTypes(this PlayerControl player)
{
- if (player == null)
+ if (player is null || !player)
{
var caller = new StackFrame(1, false);
var callerMethod = caller.GetMethod();
@@ -141,8 +141,8 @@ static class ExtendedPlayerControl
public static void RpcSetNamePrivate(this PlayerControl player, string name, bool DontShowOnModdedClient = false, PlayerControl seer = null, bool force = false)
{
- if (player == null || name == null || !AmongUsClient.Instance.AmHost) return;
- if (seer == null) seer = player;
+ if (player is null || !player || name == null || !AmongUsClient.Instance.AmHost) return;
+ if (seer is null || !seer) seer = player;
if (!force && Main.LastNotifyNames[(player.PlayerId, seer.PlayerId)] == name) return;
Main.LastNotifyNames[(player.PlayerId, seer.PlayerId)] = name;
@@ -157,7 +157,7 @@ static class ExtendedPlayerControl
public static void RpcSetRoleDesync(this PlayerControl player, RoleTypes role, int clientId)
{
- //player: Rename target
+ // player: Rename target
if (player == null) return;
if (AmongUsClient.Instance.ClientId == clientId)
@@ -222,7 +222,7 @@ static class ExtendedPlayerControl
return;
}
- if (target == null) target = killer;
+ if (target is null || !target) target = killer;
// Check Observer
if (!forObserver && !MeetingStates.FirstMeeting)
@@ -247,16 +247,6 @@ static class ExtendedPlayerControl
if (!fromSetKCD) killer.AddKillTimerToDict(half: true);
}
- //public static void SetKillCooldownV2(this PlayerControl player, float time = -1f)
- //{
- // if (player == null) return;
- // if (!player.CanUseKillButton()) return;
- // if (time >= 0f) Main.AllPlayerKillCooldown[player.PlayerId] = time * 2;
- // else Main.AllPlayerKillCooldown[player.PlayerId] *= 2;
- // player.SyncSettings();
- // player.RpcGuardAndKill();
- // player.ResetKillCooldown();
- //}
public static void AddKCDAsAbilityCD(this PlayerControl pc) => AddAbilityCD(pc, (int)Math.Round(Main.AllPlayerKillCooldown.TryGetValue(pc.PlayerId, out var KCD) ? KCD : Options.DefaultKillCooldown));
public static void AddAbilityCD(this PlayerControl pc, bool includeDuration = true) => Utils.AddAbilityCD(pc.GetCustomRole(), pc.PlayerId, includeDuration);
@@ -307,7 +297,7 @@ static class ExtendedPlayerControl
Main.PlayerStates[pc.PlayerId].SetDead();
Medic.IsDead(pc);
- if (realKiller != null)
+ if (realKiller is not null && realKiller)
{
pc.SetRealKiller(realKiller);
if (realKiller.Is(CustomRoles.Damocles)) Damocles.OnMurder(realKiller.PlayerId);
@@ -319,7 +309,7 @@ static class ExtendedPlayerControl
public static void SetKillCooldown(this PlayerControl player, float time = -1f, PlayerControl target = null, bool forceAnime = false)
{
- if (player == null) return;
+ if (player is null || !player) return;
Logger.Info($"{player.GetNameWithRole()}'s KCD set to {(Math.Abs(time - (-1f)) < 0.5f ? Main.AllPlayerKillCooldown[player.PlayerId] : time)}s", "SetKCD");
if (player.GetCustomRole().UsesPetInsteadOfKill())
{
@@ -330,7 +320,7 @@ static class ExtendedPlayerControl
if (!player.CanUseKillButton()) return;
player.AddKillTimerToDict(CD: time);
- if (target == null) target = player;
+ if (target is null || !target) target = player;
if (time >= 0f) Main.AllPlayerKillCooldown[player.PlayerId] = time * 2;
else Main.AllPlayerKillCooldown[player.PlayerId] *= 2;
if (player.Is(CustomRoles.Glitch) && Main.PlayerStates[player.PlayerId].Role is Glitch gc)
@@ -360,32 +350,6 @@ static class ExtendedPlayerControl
if (player.GetCustomRole() is not CustomRoles.Inhibitor and not CustomRoles.Saboteur) player.ResetKillCooldown();
}
- //public static void SetKillCooldownV3(this PlayerControl player, float time = -1f, PlayerControl target = null, bool forceAnime = false)
- //{
- // if (player == null) return;
- // if (!player.CanUseKillButton()) return;
- // if (target == null) target = player;
- // if (time >= 0f) Main.AllPlayerKillCooldown[player.PlayerId] = time * 2;
- // else Main.AllPlayerKillCooldown[player.PlayerId] *= 2;
- // if (forceAnime || !player.IsModClient() || !Options.DisableShieldAnimations.GetBool())
- // {
- // player.SyncSettings();
- // player.RpcGuardAndKill(target, 11);
- // }
- // else
- // {
- // time = Main.AllPlayerKillCooldown[player.PlayerId] / 2;
- // if (player.AmOwner) PlayerControl.LocalPlayer.SetKillTimer(time);
- // else
- // {
- // MessageWriter writer = AmongUsClient.Instance.StartRpcImmediately(PlayerControl.LocalPlayer.NetId, (byte)CustomRPC.SetKillTimer, SendOption.Reliable, player.GetClientId());
- // writer.Write(time);
- // AmongUsClient.Instance.FinishRpcImmediately(writer);
- // }
- // Main.AllPlayerControls.Where(x => x.Is(CustomRoles.Observer) && target.PlayerId != x.PlayerId).Do(x => x.RpcGuardAndKill(target, 11, true));
- // }
- // player.ResetKillCooldown();
- //}
public static void RpcSpecificMurderPlayer(this PlayerControl killer, PlayerControl target = null)
{
if (target == null) target = killer;
@@ -402,23 +366,9 @@ static class ExtendedPlayerControl
}
}
- /*
- [Obsolete]
- public static void RpcSpecificProtectPlayer(this PlayerControl killer, PlayerControl target = null, int colorId = 0)
- {
- if (AmongUsClient.Instance.AmClient)
- {
- killer.ProtectPlayer(target, colorId);
- }
- MessageWriter messageWriter = AmongUsClient.Instance.StartRpcImmediately(killer.NetId, (byte)RpcCalls.ProtectPlayer, SendOption.Reliable, killer.GetClientId());
- messageWriter.WriteNetObject(target);
- messageWriter.Write(colorId);
- AmongUsClient.Instance.FinishRpcImmediately(messageWriter);
- }
- */
public static void RpcResetAbilityCooldown(this PlayerControl target)
{
- if (!AmongUsClient.Instance.AmHost) return; //ホスト以外が実行しても何も起こさない
+ if (!AmongUsClient.Instance.AmHost) return;
Logger.Info($"Reset Ability Cooldown for {target.name} (ID: {target.PlayerId})", "RpcResetAbilityCooldown");
if (target.Is(CustomRoles.Glitch) && Main.PlayerStates[target.PlayerId].Role is Glitch gc)
{
@@ -457,21 +407,6 @@ static class ExtendedPlayerControl
AmongUsClient.Instance.FinishRpcImmediately(messageWriter);
}
- /*public static void RpcBeKilled(this PlayerControl player, PlayerControl KilledBy = null) {
- if(!AmongUsClient.Instance.AmHost) return;
- byte KilledById;
- if(KilledBy == null)
- KilledById = byte.MaxValue;
- else
- KilledById = KilledBy.PlayerId;
-
- MessageWriter writer = AmongUsClient.Instance.StartRpcImmediately(player.NetId, (byte)CustomRPC.BeKilled, Hazel.SendOption.Reliable, -1);
- writer.Write(player.PlayerId);
- writer.Write(KilledById);
- AmongUsClient.Instance.FinishRpcImmediately(writer);
-
- RPC.BeKilled(player.PlayerId, KilledById);
- }*/
public static void MarkDirtySettings(this PlayerControl player)
{
PlayerGameOptionsSender.SetDirty(player.PlayerId);
@@ -485,12 +420,6 @@ static class ExtendedPlayerControl
public static TaskState GetTaskState(this PlayerControl player) => Main.PlayerStates.TryGetValue(player.PlayerId, out var state) ? state.TaskState : new();
- /*public static GameOptionsData DeepCopy(this GameOptionsData opt)
- {
- var optByte = opt.ToBytes(5);
- return GameOptionsData.FromBytes(optByte);
- }*/
-
public static bool IsNonHostModClient(this PlayerControl pc) => pc.IsModClient() && !pc.IsHost();
public static string GetDisplayRoleName(this PlayerControl player, bool pure = false)
@@ -500,8 +429,8 @@ static class ExtendedPlayerControl
public static string GetSubRoleNames(this PlayerControl player, bool forUser = false)
{
- var SubRoles = Main.PlayerStates[player.PlayerId].SubRoles.ToArray();
- if (SubRoles.Length == 0) return string.Empty;
+ var SubRoles = Main.PlayerStates[player.PlayerId].SubRoles;
+ if (SubRoles.Count == 0) return string.Empty;
var sb = new StringBuilder();
foreach (CustomRoles role in SubRoles)
{
@@ -537,7 +466,7 @@ static class ExtendedPlayerControl
public static void ResetPlayerCam(this PlayerControl pc, float delay = 0f)
{
- if (pc == null || !AmongUsClient.Instance.AmHost || pc.AmOwner) return;
+ if (pc is null || !pc || !AmongUsClient.Instance.AmHost || pc.AmOwner) return;
var systemtypes = (MapNames)Main.NormalOptions.MapId switch
{
@@ -560,7 +489,7 @@ static class ExtendedPlayerControl
public static void ReactorFlash(this PlayerControl pc, float delay = 0f)
{
- if (pc == null) return;
+ if (pc is null || !pc) return;
Logger.Info($"Reactor Flash for {pc.GetNameWithRole()}", "ReactorFlash");
@@ -592,7 +521,7 @@ static class ExtendedPlayerControl
}
catch (NullReferenceException nullReferenceException)
{
- Logger.Error($"{nullReferenceException.Message} - player is null? {player == null}", "GetRealName");
+ Logger.Error($"{nullReferenceException.Message} - player is null? {player is null || !player}", "GetRealName");
return string.Empty;
}
catch (Exception exception)
@@ -714,21 +643,21 @@ static class ExtendedPlayerControl
public static bool IsDousedPlayer(this PlayerControl arsonist, PlayerControl target)
{
- if (arsonist == null || target == null || Arsonist.IsDoused == null) return false;
+ if (arsonist is null || !arsonist || target is null || !target || Arsonist.IsDoused == null) return false;
Arsonist.IsDoused.TryGetValue((arsonist.PlayerId, target.PlayerId), out bool isDoused);
return isDoused;
}
public static bool IsDrawPlayer(this PlayerControl arsonist, PlayerControl target)
{
- if (arsonist == null || target == null || Revolutionist.IsDraw == null) return false;
+ if (arsonist is null || !arsonist || target is null || !target || Revolutionist.IsDraw == null) return false;
Revolutionist.IsDraw.TryGetValue((arsonist.PlayerId, target.PlayerId), out bool isDraw);
return isDraw;
}
public static bool IsRevealedPlayer(this PlayerControl player, PlayerControl target)
{
- if (player == null || target == null || Farseer.IsRevealed == null) return false;
+ if (player is null || !player || target is null || !target || Farseer.IsRevealed == null) return false;
Farseer.IsRevealed.TryGetValue((player.PlayerId, target.PlayerId), out bool isDoused);
return isDoused;
}
@@ -786,7 +715,7 @@ static class ExtendedPlayerControl
if (Main.KilledDiseased.TryGetValue(player.PlayerId, out int value))
{
Main.AllPlayerKillCooldown[player.PlayerId] += value * Options.DiseasedCDOpt.GetFloat();
- Logger.Info($"kill cd of player set to {Main.AllPlayerKillCooldown[player.PlayerId]}", "Diseased");
+ Logger.Info($"KCD of player set to {Main.AllPlayerKillCooldown[player.PlayerId]}", "Diseased");
}
if (Main.KilledAntidote.TryGetValue(player.PlayerId, out int value1))
@@ -794,15 +723,15 @@ static class ExtendedPlayerControl
var kcd = Main.AllPlayerKillCooldown[player.PlayerId] - value1 * Options.AntidoteCDOpt.GetFloat();
if (kcd < 0) kcd = 0;
Main.AllPlayerKillCooldown[player.PlayerId] = kcd;
- Logger.Info($"kill cd of player set to {Main.AllPlayerKillCooldown[player.PlayerId]}", "Antidote");
+ Logger.Info($"KCD of player set to {Main.AllPlayerKillCooldown[player.PlayerId]}", "Antidote");
}
}
public static void TrapperKilled(this PlayerControl killer, PlayerControl target)
{
- Logger.Info($"{target?.Data?.PlayerName}はTrapperだった", "Trapper");
+ Logger.Info($"{target?.Data?.PlayerName} was Trapper", "Trapper");
var tmpSpeed = Main.AllPlayerSpeed[killer.PlayerId];
- Main.AllPlayerSpeed[killer.PlayerId] = Main.MinSpeed; //tmpSpeedで後ほど値を戻すので代入しています。
+ Main.AllPlayerSpeed[killer.PlayerId] = Main.MinSpeed;
ReportDeadBodyPatch.CanReport[killer.PlayerId] = false;
killer.MarkDirtySettings();
LateTask.New(() =>
@@ -887,33 +816,6 @@ static class ExtendedPlayerControl
killer.RpcMurderPlayer(target, true);
}
- /*
- public static void RpcMurderPlayerV2(this PlayerControl killer, PlayerControl target)
- {
- target.RemoveProtection();
- MessageWriter messageWriter = AmongUsClient.Instance.StartRpcImmediately(target.NetId, (byte)RpcCalls.MurderPlayer, SendOption.Reliable);
- messageWriter.WriteNetObject(target);
- messageWriter.Write((int)MurderResultFlags.FailedProtected);
- AmongUsClient.Instance.FinishRpcImmediately(messageWriter);
-
- if (killer.AmOwner)
- {
- killer.RpcMurderPlayer(target, true);
- }
- else
- {
- killer.MurderPlayer(target, ResultFlags);
- MessageWriter messageWriter2 = AmongUsClient.Instance.StartRpcImmediately(killer.NetId, (byte)RpcCalls.MurderPlayer, SendOption.Reliable);
- messageWriter2.WriteNetObject(target);
- messageWriter2.Write((int)ResultFlags);
- AmongUsClient.Instance.FinishRpcImmediately(messageWriter2);
- }
- target.Data.IsDead = true;
-
- NotifyRoles(SpecifySeer: killer, SpecifyTarget: target);
- NotifyRoles(SpecifySeer: target);
- }
- */
public static bool RpcCheckAndMurder(this PlayerControl killer, PlayerControl target, bool check = false) => CheckMurderPatch.RpcCheckAndMurder(killer, target, check);
public static void NoCheckStartMeeting(this PlayerControl reporter, GameData.PlayerInfo target, bool force = false)
@@ -979,7 +881,7 @@ static class ExtendedPlayerControl
public static void SetRealKiller(this PlayerControl target, PlayerControl killer, bool NotOverRide = false)
{
- if (target == null)
+ if (target is null || !target)
{
Logger.Info("target is null", "SetRealKiller");
return;
@@ -987,7 +889,7 @@ static class ExtendedPlayerControl
var State = Main.PlayerStates[target.PlayerId];
if (State.RealKiller.TIMESTAMP != DateTime.MinValue && NotOverRide) return; // Do not overwrite if value already exists
- byte killerId = killer == null ? byte.MaxValue : killer.PlayerId;
+ byte killerId = killer is null || !killer ? byte.MaxValue : killer.PlayerId;
RPC.SetRealKiller(target.PlayerId, killerId);
}
@@ -1036,7 +938,7 @@ static class ExtendedPlayerControl
public static bool IsAlive(this PlayerControl target)
{
// If target is not null and cannot be obtained, it is assumed to be alive because it has not been registered
- if (target == null || target.Is(CustomRoles.GM)) return false;
+ if (target is null || !target || target.Is(CustomRoles.GM)) return false;
return GameStates.IsLobby || !Main.PlayerStates.TryGetValue(target.PlayerId, out var ps) || !ps.IsDead;
}
diff --git a/Modules/GameOptionsSender/GameOptionsSender.cs b/Modules/GameOptionsSender/GameOptionsSender.cs
index 79e611d37..e49a9f06c 100644
--- a/Modules/GameOptionsSender/GameOptionsSender.cs
+++ b/Modules/GameOptionsSender/GameOptionsSender.cs
@@ -49,7 +49,7 @@ public abstract class GameOptionsSender
{
for (byte i = 0; i < GameManager.Instance.LogicComponents.Count; i++)
{
- var logicComponent = GameManager.Instance.LogicComponents[i];
+ var logicComponent = GameManager.Instance.LogicComponents[(Index)i];
if (logicComponent.TryCast(out _))
{
SendOptionsArray(optionArray, i, -1);
diff --git a/Modules/GameOptionsSender/PlayerGameOptionsSender.cs b/Modules/GameOptionsSender/PlayerGameOptionsSender.cs
index 11afe4f75..e35bf6c4b 100644
--- a/Modules/GameOptionsSender/PlayerGameOptionsSender.cs
+++ b/Modules/GameOptionsSender/PlayerGameOptionsSender.cs
@@ -106,7 +106,7 @@ public class PlayerGameOptionsSender(PlayerControl player) : GameOptionsSender
{
for (byte i = 0; i < GameManager.Instance.LogicComponents.Count; i++)
{
- var logicComponent = GameManager.Instance.LogicComponents[i];
+ var logicComponent = GameManager.Instance.LogicComponents[(Index)i];
if (logicComponent.TryCast(out _))
{
SendOptionsArray(optionArray, i, player.GetClientId());
diff --git a/Modules/GameState.cs b/Modules/GameState.cs
index 912861795..ffefa98d4 100644
--- a/Modules/GameState.cs
+++ b/Modules/GameState.cs
@@ -246,7 +246,7 @@ public class PlayerState(byte playerId)
if (role is CustomRoles.Flashman or CustomRoles.Dynamo)
{
Main.AllPlayerSpeed[PlayerId] = Main.RealOptionsData.GetFloat(FloatOptionNames.PlayerSpeedMod);
- Utils.GetPlayerById(PlayerId).MarkDirtySettings();
+ PlayerGameOptionsSender.SetDirty(PlayerId);
}
Utils.SendRPC(CustomRPC.RemoveSubRole, PlayerId, 1, (int)role);
diff --git a/Modules/GuessManager.cs b/Modules/GuessManager.cs
index 5e35c238c..ee2f60736 100644
--- a/Modules/GuessManager.cs
+++ b/Modules/GuessManager.cs
@@ -340,7 +340,9 @@ public static class GuessManager
{
if (!isUI) Utils.SendMessage(GetString("GuessOnbound"), pc.PlayerId);
else pc.ShowPopUp(GetString("GuessOnbound"));
- return true;
+
+ if (Onbound.GuesserSuicides.GetBool()) guesserSuicide = true;
+ else return true;
}
if (target.Is(CustomRoles.Lovers) && Lovers.GuessAbility.GetValue() == 0)
diff --git a/Modules/OptionHolder.cs b/Modules/OptionHolder.cs
index fb94df4fe..7cbcc04a5 100644
--- a/Modules/OptionHolder.cs
+++ b/Modules/OptionHolder.cs
@@ -328,9 +328,6 @@ public static class Options
public static OptionItem CrewpostorKillAfterTask;
public static OptionItem CrewpostorLungeKill;
public static OptionItem ObliviousBaitImmune;
- public static OptionItem ImpCanBeInLove;
- public static OptionItem CrewCanBeInLove;
- public static OptionItem NeutralCanBeInLove;
public static OptionItem UnluckyTaskSuicideChance;
public static OptionItem UnluckyKillSuicideChance;
public static OptionItem UnluckyVentSuicideChance;
@@ -698,9 +695,6 @@ public static class Options
public static OptionItem MadSnitchTasks;
public static OptionItem FlashmanSpeed;
public static OptionItem GiantSpeed;
- public static OptionItem LoverSpawnChances;
- public static OptionItem LoverKnowRoles;
- public static OptionItem LoverSuicide;
public static OptionItem ImpEgoistVisibalToAllies;
public static OptionItem TicketsPerKill;
public static OptionItem DualVotes;
diff --git a/Modules/Utils.cs b/Modules/Utils.cs
index 51155bd9f..b2fb7689f 100644
--- a/Modules/Utils.cs
+++ b/Modules/Utils.cs
@@ -811,7 +811,7 @@ public static class Utils
return __instance.Is(CustomRoles.Madmate) && PlayerControl.LocalPlayer.Is(CustomRoles.Madmate) && Options.MadmateKnowWhosMadmate.GetBool() ||
__instance.Is(CustomRoles.Mimic) && Main.VisibleTasksCount && __instance.Data.IsDead ||
- __instance.Is(CustomRoles.Lovers) && PlayerControl.LocalPlayer.Is(CustomRoles.Lovers) && Options.LoverKnowRoles.GetBool() ||
+ __instance.Is(CustomRoles.Lovers) && PlayerControl.LocalPlayer.Is(CustomRoles.Lovers) && Lovers.LoverKnowRoles.GetBool() ||
__instance.Is(CustomRoles.Madmate) && PlayerControl.LocalPlayer.Is(CustomRoleTypes.Impostor) && Options.ImpKnowWhosMadmate.GetBool() ||
__instance.Is(CustomRoleTypes.Impostor) && PlayerControl.LocalPlayer.Is(CustomRoles.Crewpostor) && Options.AlliesKnowCrewpostor.GetBool() ||
__instance.Is(CustomRoleTypes.Impostor) && PlayerControl.LocalPlayer.Is(CustomRoleTypes.Impostor) && Options.ImpKnowAlliesRole.GetBool() ||
@@ -1926,12 +1926,10 @@ public static class Utils
const string iconTextLeft = "\u21e8";
const string iconTextRight = "\u21e6";
const string roleNameUp = "\n \n";
+
string selfTeamName = $"{iconTextLeft} {ColorString(seerTeam.GetTeamColor(), $"{seerTeam}")} {iconTextRight}\n \n";
- SelfName = $"{ColorString(seer.GetRoleColor(), seer.GetRealName())}";
+ SelfName = $"{selfTeamName}\r\n{seer.GetCustomRole().ToColoredString()}{roleNameUp}";
- SelfName = $"{selfTeamName}\r\n{seer.GetDisplayRoleName()}\r\n{SelfName}{roleNameUp}";
-
- // Privately set name
seer.RpcSetNamePrivate(SelfName, true, seer);
continue;
}
@@ -2209,7 +2207,7 @@ public static class Utils
(seer.Data.IsDead && Options.GhostCanSeeOtherRoles.GetBool()) ||
(seer.Is(CustomRoles.Mimic) && target.Data.IsDead && Options.MimicCanSeeDeadRoles.GetBool()) ||
(target.Is(CustomRoles.Gravestone) && target.Data.IsDead) ||
- (seer.Is(CustomRoles.Lovers) && target.Is(CustomRoles.Lovers) && Options.LoverKnowRoles.GetBool()) ||
+ (seer.Is(CustomRoles.Lovers) && target.Is(CustomRoles.Lovers) && Lovers.LoverKnowRoles.GetBool()) ||
(seer.Is(CustomRoleTypes.Impostor) && target.Is(CustomRoleTypes.Impostor) && Options.ImpKnowAlliesRole.GetBool()) ||
(seer.Is(CustomRoles.Madmate) && target.Is(CustomRoleTypes.Impostor) && Options.MadmateKnowWhosImp.GetBool()) ||
(seer.Is(CustomRoleTypes.Impostor) && target.Is(CustomRoles.Madmate) && Options.ImpKnowWhosMadmate.GetBool()) ||
diff --git a/Patches/HudPatch.cs b/Patches/HudPatch.cs
index 7e851d511..24be50b50 100644
--- a/Patches/HudPatch.cs
+++ b/Patches/HudPatch.cs
@@ -1,6 +1,7 @@
using System;
using System.Collections.Generic;
using System.Linq;
+using AmongUs.GameOptions;
using EHR.Modules;
using EHR.Roles.AddOns.Common;
using EHR.Roles.Crewmate;
@@ -29,7 +30,7 @@ class HudManagerPatch
if (!GameStates.IsModHost) return;
var player = PlayerControl.LocalPlayer;
- if (player == null) return;
+ if (player is null || !player) return;
if (Input.GetKeyDown(KeyCode.LeftControl))
{
@@ -47,19 +48,19 @@ class HudManagerPatch
}
}
- if (__instance == null) return;
+ if (__instance is null || !__instance) return;
if (GameStates.IsLobby)
{
var POM = GameObject.Find("PlayerOptionsMenu(Clone)");
- __instance.GameSettings.text = POM != null ? string.Empty : OptionShower.GetTextNoFresh();
+ __instance.GameSettings.text = POM is not null && POM ? string.Empty : OptionShower.GetTextNoFresh();
__instance.GameSettings.fontSizeMin =
__instance.GameSettings.fontSizeMax = 1f;
}
if (AmongUsClient.Instance.AmHost)
{
- if (OverriddenRolesText == null)
+ if (OverriddenRolesText is null || !OverriddenRolesText)
{
OverriddenRolesText = Object.Instantiate(__instance.KillButton.cooldownTimerText, __instance.transform, true);
OverriddenRolesText.alignment = TextAlignmentOptions.Right;
@@ -79,7 +80,7 @@ class HudManagerPatch
{
var pc = Utils.GetPlayerById(item.Key);
string prefix = first ? string.Empty : "\n";
- string text = $"{prefix}{(item.Key == 0 ? "Host" : $"{(pc == null ? $"ID {item.Key}" : $"{pc.GetRealName()}")}")} - {GetString(item.Value.ToString())}";
+ string text = $"{prefix}{(item.Key == 0 ? "Host" : $"{(pc is null || !pc ? $"ID {item.Key}" : $"{pc.GetRealName()}")}")} - {GetString(item.Value.ToString())}";
resultText[item.Key] = text;
first = false;
}
@@ -98,7 +99,7 @@ class HudManagerPatch
else
{
string prefix = first ? string.Empty : "\n";
- string text = $"{prefix}{(item.Key == 0 ? "Host" : $"{(pc == null ? $"ID {item.Key}" : $"{pc.GetRealName()}")}")} - <#ffffff>({GetString(role.ToString())}<#ffffff>)";
+ string text = $"{prefix}{(item.Key == 0 ? "Host" : $"{(pc is null || !pc ? $"ID {item.Key}" : $"{pc.GetRealName()}")}")} - <#ffffff>({GetString(role.ToString())}<#ffffff>)";
resultText[item.Key] = text;
first = false;
}
@@ -185,7 +186,7 @@ class HudManagerPatch
break;
}
- if (LowerInfoText == null)
+ if (LowerInfoText is null || !LowerInfoText)
{
LowerInfoText = Object.Instantiate(__instance.KillButton.cooldownTimerText, __instance.transform, true);
LowerInfoText.alignment = TextAlignmentOptions.Center;
@@ -308,7 +309,14 @@ class ActionButtonSetFillUpPatch
{
if (__instance.isCoolingDown && timer is <= 90f and > 0f)
{
- var color = PlayerControl.LocalPlayer.IsShifted() ? Color.green : Color.white;
+ var roleType = PlayerControl.LocalPlayer.GetRoleTypes();
+ var usingAbility = roleType switch
+ {
+ RoleTypes.Engineer => PlayerControl.LocalPlayer.inVent || VentButtonDoClickPatch.Animating,
+ RoleTypes.Shapeshifter => PlayerControl.LocalPlayer.IsShifted(),
+ _ => false
+ };
+ var color = usingAbility ? Color.green : Color.white;
__instance.cooldownTimerText.text = Utils.ColorString(color, Mathf.CeilToInt(timer).ToString());
__instance.cooldownTimerText.gameObject.SetActive(true);
}
@@ -568,9 +576,9 @@ class TaskPanelBehaviourPatch
var lpc = PlayerControl.LocalPlayer;
AllText += "\r\n";
- AllText += $"\r\n{GetString("PVP.ATK")}: {lpc.ATK()}";
- AllText += $"\r\n{GetString("PVP.DF")}: {lpc.DF()}";
- AllText += $"\r\n{GetString("PVP.RCO")}: {lpc.HPRECO()}";
+ AllText += $"\r\n{GetString("PVP.ATK")}: {SoloKombatManager.PlayerATK[lpc.PlayerId]}";
+ AllText += $"\r\n{GetString("PVP.DF")}: {SoloKombatManager.PlayerDF[lpc.PlayerId]}";
+ AllText += $"\r\n{GetString("PVP.RCO")}: {SoloKombatManager.PlayerHPReco[lpc.PlayerId]}";
AllText += "\r\n";
Dictionary SummaryText = [];
diff --git a/Patches/MeetingHudPatch.cs b/Patches/MeetingHudPatch.cs
index 513aee406..03a33cdfe 100644
--- a/Patches/MeetingHudPatch.cs
+++ b/Patches/MeetingHudPatch.cs
@@ -3,6 +3,7 @@ using System.Collections.Generic;
using System.Linq;
using System.Text;
using EHR.Modules;
+using EHR.Roles.AddOns.Common;
using EHR.Roles.Crewmate;
using EHR.Roles.Impostor;
using EHR.Roles.Neutral;
@@ -796,7 +797,7 @@ class MeetingHudStartPatch
(Main.VisibleTasksCount && PlayerControl.LocalPlayer.Data.IsDead && Options.GhostCanSeeOtherRoles.GetBool()) ||
(PlayerControl.LocalPlayer.Is(CustomRoles.Mimic) && Main.VisibleTasksCount && pc.Data.IsDead && Options.MimicCanSeeDeadRoles.GetBool()) ||
(pc.Is(CustomRoles.Gravestone) && Main.VisibleTasksCount && pc.Data.IsDead) ||
- (pc.Is(CustomRoles.Lovers) && PlayerControl.LocalPlayer.Is(CustomRoles.Lovers) && Options.LoverKnowRoles.GetBool()) ||
+ (pc.Is(CustomRoles.Lovers) && PlayerControl.LocalPlayer.Is(CustomRoles.Lovers) && Lovers.LoverKnowRoles.GetBool()) ||
(pc.Is(CustomRoleTypes.Impostor) && PlayerControl.LocalPlayer.Is(CustomRoleTypes.Impostor) && Options.ImpKnowAlliesRole.GetBool()) ||
(pc.Is(CustomRoleTypes.Impostor) && PlayerControl.LocalPlayer.Is(CustomRoles.Madmate) && Options.MadmateKnowWhosImp.GetBool()) ||
(pc.Is(CustomRoles.Madmate) && PlayerControl.LocalPlayer.Is(CustomRoleTypes.Impostor) && Options.ImpKnowWhosMadmate.GetBool()) ||
diff --git a/Patches/OnGameStartedPatch.cs b/Patches/OnGameStartedPatch.cs
index 812fa2b4e..708521c87 100644
--- a/Patches/OnGameStartedPatch.cs
+++ b/Patches/OnGameStartedPatch.cs
@@ -494,7 +494,7 @@ internal class SelectRolesPatch
}
}
- if (!overrideLovers && CustomRoles.Lovers.IsEnable() && (CustomRoles.FFF.IsEnable() ? -1 : rd.Next(1, 100)) <= Options.LoverSpawnChances.GetInt()) AssignLoversRolesFromList();
+ if (!overrideLovers && CustomRoles.Lovers.IsEnable() && (CustomRoles.FFF.IsEnable() ? -1 : rd.Next(1, 100)) <= Lovers.LoverSpawnChances.GetInt()) AssignLoversRolesFromList();
var aapc = Main.AllAlivePlayerControls;
AddonRolesList
@@ -715,7 +715,7 @@ internal class SelectRolesPatch
return;
}
- var allPlayers = Main.AllPlayerControls.Where(pc => !pc.Is(CustomRoles.GM) && (!pc.HasSubRole() || pc.GetCustomSubRoles().Count < Options.NoLimitAddonsNumMax.GetInt()) && !pc.Is(CustomRoles.Dictator) && !pc.Is(CustomRoles.God) && !pc.Is(CustomRoles.FFF) && !pc.Is(CustomRoles.Bomber) && !pc.Is(CustomRoles.Nuker) && !pc.Is(CustomRoles.Provocateur) && (!pc.IsCrewmate() || Options.CrewCanBeInLove.GetBool()) && (!pc.GetCustomRole().IsNeutral() || Options.NeutralCanBeInLove.GetBool()) && (!pc.GetCustomRole().IsImpostor() || Options.ImpCanBeInLove.GetBool())).ToList();
+ var allPlayers = Main.AllPlayerControls.Where(pc => !pc.Is(CustomRoles.GM) && (!pc.HasSubRole() || pc.GetCustomSubRoles().Count < Options.NoLimitAddonsNumMax.GetInt()) && !pc.Is(CustomRoles.Dictator) && !pc.Is(CustomRoles.God) && !pc.Is(CustomRoles.FFF) && !pc.Is(CustomRoles.Bomber) && !pc.Is(CustomRoles.Nuker) && !pc.Is(CustomRoles.Provocateur) && (!pc.IsCrewmate() || Lovers.CrewCanBeInLove.GetBool()) && (!pc.GetCustomRole().IsNeutral() || Lovers.NeutralCanBeInLove.GetBool()) && (!pc.GetCustomRole().IsImpostor() || Lovers.ImpCanBeInLove.GetBool())).ToList();
const CustomRoles role = CustomRoles.Lovers;
var count = Math.Clamp(RawCount, 0, allPlayers.Count);
if (RawCount == -1) count = Math.Clamp(role.GetCount(), 0, allPlayers.Count);
diff --git a/Patches/PlayerControlPatch.cs b/Patches/PlayerControlPatch.cs
index 6609c181b..685f17eee 100644
--- a/Patches/PlayerControlPatch.cs
+++ b/Patches/PlayerControlPatch.cs
@@ -1583,7 +1583,7 @@ class FixedUpdatePatch
public static void LoversSuicide(byte deathId = 0x7f, bool isExiled = false)
{
- if (!Options.LoverSuicide.GetBool() || Main.IsLoversDead || !Main.LoversPlayers.Any(player => player.Data.IsDead && player.PlayerId == deathId)) return;
+ if (!Lovers.LoverSuicide.GetBool() || Main.IsLoversDead || !Main.LoversPlayers.Any(player => player.Data.IsDead && player.PlayerId == deathId)) return;
Main.IsLoversDead = true;
var partnerPlayer = Main.LoversPlayers.First(player => player.PlayerId != deathId && !player.Data.IsDead);
diff --git a/Resources/Lang/en_US.json b/Resources/Lang/en_US.json
index 2ec0476aa..85c14c23b 100644
--- a/Resources/Lang/en_US.json
+++ b/Resources/Lang/en_US.json
@@ -2941,6 +2941,7 @@
"EnigmaClueLevelTitle": "Enigma Level Clue!",
"EnigmaClueFriendCodeTitle": "Enigma Friend Code Clue!",
"EnigmaClueTitle": "Enigma Clue!",
+ "GuesserSuicides": "Guessers Suicide When Trying to Guess Players With <#BAAAE9>Onbound",
"PlagueDoctor": "Infection",
"PlagueDoctorInfo": "Spread the infection!",
"PlagueDoctorInfoLong": "(Neutrals):\\n(Plague Doctor from TOH)\\nThe Plague Doctor's goal is to infect every living player.\\nThey start by choosing one player to infect, after which anyone who spends a set\\namount of time in range of the infected player becomes infected themselves.\\nInfection progress is cumulative, and does not reset with distance or after meetings.",
diff --git a/Roles/AddOns/Common/Busy.cs b/Roles/AddOns/Common/Busy.cs
index 7646a6ad7..701c035fe 100644
--- a/Roles/AddOns/Common/Busy.cs
+++ b/Roles/AddOns/Common/Busy.cs
@@ -8,10 +8,10 @@ namespace EHR.Roles.AddOns.Common
public void SetupCustomOption()
{
- SetupAdtRoleOptions(15290, CustomRoles.Busy, canSetNum: true);
- BusyLongTasks = new IntegerOptionItem(15293, "BusyLongTasks", new(0, 90, 1), 1, TabGroup.Addons)
+ SetupAdtRoleOptions(15290, CustomRoles.Busy, canSetNum: true, teamSpawnOptions: true);
+ BusyLongTasks = new IntegerOptionItem(15296, "BusyLongTasks", new(0, 90, 1), 1, TabGroup.Addons)
.SetParent(CustomRoleSpawnChances[CustomRoles.Busy]);
- BusyShortTasks = new IntegerOptionItem(15294, "BusyShortTasks", new(0, 90, 1), 1, TabGroup.Addons)
+ BusyShortTasks = new IntegerOptionItem(15297, "BusyShortTasks", new(0, 90, 1), 1, TabGroup.Addons)
.SetParent(CustomRoleSpawnChances[CustomRoles.Busy]);
}
}
diff --git a/Roles/AddOns/Common/Disco.cs b/Roles/AddOns/Common/Disco.cs
index d577b3f51..4a753f218 100644
--- a/Roles/AddOns/Common/Disco.cs
+++ b/Roles/AddOns/Common/Disco.cs
@@ -11,8 +11,8 @@ namespace EHR.Roles.AddOns.Common
public void SetupCustomOption()
{
- SetupAdtRoleOptions(15430, CustomRoles.Disco, canSetNum: true);
- DiscoChangeInterval = new IntegerOptionItem(15433, "DiscoChangeInterval", new(1, 90, 1), 5, TabGroup.Addons)
+ SetupAdtRoleOptions(15430, CustomRoles.Disco, canSetNum: true, teamSpawnOptions: true);
+ DiscoChangeInterval = new IntegerOptionItem(15436, "DiscoChangeInterval", new(1, 90, 1), 5, TabGroup.Addons)
.SetParent(CustomRoleSpawnChances[CustomRoles.Disco])
.SetValueFormat(OptionFormat.Seconds);
}
diff --git a/Roles/AddOns/Common/Flash.cs b/Roles/AddOns/Common/Flash.cs
index f7dadecaf..c5c20d84b 100644
--- a/Roles/AddOns/Common/Flash.cs
+++ b/Roles/AddOns/Common/Flash.cs
@@ -6,8 +6,8 @@
public void SetupCustomOption()
{
- Options.SetupAdtRoleOptions(18700, CustomRoles.Flashman, canSetNum: true, tab: TabGroup.Addons);
- Options.FlashmanSpeed = new FloatOptionItem(18703, "FlashmanSpeed", new(0.25f, 3f, 0.05f), 2.5f, TabGroup.Addons)
+ Options.SetupAdtRoleOptions(18700, CustomRoles.Flashman, canSetNum: true, tab: TabGroup.Addons, teamSpawnOptions: true);
+ Options.FlashmanSpeed = new FloatOptionItem(18706, "FlashmanSpeed", new(0.25f, 3f, 0.05f), 2.5f, TabGroup.Addons)
.SetParent(Options.CustomRoleSpawnChances[CustomRoles.Flashman])
.SetValueFormat(OptionFormat.Multiplier);
}
diff --git a/Roles/AddOns/Common/Guesser.cs b/Roles/AddOns/Common/Guesser.cs
index 9a9e346f7..3246af93e 100644
--- a/Roles/AddOns/Common/Guesser.cs
+++ b/Roles/AddOns/Common/Guesser.cs
@@ -11,7 +11,7 @@ namespace EHR.Roles.AddOns.Common
public void SetupCustomOption()
{
- SetupAdtRoleOptions(19100, CustomRoles.Guesser, canSetNum: true, tab: TabGroup.Addons);
+ SetupAdtRoleOptions(19100, CustomRoles.Guesser, canSetNum: true, tab: TabGroup.Addons, teamSpawnOptions: true);
GCanGuessAdt = new BooleanOptionItem(19110, "GCanGuessAdt", false, TabGroup.Addons)
.SetParent(CustomRoleSpawnChances[CustomRoles.Guesser]);
GTryHideMsg = new BooleanOptionItem(19111, "GuesserTryHideMsg", true, TabGroup.Addons)
diff --git a/Roles/AddOns/Common/Lovers.cs b/Roles/AddOns/Common/Lovers.cs
index 37f2cdba6..306e13e4d 100644
--- a/Roles/AddOns/Common/Lovers.cs
+++ b/Roles/AddOns/Common/Lovers.cs
@@ -6,6 +6,12 @@ namespace EHR.Roles.AddOns.Common
{
public static bool IsChatActivated = false;
+ public static OptionItem LoverSpawnChances;
+ public static OptionItem LoverKnowRoles;
+ public static OptionItem LoverSuicide;
+ public static OptionItem ImpCanBeInLove;
+ public static OptionItem CrewCanBeInLove;
+ public static OptionItem NeutralCanBeInLove;
public static OptionItem LegacyLovers;
public static OptionItem LovingImpostorSpawnChance;
public static OptionItem PrivateChat;
diff --git a/Roles/AddOns/Common/Onbound.cs b/Roles/AddOns/Common/Onbound.cs
index 7dfb6e1bd..ff3971d89 100644
--- a/Roles/AddOns/Common/Onbound.cs
+++ b/Roles/AddOns/Common/Onbound.cs
@@ -2,11 +2,15 @@
{
public class Onbound : IAddon
{
+ public static OptionItem GuesserSuicides;
public AddonTypes Type => AddonTypes.Mixed;
public void SetupCustomOption()
{
Options.SetupAdtRoleOptions(14500, CustomRoles.Onbound, canSetNum: true, teamSpawnOptions: true);
+ GuesserSuicides = new BooleanOptionItem(14506, "GuesserSuicides", true, TabGroup.Addons)
+ .SetParent(Options.CustomRoleSpawnChances[CustomRoles.Onbound])
+ .SetGameMode(CustomGameMode.Standard);
}
}
}
\ No newline at end of file
diff --git a/Roles/AddOns/Common/Rascal.cs b/Roles/AddOns/Common/Rascal.cs
index fbc7fd1db..8bb3415e0 100644
--- a/Roles/AddOns/Common/Rascal.cs
+++ b/Roles/AddOns/Common/Rascal.cs
@@ -8,7 +8,7 @@ namespace EHR.Roles.AddOns.Common
public void SetupCustomOption()
{
- SetupAdtRoleOptions(15600, CustomRoles.Rascal, canSetNum: true, tab: TabGroup.Addons);
+ SetupAdtRoleOptions(15600, CustomRoles.Rascal, canSetNum: true, tab: TabGroup.Addons, teamSpawnOptions: true);
RascalAppearAsMadmate = new BooleanOptionItem(15610, "RascalAppearAsMadmate", true, TabGroup.Addons)
.SetParent(CustomRoleSpawnChances[CustomRoles.Rascal]);
}
diff --git a/Roles/AddOns/Common/Sleuth.cs b/Roles/AddOns/Common/Sleuth.cs
index 2c8a918c9..674e65b56 100644
--- a/Roles/AddOns/Common/Sleuth.cs
+++ b/Roles/AddOns/Common/Sleuth.cs
@@ -6,7 +6,7 @@
public void SetupCustomOption()
{
- Options.SetupAdtRoleOptions(15150, CustomRoles.Sleuth, canSetNum: true);
+ Options.SetupAdtRoleOptions(15150, CustomRoles.Sleuth, canSetNum: true, teamSpawnOptions: true);
}
}
-}
+}
\ No newline at end of file
diff --git a/Roles/AddOns/Common/Stained.cs b/Roles/AddOns/Common/Stained.cs
index 0f4ef8a46..ac5d5681d 100644
--- a/Roles/AddOns/Common/Stained.cs
+++ b/Roles/AddOns/Common/Stained.cs
@@ -9,7 +9,7 @@ namespace EHR.Roles.AddOns.Common
public void SetupCustomOption()
{
- Options.SetupAdtRoleOptions(15180, CustomRoles.Stained, canSetNum: true);
+ Options.SetupAdtRoleOptions(15180, CustomRoles.Stained, canSetNum: true, teamSpawnOptions: true);
}
public static void OnDeath(PlayerControl pc, PlayerControl killer)
diff --git a/Roles/AddOns/Common/Torch.cs b/Roles/AddOns/Common/Torch.cs
index 5bcee112e..4db4c211f 100644
--- a/Roles/AddOns/Common/Torch.cs
+++ b/Roles/AddOns/Common/Torch.cs
@@ -8,7 +8,7 @@ namespace EHR.Roles.AddOns.Common
public void SetupCustomOption()
{
- SetupAdtRoleOptions(14200, CustomRoles.Torch, canSetNum: true);
+ SetupAdtRoleOptions(14200, CustomRoles.Torch, canSetNum: true, teamSpawnOptions: true);
TorchVision = new FloatOptionItem(14210, "TorchVision", new(0.5f, 5f, 0.25f), 1.25f, TabGroup.Addons)
.SetParent(CustomRoleSpawnChances[CustomRoles.Torch])
.SetValueFormat(OptionFormat.Multiplier);
diff --git a/Roles/AddOns/Common/YouTuber.cs b/Roles/AddOns/Common/YouTuber.cs
index 4d4ef2bca..9c9a3ce38 100644
--- a/Roles/AddOns/Common/YouTuber.cs
+++ b/Roles/AddOns/Common/YouTuber.cs
@@ -6,7 +6,7 @@
public void SetupCustomOption()
{
- Options.SetupAdtRoleOptions(18800, CustomRoles.Youtuber, canSetNum: true, tab: TabGroup.Addons);
+ Options.SetupAdtRoleOptions(18800, CustomRoles.Youtuber, canSetNum: true, tab: TabGroup.Addons, teamSpawnOptions: true);
}
}
-}
+}
\ No newline at end of file