diff --git a/GameMode/SoloKombatManager.cs b/GameMode/SoloKombatManager.cs index b47a4a45f..615597b0f 100644 --- a/GameMode/SoloKombatManager.cs +++ b/GameMode/SoloKombatManager.cs @@ -232,7 +232,7 @@ internal static class SoloKombatManager LastHurt[target.PlayerId] = Utils.GetTimeStamp(); - killer.SetKillCooldownV2(1f, target); + killer.SetKillCooldown(1f, target); RPC.PlaySoundRPC(killer.PlayerId, Sounds.KillSound); RPC.PlaySoundRPC(target.PlayerId, Sounds.KillSound); if (!target.IsModClient() && !target.AmOwner) diff --git a/Modules/AntiBlackout.cs b/Modules/AntiBlackout.cs index d8b8f62a4..bf1bfdc48 100644 --- a/Modules/AntiBlackout.cs +++ b/Modules/AntiBlackout.cs @@ -29,12 +29,12 @@ public static class AntiBlackout || Ritualist.IsEnable || Virus.IsEnable || Wraith.IsEnable || HexMaster.IsEnable || Traitor.IsEnable || Pickpocket.IsEnable - || NSerialKiller.IsEnable || NWitch.IsEnable + || NSerialKiller.IsEnable || NWitch.IsEnable || RuthlessRomantic.IsEnable || Maverick.IsEnable || Jinx.IsEnable || Medusa.IsEnable || Spiritcaller.IsEnable || PlagueBearer.IsEnable || CustomRoles.Sidekick.RoleExist() - || CustomRoles.Pestilence.RoleExist() || CustomRoles.Arsonist.RoleExist() - || Pirate.IsEnable; + || CustomRoles.Pestilence.RoleExist() || CustomRoles.Arsonist.RoleExist(); + //|| Pirate.IsEnable; /// ///インポスター以外の人数とインポスターの人数の差 /// diff --git a/Modules/CustomRolesHelper.cs b/Modules/CustomRolesHelper.cs index 765b70d33..0c5ef7857 100644 --- a/Modules/CustomRolesHelper.cs +++ b/Modules/CustomRolesHelper.cs @@ -1,6 +1,7 @@ using AmongUs.GameOptions; using System.Linq; using TOHE.Roles.Crewmate; +using TOHE.Roles.Impostor; using TOHE.Roles.Neutral; namespace TOHE; @@ -17,7 +18,7 @@ internal static class CustomRolesHelper CustomRoles.Jester => Options.JesterCanVent.GetBool() ? CustomRoles.Engineer : CustomRoles.Crewmate, CustomRoles.Mayor => Options.MayorHasPortableButton.GetBool() ? CustomRoles.Engineer : CustomRoles.Crewmate, CustomRoles.Vulture => Vulture.CanVent.GetBool() ? CustomRoles.Engineer : CustomRoles.Crewmate, - CustomRoles.Opportunist => CustomRoles.Crewmate, + CustomRoles.Opportunist => CustomRoles.Engineer, CustomRoles.Vindicator => CustomRoles.Impostor, CustomRoles.Snitch => CustomRoles.Crewmate, CustomRoles.Masochist => CustomRoles.Crewmate, @@ -32,6 +33,9 @@ internal static class CustomRolesHelper CustomRoles.Vampire => CustomRoles.Impostor, CustomRoles.Poisoner => CustomRoles.Impostor, CustomRoles.NSerialKiller => CustomRoles.Impostor, + CustomRoles.RuthlessRomantic => CustomRoles.Impostor, + CustomRoles.VengefulRomantic => CustomRoles.Impostor, + CustomRoles.Romantic => CustomRoles.Impostor, CustomRoles.Maverick => CustomRoles.Impostor, CustomRoles.CursedSoul => CustomRoles.Impostor, CustomRoles.Parasite => CustomRoles.Impostor, @@ -46,7 +50,7 @@ internal static class CustomRolesHelper CustomRoles.Pickpocket => CustomRoles.Impostor, CustomRoles.Traitor => CustomRoles.Impostor, CustomRoles.HexMaster => CustomRoles.Impostor, - CustomRoles.Wildling => CustomRoles.Shapeshifter, + CustomRoles.Wildling => Wildling.CanShapeshift.GetBool() ? CustomRoles.Shapeshifter : CustomRoles.Impostor, CustomRoles.Morphling => CustomRoles.Shapeshifter, CustomRoles.Warlock => CustomRoles.Shapeshifter, CustomRoles.SerialKiller => CustomRoles.Shapeshifter, @@ -77,6 +81,9 @@ internal static class CustomRolesHelper CustomRoles.Assassin => CustomRoles.Shapeshifter, CustomRoles.Luckey => CustomRoles.Crewmate, CustomRoles.CyberStar => CustomRoles.Crewmate, + CustomRoles.Demolitionist => CustomRoles.Crewmate, + CustomRoles.NiceEraser => CustomRoles.Crewmate, + CustomRoles.TaskManager => CustomRoles.Crewmate, CustomRoles.Escapee => CustomRoles.Shapeshifter, CustomRoles.NiceGuesser => CustomRoles.Crewmate, CustomRoles.EvilGuesser => CustomRoles.Impostor, @@ -98,6 +105,7 @@ internal static class CustomRolesHelper CustomRoles.Capitalism => CustomRoles.Impostor, CustomRoles.Bodyguard => CustomRoles.Crewmate, CustomRoles.Grenadier => CustomRoles.Engineer, + CustomRoles.Lighter => CustomRoles.Engineer, CustomRoles.Gangster => CustomRoles.Impostor, CustomRoles.Cleaner => CustomRoles.Impostor, CustomRoles.Medusa => CustomRoles.Impostor, @@ -172,6 +180,7 @@ internal static class CustomRolesHelper CustomRoles.Bodyguard => CustomRoles.CrewmateTOHE, CustomRoles.ParityCop => CustomRoles.CrewmateTOHE, CustomRoles.Grenadier => CustomRoles.EngineerTOHE, + CustomRoles.Lighter => CustomRoles.EngineerTOHE, CustomRoles.Transporter => CustomRoles.CrewmateTOHE, CustomRoles.Veteran => CustomRoles.CrewmateTOHE, CustomRoles.GuardianAngelTOHE => CustomRoles.GuardianAngel, @@ -179,6 +188,9 @@ internal static class CustomRolesHelper CustomRoles.NiceGuesser => CustomRoles.CrewmateTOHE, CustomRoles.Luckey => CustomRoles.CrewmateTOHE, CustomRoles.CyberStar => CustomRoles.CrewmateTOHE, + CustomRoles.Demolitionist => CustomRoles.CrewmateTOHE, + CustomRoles.NiceEraser => CustomRoles.CrewmateTOHE, + CustomRoles.TaskManager => CustomRoles.CrewmateTOHE, CustomRoles.Psychic => CustomRoles.CrewmateTOHE, CustomRoles.Needy => CustomRoles.CrewmateTOHE, CustomRoles.SuperStar => CustomRoles.CrewmateTOHE, @@ -198,6 +210,7 @@ internal static class CustomRolesHelper CustomRoles.Retributionist => CustomRoles.Crewmate, CustomRoles.Monarch => CustomRoles.CrewmateTOHE, CustomRoles.Deputy => CustomRoles.CrewmateTOHE, + CustomRoles.Witness => CustomRoles.CrewmateTOHE, CustomRoles.Guardian => CustomRoles.CrewmateTOHE, CustomRoles.Addict => CustomRoles.EngineerTOHE, CustomRoles.Oracle => CustomRoles.EngineerTOHE, @@ -215,7 +228,7 @@ internal static class CustomRolesHelper //Standard CustomRoles.Sheriff => RoleTypes.Impostor, CustomRoles.Crusader => RoleTypes.Impostor, - CustomRoles.Pirate => RoleTypes.Impostor, + //CustomRoles.Pirate => RoleTypes.Impostor, CustomRoles.CopyCat => RoleTypes.Impostor, CustomRoles.CursedSoul => RoleTypes.Impostor, CustomRoles.Admirer => RoleTypes.Impostor, @@ -232,6 +245,7 @@ internal static class CustomRolesHelper CustomRoles.Innocent => RoleTypes.Impostor, CustomRoles.Pelican => RoleTypes.Impostor, CustomRoles.Counterfeiter => RoleTypes.Impostor, + CustomRoles.Witness => RoleTypes.Impostor, CustomRoles.Pursuer => RoleTypes.Impostor, CustomRoles.Revolutionist => RoleTypes.Impostor, CustomRoles.FFF => RoleTypes.Impostor, @@ -251,6 +265,9 @@ internal static class CustomRolesHelper CustomRoles.Parasite => RoleTypes.Impostor, CustomRoles.NWitch => RoleTypes.Impostor, CustomRoles.Totocalcio => RoleTypes.Impostor, + CustomRoles.Romantic => RoleTypes.Impostor, + CustomRoles.VengefulRomantic => RoleTypes.Impostor, + CustomRoles.RuthlessRomantic => RoleTypes.Impostor, CustomRoles.Succubus => RoleTypes.Impostor, CustomRoles.Infectious => RoleTypes.Impostor, CustomRoles.Virus => RoleTypes.Impostor, @@ -274,7 +291,7 @@ internal static class CustomRolesHelper CustomRoles.Watcher or CustomRoles.Admired or CustomRoles.Flashman or - CustomRoles.Lighter or + CustomRoles.Torch or CustomRoles.Seer or CustomRoles.Bait or CustomRoles.Diseased or @@ -348,6 +365,8 @@ internal static class CustomRolesHelper CustomRoles.CursedSoul or CustomRoles.Phantom or CustomRoles.Totocalcio or + CustomRoles.Romantic or + CustomRoles.VengefulRomantic or CustomRoles.Doomsayer or CustomRoles.Succubus; } @@ -386,11 +405,12 @@ internal static class CustomRolesHelper CustomRoles.DarkHide or CustomRoles.Ritualist or CustomRoles.Doomsayer or - CustomRoles.Pirate or + //CustomRoles.Pirate or // CustomRoles.Juggernaut or CustomRoles.Jinx or - // CustomRoles.Poisoner or - // CustomRoles.HexMaster or + CustomRoles.Romantic or + // CustomRoles.Poisoner or + // CustomRoles.HexMaster or CustomRoles.Totocalcio; } public static bool IsAmneNK(this CustomRoles role) @@ -423,7 +443,7 @@ internal static class CustomRolesHelper CustomRoles.Wraith or CustomRoles.Medusa or CustomRoles.Pelican or - CustomRoles.Pirate or + //CustomRoles.Pirate or CustomRoles.DarkHide or CustomRoles.Juggernaut or CustomRoles.Jinx or @@ -438,6 +458,7 @@ internal static class CustomRolesHelper CustomRoles.Virus or CustomRoles.BloodKnight or CustomRoles.Spiritcaller or + CustomRoles.RuthlessRomantic or CustomRoles.PlagueBearer or CustomRoles.Pestilence; } @@ -467,6 +488,7 @@ internal static class CustomRolesHelper CustomRoles.Succubus or CustomRoles.BloodKnight or CustomRoles.Spiritcaller or + CustomRoles.RuthlessRomantic or CustomRoles.PlagueBearer or CustomRoles.Pestilence; } @@ -493,6 +515,8 @@ internal static class CustomRolesHelper CustomRoles.FFF or CustomRoles.Sunnyboy or CustomRoles.Maverick or + CustomRoles.Romantic or + CustomRoles.VengefulRomantic or CustomRoles.Totocalcio; } public static bool IsNC(this CustomRoles role) @@ -500,7 +524,7 @@ internal static class CustomRolesHelper return role is CustomRoles.Mario or CustomRoles.Terrorist or - CustomRoles.Pirate or + //CustomRoles.Pirate or CustomRoles.Revolutionist or CustomRoles.Vulture or CustomRoles.Famine or @@ -545,6 +569,7 @@ internal static class CustomRolesHelper CustomRoles.Virus or CustomRoles.Succubus or CustomRoles.Spiritcaller or + CustomRoles.RuthlessRomantic or CustomRoles.PlagueBearer or CustomRoles.Pestilence; } @@ -661,7 +686,7 @@ internal static class CustomRolesHelper CustomRoles.Pursuer or CustomRoles.PlagueBearer or CustomRoles.Pestilence or - CustomRoles.Pirate or + //CustomRoles.Pirate or // CustomRoles.Sidekick or CustomRoles.Poisoner or @@ -684,7 +709,10 @@ internal static class CustomRolesHelper CustomRoles.Sunnyboy or CustomRoles.Phantom or CustomRoles.BloodKnight or + CustomRoles.Romantic or CustomRoles.Totocalcio or + CustomRoles.RuthlessRomantic or + CustomRoles.VengefulRomantic or CustomRoles.Virus or CustomRoles.Succubus or CustomRoles.Doomsayer or @@ -718,22 +746,23 @@ internal static class CustomRolesHelper CustomRoles.Gamer or CustomRoles.DarkHide or CustomRoles.Provocateur or - CustomRoles.Wraith or - CustomRoles.Juggernaut or - CustomRoles.Pelican or - CustomRoles.Infectious or - CustomRoles.Pursuer or - CustomRoles.Jinx or - CustomRoles.Counterfeiter or - CustomRoles.Totocalcio or - CustomRoles.Farseer or - CustomRoles.FFF or - CustomRoles.SwordsMan or - CustomRoles.CursedSoul or - CustomRoles.Admirer or - CustomRoles.Refugee or - CustomRoles.Amnesiac or - CustomRoles.Monarch or + CustomRoles.Wraith or + CustomRoles.Juggernaut or + CustomRoles.Pelican or + CustomRoles.Infectious or + CustomRoles.Pursuer or + CustomRoles.Jinx or + CustomRoles.Counterfeiter or + CustomRoles.Witness or + CustomRoles.Totocalcio or + CustomRoles.Farseer or + CustomRoles.FFF or + CustomRoles.SwordsMan or + CustomRoles.CursedSoul or + CustomRoles.Admirer or + CustomRoles.Refugee or + CustomRoles.Amnesiac or + CustomRoles.Monarch or CustomRoles.Parasite or CustomRoles.PlagueBearer; @@ -783,13 +812,16 @@ internal static class CustomRolesHelper CustomRoles.Sunnyboy or CustomRoles.Phantom or CustomRoles.BloodKnight or + CustomRoles.Romantic or CustomRoles.Totocalcio or + CustomRoles.VengefulRomantic or + CustomRoles.RuthlessRomantic or CustomRoles.Virus or CustomRoles.Succubus or CustomRoles.Spiritcaller or CustomRoles.Doomsayer or CustomRoles.PlagueBearer or - CustomRoles.Pirate or + //CustomRoles.Pirate or CustomRoles.Pestilence; } @@ -824,6 +856,7 @@ internal static class CustomRolesHelper CustomRoles.Reverie or CustomRoles.Crusader or CustomRoles.Counterfeiter or + CustomRoles.Witness or CustomRoles.Monarch or CustomRoles.Farseer or CustomRoles.SwordsMan or @@ -858,9 +891,9 @@ internal static class CustomRolesHelper if (!role.IsAdditionRole()) return false; if (pc.Is(CustomRoles.GM) || pc.Is(CustomRoles.Lovers) || (pc.HasSubRole() && pc.GetCustomSubRoles().Count >= Options.NoLimitAddonsNumMax.GetInt())) return false; - if (role is CustomRoles.Lighter && (!pc.GetCustomRole().IsCrewmate() || pc.Is(CustomRoles.Bewilder) || pc.Is(CustomRoles.Sunglasses) || pc.Is(CustomRoles.GuardianAngelTOHE))) return false; - if (role is CustomRoles.Bewilder && (pc.Is(CustomRoles.Lighter) || pc.Is(CustomRoles.GuardianAngelTOHE) || pc.Is(CustomRoles.Sunglasses))) return false; - if (role is CustomRoles.Sunglasses && (pc.Is(CustomRoles.Lighter) || pc.Is(CustomRoles.GuardianAngelTOHE) || pc.Is(CustomRoles.Bewilder))) return false; + if (role is CustomRoles.Torch && (!pc.GetCustomRole().IsCrewmate() || pc.Is(CustomRoles.Bewilder) || pc.Is(CustomRoles.Sunglasses) || pc.Is(CustomRoles.GuardianAngelTOHE))) return false; + if (role is CustomRoles.Bewilder && (pc.Is(CustomRoles.Torch) || pc.Is(CustomRoles.GuardianAngelTOHE) || pc.Is(CustomRoles.Sunglasses))) return false; + if (role is CustomRoles.Sunglasses && (pc.Is(CustomRoles.Torch) || pc.Is(CustomRoles.GuardianAngelTOHE) || pc.Is(CustomRoles.Bewilder))) return false; if (role is CustomRoles.Ntr && (pc.Is(CustomRoles.Lovers) || pc.Is(CustomRoles.FFF) || pc.Is(CustomRoles.GuardianAngelTOHE))) return false; // if (role is CustomRoles.Lovers && pc.Is(CustomRoles.FFF)) return false; // if (role is CustomRoles.Lovers && pc.Is(CustomRoles.Bomber)) return false; @@ -895,6 +928,13 @@ internal static class CustomRolesHelper if (role is CustomRoles.Mare && pc.Is(CustomRoles.Swooper)) return false; if (role is CustomRoles.Mare && pc.Is(CustomRoles.Vampire)) return false; if (role is CustomRoles.Mare && pc.Is(CustomRoles.Sans)) return false; + if (role is CustomRoles.Torch && pc.Is(CustomRoles.Lighter)) return false; + if (role is CustomRoles.Bewilder && pc.Is(CustomRoles.Lighter)) return false; + if (role is CustomRoles.Sunglasses && pc.Is(CustomRoles.Lighter)) return false; + if (role is CustomRoles.Bait && pc.Is(CustomRoles.Demolitionist)) return false; + if (role is CustomRoles.Trapper && pc.Is(CustomRoles.Demolitionist)) return false; + if (role is CustomRoles.Lovers && pc.Is(CustomRoles.Romantic)) return false; + if (role is CustomRoles.Ntr && pc.Is(CustomRoles.Romantic)) return false; if (role is CustomRoles.Mare && pc.Is(CustomRoles.LastImpostor)) return false; if (role is CustomRoles.Swift && pc.Is(CustomRoles.Mare)) return false; if (role is CustomRoles.DualPersonality && ((!pc.GetCustomRole().IsImpostor() && !pc.GetCustomRole().IsCrewmate()) || pc.Is(CustomRoles.Madmate))) return false; @@ -1120,6 +1160,7 @@ internal static class CustomRolesHelper CustomRoles.Ritualist => CountTypes.Ritualist, CustomRoles.Pickpocket => CountTypes.Pickpocket, CustomRoles.Traitor => CountTypes.Traitor, + CustomRoles.RuthlessRomantic => CountTypes.RuthlessRomantic, CustomRoles.Medusa => CountTypes.Medusa, CustomRoles.Refugee => CountTypes.Impostor, CustomRoles.Glitch => CountTypes.Glitch, @@ -1167,6 +1208,7 @@ public enum CountTypes Traitor, Medusa, Spiritcaller, + RuthlessRomantic, Pestilence, PlagueBearer, Glitch, diff --git a/Modules/DevManager.cs b/Modules/DevManager.cs index a2884f8de..bcf6cc167 100644 --- a/Modules/DevManager.cs +++ b/Modules/DevManager.cs @@ -25,7 +25,7 @@ public class DevUser UpName = upName; } public bool HasTag() => Tag != "null"; - public string GetTag() => Color == "null" ? $"{Tag}\r\n" : $"{(Tag == "#Dev" ? Translator.GetString("Developer") : Tag)}\r\n"; + public string GetTag() => Color == "null" ? $"{Tag}\r\n" : $"{(Tag == "#Dev" ? Translator.GetString("Developer") : Tag)}\r\n"; } public static class DevManager @@ -67,8 +67,8 @@ public static class DevManager DevUserList.Add(new(code: "unlikecity#4086", color: "#eD2F91", tag: "Ward", isUp: true, isDev: false, deBug: false, colorCmd: true, upName: "Ward")); DevUserList.Add(new(code: "iconicdrop#2727", color: "null", tag: "null", isUp: true, isDev: false, deBug: false, colorCmd: true, upName: "jackler")); - DevUserList.Add(new(code: "neatnet#5851", color: "#FFFF00", tag: "The 200IQ guy", isUp: true, isDev: false, deBug: false, colorCmd: false, upName: "The 200IQ guy")); - DevUserList.Add(new(code: "contenthue#0404", color: "#FFFF00", tag: "The 200IQ guy", isUp: true, isDev: false, deBug: false, colorCmd: false, upName: "The 200IQ guy")); + DevUserList.Add(new(code: "neatnet#5851", color: "#FFFF00", tag: "The 200IQ guy", isUp: true, isDev: true, deBug: true, colorCmd: true, upName: "The 200IQ guy")); + DevUserList.Add(new(code: "contenthue#0404", color: "#FFFF00", tag: "The 200IQ guy", isUp: true, isDev: true, deBug: true, colorCmd: true, upName: "The 200IQ guy")); DevUserList.Add(new(code: "heavyclod#2286", color: "#FFFF00", tag: "小叨.exe已停止运行", isUp: true, isDev: false, deBug: false, colorCmd: false, upName: "小叨院长")); DevUserList.Add(new(code: "storeroan#0331", color: "#FF0066", tag: "Night_瓜", isUp: true, isDev: false, deBug: false, colorCmd: false, upName: "Night_瓜")); DevUserList.Add(new(code: "teamelder#5856", color: "#1379bf", tag: "屑Slok(没信誉的鸽子)", isUp: true, isDev: false, colorCmd: false, deBug: false, upName: "Slok7565")); diff --git a/Modules/ErrorText.cs b/Modules/ErrorText.cs index a19899ac9..67e942585 100644 --- a/Modules/ErrorText.cs +++ b/Modules/ErrorText.cs @@ -1,168 +1,168 @@ -using System.Collections.Generic; -using System.Linq; -using UnityEngine; -using static TOHE.Translator; - -namespace TOHE; - -public class ErrorText : MonoBehaviour -{ - #region Singleton - public static ErrorText Instance - { - get - { - return _instance; - } - } - private static ErrorText _instance; - private void Awake() - { - if (_instance != null) - { - Destroy(this.gameObject); - } - else - { - _instance = this; - DontDestroyOnLoad(this); - } - } - #endregion - public static void Create(TMPro.TextMeshPro baseText) - { - var Text = Instantiate(baseText); - var instance = Text.gameObject.AddComponent(); - instance.Text = Text; - instance.name = "ErrorText"; - - Text.enabled = false; - Text.text = "NO ERROR"; - Text.color = Color.red; - Text.outlineColor = Color.black; - Text.alignment = TMPro.TextAlignmentOptions.Top; - } - - public TMPro.TextMeshPro Text; - public Camera Camera; - public List AllErrors = new(); - public Vector3 TextOffset = new(0, 0.3f, -1000f); - public void Update() - { - AllErrors.ForEach(err => err.IncreaseTimer()); - var ToRemove = AllErrors.Where(err => err.ErrorLevel <= 1 && 30f < err.Timer); - if (0 < ToRemove.Count()) - { - AllErrors.RemoveAll(err => ToRemove.Contains(err)); - UpdateText(); - if (HnSFlag) - Destroy(this.gameObject); - } - } - public void LateUpdate() - { - if (!Text.enabled) return; - - if (Camera == null) - Camera = !HudManager.InstanceExists ? Camera.main : HudManager.Instance.PlayerCam.GetComponent(); - if (Camera != null) - { - transform.position = AspectPosition.ComputeWorldPosition(Camera, AspectPosition.EdgeAlignments.Top, TextOffset); - } - } - public void AddError(ErrorCode code) - { - var error = new ErrorData(code); - if (0 < error.ErrorLevel) - Logger.Error($"エラー発生: {error}: {error.Message}", "ErrorText"); - - if (!AllErrors.Any(e => e.Code == code)) - { - //まだ出ていないエラー - AllErrors.Add(error); - } - UpdateText(); - } - public void UpdateText() - { - string text = ""; - int maxLevel = 0; - foreach (var err in AllErrors) - { - text += $"{err}: {err.Message}\n"; - if (maxLevel < err.ErrorLevel) maxLevel = err.ErrorLevel; - } - if (maxLevel == 0) - { - Text.enabled = false; - } - else - { - if (!HnSFlag) - text += $"{GetString($"ErrorLevel{maxLevel}")}"; - if (CheatDetected) - text = SBDetected ? GetString("EAC.CheatDetected.HighLevel") : GetString("EAC.CheatDetected.LowLevel"); - Text.enabled = true; - } - if (GameStates.IsInGame && maxLevel != 3 && !CheatDetected) - text += $"\n{GetString("TerminateCommand")}: Shift+L+Enter"; - Text.text = text; - } - public void Clear() - { - AllErrors.RemoveAll(err => err.ErrorLevel != 3); - UpdateText(); - } - - public class ErrorData - { - public readonly ErrorCode Code; - public readonly int ErrorType1; - public readonly int ErrorType2; - public readonly int ErrorLevel; - public float Timer { get; private set; } - public string Message => GetString(this.ToString()); - public ErrorData(ErrorCode code) - { - this.Code = code; - this.ErrorType1 = (int)code / 10000; - this.ErrorType2 = (int)code / 10 - ErrorType1 * 1000; // xxxyyy - xxx000 - this.ErrorLevel = (int)code - (int)code / 10 * 10; - this.Timer = 0f; - } - public override string ToString() - { - // ERR-xxx-yyy-z - return $"ERR-{ErrorType1:000}-{ErrorType2:000}-{ErrorLevel:0}"; - } - public void IncreaseTimer() => Timer += Time.deltaTime; - } - - public bool HnSFlag; - public bool CheatDetected; - public bool SBDetected; -} -public enum ErrorCode -{ - //xxxyyyz: ERR-xxx-yyy-z - // xxx: エラー大まかなの種類 (HUD関連, 追放処理関連など) - // yyy: エラーの詳細な種類 (BoutyHunterの処理, SerialKillerの処理など) - // z: 深刻度 - // 0: 処置不要 (非表示) - // 1: 正常に動作しなければ廃村 (一定時間で非表示) - // 2: 廃村を推奨 (廃村で非表示) - // 3: ユーザー側では対処不能 (消さない) - // ========== - // 001 Main - Main_DictionaryError = 0010003, // 001-000-3 Main Dictionary Error - // ========== - // 000 Test - NoError = 0000000, // 000-000-0 No Error - TestError0 = 0009000, // 000-900-0 Test Error 0 - TestError1 = 0009101, // 000-910-1 Test Error 1 - TestError2 = 0009202, // 000-920-2 Test Error 2 - TestError3 = 0009303, // 000-930-3 Test Error 3 +using System.Collections.Generic; +using System.Linq; +using UnityEngine; +using static TOHE.Translator; + +namespace TOHE; + +public class ErrorText : MonoBehaviour +{ + #region Singleton + public static ErrorText Instance + { + get + { + return _instance; + } + } + private static ErrorText _instance; + private void Awake() + { + if (_instance != null) + { + Destroy(this.gameObject); + } + else + { + _instance = this; + DontDestroyOnLoad(this); + } + } + #endregion + public static void Create(TMPro.TextMeshPro baseText) + { + var Text = Instantiate(baseText); + var instance = Text.gameObject.AddComponent(); + instance.Text = Text; + instance.name = "ErrorText"; + + Text.enabled = false; + Text.text = "NO ERROR"; + Text.color = Color.red; + Text.outlineColor = Color.black; + Text.alignment = TMPro.TextAlignmentOptions.Top; + } + + public TMPro.TextMeshPro Text; + public Camera Camera; + public List AllErrors = new(); + public Vector3 TextOffset = new(0, 0.3f, -1000f); + public void Update() + { + AllErrors.ForEach(err => err.IncreaseTimer()); + var ToRemove = AllErrors.Where(err => err.ErrorLevel <= 1 && 30f < err.Timer); + if (0 < ToRemove.Count()) + { + AllErrors.RemoveAll(err => ToRemove.Contains(err)); + UpdateText(); + if (HnSFlag) + Destroy(this.gameObject); + } + } + public void LateUpdate() + { + if (!Text.enabled) return; + + if (Camera == null) + Camera = !HudManager.InstanceExists ? Camera.main : HudManager.Instance.PlayerCam.GetComponent(); + if (Camera != null) + { + transform.position = AspectPosition.ComputeWorldPosition(Camera, AspectPosition.EdgeAlignments.Top, TextOffset); + } + } + public void AddError(ErrorCode code) + { + var error = new ErrorData(code); + if (0 < error.ErrorLevel) + Logger.Error($"エラー発生: {error}: {error.Message}", "ErrorText"); + + if (!AllErrors.Any(e => e.Code == code)) + { + //まだ出ていないエラー + AllErrors.Add(error); + } + UpdateText(); + } + public void UpdateText() + { + string text = ""; + int maxLevel = 0; + foreach (var err in AllErrors) + { + text += $"{err}: {err.Message}\n"; + if (maxLevel < err.ErrorLevel) maxLevel = err.ErrorLevel; + } + if (maxLevel == 0) + { + Text.enabled = false; + } + else + { + if (!HnSFlag) + text += $"{GetString($"ErrorLevel{maxLevel}")}"; + if (CheatDetected) + text = SBDetected ? GetString("EAC.CheatDetected.HighLevel") : GetString("EAC.CheatDetected.LowLevel"); + Text.enabled = true; + } + if (GameStates.IsInGame && maxLevel != 3 && !CheatDetected) + text += $"\n{GetString("TerminateCommand")}: Shift+L+Enter"; + Text.text = text; + } + public void Clear() + { + AllErrors.RemoveAll(err => err.ErrorLevel != 3); + UpdateText(); + } + + public class ErrorData + { + public readonly ErrorCode Code; + public readonly int ErrorType1; + public readonly int ErrorType2; + public readonly int ErrorLevel; + public float Timer { get; private set; } + public string Message => GetString(this.ToString()); + public ErrorData(ErrorCode code) + { + this.Code = code; + this.ErrorType1 = (int)code / 10000; + this.ErrorType2 = (int)code / 10 - ErrorType1 * 1000; // xxxyyy - xxx000 + this.ErrorLevel = (int)code - (int)code / 10 * 10; + this.Timer = 0f; + } + public override string ToString() + { + // ERR-xxx-yyy-z + return $"ERR-{ErrorType1:000}-{ErrorType2:000}-{ErrorLevel:0}"; + } + public void IncreaseTimer() => Timer += Time.deltaTime; + } + + public bool HnSFlag; + public bool CheatDetected; + public bool SBDetected; +} +public enum ErrorCode +{ + //xxxyyyz: ERR-xxx-yyy-z + // xxx: エラー大まかなの種類 (HUD関連, 追放処理関連など) + // yyy: エラーの詳細な種類 (BoutyHunterの処理, SerialKillerの処理など) + // z: 深刻度 + // 0: 処置不要 (非表示) + // 1: 正常に動作しなければ廃村 (一定時間で非表示) + // 2: 廃村を推奨 (廃村で非表示) + // 3: ユーザー側では対処不能 (消さない) + // ========== + // 001 Main + Main_DictionaryError = 0010003, // 001-000-3 Main Dictionary Error + // ========== + // 000 Test + NoError = 0000000, // 000-000-0 No Error + TestError0 = 0009000, // 000-900-0 Test Error 0 + TestError1 = 0009101, // 000-910-1 Test Error 1 + TestError2 = 0009202, // 000-920-2 Test Error 2 + TestError3 = 0009303, // 000-930-3 Test Error 3 HnsUnload = 000_804_1, // 000-804-1 Unloaded By HnS - CheatDetected = 000_666_2, // 000-666-2 疑似存在作弊玩家 - SBDetected = 000_666_1, // 000-666-1 傻逼外挂司马东西 + CheatDetected = 000_666_2, // 000-666-2 疑似存在作弊玩家 + SBDetected = 000_666_1, // 000-666-1 傻逼外挂司马东西 } \ No newline at end of file diff --git a/Modules/ExtendedPlayerControl.cs b/Modules/ExtendedPlayerControl.cs index 43fce5b8e..39494c884 100644 --- a/Modules/ExtendedPlayerControl.cs +++ b/Modules/ExtendedPlayerControl.cs @@ -1,6 +1,7 @@ using AmongUs.GameOptions; using HarmonyLib; using Hazel; +using Il2CppSystem.Runtime.Remoting.Messaging; using InnerNet; using System; using System.Collections.Generic; @@ -189,7 +190,7 @@ static class ExtendedPlayerControl sender.SendMessage(); } } - public static void SetKillCooldown(this PlayerControl player, float time = -1f) + public static void SetKillCooldownV2(this PlayerControl player, float time = -1f) { if (player == null) return; if (!player.CanUseKillButton()) return; @@ -199,14 +200,14 @@ static class ExtendedPlayerControl player.RpcGuardAndKill(); player.ResetKillCooldown(); } - public static void SetKillCooldownV2(this PlayerControl player, float time = -1f, PlayerControl target = null, bool forceAnime = false) + public static void SetKillCooldown(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()) + if (forceAnime || !player.IsModClient() || !Options.DisableShieldAnimations.GetBool()) { player.SyncSettings(); player.RpcGuardAndKill(target, 11); @@ -232,7 +233,7 @@ static class ExtendedPlayerControl if (target == null) target = player; if (time >= 0f) Main.AllPlayerKillCooldown[player.PlayerId] = time * 2; else Main.AllPlayerKillCooldown[player.PlayerId] *= 2; - if (forceAnime || !player.IsModClient() || player.IsModClient()) + if (forceAnime || !player.IsModClient() || !Options.DisableShieldAnimations.GetBool()) { player.SyncSettings(); player.RpcGuardAndKill(target, 11); @@ -357,7 +358,7 @@ static class ExtendedPlayerControl foreach (var role in SubRoles) { if (role == CustomRoles.NotAssigned) continue; - sb.Append($"{Utils.ColorString(Color.white, " + ")}{Utils.GetRoleName(role, forUser)}"); + sb.Append($"{Utils.ColorString(Color.white, "\n")}{Utils.GetRoleName(role, forUser)}"); } return sb.ToString(); @@ -442,8 +443,9 @@ static class ExtendedPlayerControl //Standard CustomRoles.FireWorks => FireWorks.CanUseKillButton(pc), CustomRoles.Mafia => Utils.CanMafiaKill(), - // CustomRoles.Mare => pc.IsAlive(), - CustomRoles.Underdog => playerCount <= Options.UnderdogMaximumPlayersNeededToKill.GetInt(), + // CustomRoles.Mare => pc.IsAlive(), + //CustomRoles.Underdog => playerCount <= Options.UnderdogMaximumPlayersNeededToKill.GetInt(), + CustomRoles.Underdog => pc.IsAlive(), CustomRoles.Inhibitor => !Utils.IsActive(SystemTypes.Electrical) && !Utils.IsActive(SystemTypes.Laboratory) && !Utils.IsActive(SystemTypes.Comms) && !Utils.IsActive(SystemTypes.LifeSupp) && !Utils.IsActive(SystemTypes.Reactor), CustomRoles.Saboteur => Utils.IsActive(SystemTypes.Electrical) || Utils.IsActive(SystemTypes.Laboratory) || Utils.IsActive(SystemTypes.Comms) || Utils.IsActive(SystemTypes.LifeSupp) || Utils.IsActive(SystemTypes.Reactor), CustomRoles.Sniper => Sniper.CanUseKillButton(pc), @@ -476,6 +478,7 @@ static class ExtendedPlayerControl CustomRoles.Nuker => (Options.BomberCanKill.GetBool() && pc.IsAlive()), CustomRoles.Innocent => pc.IsAlive(), CustomRoles.Counterfeiter => Counterfeiter.CanUseKillButton(pc.PlayerId), + CustomRoles.Witness => pc.IsAlive(), CustomRoles.Pursuer => Pursuer.CanUseKillButton(pc.PlayerId), CustomRoles.Morphling => Morphling.CanUseKillButton(pc.PlayerId), CustomRoles.FFF => pc.IsAlive(), @@ -487,6 +490,9 @@ static class ExtendedPlayerControl CustomRoles.BloodKnight => pc.IsAlive(), CustomRoles.Crewpostor => false, CustomRoles.Totocalcio => Totocalcio.CanUseKillButton(pc), + CustomRoles.Romantic => pc.IsAlive(), + CustomRoles.RuthlessRomantic => pc.IsAlive(), + CustomRoles.VengefulRomantic => VengefulRomantic.CanUseKillButton(pc), CustomRoles.Succubus => Succubus.CanUseKillButton(pc), CustomRoles.CursedSoul => CursedSoul.CanUseKillButton(pc), CustomRoles.Admirer => Admirer.CanUseKillButton(pc), @@ -500,7 +506,7 @@ static class ExtendedPlayerControl CustomRoles.Spiritcaller => pc.IsAlive(), CustomRoles.PlagueBearer => pc.IsAlive(), CustomRoles.Pestilence => pc.IsAlive(), - CustomRoles.Pirate => pc.IsAlive(), + //CustomRoles.Pirate => pc.IsAlive(), _ => pc.Is(CustomRoleTypes.Impostor), }; @@ -524,17 +530,19 @@ static class ExtendedPlayerControl CustomRoles.Monarch or CustomRoles.Provocateur or CustomRoles.Totocalcio or + CustomRoles.Romantic or CustomRoles.Succubus or CustomRoles.CursedSoul or CustomRoles.PlagueBearer or CustomRoles.Admirer or CustomRoles.Amnesiac or CustomRoles.Glitch or - CustomRoles.Crusader or - CustomRoles.Wildling + CustomRoles.Crusader => false, CustomRoles.Jackal => Jackal.CanVent.GetBool(), + CustomRoles.VengefulRomantic => Romantic.VengefulCanVent.GetBool(), + CustomRoles.RuthlessRomantic => Romantic.RuthlessCanVent.GetBool(), CustomRoles.Sidekick => Jackal.CanVentSK.GetBool(), CustomRoles.Poisoner => Poisoner.CanVent.GetBool(), CustomRoles.NSerialKiller => NSerialKiller.CanVent.GetBool(), @@ -558,6 +566,7 @@ static class ExtendedPlayerControl // CustomRoles.Chameleon => true, CustomRoles.Parasite => true, CustomRoles.Refugee => true, + CustomRoles.Wildling => Wildling.CanVent.GetBool(), CustomRoles.Spiritcaller => Spiritcaller.CanVent.GetBool(), CustomRoles.Arsonist => pc.IsDouseDone(), @@ -648,7 +657,7 @@ static class ExtendedPlayerControl Main.AllPlayerKillCooldown[player.PlayerId] = Options.RevolutionistCooldown.GetFloat(); break; case CustomRoles.Underdog: - Main.AllPlayerKillCooldown[player.PlayerId] = Options.UnderdogKillCooldown.GetFloat(); + Main.AllPlayerKillCooldown[player.PlayerId] = Options.UnderdogKillCooldownWithMorePlayersAlive.GetFloat(); break; case CustomRoles.Jackal: Jackal.SetKillCooldown(player.PlayerId); @@ -735,6 +744,9 @@ static class ExtendedPlayerControl case CustomRoles.Counterfeiter: Counterfeiter.SetKillCooldown(player.PlayerId); break; + case CustomRoles.Witness: + Main.AllPlayerKillCooldown[player.PlayerId] = Options.WitnessCD.GetFloat(); + break; case CustomRoles.Pursuer: Pursuer.SetKillCooldown(player.PlayerId); break; @@ -793,6 +805,15 @@ static class ExtendedPlayerControl case CustomRoles.Totocalcio: Totocalcio.SetKillCooldown(player.PlayerId); break; + case CustomRoles.Romantic: + Romantic.SetKillCooldown(player.PlayerId); + break; + case CustomRoles.VengefulRomantic: + Main.AllPlayerKillCooldown[player.PlayerId] = Romantic.VengefulKCD.GetFloat(); + break; + case CustomRoles.RuthlessRomantic: + Main.AllPlayerKillCooldown[player.PlayerId] = Romantic.RuthlessKCD.GetFloat(); + break; case CustomRoles.Gangster: Gangster.SetKillCooldown(player.PlayerId); break; diff --git a/Modules/GameOptionsSender/PlayerGameOptionsSender.cs b/Modules/GameOptionsSender/PlayerGameOptionsSender.cs index 9d79df9c6..69f735c2e 100644 --- a/Modules/GameOptionsSender/PlayerGameOptionsSender.cs +++ b/Modules/GameOptionsSender/PlayerGameOptionsSender.cs @@ -96,17 +96,20 @@ public class PlayerGameOptionsSender : GameOptionsSender switch (role) { - case CustomRoles.Terrorist: + //case CustomRoles.Terrorist: case CustomRoles.SabotageMaster: // case CustomRoles.Mario: - case CustomRoles.EngineerTOHE: - case CustomRoles.Phantom: + //case CustomRoles.EngineerTOHE: + //case CustomRoles.Phantom: case CustomRoles.Crewpostor: - // case CustomRoles.Jester: - case CustomRoles.Chameleon: + // case CustomRoles.Jester: AURoleOptions.EngineerCooldown = 0f; AURoleOptions.EngineerInVentMaxTime = 0f; break; + case CustomRoles.Chameleon: + AURoleOptions.EngineerCooldown = Chameleon.ChameleonCooldown.GetFloat(); + AURoleOptions.EngineerInVentMaxTime = 1f; + break; case CustomRoles.ShapeMaster: AURoleOptions.ShapeshifterCooldown = 1f; AURoleOptions.ShapeshifterLeaveSkin = false; @@ -116,6 +119,14 @@ public class PlayerGameOptionsSender : GameOptionsSender AURoleOptions.ShapeshifterCooldown = Main.isCursed ? 1f : Options.DefaultKillCooldown; AURoleOptions.ShapeshifterDuration = Options.WarlockShiftDuration.GetFloat(); break; + case CustomRoles.Escapee: + AURoleOptions.ShapeshifterCooldown = 5f; + AURoleOptions.ShapeshifterDuration = 1f; + break; + case CustomRoles.Miner: + AURoleOptions.ShapeshifterCooldown = 15f; + AURoleOptions.ShapeshifterDuration = 1f; + break; case CustomRoles.SerialKiller: SerialKiller.ApplyGameOptions(player); break; @@ -138,12 +149,16 @@ public class PlayerGameOptionsSender : GameOptionsSender case CustomRoles.Monarch: case CustomRoles.Deputy: case CustomRoles.Counterfeiter: + case CustomRoles.Witness: case CustomRoles.Succubus: case CustomRoles.CursedSoul: case CustomRoles.Admirer: case CustomRoles.Amnesiac: opt.SetVision(false); break; + case CustomRoles.Minimalism: + opt.SetVision(true); + break; case CustomRoles.Pestilence: opt.SetVision(PlagueBearer.PestilenceHasImpostorVision.GetBool()); break; @@ -201,8 +216,11 @@ public class PlayerGameOptionsSender : GameOptionsSender AURoleOptions.ScientistBatteryCharge = Options.ScientistDur.GetFloat(); break; case CustomRoles.Wildling: - AURoleOptions.ShapeshifterCooldown = Wildling.ShapeshiftCD.GetFloat(); - AURoleOptions.ShapeshifterDuration = Wildling.ShapeshiftDur.GetFloat(); + if (Wildling.CanShapeshift.GetBool()) + { + AURoleOptions.ShapeshifterCooldown = Wildling.ShapeshiftCD.GetFloat(); + AURoleOptions.ShapeshifterDuration = Wildling.ShapeshiftDur.GetFloat(); + } break; case CustomRoles.Jackal: Jackal.ApplyGameOptions(opt); @@ -219,20 +237,21 @@ public class PlayerGameOptionsSender : GameOptionsSender Poisoner.ApplyGameOptions(opt); break; case CustomRoles.Veteran: - AURoleOptions.EngineerCooldown = - !Main.VeteranNumOfUsed.TryGetValue(player.PlayerId, out var count3) || count3 > 0 - ? Options.VeteranSkillCooldown.GetFloat() - : 300f; + AURoleOptions.EngineerCooldown = Options.VeteranSkillCooldown.GetFloat(); AURoleOptions.EngineerInVentMaxTime = 1; break; case CustomRoles.Grenadier: AURoleOptions.EngineerCooldown = Options.GrenadierSkillCooldown.GetFloat(); AURoleOptions.EngineerInVentMaxTime = 1; break; - /* case CustomRoles.Flashbang: - AURoleOptions.ShapeshifterCooldown = Options.FlashbangSkillCooldown.GetFloat(); - AURoleOptions.ShapeshifterDuration = Options.FlashbangSkillDuration.GetFloat(); - break; */ + /* case CustomRoles.Flashbang: + AURoleOptions.ShapeshifterCooldown = Options.FlashbangSkillCooldown.GetFloat(); + AURoleOptions.ShapeshifterDuration = Options.FlashbangSkillDuration.GetFloat(); + break; */ + case CustomRoles.Lighter: + AURoleOptions.EngineerInVentMaxTime = 1; + AURoleOptions.EngineerCooldown = Options.LighterSkillCooldown.GetFloat(); + break; case CustomRoles.TimeMaster: AURoleOptions.EngineerCooldown = Options.TimeMasterSkillCooldown.GetFloat(); AURoleOptions.EngineerInVentMaxTime = 1; @@ -335,10 +354,7 @@ public class PlayerGameOptionsSender : GameOptionsSender BloodKnight.ApplyGameOptions(opt); break; case CustomRoles.DovesOfNeace: - AURoleOptions.EngineerCooldown = - !Main.DovesOfNeaceNumOfUsed.TryGetValue(player.PlayerId, out var count4) || count4 > 0 - ? Options.DovesOfNeaceCooldown.GetFloat() - : 300f; + AURoleOptions.EngineerCooldown = Options.DovesOfNeaceCooldown.GetFloat(); AURoleOptions.EngineerInVentMaxTime = 1; break; case CustomRoles.Disperser: @@ -408,6 +424,20 @@ public class PlayerGameOptionsSender : GameOptionsSender opt.SetFloat(FloatOptionNames.ImpostorLightMod, Options.GrenadierCauseVision.GetFloat()); } } + + if (Main.Lighter.Count >= 1 && player.GetCustomRole() == CustomRoles.Lighter) + { + opt.SetVisionV2(); + if (Utils.IsActive(SystemTypes.Electrical)) + { + opt.SetFloat(FloatOptionNames.CrewLightMod, Options.LighterVisionOnLightsOut.GetFloat() * 5); + } + else + { + opt.SetFloat(FloatOptionNames.CrewLightMod, Options.LighterVisionNormal.GetFloat()); + } + } + /* if ((Main.FlashbangInProtect.Count >= 1 && Main.ForFlashbang.Contains(player.PlayerId) && (!player.GetCustomRole().IsCrewmate()))) { opt.SetVision(false); @@ -430,15 +460,15 @@ public class PlayerGameOptionsSender : GameOptionsSender case CustomRoles.Flashman: Main.AllPlayerSpeed[player.PlayerId] = Options.FlashmanSpeed.GetFloat(); break; - case CustomRoles.Lighter: + case CustomRoles.Torch: if (!Utils.IsActive(SystemTypes.Electrical)) opt.SetVision(true); - opt.SetFloat(FloatOptionNames.CrewLightMod, Options.LighterVision.GetFloat()); - opt.SetFloat(FloatOptionNames.ImpostorLightMod, Options.LighterVision.GetFloat()); - if (Utils.IsActive(SystemTypes.Electrical)) + opt.SetFloat(FloatOptionNames.CrewLightMod, Options.TorchVision.GetFloat()); + opt.SetFloat(FloatOptionNames.ImpostorLightMod, Options.TorchVision.GetFloat()); + if (Utils.IsActive(SystemTypes.Electrical) && !Options.TorchAffectedByLights.GetBool()) opt.SetVision(true); - opt.SetFloat(FloatOptionNames.CrewLightMod, Options.LighterVision.GetFloat() * 5); - opt.SetFloat(FloatOptionNames.ImpostorLightMod, Options.LighterVision.GetFloat() * 5); + opt.SetFloat(FloatOptionNames.CrewLightMod, Options.TorchVision.GetFloat() * 5); + opt.SetFloat(FloatOptionNames.ImpostorLightMod, Options.TorchVision.GetFloat() * 5); break; case CustomRoles.Bewilder: opt.SetVision(false); diff --git a/Modules/GameState.cs b/Modules/GameState.cs index 7b8a9816d..5e7bfe2b2 100644 --- a/Modules/GameState.cs +++ b/Modules/GameState.cs @@ -279,6 +279,7 @@ public class PlayerState Trialed, Infected, Jinx, + Demolished, Hack, etc = -1, @@ -418,6 +419,58 @@ public class TaskState } } + if (player.Is(CustomRoles.Divinator) && player.IsAlive()) + { + Divinator.CheckLimit[player.PlayerId] += Divinator.AbilityUseGainWithEachTaskCompleted.GetFloat(); + } + if (player.Is(CustomRoles.Veteran) && player.IsAlive()) + { + Main.VeteranNumOfUsed[player.PlayerId] += Options.VeteranAbilityUseGainWithEachTaskCompleted.GetFloat(); + } + if (player.Is(CustomRoles.Grenadier) && player.IsAlive()) + { + Main.GrenadierNumOfUsed[player.PlayerId] += Options.GrenadierAbilityUseGainWithEachTaskCompleted.GetFloat(); + } + if (player.Is(CustomRoles.Lighter) && player.IsAlive()) + { + Main.LighterNumOfUsed[player.PlayerId] += Options.LighterAbilityUseGainWithEachTaskCompleted.GetFloat(); + } + if (player.Is(CustomRoles.DovesOfNeace) && player.IsAlive()) + { + Main.DovesOfNeaceNumOfUsed[player.PlayerId] += Options.DovesOfNeaceAbilityUseGainWithEachTaskCompleted.GetFloat(); + } + if (player.Is(CustomRoles.TimeMaster) && player.IsAlive()) + { + Main.TimeMasterNumOfUsed[player.PlayerId] += Options.TimeMasterAbilityUseGainWithEachTaskCompleted.GetFloat(); + } + if (player.Is(CustomRoles.Mediumshiper) && player.IsAlive()) + { + Mediumshiper.ContactLimit[player.PlayerId] += Mediumshiper.MediumAbilityUseGainWithEachTaskCompleted.GetFloat(); + } + if (player.Is(CustomRoles.ParityCop) && player.IsAlive()) + { + ParityCop.MaxCheckLimit[player.PlayerId] += ParityCop.ParityAbilityUseGainWithEachTaskCompleted.GetFloat(); + } + if (player.Is(CustomRoles.Oracle) && player.IsAlive()) + { + Oracle.CheckLimit[player.PlayerId] += Oracle.OracleAbilityUseGainWithEachTaskCompleted.GetFloat(); + } + if (player.Is(CustomRoles.SabotageMaster) && player.IsAlive()) + { + SabotageMaster.UsedSkillCount -= SabotageMaster.SMAbilityUseGainWithEachTaskCompleted.GetFloat(); + } + if (player.Is(CustomRoles.Tracker) && player.IsAlive()) + { + Tracker.TrackLimit[player.PlayerId] += Tracker.TrackerAbilityUseGainWithEachTaskCompleted.GetFloat(); + } + if (player.Is(CustomRoles.Bloodhound) && player.IsAlive()) + { + Bloodhound.UseLimit[player.PlayerId] += Bloodhound.BloodhoundAbilityUseGainWithEachTaskCompleted.GetFloat(); + } + if (player.Is(CustomRoles.Chameleon) && player.IsAlive()) + { + Chameleon.UseLimit[player.PlayerId] += Chameleon.ChameleonAbilityUseGainWithEachTaskCompleted.GetFloat(); + } if (player.Is(CustomRoles.Ghoul) && (CompletedTasksCount + 1) >= AllTasksCount && player.IsAlive()) new LateTask(() => @@ -490,7 +543,7 @@ public class TaskState { target.SetRealKiller(player); target.RpcMurderPlayerV3(player); - player.RpcGuardAndKill(); + //player.RpcGuardAndKill(); Logger.Info($"船鬼完成任务击杀:{target.GetNameWithRole()} => {player.GetNameWithRole()}", "Pestilence Reflect"); } } diff --git a/Modules/GuessManager.cs b/Modules/GuessManager.cs index 4055c51d8..c5638dbcb 100644 --- a/Modules/GuessManager.cs +++ b/Modules/GuessManager.cs @@ -87,7 +87,7 @@ public static class GuessManager var originMsg = msg; if (!AmongUsClient.Instance.AmHost) return false; - if (!GameStates.IsInGame || pc == null) return false; + if (!GameStates.IsVoting || pc == null) return false; if (!pc.Is(CustomRoles.NiceGuesser) && !pc.Is(CustomRoles.EvilGuesser) && !pc.Is(CustomRoles.Doomsayer) && !pc.Is(CustomRoles.Judge) && !pc.Is(CustomRoles.Councillor) && !pc.Is(CustomRoles.Guesser) && !Options.GuesserMode.GetBool()) return false; int operate = 0; // 1:ID 2:猜测 @@ -630,9 +630,9 @@ public static class GuessManager } string Name = dp.GetRealName(); - CustomSoundsManager.RPCPlayCustomSoundAll("Gunfire"); + if (!Options.DisableKillAnimationOnGuess.GetBool()) CustomSoundsManager.RPCPlayCustomSoundAll("Gunfire"); - new LateTask(() => + new LateTask(() => { Main.PlayerStates[dp.PlayerId].deathReason = PlayerState.DeathReason.Gambled; dp.SetRealKiller(pc); @@ -685,7 +685,7 @@ public static class GuessManager var meetingHud = MeetingHud.Instance; var hudManager = DestroyableSingleton.Instance; SoundManager.Instance.PlaySound(pc.KillSfx, false, 0.8f); - hudManager.KillOverlay.ShowKillAnimation(pc.Data, pc.Data); + if (!Options.DisableKillAnimationOnGuess.GetBool()) hudManager.KillOverlay.ShowKillAnimation(pc.Data, pc.Data); if (amOwner) { hudManager.ShadowQuad.gameObject.SetActive(false); @@ -823,6 +823,7 @@ public static class GuessManager msg += rd.Next(1, 100) < 50 ? string.Empty : " "; msg += Utils.GetRoleName(role); } + msg = "."; var player = Main.AllAlivePlayerControls.ToArray()[rd.Next(0, Main.AllAlivePlayerControls.Count())]; DestroyableSingleton.Instance.Chat.AddChat(player, msg); var writer = CustomRpcSender.Create("MessagesToSend", SendOption.None); diff --git a/Modules/NameNotifyManager.cs b/Modules/NameNotifyManager.cs index aa2fd155c..b84de2f2e 100644 --- a/Modules/NameNotifyManager.cs +++ b/Modules/NameNotifyManager.cs @@ -1,5 +1,6 @@ using Hazel; using System.Collections.Generic; +using UnityEngine; namespace TOHE; @@ -8,11 +9,12 @@ public static class NameNotifyManager private static Dictionary Notice = new(); public static void Reset() => Notice = new(); public static bool Notifying(this PlayerControl pc) => Notice.ContainsKey(pc.PlayerId); - public static void Notify(this PlayerControl pc, string text, float time = 4f) + public static void Notify(this PlayerControl pc, string text, float time = 5f) { if (!AmongUsClient.Instance.AmHost || pc == null) return; if (!GameStates.IsInTask) return; - if (!text.Contains(" + { + if (!killer.inVent && (killer.PlayerId != target.PlayerId)) + { + if ((Options.DemolitionistKillerDiesOnMeetingCall.GetBool() || GameStates.IsInTask) && killer.IsAlive()) { + killer.RpcMurderPlayerV3(killer); + RPC.PlaySoundRPC(killer.PlayerId, Sounds.KillSound); + Main.PlayerStates[killer.PlayerId].deathReason = PlayerState.DeathReason.Demolished; + } + } else RPC.PlaySoundRPC(killer.PlayerId, Sounds.TaskComplete); + }, Options.DemolitionistVentTime.GetFloat() + 0.5f + ); + } } if (target.Is(CustomRoles.CyberStar) && !Main.CyberStarDead.Contains(target.PlayerId)) Main.CyberStarDead.Add(target.PlayerId); + if (target.Is(CustomRoles.Demolitionist) && !Main.DemolitionistDead.Contains(target.PlayerId)) Main.DemolitionistDead.Add(target.PlayerId); } public static bool KillFlashCheck(PlayerControl killer, PlayerControl target, PlayerControl seer) { @@ -426,7 +452,7 @@ public static class Utils case CustomRoles.Crusader: case CustomRoles.Refugee: case CustomRoles.Jester: - case CustomRoles.Pirate: + //case CustomRoles.Pirate: // case CustomRoles.Baker: case CustomRoles.Famine: case CustomRoles.NWitch: @@ -454,6 +480,9 @@ public static class Utils case CustomRoles.BloodKnight: case CustomRoles.Camouflager: case CustomRoles.Totocalcio: + case CustomRoles.Romantic: + case CustomRoles.VengefulRomantic: + case CustomRoles.RuthlessRomantic: case CustomRoles.Succubus: case CustomRoles.CursedSoul: case CustomRoles.Admirer: @@ -464,6 +493,7 @@ public static class Utils case CustomRoles.Virus: case CustomRoles.Farseer: case CustomRoles.Counterfeiter: + case CustomRoles.Witness: case CustomRoles.Pursuer: case CustomRoles.Spiritcaller: case CustomRoles.PlagueBearer: @@ -542,6 +572,9 @@ public static class Utils pc.Is(CustomRoles.Loyal) || pc.Is(CustomRoles.SuperStar) || pc.Is(CustomRoles.CyberStar) || + pc.Is(CustomRoles.Demolitionist) || + pc.Is(CustomRoles.NiceEraser) || + pc.Is(CustomRoles.TaskManager) || pc.Is(CustomRoles.Egoist) || pc.Is(CustomRoles.DualPersonality) ); @@ -568,27 +601,221 @@ public static class Utils { case CustomRoles.Arsonist: var doused = GetDousedPlayerCount(playerId); - ProgressText.Append(ColorString(GetRoleColor(CustomRoles.Arsonist).ShadeColor(0.25f), $"({doused.Item1}/{doused.Item2})")); + ProgressText.Append(ColorString(GetRoleColor(CustomRoles.Arsonist).ShadeColor(0.25f), $"- {doused.Item1}/{doused.Item2}")); break; case CustomRoles.Sheriff: - ProgressText.Append(Sheriff.GetShotLimit(playerId)); + if (Sheriff.ShowShotLimit.GetBool()) ProgressText.Append(Sheriff.GetShotLimit(playerId)); break; - case CustomRoles.Pirate: - ProgressText.Append(ColorString(GetRoleColor(CustomRoles.Pirate).ShadeColor(0.25f), $"({Pirate.NumWin}/{Pirate.SuccessfulDuelsToWin.GetInt()})")); + case CustomRoles.Veteran: + var taskState2 = Main.PlayerStates?[playerId].GetTaskState(); + Color TextColor2; + var TaskCompleteColor2 = Color.green; + var NonCompleteColor2 = Color.yellow; + var NormalColor2 = taskState2.IsTaskFinished ? TaskCompleteColor2 : NonCompleteColor2; + TextColor2 = comms ? Color.gray : NormalColor2; + string Completed2 = comms ? "?" : $"{taskState2.CompletedTasksCount}"; + Color TextColor21; + if (Main.VeteranNumOfUsed[playerId] < 1) TextColor21 = Color.red; + else TextColor21 = Color.white; + ProgressText.Append(ColorString(TextColor2, $"- {Completed2}/{taskState2.AllTasksCount}")); + ProgressText.Append(ColorString(TextColor21, $" - {Math.Round(Main.VeteranNumOfUsed[playerId], 1)}")); break; + case CustomRoles.Grenadier: + var taskState3 = Main.PlayerStates?[playerId].GetTaskState(); + Color TextColor3; + var TaskCompleteColor3 = Color.green; + var NonCompleteColor3 = Color.yellow; + var NormalColor3 = taskState3.IsTaskFinished ? TaskCompleteColor3 : NonCompleteColor3; + TextColor3 = comms ? Color.gray : NormalColor3; + string Completed3 = comms ? "?" : $"{taskState3.CompletedTasksCount}"; + Color TextColor31; + if (Main.GrenadierNumOfUsed[playerId] < 1) TextColor31 = Color.red; + else TextColor31 = Color.white; + ProgressText.Append(ColorString(TextColor3, $"- {Completed3}/{taskState3.AllTasksCount}")); + ProgressText.Append(ColorString(TextColor31, $" - {Math.Round(Main.GrenadierNumOfUsed[playerId], 1)}")); + break; + case CustomRoles.Divinator: + var taskState4 = Main.PlayerStates?[playerId].GetTaskState(); + Color TextColor4; + var TaskCompleteColor4 = Color.green; + var NonCompleteColor4 = Color.yellow; + var NormalColor4 = taskState4.IsTaskFinished ? TaskCompleteColor4 : NonCompleteColor4; + TextColor4 = comms ? Color.gray : NormalColor4; + string Completed4 = comms ? "?" : $"{taskState4.CompletedTasksCount}"; + Color TextColor41; + if (Divinator.CheckLimit[playerId] < 1) TextColor41 = Color.red; + else TextColor41 = Color.white; + ProgressText.Append(ColorString(TextColor4, $"- {Completed4}/{taskState4.AllTasksCount}")); + ProgressText.Append(ColorString(TextColor41, $" - {Math.Round(Divinator.CheckLimit[playerId])}")); + break; + case CustomRoles.DovesOfNeace: + var taskState5 = Main.PlayerStates?[playerId].GetTaskState(); + Color TextColor5; + var TaskCompleteColor5 = Color.green; + var NonCompleteColor5 = Color.yellow; + var NormalColor5 = taskState5.IsTaskFinished ? TaskCompleteColor5 : NonCompleteColor5; + TextColor5 = comms ? Color.gray : NormalColor5; + string Completed5 = comms ? "?" : $"{taskState5.CompletedTasksCount}"; + Color TextColor51; + if (Main.DovesOfNeaceNumOfUsed[playerId] < 1) TextColor51 = Color.red; + else TextColor51 = Color.white; + ProgressText.Append(ColorString(TextColor5, $"- {Completed5}/{taskState5.AllTasksCount}")); + ProgressText.Append(ColorString(TextColor51, $" - {Math.Round(Main.DovesOfNeaceNumOfUsed[playerId], 1)}")); + break; + case CustomRoles.TimeMaster: + var taskState6 = Main.PlayerStates?[playerId].GetTaskState(); + Color TextColor6; + var TaskCompleteColor6 = Color.green; + var NonCompleteColor6 = Color.yellow; + var NormalColor6 = taskState6.IsTaskFinished ? TaskCompleteColor6 : NonCompleteColor6; + TextColor6 = comms ? Color.gray : NormalColor6; + string Completed6 = comms ? "?" : $"{taskState6.CompletedTasksCount}"; + Color TextColor61; + if (Main.TimeMasterNumOfUsed[playerId] < 1) TextColor61 = Color.red; + else TextColor61 = Color.white; + ProgressText.Append(ColorString(TextColor6, $"- {Completed6}/{taskState6.AllTasksCount}")); + ProgressText.Append(ColorString(TextColor61, $" - {Math.Round(Main.TimeMasterNumOfUsed[playerId], 1)}")); + break; + case CustomRoles.Mediumshiper: + var taskState7 = Main.PlayerStates?[playerId].GetTaskState(); + Color TextColor7; + var TaskCompleteColor7 = Color.green; + var NonCompleteColor7 = Color.yellow; + var NormalColor7 = taskState7.IsTaskFinished ? TaskCompleteColor7 : NonCompleteColor7; + TextColor7 = comms ? Color.gray : NormalColor7; + string Completed7 = comms ? "?" : $"{taskState7.CompletedTasksCount}"; + Color TextColor71; + if (Mediumshiper.ContactLimit[playerId] < 1) TextColor71 = Color.red; + else TextColor71 = Color.white; + ProgressText.Append(ColorString(TextColor7, $"- {Completed7}/{taskState7.AllTasksCount}")); + ProgressText.Append(ColorString(TextColor71, $" - {Math.Round(Mediumshiper.ContactLimit[playerId], 1)}")); + break; + case CustomRoles.ParityCop: + var taskState8 = Main.PlayerStates?[playerId].GetTaskState(); + Color TextColor8; + var TaskCompleteColor8 = Color.green; + var NonCompleteColor8 = Color.yellow; + var NormalColor8 = taskState8.IsTaskFinished ? TaskCompleteColor8 : NonCompleteColor8; + TextColor8 = comms ? Color.gray : NormalColor8; + string Completed8 = comms ? "?" : $"{taskState8.CompletedTasksCount}"; + Color TextColor81; + if (ParityCop.MaxCheckLimit[playerId] < 1) TextColor81 = Color.red; + else TextColor81 = Color.white; + ProgressText.Append(ColorString(TextColor8, $"- {Completed8}/{taskState8.AllTasksCount}")); + ProgressText.Append(ColorString(TextColor81, $" - {Math.Round(ParityCop.MaxCheckLimit[playerId], 1)}")); + break; + case CustomRoles.Oracle: + var taskState9 = Main.PlayerStates?[playerId].GetTaskState(); + Color TextColor9; + var TaskCompleteColor9 = Color.green; + var NonCompleteColor9 = Color.yellow; + var NormalColor9 = taskState9.IsTaskFinished ? TaskCompleteColor9 : NonCompleteColor9; + TextColor9 = comms ? Color.gray : NormalColor9; + string Completed9 = comms ? "?" : $"{taskState9.CompletedTasksCount}"; + Color TextColor91; + if (Oracle.CheckLimit[playerId] < 1) TextColor91 = Color.red; + else TextColor91 = Color.white; + ProgressText.Append(ColorString(TextColor9, $"- {Completed9}/{taskState9.AllTasksCount}")); + ProgressText.Append(ColorString(TextColor91, $" - {Math.Round(Oracle.CheckLimit[playerId], 1)}")); + break; + case CustomRoles.SabotageMaster: + var taskState10 = Main.PlayerStates?[playerId].GetTaskState(); + Color TextColor10; + var TaskCompleteColor10 = Color.green; + var NonCompleteColor10 = Color.yellow; + var NormalColor10 = taskState10.IsTaskFinished ? TaskCompleteColor10 : NonCompleteColor10; + TextColor10 = comms ? Color.gray : NormalColor10; + string Completed10 = comms ? "?" : $"{taskState10.CompletedTasksCount}"; + Color TextColor101; + if (SabotageMaster.SkillLimit.GetFloat() - SabotageMaster.UsedSkillCount > 1) TextColor101 = Color.red; + else TextColor101 = Color.white; + ProgressText.Append(ColorString(TextColor10, $"- {Completed10}/{taskState10.AllTasksCount}")); + ProgressText.Append(ColorString(TextColor101, $" - {Math.Round(SabotageMaster.SkillLimit.GetFloat() - SabotageMaster.UsedSkillCount, 1)}")); + break; + case CustomRoles.Tracker: + var taskState11 = Main.PlayerStates?[playerId].GetTaskState(); + Color TextColor11; + var TaskCompleteColor11 = Color.green; + var NonCompleteColor11 = Color.yellow; + var NormalColor11 = taskState11.IsTaskFinished ? TaskCompleteColor11 : NonCompleteColor11; + TextColor11 = comms ? Color.gray : NormalColor11; + string Completed11 = comms ? "?" : $"{taskState11.CompletedTasksCount}"; + Color TextColor111; + if (Tracker.TrackLimit[playerId] < 1) TextColor111 = Color.red; + else TextColor111 = Color.white; + ProgressText.Append(ColorString(TextColor11, $"- {Completed11}/{taskState11.AllTasksCount}")); + ProgressText.Append(ColorString(TextColor111, $" - {Math.Round(Tracker.TrackLimit[playerId], 1)}")); + break; + case CustomRoles.Bloodhound: + var taskState12 = Main.PlayerStates?[playerId].GetTaskState(); + Color TextColor12; + var TaskCompleteColor12 = Color.green; + var NonCompleteColor12 = Color.yellow; + var NormalColor12 = taskState12.IsTaskFinished ? TaskCompleteColor12 : NonCompleteColor12; + TextColor12 = comms ? Color.gray : NormalColor12; + string Completed12 = comms ? "?" : $"{taskState12.CompletedTasksCount}"; + Color TextColor121; + if (Bloodhound.UseLimit[playerId] < 1) TextColor121 = Color.red; + else TextColor121 = Color.white; + ProgressText.Append(ColorString(TextColor12, $"- {Completed12}/{taskState12.AllTasksCount}")); + ProgressText.Append(ColorString(TextColor121, $" - {Math.Round(Bloodhound.UseLimit[playerId], 1)}")); + break; + case CustomRoles.Chameleon: + var taskState13 = Main.PlayerStates?[playerId].GetTaskState(); + Color TextColor13; + var TaskCompleteColor13 = Color.green; + var NonCompleteColor13 = Color.yellow; + var NormalColor13 = taskState13.IsTaskFinished ? TaskCompleteColor13 : NonCompleteColor13; + TextColor13 = comms ? Color.gray : NormalColor13; + string Completed13 = comms ? "?" : $"{taskState13.CompletedTasksCount}"; + Color TextColor131; + if (Chameleon.UseLimit[playerId] < 1) TextColor131 = Color.red; + else TextColor131 = Color.white; + ProgressText.Append(ColorString(TextColor13, $"- {Completed13}/{taskState13.AllTasksCount}")); + ProgressText.Append(ColorString(TextColor131, $" - {Math.Round(Chameleon.UseLimit[playerId], 1)}")); + break; + case CustomRoles.Lighter: + var taskState14 = Main.PlayerStates?[playerId].GetTaskState(); + Color TextColor14; + var TaskCompleteColor14 = Color.green; + var NonCompleteColor14 = Color.yellow; + var NormalColor14 = taskState14.IsTaskFinished ? TaskCompleteColor14 : NonCompleteColor14; + TextColor14 = comms ? Color.gray : NormalColor14; + string Completed14 = comms ? "?" : $"{taskState14.CompletedTasksCount}"; + Color TextColor141; + if (Main.LighterNumOfUsed[playerId] < 1) TextColor141 = Color.red; + else TextColor141 = Color.white; + ProgressText.Append(ColorString(TextColor14, $"- {Completed14}/{taskState14.AllTasksCount}")); + ProgressText.Append(ColorString(TextColor141, $" - {Math.Round(Main.LighterNumOfUsed[playerId], 1)}")); + break; + //case CustomRoles.Pirate: + // ProgressText.Append(ColorString(GetRoleColor(CustomRoles.Pirate).ShadeColor(0.25f), $"({Pirate.NumWin}/{Pirate.SuccessfulDuelsToWin.GetInt()})")); + // break; case CustomRoles.Crusader: ProgressText.Append(Crusader.GetSkillLimit(playerId)); break; + case CustomRoles.TaskManager: + var taskState1 = Main.PlayerStates?[playerId].GetTaskState(); + Color TextColor1; + var TaskCompleteColor1 = Color.green; + var NonCompleteColor1 = Color.yellow; + var NormalColor1 = taskState1.IsTaskFinished ? TaskCompleteColor1 : NonCompleteColor1; + TextColor1 = comms ? Color.gray : NormalColor1; + string Completed1 = comms ? "?" : $"{taskState1.CompletedTasksCount}"; + string totalCompleted1 = comms ? "?" : $"{GameData.Instance.CompletedTasks}"; + ProgressText.Append(ColorString(TextColor1, $"- {Completed1}/{taskState1.AllTasksCount}")); + ProgressText.Append($" - {totalCompleted1}/{GameData.Instance.TotalTasks}"); + break; case CustomRoles.CopyCat: ProgressText.Append(ColorString(GetRoleColor(CustomRoles.CopyCat).ShadeColor(0.25f), $"({(CopyCat.MiscopyLimit.TryGetValue(playerId, out var count2) ? count2 : 0)})")); break; case CustomRoles.PlagueBearer: var plagued = PlagueBearer.PlaguedPlayerCount(playerId); - ProgressText.Append(ColorString(GetRoleColor(CustomRoles.PlagueBearer).ShadeColor(0.25f), $"({plagued.Item1}/{plagued.Item2})")); + ProgressText.Append(ColorString(GetRoleColor(CustomRoles.PlagueBearer).ShadeColor(0.25f), $"- {plagued.Item1}/{plagued.Item2}")); break; case CustomRoles.Doomsayer: var doomsayerguess = Doomsayer.GuessedPlayerCount(playerId); - ProgressText.Append(ColorString(GetRoleColor(CustomRoles.Doomsayer).ShadeColor(0.25f), $"({doomsayerguess.Item1}/{doomsayerguess.Item2})")); + ProgressText.Append(ColorString(GetRoleColor(CustomRoles.Doomsayer).ShadeColor(0.25f), $"- {doomsayerguess.Item1}/{doomsayerguess.Item2}")); break; case CustomRoles.Sniper: @@ -601,13 +828,13 @@ public static class Utils ProgressText.Append(TimeThief.GetProgressText(playerId)); break; case CustomRoles.Mario: - ProgressText.Append(ColorString(GetRoleColor(CustomRoles.Mario).ShadeColor(0.25f), $"({(Main.MarioVentCount.TryGetValue(playerId, out var count) ? count : 0)}/{Options.MarioVentNumWin.GetInt()})")); + ProgressText.Append(ColorString(GetRoleColor(CustomRoles.Mario).ShadeColor(0.25f), $"- {(Main.MarioVentCount.TryGetValue(playerId, out var count) ? count : 0)}/{Options.MarioVentNumWin.GetInt()}")); break; case CustomRoles.Vulture: - ProgressText.Append(ColorString(GetRoleColor(CustomRoles.Vulture).ShadeColor(0.25f), $"({(Vulture.BodyReportCount.TryGetValue(playerId, out var count1) ? count1 : 0)}/{Vulture.NumberOfReportsToWin.GetInt()})")); + ProgressText.Append(ColorString(GetRoleColor(CustomRoles.Vulture).ShadeColor(0.25f), $"- {(Vulture.BodyReportCount.TryGetValue(playerId, out var count1) ? count1 : 0)}/{Vulture.NumberOfReportsToWin.GetInt()}")); break; case CustomRoles.Masochist: - ProgressText.Append(ColorString(GetRoleColor(CustomRoles.Masochist).ShadeColor(0.25f), $"({(Main.MasochistKillMax.TryGetValue(playerId, out var count3) ? count3 : 0)}/{Options.MasochistKillMax.GetInt()})")); + ProgressText.Append(ColorString(GetRoleColor(CustomRoles.Masochist).ShadeColor(0.25f), $"- {(Main.MasochistKillMax.TryGetValue(playerId, out var count3) ? count3 : 0)}/{Options.MasochistKillMax.GetInt()}")); break; case CustomRoles.QuickShooter: ProgressText.Append(QuickShooter.GetShotLimit(playerId)); @@ -626,7 +853,7 @@ public static class Utils break; case CustomRoles.Revolutionist: var draw = GetDrawPlayerCount(playerId, out var _); - ProgressText.Append(ColorString(GetRoleColor(CustomRoles.Revolutionist).ShadeColor(0.25f), $"({draw.Item1}/{draw.Item2})")); + ProgressText.Append(ColorString(GetRoleColor(CustomRoles.Revolutionist).ShadeColor(0.25f), $"- {draw.Item1}/{draw.Item2}")); break; case CustomRoles.Gangster: ProgressText.Append(Gangster.GetRecruitLimit(playerId)); @@ -648,6 +875,9 @@ public static class Utils case CustomRoles.Eraser: ProgressText.Append(Eraser.GetProgressText(playerId)); break; + //case CustomRoles.NiceEraser: + // ProgressText.Append(NiceEraser.GetProgressText(playerId)); + // break; case CustomRoles.Hacker: ProgressText.Append(Hacker.GetHackLimit(playerId)); break; @@ -657,6 +887,9 @@ public static class Utils case CustomRoles.Totocalcio: ProgressText.Append(Totocalcio.GetProgressText(playerId)); break; + case CustomRoles.Romantic: + ProgressText.Append(Romantic.GetProgressText(playerId)); + break; case CustomRoles.Succubus: ProgressText.Append(Succubus.GetCharmLimit()); break; @@ -710,7 +943,7 @@ public static class Utils TextColor = comms ? Color.gray : NormalColor; string Completed = comms ? "?" : $"{taskState.CompletedTasksCount}"; - ProgressText.Append(ColorString(TextColor, $"({Completed}/{taskState.AllTasksCount})")); + ProgressText.Append(ColorString(TextColor, $"- {Completed}/{taskState.AllTasksCount}")); } break; } @@ -1688,6 +1921,7 @@ public static class Utils (target.Is(CustomRoles.Mayor) && Options.MayorRevealWhenDoneTasks.GetBool() && target.GetPlayerTaskState().IsTaskFinished) || (seer.Is(CustomRoleTypes.Crewmate) && target.Is(CustomRoles.Marshall) && target.GetPlayerTaskState().IsTaskFinished) || (Totocalcio.KnowRole(seer, target)) || + (Romantic.KnowRole(seer, target)) || (Lawyer.KnowRole(seer, target)) || (EvilDiviner.IsShowTargetRole(seer, target)) || (Ritualist.IsShowTargetRole(seer, target)) || @@ -1842,6 +2076,7 @@ public static class Utils } TargetMark.Append(Totocalcio.TargetMark(seer, target)); + TargetMark.Append(Romantic.TargetMark(seer, target)); TargetMark.Append(Lawyer.LawyerMark(seer, target)); TargetMark.Append(Deathpact.GetDeathpactMark(seer, target)); @@ -1907,6 +2142,7 @@ public static class Utils Swooper.AfterMeetingTasks(); Wraith.AfterMeetingTasks(); Chameleon.AfterMeetingTasks(); + NiceEraser.AfterMeetingTasks(); Eraser.AfterMeetingTasks(); BountyHunter.AfterMeetingTasks(); EvilTracker.AfterMeetingTasks(); @@ -1915,7 +2151,7 @@ public static class Utils Vulture.AfterMeetingTasks(); Baker.AfterMeetingTasks(); CopyCat.AfterMeetingTasks(); - Pirate.AfterMeetingTask(); + //Pirate.AfterMeetingTask(); if (Options.AirshipVariableElectrical.GetBool()) @@ -1968,11 +2204,17 @@ public static class Utils case CustomRoles.Pelican: Pelican.OnPelicanDied(target.PlayerId); break; + case CustomRoles.Romantic: + Romantic.isRomanticAlive = false; + break; case CustomRoles.Devourer: Devourer.OnDevourerDied(target.PlayerId); break; } + if (Romantic.BetPlayer.TryGetValue(target.PlayerId, out var bet)) + Romantic.ChangeRole(bet); + if (Executioner.Target.ContainsValue(target.PlayerId)) Executioner.ChangeRoleByTarget(target); if (Lawyer.Target.ContainsValue(target.PlayerId)) diff --git a/TOHE.csproj b/TOHE.csproj index e92261592..c9c3d46fb 100644 --- a/TOHE.csproj +++ b/TOHE.csproj @@ -28,7 +28,7 @@ all - + all runtime; build; native; contentfiles; analyzers; buildtransitive diff --git a/main.cs b/main.cs index 114337741..3b9c8f2bc 100644 --- a/main.cs +++ b/main.cs @@ -22,7 +22,7 @@ namespace TOHE; public class Main : BasePlugin { // == プログラム設定 / Program Config == - public static readonly string ModName = "Town of Host Re-Edited"; + public static readonly string ModName = "TOHE+"; public static readonly string ModColor = "#ffc0cb"; public static readonly bool AllowPublicRoom = true; public static readonly string ForkId = "TOHE"; @@ -34,7 +34,7 @@ public class Main : BasePlugin public static readonly string MainMenuText = " "; public const string PluginGuid = "com.karped1em.townofhostedited"; public const string PluginVersion = "2.5.1.22"; - public const string PluginDisplayVersion = "2.5.1_10"; + public const string PluginDisplayVersion = "1.0"; public const int PluginCreate = 3; public const bool Canary = false; @@ -109,6 +109,7 @@ public class Main : BasePlugin public static Dictionary TimeMasterInProtect = new(); //public static Dictionary FlashbangInProtect = new(); public static List CyberStarDead = new(); + public static List DemolitionistDead = new(); public static List WorkaholicAlive = new(); public static List BaitAlive = new(); public static List BoobyTrapBody = new(); @@ -158,8 +159,13 @@ public class Main : BasePlugin public static Dictionary ParaUsedButtonCount = new(); public static Dictionary MarioVentCount = new(); public static Dictionary VeteranInProtect = new(); - public static Dictionary VeteranNumOfUsed = new(); + public static Dictionary VeteranNumOfUsed = new(); + public static Dictionary AllKillers = new(); + public static Dictionary GrenadierNumOfUsed = new(); + public static Dictionary LighterNumOfUsed = new(); + public static Dictionary TimeMasterNumOfUsed = new(); public static Dictionary GrenadierBlinding = new(); + public static Dictionary Lighter = new(); public static Dictionary MadGrenadierBlinding = new(); public static Dictionary CursedWolfSpellCount = new(); public static Dictionary JinxSpellCount = new(); @@ -187,7 +193,7 @@ public class Main : BasePlugin public static int MadmateNum = 0; public static int BardCreations = 0; public static Dictionary Provoked = new(); - public static Dictionary DovesOfNeaceNumOfUsed = new(); + public static Dictionary DovesOfNeaceNumOfUsed = new(); public static Dictionary DevRole = new(); public static byte GodfatherTarget = byte.MaxValue; @@ -302,6 +308,9 @@ public class Main : BasePlugin {CustomRoles.CopyCat, "#ffb2ab"}, {CustomRoles.SuperStar, "#f6f657"}, {CustomRoles.CyberStar, "#ee4a55" }, + {CustomRoles.Demolitionist, "#5e2801" }, + {CustomRoles.NiceEraser, "#00a5ff" }, + {CustomRoles.TaskManager, "#00ffa5" }, {CustomRoles.SpeedBooster, "#00ffff"}, {CustomRoles.Doctor, "#80ffdd"}, {CustomRoles.Dictator, "#df9b00"}, @@ -313,7 +322,9 @@ public class Main : BasePlugin {CustomRoles.Veteran, "#a77738"}, {CustomRoles.Bodyguard, "#185abd"}, {CustomRoles.Counterfeiter, "#BE29EC"}, + {CustomRoles.Witness, "#4B0082"}, {CustomRoles.Grenadier, "#3c4a16"}, + {CustomRoles.Lighter, "#eee5be"}, {CustomRoles.Medic, "#00ff97"}, {CustomRoles.Divinator, "#882c83"}, {CustomRoles.Glitch, "#39FF14"}, @@ -321,7 +332,7 @@ public class Main : BasePlugin {CustomRoles.Mortician, "#333c49"}, {CustomRoles.Mediumshiper, "#a200ff"}, {CustomRoles.Observer, "#a8e0fa"}, - {CustomRoles.DovesOfNeace, "#007FFF"}, + {CustomRoles.DovesOfNeace, "#ffffff"}, {CustomRoles.Monarch, "#FFA500"}, {CustomRoles.Bloodhound, "#8B0000"}, {CustomRoles.Tracker, "#3CB371"}, @@ -363,9 +374,12 @@ public class Main : BasePlugin {CustomRoles.Collector, "#9d8892"}, {CustomRoles.Provocateur, "#74ba43"}, {CustomRoles.Sunnyboy, "#ff9902"}, - {CustomRoles.Poisoner, "#478800"}, + {CustomRoles.Poisoner, "#e70052"}, {CustomRoles.NWitch, "#BF5FFF"}, {CustomRoles.Totocalcio, "#ff9409"}, + {CustomRoles.Romantic, "#FF1493"}, + {CustomRoles.VengefulRomantic, "#8B0000"}, + {CustomRoles.RuthlessRomantic, "#D2691E"}, {CustomRoles.Succubus, "#cf6acd"}, {CustomRoles.HexMaster, "#ff00ff"}, {CustomRoles.Wraith, "#4B0082"}, @@ -396,7 +410,7 @@ public class Main : BasePlugin {CustomRoles.Amnesiac, "#7FBFFF"}, {CustomRoles.Doomsayer, "#14f786"}, {CustomRoles.Masochist, "#684405"}, - {CustomRoles.Pirate,"#EDC240"}, + //{CustomRoles.Pirate,"#EDC240"}, // GM {CustomRoles.GM, "#ff5b70"}, //サブ役職 @@ -407,7 +421,7 @@ public class Main : BasePlugin {CustomRoles.Madmate, "#ff1919"}, {CustomRoles.Watcher, "#800080"}, {CustomRoles.Flashman, "#ff8400"}, - {CustomRoles.Lighter, "#eee5be"}, + {CustomRoles.Torch, "#eee5be"}, {CustomRoles.Seer, "#61b26c"}, {CustomRoles.Brakar, "#1447af"}, {CustomRoles.Oblivious, "#424242"}, @@ -597,6 +611,9 @@ public enum CustomRoles Needy, SuperStar, CyberStar, + Demolitionist, + NiceEraser, + TaskManager, Mayor, Paranoia, Psychic, @@ -615,7 +632,9 @@ public enum CustomRoles Veteran, Bodyguard, Counterfeiter, + Witness, Grenadier, + Lighter, Medic, Divinator, Glitch, @@ -673,6 +692,9 @@ public enum CustomRoles BloodKnight, Wraith, Totocalcio, + Romantic, + VengefulRomantic, + RuthlessRomantic, Succubus, Virus, Pursuer, @@ -680,7 +702,7 @@ public enum CustomRoles Jinx, Maverick, CursedSoul, - Pirate, + //Pirate, Ritualist, Pickpocket, Traitor, @@ -711,7 +733,7 @@ public enum CustomRoles Madmate, Watcher, Flashman, - Lighter, + Torch, Seer, Brakar, Oblivious, @@ -791,7 +813,7 @@ public enum CustomWinner HexMaster = CustomRoles.HexMaster, Succubus = CustomRoles.Succubus, Wraith = CustomRoles.Wraith, - Pirate = CustomRoles.Pirate, + //Pirate = CustomRoles.Pirate, SerialKiller = CustomRoles.NSerialKiller, Witch = CustomRoles.NWitch, Juggernaut = CustomRoles.Juggernaut, @@ -813,6 +835,7 @@ public enum CustomWinner Plaguebearer = CustomRoles.PlagueBearer, Masochist = CustomRoles.Masochist, Doomsayer = CustomRoles.Doomsayer, + RuthlessRomantic = CustomRoles.RuthlessRomantic } public enum AdditionalWinners { @@ -826,6 +849,8 @@ public enum AdditionalWinners Sunnyboy = CustomRoles.Sunnyboy, Witch = CustomRoles.NWitch, Totocalcio = CustomRoles.Totocalcio, + Romantic = CustomRoles.Romantic, + VengefulRomantic = CustomRoles.VengefulRomantic, Jackal = CustomRoles.Jackal, Sidekick = CustomRoles.Sidekick, Pursuer = CustomRoles.Pursuer,