diff --git a/Helpers/CustomRolesHelper.cs b/Helpers/CustomRolesHelper.cs index b9efc1e05..30b5556cb 100644 --- a/Helpers/CustomRolesHelper.cs +++ b/Helpers/CustomRolesHelper.cs @@ -150,20 +150,29 @@ CustomRoles.PurpleLovers or } public static bool IsRiaju(this PlayerControl pc, bool checkonelover = true) { - return pc.Is(CustomRoles.Lovers) || pc.Is(CustomRoles.RedLovers) || pc.Is(CustomRoles.YellowLovers) || pc.Is(CustomRoles.BlueLovers) || pc.Is(CustomRoles.GreenLovers) || pc.Is(CustomRoles.WhiteLovers) || pc.Is(CustomRoles.PurpleLovers) || pc.Is(CustomRoles.MadonnaLovers) || (pc.Is(CustomRoles.OneLove) && checkonelover); + return pc.Is(CustomRoles.Lovers) || pc.Is(CustomRoles.RedLovers) || + pc.Is(CustomRoles.YellowLovers) || pc.Is(CustomRoles.BlueLovers) || + pc.Is(CustomRoles.GreenLovers) || pc.Is(CustomRoles.WhiteLovers) || + pc.Is(CustomRoles.PurpleLovers) || pc.Is(CustomRoles.MadonnaLovers) || + (pc.Is(CustomRoles.OneLove) && checkonelover); } public static CustomRoles GetRiaju(this PlayerControl pc) { if (pc == null) return CustomRoles.NotAssigned; - if (pc.Is(CustomRoles.Lovers)) return CustomRoles.Lovers; - if (pc.Is(CustomRoles.RedLovers)) return CustomRoles.RedLovers; - if (pc.Is(CustomRoles.YellowLovers)) return CustomRoles.YellowLovers; - if (pc.Is(CustomRoles.BlueLovers)) return CustomRoles.BlueLovers; - if (pc.Is(CustomRoles.GreenLovers)) return CustomRoles.GreenLovers; - if (pc.Is(CustomRoles.WhiteLovers)) return CustomRoles.WhiteLovers; - if (pc.Is(CustomRoles.PurpleLovers)) return CustomRoles.PurpleLovers; - if (pc.Is(CustomRoles.MadonnaLovers)) return CustomRoles.MadonnaLovers; - if (pc.Is(CustomRoles.OneLove)) return CustomRoles.OneLove; + var state = PlayerState.GetByPlayerId(pc.PlayerId); + foreach (var sub in state.SubRoles) + switch (sub) + { + case CustomRoles.Lovers: return CustomRoles.Lovers; + case CustomRoles.RedLovers: return CustomRoles.RedLovers; + case CustomRoles.YellowLovers: return CustomRoles.YellowLovers; + case CustomRoles.BlueLovers: return CustomRoles.BlueLovers; + case CustomRoles.GreenLovers: return CustomRoles.GreenLovers; + case CustomRoles.WhiteLovers: return CustomRoles.WhiteLovers; + case CustomRoles.PurpleLovers: return CustomRoles.PurpleLovers; + case CustomRoles.OneLove: return CustomRoles.OneLove; + case CustomRoles.MadonnaLovers: return CustomRoles.MadonnaLovers; + } return CustomRoles.NotAssigned; } public static bool IsWhiteCrew(this CustomRoles roles) @@ -193,8 +202,8 @@ public static bool CheckGuesser() if (RoleAddAddons.GetRoleAddon(role, out var op, subrole: CustomRoles.Guesser)) if (op.GiveGuesser.GetBool()) return true; } - if (CustomRoles.LastImpostor.IsPresent() && LastNeutral.GiveGuesser.GetBool()) return true; - if (CustomRoles.LastNeutral.IsPresent() && LastImpostor.giveguesser) return true; + if (CustomRoles.LastImpostor.IsPresent() && LastImpostor.giveguesser) return true; + if (CustomRoles.LastNeutral.IsPresent() && LastNeutral.GiveGuesser.GetBool()) return true; return false; } diff --git a/Modules/Camouflague.cs b/Modules/Camouflague.cs index 3208ca27a..3f962b23b 100644 --- a/Modules/Camouflague.cs +++ b/Modules/Camouflague.cs @@ -75,9 +75,10 @@ public static void CheckCamouflage() public static List ventplayr = new(); public static void RpcSetSkin(PlayerControl target, bool ForceRevert = false, bool RevertToDefault = false, bool? kyousei = false) { - if (!AmongUsClient.Instance.AmHost && !(Options.CommsCamouflage.GetBool() || (kyousei is null or true))) return; - if (GameStates.IsLobby) return; - if (target == null) return; + if ((!AmongUsClient.Instance.AmHost && !(Options.CommsCamouflage.GetBool() || (kyousei is null or true))) + || (GameStates.IsLobby) + || (target == null)) return; + var id = target.PlayerId; if (IsCamouflage && kyousei is true) @@ -94,7 +95,7 @@ public static void RpcSetSkin(PlayerControl target, bool ForceRevert = false, bo { //コミュサボ解除または強制解除 - if (Main.CheckShapeshift.TryGetValue(id, out var shapeshifting) && target.GetRoleClass() is not IUseTheShButton && shapeshifting && !RevertToDefault && kyousei is not null) + if (Main.CheckShapeshift.TryGetValue(id, out var shapeshifting) /*&& target.GetRoleClass() is not IUseTheShButton */ && shapeshifting && !RevertToDefault && kyousei is not null) { //シェイプシフターなら今の姿のidに変更 id = Main.ShapeshiftTarget[id]; diff --git a/Modules/ChatManager.cs b/Modules/ChatManager.cs index 1113d7f63..3b2b7983b 100644 --- a/Modules/ChatManager.cs +++ b/Modules/ChatManager.cs @@ -57,43 +57,39 @@ public static void SendMessage(PlayerControl player, string message) else if (CommandCheck(message)) operate = 1; else if (message.RemoveHtmlTags() != message) operate = 5;//tagが含まれてるならシステムメッセ - if (operate == 1) + switch (operate) { - message = msg; - cancel = true; - } - else if (operate == 2) - { - message = msg; - cancel = false; - } - else if (operate == 5) - { - message = msg; - cancel = false; - } - else if (operate == 4)//特定の人物が喋ったら消すなどに。 - { - message = msg; - cancel = false; - SendPreviousMessagesToAll(); - } - else if (operate == 6) - { - if (Main.UseYomiage.Value && isalive) ChatCommands.Yomiage(player.Data.DefaultOutfit.ColorId, message).Wait(); - } - else if (operate == 3) - { - if (Main.UseYomiage.Value && isalive) ChatCommands.Yomiage(player.Data.DefaultOutfit.ColorId, message).Wait(); - message = msg; - string chatEntry = $"{player.PlayerId}: {message}"; - chatHistory.Add(chatEntry); - - if (chatHistory.Count > maxHistorySize) - { - chatHistory.RemoveAt(0); - } - cancel = false; + case 1://その他コマンド + message = msg; + cancel = true; + break; + case 2://ゲッサーコマンド + message = msg; + cancel = false; + break; + case 3: //投票の記録、通常のチャット + if (Main.UseYomiage.Value && isalive) ChatCommands.Yomiage(player.Data.DefaultOutfit.ColorId, message).Wait(); + message = msg; + string chatEntry = $"{player.PlayerId}: {message}"; + chatHistory.Add(chatEntry); + if (chatHistory.Count > maxHistorySize) + { + chatHistory.RemoveAt(0); + } + cancel = false; + break; + case 4: //特定の人物が喋ったら消す等 + message = msg; + cancel = false; + SendPreviousMessagesToAll(); + break; + case 5://システムメッセージ + message = msg; + cancel = false; + break; + case 6://ロビーの処理 + if (Main.UseYomiage.Value && isalive) ChatCommands.Yomiage(player.Data.DefaultOutfit.ColorId, message).Wait(); + break; } } diff --git a/Modules/DisableDevice.cs b/Modules/DisableDevice.cs index 97abf5d76..6ca7ea7ba 100644 --- a/Modules/DisableDevice.cs +++ b/Modules/DisableDevice.cs @@ -37,6 +37,7 @@ class DisableDevice public static float optTimeLimitCamAndLog; public static float optTarnTimeLimitCamAndLog; public static float optTimeLimitAdmin; + public static float optTimeLimitVital; public static bool DisableDevicesIgnoreImpostors; public static bool DisableDevicesIgnoreMadmates; public static bool DisableDevicesIgnoreNeutrals; @@ -49,6 +50,7 @@ public static void Reset() optTimeLimitDevices = Options.TimeLimitDevices.GetBool(); optTarnTimeLimitDevice = Options.TarnTimeLimitDevice.GetBool(); optTimeLimitAdmin = Options.TimeLimitAdmin.GetFloat(); + optTimeLimitVital = Options.TimeLimitVital.GetFloat(); DisableDevicesIgnoreImpostors = Options.DisableDevicesIgnoreImpostors.GetBool(); DisableDevicesIgnoreMadmates = Options.DisableDevicesIgnoreMadmates.GetBool(); DisableDevicesIgnoreNeutrals = Options.DisableDevicesIgnoreNeutrals.GetBool(); @@ -79,27 +81,27 @@ public static void StartMeeting() } public static string GetAddminTimer() { - if (optTimeLimitAdmin == 0) return ""; - if ((MapNames)Main.NormalOptions.MapId is MapNames.Fungle) return ""; + if (optTimeLimitAdmin == 0 + || (MapNames)Main.NormalOptions.MapId is MapNames.Fungle) return ""; var a = "Ⓐ"; if (optTimeLimitAdmin <= GameAdminTimer) return a + "×"; else return a + ":" + Math.Round(optTimeLimitAdmin - GameAdminTimer) + "s"; } public static string GetCamTimr() { - if (optTimeLimitCamAndLog == 0) return ""; - if ((MapNames)Main.NormalOptions.MapId is MapNames.Fungle) return ""; + if (optTimeLimitCamAndLog == 0 + || (MapNames)Main.NormalOptions.MapId is MapNames.Fungle) return ""; var a = (MapNames)Main.NormalOptions.MapId is MapNames.Mira ? "Ⓛ" : "Ⓒ"; if (optTimeLimitCamAndLog <= GameLogAndCamTimer) return a + "×"; else return a + ":" + Math.Round(optTimeLimitCamAndLog - GameLogAndCamTimer) + "s"; } public static string GetVitalTimer() { - if (Options.TimeLimitVital.GetFloat() == 0) return ""; - if ((MapNames)Main.NormalOptions.MapId is MapNames.Skeld or MapNames.Mira) return ""; + if (optTimeLimitVital == 0 + || (MapNames)Main.NormalOptions.MapId is MapNames.Skeld or MapNames.Mira) return ""; var a = "Ⓥ"; - if (Options.TimeLimitVital.GetFloat() <= GameVitalTimer) return a + "×"; - else return a + ":" + Math.Round(Options.TimeLimitVital.GetFloat() - GameVitalTimer) + "s"; + if (optTimeLimitVital <= GameVitalTimer) return a + "×"; + else return a + ":" + Math.Round(optTimeLimitVital - GameVitalTimer) + "s"; } public static readonly Dictionary DevicePos = new() { @@ -162,9 +164,9 @@ public static bool VitealUsecheck(PlayerControl player, bool? i = null) if (DemonicCrusher.DemUseAbility) return i == null; - if (Options.TimeLimitVital.GetFloat() > 0 && GameVitalTimer > Options.TimeLimitVital.GetFloat()) return i == null; + if (optTimeLimitVital > 0 && GameVitalTimer > optTimeLimitVital) return i == null; - if (Options.TarnTimeLimitVital.GetFloat() > 0 && TarnVitalTimer > Options.TarnTimeLimitVital.GetFloat()) return i == null; + if (optTimeLimitVital > 0 && TarnVitalTimer > Options.TarnTimeLimitVital.GetFloat()) return i == null; if (player.Is(CustomRoles.InfoPoor) || (RoleAddAddons.GetRoleAddon(player.GetCustomRole(), out var data, player, subrole: CustomRoles.InfoPoor) && @@ -459,19 +461,12 @@ public static void Postfix(VitalsMinigame __instance) if (PlayerControl.LocalPlayer.IsAlive()) { - var ch = true; - if (Options.TimeLimitVital.GetFloat() > 0 && GameVitalTimer > Options.TimeLimitVital.GetFloat()) + if ((optTimeLimitVital > 0 && GameVitalTimer > optTimeLimitVital) + || (optTimeLimitVital > 0 && TarnVitalTimer > optTimeLimitVital)) { __instance.Close(); - ch = false; } - - if (Options.TarnTimeLimitVital.GetFloat() > 0 && TarnVitalTimer > Options.TarnTimeLimitVital.GetFloat()) - { - __instance.Close(); - ch = false; - } - if (ch) + else { if (optTimeLimitDevices) GameVitalTimer += Time.fixedDeltaTime; if (optTarnTimeLimitDevice) TarnVitalTimer += Time.fixedDeltaTime; @@ -491,12 +486,8 @@ public static void Postfix(PlanetSurveillanceMinigame __instance) if (PlayerControl.LocalPlayer.IsAlive() && DemonicCrusher.DemUseAbility) __instance.Close(); if (PlayerControl.LocalPlayer.IsAlive() && __instance) { - if (optTimeLimitCamAndLog > 0 && GameLogAndCamTimer > optTimeLimitCamAndLog) - { - __instance.Close(); - } - - if (optTarnTimeLimitCamAndLog > 0 && TarnLogAndCamTimer > optTarnTimeLimitCamAndLog) + if ((optTimeLimitCamAndLog > 0 && GameLogAndCamTimer > optTimeLimitCamAndLog) + || (optTarnTimeLimitCamAndLog > 0 && TarnLogAndCamTimer > optTarnTimeLimitCamAndLog)) { __instance.Close(); } @@ -515,10 +506,8 @@ public static void Postfix(SurveillanceMinigame __instance) if (PlayerControl.LocalPlayer.IsAlive() && __instance) { - if (optTimeLimitCamAndLog > 0 && GameLogAndCamTimer > optTimeLimitCamAndLog) - __instance.Close(); - - if (optTarnTimeLimitCamAndLog > 0 && TarnLogAndCamTimer > optTarnTimeLimitCamAndLog) + if ((optTimeLimitCamAndLog > 0 && GameLogAndCamTimer > optTimeLimitCamAndLog) + || (optTarnTimeLimitCamAndLog > 0 && TarnLogAndCamTimer > optTarnTimeLimitCamAndLog)) __instance.Close(); } } @@ -536,19 +525,12 @@ public static void Postfix(SecurityLogGame __instance) if (PlayerControl.LocalPlayer.IsAlive() && __instance) { - var ch = true; - if (optTimeLimitCamAndLog > 0 && GameLogAndCamTimer > optTimeLimitCamAndLog) - { - __instance.Close(); - ch = false; - } - - if (optTarnTimeLimitCamAndLog > 0 && TarnLogAndCamTimer > optTarnTimeLimitCamAndLog) + if ((optTimeLimitCamAndLog > 0 && GameLogAndCamTimer > optTimeLimitCamAndLog) + || (optTarnTimeLimitCamAndLog > 0 && TarnLogAndCamTimer > optTarnTimeLimitCamAndLog)) { __instance.Close(); - ch = false; } - if (ch) + else { if (optTimeLimitDevices) GameLogAndCamTimer += Time.fixedDeltaTime; if (optTarnTimeLimitDevice) TarnLogAndCamTimer += Time.fixedDeltaTime; @@ -574,19 +556,12 @@ public static void Prefix(MapCountOverlay __instance) } if (PlayerControl.LocalPlayer.IsAlive() && MapBehaviour.Instance && __instance) { - var ch = true; - if (optTimeLimitAdmin > 0 && GameAdminTimer > optTimeLimitAdmin) - { - MapBehaviour.Instance.Close(); - ch = false; - } - - if (optTimeLimitAdmin > 0 && TarnAdminTimer > optTimeLimitAdmin) + if ((optTimeLimitAdmin > 0 && GameAdminTimer > optTimeLimitAdmin) + || (optTimeLimitAdmin > 0 && TarnAdminTimer > optTimeLimitAdmin)) { MapBehaviour.Instance.Close(); - ch = false; } - if (ch) + else { if (optTimeLimitDevices) GameAdminTimer += Time.fixedDeltaTime; if (optTarnTimeLimitDevice) TarnAdminTimer += Time.fixedDeltaTime; diff --git a/Modules/GameOptionsSender/PlayerGameOptionsSender.cs b/Modules/GameOptionsSender/PlayerGameOptionsSender.cs index 781366c82..bc7bf1ffd 100644 --- a/Modules/GameOptionsSender/PlayerGameOptionsSender.cs +++ b/Modules/GameOptionsSender/PlayerGameOptionsSender.cs @@ -212,7 +212,7 @@ public override IGameOptions BuildGameOptions() } state.taskState.hasTasks = UtilsTask.HasTasks(player.Data, false); - if ((GhostCanSeeOtherVotes.GetBool() || !Options.GhostOptions.GetBool()) && player.Data.IsDead && !player.Is(CustomRoles.AsistingAngel) && (!player.IsGorstRole() || GRCanSeeOtherVotes.GetBool())) + if ((GhostCanSeeOtherVotes.GetBool() || !GhostOptions.GetBool()) && player.Data.IsDead && !player.Is(CustomRoles.AsistingAngel) && (!player.IsGorstRole() || GRCanSeeOtherVotes.GetBool())) opt.SetBool(BoolOptionNames.AnonymousVotes, false); if (AdditionalEmergencyCooldown.GetBool() && AdditionalEmergencyCooldownThreshold.GetInt() <= PlayerCatch.AllAlivePlayersCount) { diff --git a/Modules/GuessManager.cs b/Modules/GuessManager.cs index 9a2634bc8..c6e5cfa4a 100644 --- a/Modules/GuessManager.cs +++ b/Modules/GuessManager.cs @@ -82,6 +82,7 @@ public static bool GuesserMsg(PlayerControl pc, string msg, bool isUI = false) if (!pc.IsAlive()) return true;//本当は悪あがきはやめなって処理入れたかった(´・ω・`)←入れてもいいけどめんどくs(((!(?) if (operate == 2) { + var RoleTypes = pc.GetCustomRole().GetCustomRoleTypes(); if (!Options.ExHideChatCommand.GetBool()) { if (pc.IsAlive()) ChatManager.SendPreviousMessagesToAll(); @@ -128,21 +129,24 @@ public static bool GuesserMsg(PlayerControl pc, string msg, bool isUI = false) if (targetroleclass?.CheckGuess(pc) == null && targetroleclass != null) return true; //陣営事に区別する - if (pc.Is(CustomRoleTypes.Impostor)) if (GuessCountImp(pc)) return true; - if (pc.Is(CustomRoleTypes.Neutral)) if (GuessCountNeu(pc)) return true; - if (pc.Is(CustomRoleTypes.Crewmate) || pc.Is(CustomRoleTypes.Madmate)) if (GuessCountCrewandMad(pc)) return true; - //クルーとマッドは処理一緒だからまとめる。 - - if (role == CustomRoles.GM || target.Is(CustomRoles.GM)) return true; - - if (role.IsAddOn()) - return true; + switch (RoleTypes) + { + case CustomRoleTypes.Impostor: + if (GuessCountImp(pc) || role is CustomRoles.Egoist) return true; + break; + case CustomRoleTypes.Neutral: + if (GuessCountNeu(pc)) return true; + break; + //クルーとマッドは処理一緒だからまとめる。 + case CustomRoleTypes.Crewmate: + case CustomRoleTypes.Madmate: + if (GuessCountCrewandMad(pc)) return true; + break; + } - if (role.IsGorstRole()) + if (role == CustomRoles.GM || target.Is(CustomRoles.GM) || role.IsAddOn() || role.IsGorstRole()) return true; - if (pc.Is(CustomRoleTypes.Impostor) && role == CustomRoles.Egoist) - return true; if (pc.Is(CustomRoles.Egoist) && target.Is(CustomRoleTypes.Impostor) && Guesser.ICanGuessNakama.GetBool()) return true; @@ -160,20 +164,30 @@ public static bool GuesserMsg(PlayerControl pc, string msg, bool isUI = false) { guesserSuicide = false; } - //ここから陣営事に処理決める - if (pc.Is(CustomRoleTypes.Impostor)) - if (ImpHantei(pc, target)) guesserSuicide = true; - if (pc.Is(CustomRoleTypes.Crewmate)) - if (CrewHantei(pc, target)) guesserSuicide = true; - if (pc.Is(CustomRoleTypes.Madmate)) - if (MadHantei(pc, target)) guesserSuicide = true; - if (pc.Is(CustomRoleTypes.Neutral)) - if (NeuHantei(pc, target)) guesserSuicide = true; - + else if (targetroleclass?.CheckGuess(pc) == false) { guesserSuicide = true; } + else + { + //ここから陣営事に処理決める + switch (RoleTypes) + { + case CustomRoleTypes.Impostor: + guesserSuicide |= ImpHantei(pc, target); + break; + case CustomRoleTypes.Crewmate: + guesserSuicide |= CrewHantei(pc, target); + break; + case CustomRoleTypes.Madmate: + guesserSuicide |= MadHantei(pc, target); + break; + case CustomRoleTypes.Neutral: + guesserSuicide |= NeuHantei(pc, target); + break; + } + } //自殺が決まってないなら処理 if (CheckTargetRoles(target, role) && !guesserSuicide) @@ -600,11 +614,12 @@ public static bool GuessCountImp(PlayerControl pc) { CustomRoles? RoleNullable = pc?.GetCustomRole(); CustomRoles role = RoleNullable.Value; + var roleaddon = RoleAddAddons.GetRoleAddon(role, out var data, pc, subrole: CustomRoles.Guesser); //全体 var tama = 0; if (pc.Is(CustomRoles.Guesser)) tama = Guesser.CanGuessTime.GetInt(); - if (RoleAddAddons.GetRoleAddon(role, out var data, pc, subrole: CustomRoles.Guesser) && data.GiveGuesser.GetBool()) + if (roleaddon && data.GiveGuesser.GetBool()) { if (data.AddTama.GetBool()) tama += data.CanGuessTime.GetInt(); else tama = data.CanGuessTime.GetInt(); @@ -615,7 +630,7 @@ public static bool GuessCountImp(PlayerControl pc) //1会議 var mtama = 0; if (pc.Is(CustomRoles.Guesser)) mtama = Guesser.CanGuessTime.GetInt(); - if (RoleAddAddons.GetRoleAddon(role, out var d, pc) && data.GiveAddons.GetBool() && data.GiveGuesser.GetBool()) if (d.GiveGuesser.GetBool()) mtama = d.OwnCanGuessTime.GetInt(); + if (roleaddon && data.GiveGuesser.GetBool()) if (data.GiveGuesser.GetBool()) mtama = data.OwnCanGuessTime.GetInt(); if (pc.Is(CustomRoles.LastImpostor) && LastImpostor.giveguesser) mtama = LastImpostor.CanGuessTime.GetInt(); if (GuesserGuessed[pc.PlayerId] >= tama) @@ -635,11 +650,12 @@ public static bool GuessCountNeu(PlayerControl pc) { CustomRoles? RoleNullable = pc?.GetCustomRole(); CustomRoles role = RoleNullable.Value; + var roleaddon = RoleAddAddons.GetRoleAddon(role, out var data, pc, subrole: CustomRoles.Guesser); //全体 var tama = 0; if (pc.Is(CustomRoles.Guesser)) tama = Guesser.CanGuessTime.GetInt(); - if (RoleAddAddons.GetRoleAddon(role, out var data, pc, subrole: CustomRoles.Guesser)) + if (roleaddon && data.GiveGuesser.GetBool()) { if (data.AddTama.GetBool()) tama += data.CanGuessTime.GetInt(); else tama = data.CanGuessTime.GetInt(); @@ -651,7 +667,7 @@ public static bool GuessCountNeu(PlayerControl pc) //1会議 var mtama = 0; if (pc.Is(CustomRoles.Guesser)) mtama = Guesser.CanGuessTime.GetInt(); - if (RoleAddAddons.GetRoleAddon(role, out var d, pc, subrole: CustomRoles.Guesser)) if (d.GiveGuesser.GetBool()) mtama = d.OwnCanGuessTime.GetInt(); + if (roleaddon && data.GiveGuesser.GetBool()) mtama = data.OwnCanGuessTime.GetInt(); if (pc.Is(CustomRoles.LastNeutral) && LastNeutral.GiveGuesser.GetBool()) mtama = LastNeutral.CanGuessTime.GetInt(); if (GuesserGuessed[pc.PlayerId] >= tama) @@ -672,10 +688,12 @@ public static bool GuessCountCrewandMad(PlayerControl pc) CustomRoles? RoleNullable = pc?.GetCustomRole(); CustomRoles role = RoleNullable.Value; + var roleaddon = RoleAddAddons.GetRoleAddon(role, out var data, pc, subrole: CustomRoles.Guesser); + //全体 var tama = 0; if (pc.Is(CustomRoles.Guesser)) tama = Guesser.CanGuessTime.GetInt(); - if (RoleAddAddons.GetRoleAddon(role, out var data, pc, subrole: CustomRoles.Guesser)) + if (roleaddon && data.GiveGuesser.GetBool()) { if (data.AddTama.GetBool()) tama += data.CanGuessTime.GetInt(); else tama = data.CanGuessTime.GetInt(); @@ -684,7 +702,7 @@ public static bool GuessCountCrewandMad(PlayerControl pc) //1会議 var mtama = 0; if (pc.Is(CustomRoles.Guesser)) mtama = Guesser.CanGuessTime.GetInt(); - if (RoleAddAddons.GetRoleAddon(role, out var d, pc, subrole: CustomRoles.Guesser)) if (d.GiveGuesser.GetBool()) mtama = d.OwnCanGuessTime.GetInt(); + if (roleaddon && data.GiveGuesser.GetBool()) mtama = data.OwnCanGuessTime.GetInt(); if (GuesserGuessed[pc.PlayerId] >= tama) { @@ -704,11 +722,12 @@ public static bool ImpHantei(PlayerControl pc, PlayerControl target) { CustomRoles? RoleNullable = pc?.GetCustomRole(); CustomRoles role = RoleNullable.Value; + var roleaddon = RoleAddAddons.GetRoleAddon(role, out var data, pc, subrole: CustomRoles.Guesser); if (target.Is(CustomRoles.Snitch) && target.AllTasksCompleted()) { var dame = Guesser.ICanGuessTaskDoneSnitch.GetBool(); - if (RoleAddAddons.GetRoleAddon(role, out var data, pc, subrole: CustomRoles.Guesser)) if (data.GiveGuesser.GetBool()) dame = data.ICanGuessTaskDoneSnitch.GetBool(); + if (roleaddon && data.GiveGuesser.GetBool()) dame = data.ICanGuessTaskDoneSnitch.GetBool(); if (pc.Is(CustomRoles.LastImpostor) && LastImpostor.giveguesser) dame = LastImpostor.ICanGuessTaskDoneSnitch.GetBool(); if (!dame) { @@ -720,7 +739,7 @@ public static bool ImpHantei(PlayerControl pc, PlayerControl target) if (role.IsImpostor() && target.Is(CustomRoleTypes.Impostor)) { var Nakama = Guesser.ICanGuessNakama.GetBool(); - if (RoleAddAddons.GetRoleAddon(role, out var data, pc, subrole: CustomRoles.Guesser)) if (data.GiveGuesser.GetBool()) Nakama = data.ICanGuessNakama.GetBool(); + if (roleaddon && data.GiveGuesser.GetBool()) Nakama = data.ICanGuessNakama.GetBool(); if (pc.Is(CustomRoles.LastImpostor) && LastImpostor.giveguesser) Nakama = LastImpostor.ICanGuessNakama.GetBool(); if (!Nakama) return true; } @@ -728,7 +747,7 @@ public static bool ImpHantei(PlayerControl pc, PlayerControl target) if (role.IsWhiteCrew()) { var WC = Guesser.ICanWhiteCrew.GetBool(); - if (RoleAddAddons.GetRoleAddon(role, out var data, pc, subrole: CustomRoles.Guesser)) if (data.GiveGuesser.GetBool()) WC = data.ICanWhiteCrew.GetBool(); + if (roleaddon && data.GiveGuesser.GetBool()) WC = data.ICanWhiteCrew.GetBool(); if (pc.Is(CustomRoles.LastImpostor) && LastImpostor.giveguesser) WC = LastImpostor.ICanWhiteCrew.GetBool(); if (!WC) return true; } @@ -736,7 +755,7 @@ public static bool ImpHantei(PlayerControl pc, PlayerControl target) if (role.IsVanilla()) { var va = Guesser.ICanGuessVanilla.GetBool(); - if (RoleAddAddons.GetRoleAddon(role, out var data, pc, subrole: CustomRoles.Guesser)) if (data.GiveGuesser.GetBool()) va = data.ICanGuessVanilla.GetBool(); + if (roleaddon && data.GiveGuesser.GetBool()) va = data.ICanGuessVanilla.GetBool(); if (pc.Is(CustomRoles.LastImpostor) && LastImpostor.giveguesser) va = LastImpostor.ICanGuessVanilla.GetBool(); if (!va) return true; } @@ -746,12 +765,13 @@ public static bool NeuHantei(PlayerControl pc, PlayerControl target) { CustomRoles? RoleNullable = pc?.GetCustomRole(); CustomRoles role = RoleNullable.Value; + var roleaddon = RoleAddAddons.GetRoleAddon(role, out var data, pc, subrole: CustomRoles.Guesser); //スニッチを撃ちぬけるか if (target.Is(CustomRoles.Snitch) && target.AllTasksCompleted()) { var dame = Guesser.NCanGuessTaskDoneSnitch.GetBool(); - if (RoleAddAddons.GetRoleAddon(role, out var data, pc, subrole: CustomRoles.Guesser)) if (data.GiveGuesser.GetBool()) dame = data.ICanGuessTaskDoneSnitch.GetBool(); + if (roleaddon && data.GiveGuesser.GetBool()) dame = data.ICanGuessTaskDoneSnitch.GetBool(); if (pc.Is(CustomRoles.LastNeutral) && LastNeutral.GiveGuesser.GetBool()) dame = LastNeutral.ICanGuessTaskDoneSnitch.GetBool(); if (!dame) { @@ -763,7 +783,7 @@ public static bool NeuHantei(PlayerControl pc, PlayerControl target) if (role.IsWhiteCrew()) { var WC = Guesser.NCanWhiteCrew.GetBool(); - if (RoleAddAddons.GetRoleAddon(role, out var data, pc, subrole: CustomRoles.Guesser)) if (data.GiveGuesser.GetBool()) WC = data.ICanWhiteCrew.GetBool(); + if (roleaddon && data.GiveGuesser.GetBool()) WC = data.ICanWhiteCrew.GetBool(); if (pc.Is(CustomRoles.LastNeutral) && LastNeutral.GiveGuesser.GetBool()) WC = LastNeutral.ICanWhiteCrew.GetBool(); if (!WC) return true; } @@ -771,7 +791,7 @@ public static bool NeuHantei(PlayerControl pc, PlayerControl target) if (role.IsVanilla()) { var va = Guesser.NCanGuessVanilla.GetBool(); - if (RoleAddAddons.GetRoleAddon(role, out var data, pc, subrole: CustomRoles.Guesser)) if (data.GiveGuesser.GetBool()) va = data.ICanGuessVanilla.GetBool(); + if (roleaddon && data.GiveGuesser.GetBool()) va = data.ICanGuessVanilla.GetBool(); if (pc.Is(CustomRoles.LastNeutral) && LastNeutral.GiveGuesser.GetBool()) va = LastNeutral.ICanGuessVanilla.GetBool(); if (!va) return true; } @@ -781,11 +801,12 @@ public static bool MadHantei(PlayerControl pc, PlayerControl target) { CustomRoles? RoleNullable = pc?.GetCustomRole(); CustomRoles role = RoleNullable.Value; + var roleaddon = RoleAddAddons.GetRoleAddon(role, out var data, pc, subrole: CustomRoles.Guesser); if (target.Is(CustomRoles.Snitch) && target.AllTasksCompleted()) { var dame = Guesser.MCanGuessTaskDoneSnitch.GetBool(); - if (RoleAddAddons.GetRoleAddon(role, out var data, pc, subrole: CustomRoles.Guesser)) if (data.GiveGuesser.GetBool()) dame = data.ICanGuessTaskDoneSnitch.GetBool(); + if (roleaddon && data.GiveGuesser.GetBool()) dame = data.ICanGuessTaskDoneSnitch.GetBool(); if (!dame) { Utils.SendMessage(string.Format(GetString("GuessSnitch"), GetString("Madmate")), pc.PlayerId, Utils.ColorString(Palette.ImpostorRed, "【=== 全てわかってる奴は打てないよ ===】")); @@ -796,21 +817,21 @@ public static bool MadHantei(PlayerControl pc, PlayerControl target) if (role.IsImpostorTeam() && (target.Is(CustomRoleTypes.Impostor) || target.Is(CustomRoleTypes.Madmate))) { var Nakama = Guesser.MCanGuessNakama.GetBool(); - if (RoleAddAddons.GetRoleAddon(role, out var data, pc, subrole: CustomRoles.Guesser)) if (data.GiveGuesser.GetBool()) Nakama = data.ICanGuessNakama.GetBool(); + if (roleaddon && data.GiveGuesser.GetBool()) Nakama = data.ICanGuessNakama.GetBool(); if (!Nakama) return true; } //各白を打ち抜けるか if (role.IsWhiteCrew()) { var WC = Guesser.MCanWhiteCrew.GetBool(); - if (RoleAddAddons.GetRoleAddon(role, out var data, pc, subrole: CustomRoles.Guesser)) if (data.GiveGuesser.GetBool()) WC = data.ICanWhiteCrew.GetBool(); + if (roleaddon && data.GiveGuesser.GetBool()) WC = data.ICanWhiteCrew.GetBool(); if (!WC) return true; } //バニラを撃ちぬけるか if (role.IsVanilla()) { var va = Guesser.MCanGuessVanilla.GetBool(); - if (RoleAddAddons.GetRoleAddon(role, out var data, pc, subrole: CustomRoles.Guesser)) if (data.GiveGuesser.GetBool()) va = data.ICanGuessVanilla.GetBool(); + if (roleaddon && data.GiveGuesser.GetBool()) va = data.ICanGuessVanilla.GetBool(); if (!va) return true; } return false; @@ -819,26 +840,27 @@ public static bool CrewHantei(PlayerControl pc, PlayerControl target) { CustomRoles? RoleNullable = pc?.GetCustomRole(); CustomRoles role = RoleNullable.Value; + var roleaddon = RoleAddAddons.GetRoleAddon(role, out var data, pc, subrole: CustomRoles.Guesser); //仲間を撃ちぬけるか if (role.IsCrewmate() && target.Is(CustomRoleTypes.Crewmate)) { var Nakama = Guesser.CCanGuessNakama.GetBool(); - if (RoleAddAddons.GetRoleAddon(role, out var data, pc, subrole: CustomRoles.Guesser)) if (data.GiveGuesser.GetBool()) Nakama = data.ICanGuessNakama.GetBool(); + if (roleaddon && data.GiveGuesser.GetBool()) Nakama = data.ICanGuessNakama.GetBool(); if (!Nakama) return true; } //各白を打ち抜けるか if (role.IsWhiteCrew()) { var WC = Guesser.CCanWhiteCrew.GetBool(); - if (RoleAddAddons.GetRoleAddon(role, out var data, pc, subrole: CustomRoles.Guesser)) if (data.GiveGuesser.GetBool()) WC = data.ICanWhiteCrew.GetBool(); + if (roleaddon && data.GiveGuesser.GetBool()) WC = data.ICanWhiteCrew.GetBool(); if (!WC) return true; } //バニラを撃ちぬけるか if (role.IsVanilla()) { var va = Guesser.CCanGuessVanilla.GetBool(); - if (RoleAddAddons.GetRoleAddon(role, out var data, pc, subrole: CustomRoles.Guesser)) if (data.GiveGuesser.GetBool()) va = data.ICanGuessVanilla.GetBool(); + if (roleaddon && data.GiveGuesser.GetBool()) va = data.ICanGuessVanilla.GetBool(); if (!va) return true; } return false; diff --git a/Modules/MeetingTimeManager.cs b/Modules/MeetingTimeManager.cs index 91a1bbfce..10fd0d946 100644 --- a/Modules/MeetingTimeManager.cs +++ b/Modules/MeetingTimeManager.cs @@ -3,7 +3,6 @@ using TownOfHost.Roles.Core; using TownOfHost.Roles.Core.Interfaces; -using TownOfHost.Roles.Crewmate; namespace TownOfHost.Modules { @@ -57,8 +56,6 @@ public static void OnReportDeadBody() { if (role is IMeetingTimeAlterable meetingTimeAlterable) { - // Hyz-sui: 会議時間をいじる役職が増えたら上限&下限設定の置き場所要検討 - if (!role.Player.IsAlive() && meetingTimeAlterable.RevertOnDie) { continue; diff --git a/Modules/MeetingVoteManager.cs b/Modules/MeetingVoteManager.cs index 5a4e97ce2..d5a1d504a 100644 --- a/Modules/MeetingVoteManager.cs +++ b/Modules/MeetingVoteManager.cs @@ -79,7 +79,6 @@ public void SetVote(byte voter, byte voteFor, int numVotes = 1, bool isIntention var player = PlayerCatch.GetPlayerById(voter); var votetarget = PlayerCatch.GetPlayerById(voteFor); RoleAddAddons.GetRoleAddon(player.GetCustomRole(), out var data, player, subrole: [CustomRoles.Elector, CustomRoles.PlusVote, CustomRoles.Notvoter]); - var giveaddon = data.GiveAddons.GetBool(); if (!votetarget.IsAlive() && voteFor != Skip && voteFor != NoVote) { @@ -88,7 +87,7 @@ public void SetVote(byte voter, byte voteFor, int numVotes = 1, bool isIntention return; } - if ((player.Is(CustomRoles.Elector) || (giveaddon && data.GiveElector.GetBool())) && voteFor == Skip) + if ((player.Is(CustomRoles.Elector) || data.GiveElector.GetBool()) && voteFor == Skip) { logger.Info($"{player.GetNameWithRole().RemoveHtmlTags()} スキップ投票は取り消されます"); doVote = false; @@ -119,13 +118,13 @@ public void SetVote(byte voter, byte voteFor, int numVotes = 1, bool isIntention } //プラスポート - if (giveaddon && data.GivePlusVote.GetBool()) + if (data.GivePlusVote.GetBool()) numVotes += data.AdditionalVote.GetInt(); if (player.Is(CustomRoles.PlusVote)) numVotes += PlusVote.AdditionalVote.GetInt(); //ノットヴォウター - if (player.Is(CustomRoles.Notvoter) || (giveaddon && data.GiveNotvoter.GetBool())) + if (player.Is(CustomRoles.Notvoter) || data.GiveNotvoter.GetBool()) { logger.Info($"{player.GetNameWithRole().RemoveHtmlTags()} の {player.GetNameWithRole().RemoveHtmlTags()} の投票数を 0 に変更します"); numVotes = 0; diff --git a/Modules/ModUpdater.cs b/Modules/ModUpdater.cs index c95d94b93..d692a243a 100644 --- a/Modules/ModUpdater.cs +++ b/Modules/ModUpdater.cs @@ -195,19 +195,29 @@ public static async Task CheckRelease(bool beta = false, bool all = false, } isChecked = true; isBroken = false; - body = data["body"].ToString(); - /*body = data["body"].ToString(); - - // Subverのチェック。 - // バージョンが同一で、                現在のサブバージョンがGitHubに記載されてなくて、        サブバージョンの記載がある時~ - if (latestVersion.CompareTo(Main.version) == 0 && !body.Contains($"PluginSubVersion:{Main.PluginSubVersion}") && body.Contains($"PluginSubVersion:")) + var ages = data["body"].ToString().Split("## "); + for (var i = 0; i < ages.Length - 1; i++) { - hasUpdate = true; - isSubUpdata = true; - var entryParts = body.Split("luginSubVersion:"); - var subvarsion = 1 <= entryParts.Length ? entryParts[1].Trim() : "?"; - latestTitle += $"{subvarsion.RemoveText(true)}"; + if (i == 0) + { + body = ages[0] + ""; + continue; + } + if (i == 1) continue; + var ages2 = ages[i].Split("\n"); + for (var i2 = 0; i2 < ages2.Length; i2++) + { + if (i2 == 0) + { + body += $"{ages2[i2]}"; + body += "\n"; + continue; + } + body += ages2[i2] + "\n"; + } } + /*body = data["body"].ToString(); + else isSubUpdata = false; *///if (body.Contains("📢公開ルーム○")) publicok = true; //else if (body.Contains("📢公開ルーム×")) publicok = false; diff --git a/Modules/OptionHolder.cs b/Modules/OptionHolder.cs index ec4902245..941cb764e 100644 --- a/Modules/OptionHolder.cs +++ b/Modules/OptionHolder.cs @@ -97,7 +97,6 @@ public static void WaitOptionsLoad() //試験的機能 public static OptionItem ExperimentalMode; - public static OptionItem ExMeetingblackout; public static OptionItem ExAftermeetingflash; public static OptionItem ExHideChatCommand; public static OptionItem FixSpawnPacketSize; @@ -636,8 +635,6 @@ public static void Load() // 試験的機能 ExperimentalMode = BooleanOptionItem.Create(300000, "ExperimentalMode", false, TabGroup.MainSettings, false).SetColor(Palette.CrewmateSettingChangeText) .SetGameMode(CustomGameMode.Standard); - ExMeetingblackout = BooleanOptionItem.Create(300001, "ExMeetingblackout", false, TabGroup.MainSettings, false).SetParent(ExperimentalMode) - .SetGameMode(CustomGameMode.Standard); ExAftermeetingflash = BooleanOptionItem.Create(300002, "ExAftermeetingflash", false, TabGroup.MainSettings, false).SetParent(ExperimentalMode) .SetGameMode(CustomGameMode.Standard); ExHideChatCommand = BooleanOptionItem.Create(300003, "ExHideChatCommand", false, TabGroup.MainSettings, false).SetParent(ExperimentalMode) @@ -687,9 +684,9 @@ public static void Load() // Madmate, Crewmate, Neutral sortedRoleInfo.Where(role => role.CustomRoleType != CustomRoleTypes.Impostor).Do(info => { -#if RELEASE - if (info.RoleName == CustomRoles.Cakeshop && !(((DateTime.Now.Month == 10 && DateTime.Now.Day is 31 ) || DateTime.Now.Month == 11 && DateTime.Now.Day < 4)&& DateTime.Now.Year == 2024)) return; -#endif + //#if RELEASE + if (info.RoleName == CustomRoles.Cakeshop && !((DateTime.Now.Month == 12 && 20 <= DateTime.Now.Day) || (DateTime.Now.Month == 1 && DateTime.Now.Day <= 8))) return; + //#endif SetupRoleOptions(info); info.OptionCreator?.Invoke(); }); @@ -802,7 +799,7 @@ public static void Load() CuseVent = BooleanOptionItem.Create(101701, "Can'tUseVent", false, TabGroup.MainSettings, false).SetParent(MapModification); CuseVentCount = FloatOptionItem.Create(101702, "CuseVentCount", new(1f, 15f, 1f), 5f, TabGroup.MainSettings, false).SetValueFormat(OptionFormat.Players).SetParent(CuseVent); // タスク無効化 - UploadDataIsLongTask = BooleanOptionItem.Create(101703, "UploadDataIsLongTask", false, TabGroup.MainSettings, false).SetParent(MapModification) + UploadDataIsLongTask = BooleanOptionItem.Create(101703, "UploadDataIsLongTask", false, TabGroup.MainSettings, false) .SetGameMode(CustomGameMode.All) .SetParent(MapModification); DisableTasks = BooleanOptionItem.Create(100300, "DisableTasks", false, TabGroup.MainSettings, false).SetParent(MapModification) diff --git a/Modules/OptionItem/OptionItem.cs b/Modules/OptionItem/OptionItem.cs index d246584b0..3853e5ed8 100644 --- a/Modules/OptionItem/OptionItem.cs +++ b/Modules/OptionItem/OptionItem.cs @@ -190,8 +190,7 @@ bool CheckRoleOption(OptionItem option) if (option == null) return false; var intopiton = option as IntegerOptionItem; if (intopiton == null) return false; - if (Options.CustomRoleSpawnChances.ContainsValue(intopiton)) return true; - return false; + return Options.CustomRoleSpawnChances.ContainsValue(intopiton); } /* オプションのgetboolの表示のやつ */ public virtual bool OptionMeGetBool() => CurrentValue != 0; @@ -211,8 +210,10 @@ public virtual bool IsHiddenOn(CustomGameMode mode) public string ApplyFormat(string value) { - if (value == "0" && Infinity == true) return "∞"; - if (value == "0" && Infinity == null) return ""; + if (value == "0") + { + if (Infinity != false) return Infinity == true ? "∞" : ""; + } if (ValueFormat == OptionFormat.None) return value; return string.Format(Translator.GetString("Format." + ValueFormat), value); } diff --git a/Modules/OptionShower.cs b/Modules/OptionShower.cs index 831b936fc..879e0eea0 100644 --- a/Modules/OptionShower.cs +++ b/Modules/OptionShower.cs @@ -175,53 +175,89 @@ private static void ShowChildren(OptionItem option, ref StringBuilder sb, Color { foreach (var opt in option.Children.Select((v, i) => new { Value = v, Index = i + 1 })) { - if (opt.Value.Name == "GiveGuesser" && !opt.Value.GetBool()) continue; - if (opt.Value.Name == "GiveWatching" && !opt.Value.GetBool()) continue; - if (opt.Value.Name == "GiveManagement" && !opt.Value.GetBool()) continue; - if (opt.Value.Name == "Giveseeing" && !opt.Value.GetBool()) continue; - if (opt.Value.Name == "GiveAutopsy" && !opt.Value.GetBool()) continue; - if (opt.Value.Name == "GiveTiebreaker" && !opt.Value.GetBool()) continue; - if (opt.Value.Name == "GiveMagicHand" && !opt.Value.GetBool()) continue; - if (opt.Value.Name == "GivePlusVote" && !opt.Value.GetBool()) continue; - if (opt.Value.Name == "GiveRevenger" && !opt.Value.GetBool()) continue; - if (opt.Value.Name == "GiveOpener" && !opt.Value.GetBool()) continue; - if (opt.Value.Name == "GiveLighting" && !opt.Value.GetBool()) continue; - if (opt.Value.Name == "GiveMoon" && !opt.Value.GetBool()) continue; - if (opt.Value.Name == "GiveElector" && !opt.Value.GetBool()) continue; - if (opt.Value.Name == "GiveInfoPoor" && !opt.Value.GetBool()) continue; - if (opt.Value.Name == "GiveNonReport" && !opt.Value.GetBool()) continue; - if (opt.Value.Name == "GiveTransparent" && !opt.Value.GetBool()) continue; - if (opt.Value.Name == "GiveNotvoter" && !opt.Value.GetBool()) continue; - if (opt.Value.Name == "GiveWater" && !opt.Value.GetBool()) continue; - if (opt.Value.Name == "GiveSpeeding" && !opt.Value.GetBool()) continue; - if (opt.Value.Name == "GiveGuarding" && !opt.Value.GetBool()) continue; - if (opt.Value.Name == "GiveClumsy" && !opt.Value.GetBool()) continue; - if (opt.Value.Name == "GiveSlacker" && !opt.Value.GetBool()) continue; - if (opt.Value.Name == "Maximum") continue; //Maximumの項目は飛ばす - if (opt.Value.Name == "FixedRole") continue; - if (opt.Value.Name == "DisableSkeldDevices" && !Options.IsActiveSkeld) continue; - if (opt.Value.Name == "SkeldReactorTimeLimit" && !Options.IsActiveSkeld) continue; - if (opt.Value.Name == "SkeldO2TimeLimit" && !Options.IsActiveSkeld) continue; - if (opt.Value.Name == "MiraReactorTimeLimit" && !Options.IsActiveMiraHQ) continue; - if (opt.Value.Name == "MiraO2TimeLimit" && !Options.IsActiveMiraHQ) continue; - if (opt.Value.Name == "DisableMiraHQDevices" && !Options.IsActiveMiraHQ) continue; - if (opt.Value.Name == "DisablePolusDevices" && !Options.IsActivePolus) continue; - if (opt.Value.Name == "PolusReactorTimeLimit" && !Options.IsActivePolus) continue; - if (opt.Value.Name == "DisableAirshipDevices" && !Options.IsActiveAirship) continue; - if (opt.Value.Name == "AirshipReactorTimeLimit" && !Options.IsActiveAirship) continue; - if (opt.Value.Name == "DisableFungleDevices" && !Options.IsActiveFungle) continue; - if (opt.Value.Name == "FungleReactorTimeLimit" && !Options.IsActiveFungle) continue; - if (opt.Value.Name == "FungleMushroomMixupDuration" && !Options.IsActiveFungle) continue; - if (opt.Value.Name == "DisableFungleSporeTrigger" && !Options.IsActiveFungle) continue; - if (opt.Value.Name == "CantUseZipLineTotop" && !Options.IsActiveFungle) continue; - if (opt.Value.Name == "CantUseZipLineTodown" && !Options.IsActiveFungle) continue; + if (!opt.Value.GetBool()) + { + switch (opt.Value.Name) + { + case "GiveGuesser": continue; + case "GiveWatching": continue; + case "GiveManagement": continue; + case "Giveseeing": continue; + case "GiveAutopsy": continue; + case "GiveTiebreaker": continue; + case "GiveMagicHand": continue; + case "GivePlusVote": continue; + case "GiveRevenger": continue; + case "GiveOpener": continue; + case "GiveLighting": continue; + case "GiveMoon": continue; + case "GiveElector": continue; + case "GiveInfoPoor": continue; + case "GiveNonReport": continue; + case "GiveTransparent": continue; + case "GiveNotvoter": continue; + case "GiveWater": continue; + case "GiveSpeeding": continue; + case "GiveGuarding": continue; + case "GiveClumsy": continue; + case "GiveSlacker": continue; + } + } + if (!Options.IsActiveSkeld) + { + switch (opt.Value.Name) + { + case "DisableSkeldDevices": continue; + case "SkeldReactorTimeLimit": continue; + case "SkeldO2TimeLimit": continue; + } + } + if (!Options.IsActiveMiraHQ) + { + switch (opt.Value.Name) + { + case "MiraReactorTimeLimit": continue; + case "MiraO2TimeLimit": continue; + case "DisableMiraHQDevices": continue; + } + } + if (!Options.IsActivePolus) + { + switch (opt.Value.Name) + { + case "DisablePolusDevices": continue; + case "PolusReactorTimeLimit": continue; + } + } + if (!Options.IsActiveAirship) + { + switch (opt.Value.Name) + { + case "DisableAirshipDevices": continue; + case "AirshipReactorTimeLimit": continue; + case "AirShipVariableElectrical": continue; + case "DisableAirshipMovingPlatform": continue; + case "DisableAirshipViewingDeckLightsPanel": continue; + case "DisableAirshipCargoLightsPanel": continue; + case "DisableAirshipGapRoomLightsPanel": continue; + } + } + if (!Options.IsActiveFungle) + { + switch (opt.Value.Name) + { + case "DisableFungleDevices": continue; + case "FungleReactorTimeLimit": continue; + case "FungleMushroomMixupDuration": continue; + case "DisableFungleSporeTrigger": continue; + case "CantUseZipLineTotop": continue; + case "CantUseZipLineTodown": continue; + } + } + if (opt.Value.Name is "Maximum" or "FixedRole") continue; if (opt.Value.Name == "ResetDoorsEveryTurns" && !(Options.IsActiveFungle || Options.IsActiveAirship || Options.IsActivePolus)) continue; - if (opt.Value.Name == "AirShipVariableElectrical" && !Options.IsActiveAirship) continue; - if (opt.Value.Name == "DisableAirshipMovingPlatform" && !Options.IsActiveAirship) continue; - if (opt.Value.Name == "DisableAirshipViewingDeckLightsPanel" && !Options.IsActiveAirship) continue; - if (opt.Value.Name == "DisableAirshipCargoLightsPanel" && !Options.IsActiveAirship) continue; - if (opt.Value.Name == "DisableAirshipGapRoomLightsPanel" && !Options.IsActiveAirship) continue; if (opt.Value.Name == "ResetDoorsEveryTurns" && !(Options.IsActiveSkeld || Options.IsActiveMiraHQ || Options.IsActiveAirship || Options.IsActivePolus)) continue; + sb.Append(""); if (deep > 0) { @@ -234,50 +270,86 @@ private static void ShowChildren(OptionItem option, ref StringBuilder sb, Color } public static bool? Checkenabled(OptionItem opt) { - if (opt.Name == "GiveGuesser" && !opt.GetBool()) return false; - if (opt.Name == "GiveWatching" && !opt.GetBool()) return false; - if (opt.Name == "GiveManagement" && !opt.GetBool()) return false; - if (opt.Name == "Giveseeing" && !opt.GetBool()) return false; - if (opt.Name == "GiveAutopsy" && !opt.GetBool()) return false; - if (opt.Name == "GiveTiebreaker" && !opt.GetBool()) return false; - if (opt.Name == "GivePlusVote" && !opt.GetBool()) return false; - if (opt.Name == "GiveRevenger" && !opt.GetBool()) return false; - if (opt.Name == "GiveOpener" && !opt.GetBool()) return false; - if (opt.Name == "GiveLighting" && !opt.GetBool()) return false; - if (opt.Name == "GiveMoon" && !opt.GetBool()) return false; - if (opt.Name == "GiveElector" && !opt.GetBool()) return false; - if (opt.Name == "GiveInfoPoor" && !opt.GetBool()) return false; - if (opt.Name == "GiveNonReport" && !opt.GetBool()) return false; - if (opt.Name == "GiveTransparent" && !opt.GetBool()) return false; - if (opt.Name == "GiveNotvoter" && !opt.GetBool()) return false; - if (opt.Name == "GiveWater" && !opt.GetBool()) return false; - if (opt.Name == "GiveSpeeding" && !opt.GetBool()) return false; - if (opt.Name == "GiveGuarding" && !opt.GetBool()) return false; - if (opt.Name == "GiveClumsy" && !opt.GetBool()) return false; - if (opt.Name == "GiveSlacker" && !opt.GetBool()) return false; - - if (opt.Name == "DisableSkeldDevices" && !Options.IsActiveSkeld) return null; - if (opt.Name == "DisableMiraHQDevices" && !Options.IsActiveMiraHQ) return null; - if (opt.Name == "DisablePolusDevices" && !Options.IsActivePolus) return null; - if (opt.Name == "PolusReactorTimeLimit" && !Options.IsActivePolus) return null; - if (opt.Name == "DisableAirshipDevices" && !Options.IsActiveAirship) return null; - if (opt.Name == "AirshipReactorTimeLimit" && !Options.IsActiveAirship) return null; - if (opt.Name == "DisableFungleDevices" && !Options.IsActiveFungle) return null; - if (opt.Name == "FungleReactorTimeLimit" && !Options.IsActiveFungle) return null; - if (opt.Name == "CantUseZipLineTotop" && !Options.IsActiveFungle) return null; - if (opt.Name == "CantUseZipLineTodown" && !Options.IsActiveFungle) return null; - if (opt.Name == "SkeldReactorTimeLimit" && !Options.IsActiveSkeld) return null; - if (opt.Name == "SkeldO2TimeLimit" && !Options.IsActiveSkeld) return null; - if (opt.Name == "MiraReactorTimeLimit" && !Options.IsActiveMiraHQ) return null; - if (opt.Name == "MiraO2TimeLimit" && !Options.IsActiveMiraHQ) return null; - if (opt.Name == "FungleMushroomMixupDuration" && !Options.IsActiveFungle) return null; - if (opt.Name == "DisableFungleSporeTrigger" && !Options.IsActiveFungle) return null; + if (!opt.GetBool()) + { + switch (opt.Name) + { + case "GiveGuesser": return false; + case "GiveWatching": return false; + case "GiveManagement": return false; + case "Giveseeing": return false; + case "GiveAutopsy": return false; + case "GiveTiebreaker": return false; + case "GiveMagicHand": return false; + case "GivePlusVote": return false; + case "GiveRevenger": return false; + case "GiveOpener": return false; + case "GiveLighting": return false; + case "GiveMoon": return false; + case "GiveElector": return false; + case "GiveInfoPoor": return false; + case "GiveNonReport": return false; + case "GiveTransparent": return false; + case "GiveNotvoter": return false; + case "GiveWater": return false; + case "GiveSpeeding": return false; + case "GiveGuarding": return false; + case "GiveClumsy": return false; + case "GiveSlacker": return false; + } + } + if (!Options.IsActiveSkeld) + { + switch (opt.Name) + { + case "DisableSkeldDevices": return null; + case "SkeldReactorTimeLimit": return null; + case "SkeldO2TimeLimit": return null; + } + } + if (!Options.IsActiveMiraHQ) + { + switch (opt.Name) + { + case "MiraReactorTimeLimit": return null; + case "MiraO2TimeLimit": return null; + case "DisableMiraHQDevices": return null; + } + } + if (!Options.IsActivePolus) + { + switch (opt.Name) + { + case "DisablePolusDevices": return null; + case "PolusReactorTimeLimit": return null; + } + } + if (!Options.IsActiveAirship) + { + switch (opt.Name) + { + case "DisableAirshipDevices": return null; + case "AirshipReactorTimeLimit": return null; + case "AirShipVariableElectrical": return null; + case "DisableAirshipMovingPlatform": return null; + case "DisableAirshipViewingDeckLightsPanel": return null; + case "DisableAirshipCargoLightsPanel": return null; + case "DisableAirshipGapRoomLightsPanel": return null; + } + } + if (!Options.IsActiveFungle) + { + switch (opt.Name) + { + case "DisableFungleDevices": return null; + case "FungleReactorTimeLimit": return null; + case "FungleMushroomMixupDuration": return null; + case "DisableFungleSporeTrigger": return null; + case "CantUseZipLineTotop": return null; + case "CantUseZipLineTodown": return null; + } + } if (opt.Name == "ResetDoorsEveryTurns" && !(Options.IsActiveFungle || Options.IsActiveAirship || Options.IsActivePolus)) return null; - if (opt.Name == "AirShipVariableElectrical" && !Options.IsActiveAirship) return null; - if (opt.Name == "DisableAirshipMovingPlatform" && !Options.IsActiveAirship) return null; - if (opt.Name == "DisableAirshipViewingDeckLightsPanel" && !Options.IsActiveAirship) return null; - if (opt.Name == "DisableAirshipCargoLightsPanel" && !Options.IsActiveAirship) return null; - if (opt.Name == "DisableAirshipGapRoomLightsPanel" && !Options.IsActiveAirship) return null; if (opt.Name == "ResetDoorsEveryTurns" && !(Options.IsActiveSkeld || Options.IsActiveMiraHQ || Options.IsActiveAirship || Options.IsActivePolus)) return null; return true; } diff --git a/Modules/PlayerCatch.cs b/Modules/PlayerCatch.cs index 6fa8152d1..24086bf00 100644 --- a/Modules/PlayerCatch.cs +++ b/Modules/PlayerCatch.cs @@ -71,6 +71,7 @@ public static void CountAlivePlayers(bool sendLog = false) public static Dictionary AllPlayerFirstTypes = new(); public static IEnumerable AllPlayerControls => PlayerControl.AllPlayerControls.ToArray().Where(p => p != null && p.PlayerId <= 15); public static IEnumerable AllAlivePlayerControls => PlayerControl.AllPlayerControls.ToArray().Where(p => p != null && p.IsAlive() && p.PlayerId <= 15); - + //1ターン前に生きてた人達のリスト + public static List OldAlivePlayerControles = new(); } } \ No newline at end of file diff --git a/Modules/Special.cs b/Modules/Special.cs index f1ee67eb9..635e725eb 100644 --- a/Modules/Special.cs +++ b/Modules/Special.cs @@ -18,8 +18,9 @@ static class Event public static bool April = DateTime.Now.Month == 4 && DateTime.Now.Day is 1; public static bool IsEventDay => IsChristmas || White || IsInitialRelease || IsHalloween || GoldenWeek || April; public static bool Special = false; + public static bool NowRoleEvent => (DateTime.Now.Month == 12 && 20 <= DateTime.Now.Day) || (DateTime.Now.Month == 1 && DateTime.Now.Day <= 8); public static List OptionLoad = new(); - public static bool IsE(this CustomRoles role) => role is CustomRoles.SpeedStar or CustomRoles.EvilTeller; + public static bool IsE(this CustomRoles role) => role is CustomRoles.SpeedStar or CustomRoles.Chameleon; } @@ -229,7 +230,7 @@ void ChengeTeam() Logger.Info($"Now : {NowTeam}", "Chameleon"); - UtilsNotifyRoles.NotifyRoles(); + UtilsNotifyRoles.NotifyRoles(SpecifySeer: Player); } public override void OverrideTrueRoleName(ref UnityEngine.Color roleColor, ref string roleText) => roleText = Translator.GetString($"{NowTeam}").Color(UtilsRoleText.GetRoleColor(NowTeam)) + Translator.GetString("Chameleon"); public override void AfterMeetingTasks() => _ = new LateTask(() => { if (!GameStates.Meeting) ChengeTeam(); }, 5f, "", true); diff --git a/Modules/SuddenDeathMode.cs b/Modules/SuddenDeathMode.cs index 89886fca6..3fd92dcf8 100644 --- a/Modules/SuddenDeathMode.cs +++ b/Modules/SuddenDeathMode.cs @@ -26,6 +26,7 @@ public static class SuddenDeathMode static float opttime; public static bool NowSuddenDeathMode; public static bool NowSuddenDeathTemeMode; + public static bool SuddenCannotSeeName; public static List TeamRed = new(); public static List TeamBlue = new(); public static List TeamYellow = new(); @@ -50,6 +51,7 @@ public static void Reset() { NowSuddenDeathTemeMode = Options.SuddenTeam.GetBool(); NowSuddenDeathMode = Options.SuddenDeathMode.GetBool(); + SuddenCannotSeeName = Options.SuddenCannotSeeName.GetBool(); SuddenDeathtime = 0; ItijohoSendTime = 0; sabotage = false; diff --git a/Modules/Translator.cs b/Modules/Translator.cs index 060e6bfd1..2699fce69 100644 --- a/Modules/Translator.cs +++ b/Modules/Translator.cs @@ -82,6 +82,7 @@ public static string GetString(string str, SupportedLangs langId) { var res = $""; var ch = res; + if ((Event.OptionLoad.Contains(str) || str is "CakeshopInfoLong" or "CakeshopInfo" or "Cakeshop") && !Event.Special && !Event.NowRoleEvent) return res; if (translateMaps.TryGetValue(str, out var dic) && (!dic.TryGetValue((int)langId, out res) || res == "")) //strに該当する&無効なlangIdかresが空 { res = $"*{dic[0]}"; diff --git a/Modules/Utils/Utils.cs b/Modules/Utils/Utils.cs index 318c75a73..8412df434 100644 --- a/Modules/Utils/Utils.cs +++ b/Modules/Utils/Utils.cs @@ -133,8 +133,9 @@ public static bool KillFlashCheck(MurderInfo info, PlayerControl seer) { PlayerControl killer = info.AppearanceKiller, target = info.AttemptTarget; - if (seer.Is(CustomRoles.GM)) return true; - if (Options.SuddenCanSeeKillflash.GetBool()) return true; + if (seer.Is(CustomRoles.GM) || + Options.SuddenCanSeeKillflash.GetBool()) return true; + if (seer.Data.IsDead && (Options.GhostCanSeeKillflash.GetBool() || !Options.GhostOptions.GetBool()) && !seer.Is(CustomRoles.AsistingAngel) && (!seer.IsGorstRole() || Options.GRCanSeeKillflash.GetBool()) && target != seer) return true; if (seer.Data.IsDead || killer == seer || target == seer) return false; @@ -349,8 +350,8 @@ public static void ApplySuffix(PlayerControl pc) name += $"\r\n{DataManager.player.Customization.Name}"; break; case SuffixModes.Timer: - if (GameStates.IsLocalGame) break; - if (GameStates.IsCountDown) break; + if (GameStates.IsLocalGame + || GameStates.IsCountDown) break; float timerValue = GameStartManagerPatch.GetTimer(); if (timerValue < GameStartManagerPatch.Timer2 - 2 || GameStartManagerPatch.Timer2 < 25) GameStartManagerPatch.Timer2 = timerValue; @@ -376,14 +377,14 @@ public static void ApplySuffix(PlayerControl pc) var info = ""; var at = ""; - if (Options.NoGameEnd.GetBool()) info += $"\r\n" + ColorString(Color.red, GetString("NoGameEnd")); else at += "\r\n"; + if (Options.NoGameEnd.OptionMeGetBool()) info += $"\r\n" + ColorString(Color.red, GetString("NoGameEnd")); else at += "\r\n"; if (Options.IsStandardHAS) info += $"\r\n" + ColorString(Color.yellow, GetString("StandardHAS")); else at += "\r\n"; if (Options.CurrentGameMode == CustomGameMode.HideAndSeek) info += $"\r\n" + ColorString(Color.red, GetString("HideAndSeek")); else at += "\r\n"; if (Options.CurrentGameMode == CustomGameMode.TaskBattle) info += $"\r\n" + ColorString(Color.cyan, GetString("TaskBattle")); else at += "\r\n"; - if (Options.SuddenDeathMode.GetBool()) info += "\r\n" + ColorString(GetRoleColor(CustomRoles.Comebacker), GetString("SuddenDeathMode")); else at += "\r\n"; - if (Options.EnableGM.GetBool()) info += $"\r\n" + ColorString(GetRoleColor(CustomRoles.GM), GetString("GM")); else at += "\r\n"; + if (Options.SuddenDeathMode.OptionMeGetBool()) info += "\r\n" + ColorString(GetRoleColor(CustomRoles.Comebacker), GetString("SuddenDeathMode")); else at += "\r\n"; + if (Options.EnableGM.OptionMeGetBool()) info += $"\r\n" + ColorString(GetRoleColor(CustomRoles.GM), GetString("GM")); else at += "\r\n"; if (DebugModeManager.IsDebugMode) - info += "\r\n" + (DebugModeManager.EnableTOHkDebugMode.GetBool() ? "DebugMode" : ColorString(Color.green, "デバッグモード")); + info += "\r\n" + (DebugModeManager.EnableTOHkDebugMode.OptionMeGetBool() ? "DebugMode" : ColorString(Color.green, "デバッグモード")); else at += "\r\n"; info += ""; diff --git a/Modules/Utils/UtilsLog.cs b/Modules/Utils/UtilsLog.cs index a0e3f7c79..cab807b82 100644 --- a/Modules/Utils/UtilsLog.cs +++ b/Modules/Utils/UtilsLog.cs @@ -81,15 +81,9 @@ public static string GetLogtext(byte pc) var pos1 = pos + 4f; var pos2 = pos + 4f + (DestroyableSingleton.Instance.currentLanguage.languageID == SupportedLangs.English ? 8f : 4.5f); - var name = "('ω')"; - if (LastLog.ContainsKey(pc)) - name = LastLog[pc]; - var pro = "(;;)"; - if (LastLogPro.ContainsKey(pc)) - pro = LastLogPro[pc]; - var role = "_(:3 」∠)_"; - if (LastLogRole.ContainsKey(pc)) - role = LastLogRole[pc]; + var name = LastLog.TryGetValue(pc, out var log) ? log : "('ω')"; + var pro = LastLog.TryGetValue(pc, out var prog) ? prog : "(;;)"; + var role = LastLog.TryGetValue(pc, out var rolelog) ? rolelog : "_(:3 」∠)_"; var addon = "(´-ω-`)"; addon = LastLogSubRole.TryGetValue(pc, out var m) ? m : GetSubRolesText(pc, mark: true); diff --git a/Modules/Utils/UtilsNotifyRoles.cs b/Modules/Utils/UtilsNotifyRoles.cs index f657b705a..4487f282d 100644 --- a/Modules/Utils/UtilsNotifyRoles.cs +++ b/Modules/Utils/UtilsNotifyRoles.cs @@ -87,6 +87,7 @@ public static void NotifyRoles(bool isForMeeting = false, PlayerControl SpecifyS var role = seer.GetCustomRole(); var seerRole = seer.GetRoleClass(); var seerRoleInfo = seer.GetCustomRole().GetRoleInfo(); + var seerSubrole = seer.GetCustomSubRoles(); var seerisAlive = seer.IsAlive(); var Amnesiacheck = Amnesia.CheckAbility(seer); var seercone = seer.Is(CustomRoles.Connecting); @@ -179,14 +180,14 @@ public static void NotifyRoles(bool isForMeeting = false, PlayerControl SpecifyS if (SelfSuffix.ToString() != "") SelfSuffix.Append('\n'); SelfSuffix.Append("" + MeetingVoteManager.Voteresult + ""); } - if ((seer.Is(CustomRoles.Guesser) || - (LastNeutral.GiveGuesser.GetBool() && seer.Is(CustomRoles.LastNeutral)) || - (LastImpostor.giveguesser && seer.Is(CustomRoles.LastImpostor)) || - (data.GiveAddons.GetBool() && data.GiveGuesser.GetBool()) + if ((seerSubrole.Contains(CustomRoles.Guesser) || + (LastNeutral.GiveGuesser.GetBool() && seerSubrole.Contains(CustomRoles.LastNeutral)) || + (LastImpostor.giveguesser && seerSubrole.Contains(CustomRoles.LastImpostor)) || + data.GiveGuesser.GetBool() ) && isForMeeting ) { - var gi = $" \n{GetString("GuessInfo")}"; + var gi = $" \n{GetString("GuessInfo")}"; SelfSuffix.Append(gi); } //seer役職が対象のSuffix @@ -198,7 +199,7 @@ public static void NotifyRoles(bool isForMeeting = false, PlayerControl SpecifyS //RealNameを取得 なければ現在の名前をRealNamesに書き込む string SeerRealName = (seerRole is IUseTheShButton) ? Main.AllPlayerNames[seer.PlayerId] : seer.GetRealName(isForMeeting); - if (Options.SuddenCannotSeeName.GetBool()) + if (SuddenDeathMode.SuddenCannotSeeName) { SeerRealName = ""; } @@ -274,7 +275,6 @@ public static void NotifyRoles(bool isForMeeting = false, PlayerControl SpecifyS || seer.IsNeutralKiller() //seerがキル出来るニュートラル || PlayerState.GetByPlayerId(seer.PlayerId).TargetColorData.Count > 0 //seer視点用の名前色データが一つ以上ある || Witch.IsSpelled() - || CustomRoles.TaskStar.IsEnable() || seer.IsRiaju() || seercone || IsActive(SystemTypes.Electrical) @@ -282,16 +282,18 @@ public static void NotifyRoles(bool isForMeeting = false, PlayerControl SpecifyS || isMushroomMixupActive || rolech || Options.CurrentGameMode == CustomGameMode.TaskBattle - || (seerRole is IUseTheShButton) //ワンクリックシェイプボタン持ち + //|| (seerRole is IUseTheShButton) //ワンクリックシェイプボタン持ち || NoCache || ForceLoop ) { - foreach (var target in PlayerCatch.AllPlayerControls) + //死者じゃない場合タスクターン中、霊の名前を変更する必要がないので少しでも処理を減らす敵な感じで + var ForeachList = isForMeeting || !seerisAlive ? PlayerCatch.AllPlayerControls : PlayerCatch.OldAlivePlayerControles; + foreach (var target in ForeachList) { //targetがseer自身の場合は何もしない - if (target == seer) continue; - if (target == null) continue; + if (target == seer || target == null) continue; + var targetisalive = target.IsAlive(); logger.Info("NotifyRoles-Loop2-" + target.GetNameWithRole().RemoveHtmlTags() + ":START"); @@ -316,8 +318,9 @@ public static void NotifyRoles(bool isForMeeting = false, PlayerControl SpecifyS //ハートマークを付ける(相手に) var seerri = seer.GetRiaju(); var tageri = target.GetRiaju(); - var seerisone = seer.Is(CustomRoles.OneLove); - var seenIsOne = target.Is(CustomRoles.OneLove); + var seerisone = seerSubrole.Contains(CustomRoles.OneLove); + var targetsubrole = target.GetCustomSubRoles(); + var seenIsOne = targetsubrole.Contains(CustomRoles.OneLove); if (seerri == tageri && seer.IsRiaju() && !seerisone) TargetMark.Append(ColorString(GetRoleColor(seerri), "♥")); else if (seer.Data.IsDead && !seer.Is(tageri) && tageri != CustomRoles.NotAssigned && !seerisone) @@ -329,8 +332,8 @@ public static void NotifyRoles(bool isForMeeting = false, PlayerControl SpecifyS ) TargetMark.Append("♡"); - if (seercone && target.Is(CustomRoles.Connecting) && (role is not CustomRoles.WolfBoy || !seerisAlive) - || (seer.Data.IsDead && !seercone && target.Is(CustomRoles.Connecting)) + if (seercone && targetsubrole.Contains(CustomRoles.Connecting) && (role is not CustomRoles.WolfBoy || !seerisAlive) + || (seer.Data.IsDead && !seercone && targetsubrole.Contains(CustomRoles.Connecting)) ) //狼少年じゃないか死亡なら処理 TargetMark.Append($"Ψ"); @@ -370,16 +373,13 @@ public static void NotifyRoles(bool isForMeeting = false, PlayerControl SpecifyS TargetMark.Append(seerRole?.GetMark(seer, target, isForMeeting) ?? ""); TargetSuffix.Append(seerRole?.GetSuffix(seer, target, isForMeeting: isForMeeting) ?? ""); - if (target.Is(CustomRoles.Workhorse)) + if (targetsubrole.Contains(CustomRoles.Workhorse)) { - if (target.Is(CustomRoles.Workhorse)) + if (((seerRole as Alien)?.modeProgresskiller == true && Alien.ProgressWorkhorseseen) + || ((seerRole as JackalAlien)?.modeProgresskiller == true && JackalAlien.ProgressWorkhorseseen) + || (role is CustomRoles.ProgressKiller && ProgressKiller.ProgressWorkhorseseen)) { - if (((seerRole as Alien)?.modeProgresskiller == true && Alien.ProgressWorkhorseseen) - || ((seerRole as JackalAlien)?.modeProgresskiller == true && JackalAlien.ProgressWorkhorseseen) - || (seer.Is(CustomRoles.ProgressKiller) && ProgressKiller.ProgressWorkhorseseen)) - { - TargetMark.Append($"♦"); - } + TargetMark.Append($"♦"); } } } @@ -391,10 +391,10 @@ public static void NotifyRoles(bool isForMeeting = false, PlayerControl SpecifyS TargetPlayerName = TargetPlayerName.ApplyNameColorData(seer, target, isForMeeting); if (isForMeeting) { - if (seer.Is(CustomRoles.Guesser) - || (data.GiveAddons.GetBool() && data.GiveGuesser.GetBool()) - || (seer.Is(CustomRoles.LastImpostor) && LastImpostor.giveguesser) - || (seer.Is(CustomRoles.LastNeutral) && LastNeutral.GiveGuesser.GetBool())) + if (seerSubrole.Contains(CustomRoles.Guesser) + || data.GiveGuesser.GetBool() + || (seerSubrole.Contains(CustomRoles.LastImpostor) && LastImpostor.giveguesser) + || (seerSubrole.Contains(CustomRoles.LastNeutral) && LastNeutral.GiveGuesser.GetBool())) { if (seerisAlive && targetisalive && isForMeeting) { @@ -405,12 +405,12 @@ public static void NotifyRoles(bool isForMeeting = false, PlayerControl SpecifyS string TargetDeathReason = ""; if (seer.KnowDeathReason(target)) - TargetDeathReason = $"({ColorString(GetRoleColor(CustomRoles.Doctor), GetVitalText(target.PlayerId, seer.PlayerId.CanDeathReasonKillerColor()))})"; + TargetDeathReason = $"({GetVitalText(target.PlayerId, seer.PlayerId.CanDeathReasonKillerColor() == true ? true : null)})"; if (((IsActive(SystemTypes.Comms) && Options.CommsCamouflage.GetBool()) || (role is CustomRoles.Monochromer && seerisAlive) || Camouflager.NowUse - || (Options.SuddenCannotSeeName.GetBool() && !TemporaryName)) + || (SuddenDeathMode.SuddenCannotSeeName && !TemporaryName)) && (!((targetrole as Jumper)?.ability == true))) { TargetPlayerName = $"{TargetPlayerName} "; diff --git a/Modules/Utils/UtilsOption.cs b/Modules/Utils/UtilsOption.cs index 9e75cd349..0fea414d3 100644 --- a/Modules/Utils/UtilsOption.cs +++ b/Modules/Utils/UtilsOption.cs @@ -422,54 +422,91 @@ public static void ShowChildrenSettings(OptionItem option, ref StringBuilder sb, { foreach (var opt in option.Children.Select((v, i) => new { Value = v, Index = i + 1 })) { - if (opt.Value.Name == "GiveGuesser" && !opt.Value.GetBool()) continue; - if (opt.Value.Name == "GiveWatching" && !opt.Value.GetBool()) continue; - if (opt.Value.Name == "GiveManagement" && !opt.Value.GetBool()) continue; - if (opt.Value.Name == "Giveseeing" && !opt.Value.GetBool()) continue; - if (opt.Value.Name == "GiveAutopsy" && !opt.Value.GetBool()) continue; - if (opt.Value.Name == "GiveTiebreaker" && !opt.Value.GetBool()) continue; - if (opt.Value.Name == "GivePlusVote" && !opt.Value.GetBool()) continue; - if (opt.Value.Name == "GiveRevenger" && !opt.Value.GetBool()) continue; - if (opt.Value.Name == "GiveOpener" && !opt.Value.GetBool()) continue; - if (opt.Value.Name == "GiveLighting" && !opt.Value.GetBool()) continue; - if (opt.Value.Name == "GiveMoon" && !opt.Value.GetBool()) continue; - if (opt.Value.Name == "GiveElector" && !opt.Value.GetBool()) continue; - if (opt.Value.Name == "GiveInfoPoor" && !opt.Value.GetBool()) continue; - if (opt.Value.Name == "GiveNonReport" && !opt.Value.GetBool()) continue; - if (opt.Value.Name == "GiveTransparent" && !opt.Value.GetBool()) continue; - if (opt.Value.Name == "GiveNotvoter" && !opt.Value.GetBool()) continue; - if (opt.Value.Name == "GiveWater" && !opt.Value.GetBool()) continue; - if (opt.Value.Name == "GiveSpeeding" && !opt.Value.GetBool()) continue; - if (opt.Value.Name == "GiveGuarding" && !opt.Value.GetBool()) continue; - if (opt.Value.Name == "GiveClumsy" && !opt.Value.GetBool()) continue; - if (opt.Value.Name == "GiveSlacker" && !opt.Value.GetBool()) continue; - if (opt.Value.Name == "Maximum") continue; //Maximumの項目は飛ばす - if (opt.Value.Name == "FixedRole") continue; - if (opt.Value.Name == "DisableSkeldDevices" && !Options.IsActiveSkeld) continue; - if (opt.Value.Name == "DisableMiraHQDevices" && !Options.IsActiveMiraHQ) continue; - if (opt.Value.Name == "DisablePolusDevices" && !Options.IsActivePolus) continue; - if (opt.Value.Name == "PolusReactorTimeLimit" && !Options.IsActivePolus) continue; - if (opt.Value.Name == "DisableAirshipDevices" && !Options.IsActiveAirship) continue; - if (opt.Value.Name == "AirshipReactorTimeLimit" && !Options.IsActiveAirship) continue; - if (opt.Value.Name == "DisableFungleDevices" && !Options.IsActiveFungle) continue; - if (opt.Value.Name == "FungleReactorTimeLimit" && !Options.IsActiveFungle) continue; - if (opt.Value.Name == "SkeldReactorTimeLimit" && !Options.IsActiveSkeld) continue; - if (opt.Value.Name == "SkeldO2TimeLimit" && !Options.IsActiveSkeld) continue; - if (opt.Value.Name == "MiraReactorTimeLimit" && !Options.IsActiveMiraHQ) continue; - if (opt.Value.Name == "MiraO2TimeLimit" && !Options.IsActiveMiraHQ) continue; - if (opt.Value.Name == "FungleMushroomMixupDuration" && !Options.IsActiveFungle) continue; - if (opt.Value.Name == "DisableFungleSporeTrigger" && !Options.IsActiveFungle) continue; - if (opt.Value.Name == "CantUseZipLineTotop" && !Options.IsActiveFungle) continue; - if (opt.Value.Name == "CantUseZipLineTodown" && !Options.IsActiveFungle) continue; + if (!opt.Value.GetBool()) + { + switch (opt.Value.Name) + { + case "GiveGuesser": continue; + case "GiveWatching": continue; + case "GiveManagement": continue; + case "Giveseeing": continue; + case "GiveAutopsy": continue; + case "GiveTiebreaker": continue; + case "GiveMagicHand": continue; + case "GivePlusVote": continue; + case "GiveRevenger": continue; + case "GiveOpener": continue; + case "GiveLighting": continue; + case "GiveMoon": continue; + case "GiveElector": continue; + case "GiveInfoPoor": continue; + case "GiveNonReport": continue; + case "GiveTransparent": continue; + case "GiveNotvoter": continue; + case "GiveWater": continue; + case "GiveSpeeding": continue; + case "GiveGuarding": continue; + case "GiveClumsy": continue; + case "GiveSlacker": continue; + default: if (getbool) continue; break; + } + } + if (!Options.IsActiveSkeld) + { + switch (opt.Value.Name) + { + case "DisableSkeldDevices": continue; + case "SkeldReactorTimeLimit": continue; + case "SkeldO2TimeLimit": continue; + } + } + if (!Options.IsActiveMiraHQ) + { + switch (opt.Value.Name) + { + case "MiraReactorTimeLimit": continue; + case "MiraO2TimeLimit": continue; + case "DisableMiraHQDevices": continue; + } + } + if (!Options.IsActivePolus) + { + switch (opt.Value.Name) + { + case "DisablePolusDevices": continue; + case "PolusReactorTimeLimit": continue; + } + } + if (!Options.IsActiveAirship) + { + switch (opt.Value.Name) + { + case "DisableAirshipDevices": continue; + case "AirshipReactorTimeLimit": continue; + case "AirShipVariableElectrical": continue; + case "DisableAirshipMovingPlatform": continue; + case "DisableAirshipViewingDeckLightsPanel": continue; + case "DisableAirshipCargoLightsPanel": continue; + case "DisableAirshipGapRoomLightsPanel": continue; + } + } + if (!Options.IsActiveFungle) + { + switch (opt.Value.Name) + { + case "DisableFungleDevices": continue; + case "FungleReactorTimeLimit": continue; + case "FungleMushroomMixupDuration": continue; + case "DisableFungleSporeTrigger": continue; + case "CantUseZipLineTotop": continue; + case "CantUseZipLineTodown": continue; + } + } + if (opt.Value.Name is "Maximum" or "FixedRole") continue; if (opt.Value.Name == "ResetDoorsEveryTurns" && !(Options.IsActiveFungle || Options.IsActiveAirship || Options.IsActivePolus)) continue; - if (opt.Value.Name == "AirShipVariableElectrical" && !Options.IsActiveAirship) continue; - if (opt.Value.Name == "DisableAirshipMovingPlatform" && !Options.IsActiveAirship) continue; - if (opt.Value.Name == "DisableAirshipViewingDeckLightsPanel" && !Options.IsActiveAirship) continue; - if (opt.Value.Name == "DisableAirshipCargoLightsPanel" && !Options.IsActiveAirship) continue; - if (opt.Value.Name == "DisableAirshipGapRoomLightsPanel" && !Options.IsActiveAirship) continue; if (opt.Value.Name == "ResetDoorsEveryTurns" && !(Options.IsActiveSkeld || Options.IsActiveMiraHQ || Options.IsActiveAirship || Options.IsActivePolus)) continue; - if (Askesu) if (opt.Value.Name == "%roleTypes%Maximum") continue; - if (getbool && !opt.Value.GetBool()) continue; + if (Askesu && opt.Value.Name == "%roleTypes%Maximum") continue; + if (pc != null) { if (!pc.Is(CustomRoleTypes.Crewmate)) @@ -655,57 +692,60 @@ public static void GetGhostRolesInfo(PlayerControl player) } public static string GetAddonsHelp(CustomRoles role) { + if (!(role.IsAddOn() || role.IsGorstRole() || role.IsRiaju() || role is CustomRoles.Amanojaku)) return ""; var s = ""; var k = ""; //バフ - if (role == CustomRoles.Guesser) s += k + AddonInfo(role, "∮", From.TheOtherRoles); - if (role == CustomRoles.Serial) s += k + AddonInfo(role, "∂"); - if (role == CustomRoles.MagicHand) s += k + AddonInfo(role, "ж"); - if (role == CustomRoles.Connecting) s += k + AddonInfo(role, "Ψ"); - if (role == CustomRoles.watching) s += k + AddonInfo(role, "∑", From.TOR_GM_Edition); - if (role == CustomRoles.PlusVote) s += k + AddonInfo(role, "р", From.TownOfHost_Y); - if (role == CustomRoles.Tiebreaker) s += k + AddonInfo(role, "т", From.TheOtherRoles); - if (role == CustomRoles.Autopsy) s += k + AddonInfo(role, "Å", From.TownOfHost_Y); - if (role == CustomRoles.Revenger) s += k + AddonInfo(role, "Я", From.TownOfHost_Y); - if (role == CustomRoles.Speeding) s += k + AddonInfo(role, "∈"); - if (role == CustomRoles.Guarding) s += k + AddonInfo(role, "ζ", From.TownOfHost_Y); - if (role == CustomRoles.Management) s += k + AddonInfo(role, "θ", From.TownOfHost_Y); - if (role == CustomRoles.Opener) s += k + AddonInfo(role, "п"); - if (role == CustomRoles.seeing) s += k + AddonInfo(role, "☯", From.TownOfHost_Y); - if (role == CustomRoles.Lighting) s += k + AddonInfo(role, "*", From.TownOfHost_Y); - if (role == CustomRoles.Moon) s += k + AddonInfo(role, "э"); - - //デバフ - if (role == CustomRoles.Amnesia) s += k + AddonInfo(role); - if (role == CustomRoles.SlowStarter) s += k + AddonInfo(role, "Ss"); - if (role == CustomRoles.Notvoter) s += k + AddonInfo(role, "V"); - if (role == CustomRoles.Elector) s += k + AddonInfo(role, "E"); - if (role == CustomRoles.InfoPoor) s += k + AddonInfo(role, "I", From.TownOfHost_Y); - if (role == CustomRoles.NonReport) s += k + AddonInfo(role, "R", From.TownOfHost_Y); - if (role == CustomRoles.Transparent) s += k + AddonInfo(role, "T"); - if (role == CustomRoles.Water) s += k + AddonInfo(role, "W"); - if (role == CustomRoles.Clumsy) s += k + AddonInfo(role, "C", From.TownOfHost_Y); - if (role == CustomRoles.Slacker) s += k + AddonInfo(role, "SL"); - - //第三 - if (role.IsRiaju()) s += k + AddonInfo(role, "♥", role != CustomRoles.Lovers ? From.None : From.Love_Couple_Mod); - - //ラスト - if (role == CustomRoles.LastImpostor) s += k + AddonInfo(role, from: From.TownOfHost); - if (role == CustomRoles.LastNeutral) s += k + AddonInfo(role); - if (role == CustomRoles.Workhorse) s += k + AddonInfo(role, from: From.TownOfHost); - if (role == CustomRoles.Amanojaku) s += k + AddonInfo(role); - //幽霊役職 - - if (role == CustomRoles.Ghostbuttoner) s += k + AddonInfo(role); - if (role == CustomRoles.GhostNoiseSender) s += k + AddonInfo(role); - if (role == CustomRoles.GhostReseter) s += k + AddonInfo(role); - if (role == CustomRoles.GuardianAngel) s += k + AddonInfo(role); - if (role == CustomRoles.DemonicTracker) s += k + AddonInfo(role); - if (role == CustomRoles.DemonicCrusher) s += k + AddonInfo(role); - if (role == CustomRoles.DemonicVenter) s += k + AddonInfo(role); - if (role == CustomRoles.AsistingAngel) s += k + AddonInfo(role); - return s; + return (s += k) + (role switch + { + //バフ + CustomRoles.Guesser => AddonInfo(role, "∮", From.TheOtherRoles), + CustomRoles.Serial => AddonInfo(role, "∂"), + CustomRoles.MagicHand => AddonInfo(role, "ж"), + CustomRoles.Connecting => AddonInfo(role, "Ψ"), + CustomRoles.watching => AddonInfo(role, "∑", From.TOR_GM_Edition), + CustomRoles.PlusVote => AddonInfo(role, "р", From.TownOfHost_Y), + CustomRoles.Tiebreaker => AddonInfo(role, "т", From.TheOtherRoles), + CustomRoles.Autopsy => AddonInfo(role, "Å", From.TownOfHost_Y), + CustomRoles.Revenger => AddonInfo(role, "Я", From.TownOfHost_Y), + CustomRoles.Speeding => AddonInfo(role, "∈"), + CustomRoles.Guarding => AddonInfo(role, "ζ", From.TownOfHost_Y), + CustomRoles.Management => AddonInfo(role, "θ", From.TownOfHost_Y), + CustomRoles.Opener => AddonInfo(role, "п"), + CustomRoles.seeing => AddonInfo(role, "☯", From.TownOfHost_Y), + CustomRoles.Lighting => AddonInfo(role, "*", From.TownOfHost_Y), + CustomRoles.Moon => AddonInfo(role, "э"), + //デバフ + CustomRoles.Amnesia => AddonInfo(role), + CustomRoles.SlowStarter => AddonInfo(role, "Ss"), + CustomRoles.Notvoter => AddonInfo(role, "V"), + CustomRoles.Elector => AddonInfo(role, "E"), + CustomRoles.InfoPoor => AddonInfo(role, "I", From.TownOfHost_Y), + CustomRoles.NonReport => AddonInfo(role, "R", From.TownOfHost_Y), + CustomRoles.Transparent => AddonInfo(role, "T"), + CustomRoles.Water => AddonInfo(role, "W"), + CustomRoles.Clumsy => AddonInfo(role, "C", From.TownOfHost_Y), + CustomRoles.Slacker => AddonInfo(role, "SL"), + //第三属性 + CustomRoles.Amanojaku => AddonInfo(role), + CustomRoles.Lovers or CustomRoles.RedLovers or CustomRoles.BlueLovers or CustomRoles.YellowLovers or CustomRoles.GreenLovers + or CustomRoles.WhiteLovers or CustomRoles.PurpleLovers => AddonInfo(role, "♥", role != CustomRoles.Lovers ? From.None : From.Love_Couple_Mod), + //ラスト系 + CustomRoles.LastImpostor => AddonInfo(role, from: From.TownOfHost), + CustomRoles.LastNeutral => AddonInfo(role), + CustomRoles.Workhorse => AddonInfo(role, from: From.TownOfHost), + //幽霊役職 + CustomRoles.Ghostbuttoner => AddonInfo(role), + CustomRoles.GhostNoiseSender => AddonInfo(role), + CustomRoles.GhostReseter => AddonInfo(role), + CustomRoles.GuardianAngel => AddonInfo(role), + CustomRoles.DemonicTracker => AddonInfo(role), + CustomRoles.DemonicCrusher => AddonInfo(role), + CustomRoles.DemonicVenter => AddonInfo(role), + CustomRoles.AsistingAngel => AddonInfo(role), + + _ => "...?" + }); } public static string AddonInfo(CustomRoles role, string Mark = "", From from = From.None, PlayerControl pc = null) { diff --git a/Modules/Utils/UtilsTask.cs b/Modules/Utils/UtilsTask.cs index b24121406..0ecca4643 100644 --- a/Modules/Utils/UtilsTask.cs +++ b/Modules/Utils/UtilsTask.cs @@ -10,9 +10,9 @@ public static bool HasTasks(NetworkedPlayerInfo p, bool ForRecompute = true) { if (GameStates.IsLobby) return false; //Tasksがnullの場合があるのでその場合タスク無しとする - if (p.Tasks == null) return false; - if (p.Role == null) return false; - if (p.Disconnected) return false; + if (p.Tasks == null + || p.Role == null + || p.Disconnected) return false; var hasTasks = true; var States = PlayerState.GetByPlayerId(p.PlayerId); @@ -132,8 +132,6 @@ public static void DelTask() { if (pc != null) { - if (pc.GetCustomRole().GetRoleInfo()?.BaseRoleType.Invoke() is RoleTypes.Impostor or RoleTypes.Shapeshifter or RoleTypes.Phantom) continue; - if (Main.AllPlayerTask.TryGetValue(pc.PlayerId, out var tasks)) tasks.Do(task => pc.RpcCompleteTask(task)); } diff --git a/Patches/CredentialsPatch.cs b/Patches/CredentialsPatch.cs index a497de2bc..6aa6806ec 100644 --- a/Patches/CredentialsPatch.cs +++ b/Patches/CredentialsPatch.cs @@ -40,17 +40,17 @@ static void Postfix(PingTracker __instance) if (Main.DebugVersion) Debugver = $"☆Debug☆"; sb.Append("\r\n").Append($"{Main.ModName} v{Main.PluginShowVersion}" + Debugver); - if ((Options.NoGameEnd.GetBool() && GameStates.IsLobby) || (Main.DontGameSet && !GameStates.IsLobby)) sb.Append($"\r\n").Append(Utils.ColorString(Color.red, GetString("NoGameEnd"))); + if ((Options.NoGameEnd.OptionMeGetBool() && GameStates.IsLobby) || (Main.DontGameSet && !GameStates.IsLobby)) sb.Append($"\r\n").Append(Utils.ColorString(Color.red, GetString("NoGameEnd"))); if (Options.IsStandardHAS) sb.Append($"\r\n").Append(Utils.ColorString(Color.yellow, GetString("StandardHAS"))); if (Options.CurrentGameMode == CustomGameMode.HideAndSeek) sb.Append($"\r\n").Append(Utils.ColorString(Color.red, GetString("HideAndSeek"))); if (Options.CurrentGameMode == CustomGameMode.TaskBattle) sb.Append($"\r\n").Append(Utils.ColorString(Color.cyan, GetString("TaskBattle"))); - if (Options.SuddenDeathMode.GetBool()) sb.Append("\r\n").Append(Utils.ColorString(UtilsRoleText.GetRoleColor(CustomRoles.Comebacker), GetString("SuddenDeathMode"))); - if (Options.EnableGM.GetBool()) sb.Append($"\r\n").Append(Utils.ColorString(UtilsRoleText.GetRoleColor(CustomRoles.GM), GetString("GM"))); + if (Options.SuddenDeathMode.OptionMeGetBool()) sb.Append("\r\n").Append(Utils.ColorString(UtilsRoleText.GetRoleColor(CustomRoles.Comebacker), GetString("SuddenDeathMode"))); + if (Options.EnableGM.OptionMeGetBool()) sb.Append($"\r\n").Append(Utils.ColorString(UtilsRoleText.GetRoleColor(CustomRoles.GM), GetString("GM"))); if (!GameStates.IsModHost) sb.Append($"\r\n").Append(Utils.ColorString(Color.red, GetString("Warning.NoModHost"))); if (DebugModeManager.IsDebugMode) { sb.Append("\r\n"); - sb.Append(DebugModeManager.EnableTOHkDebugMode.GetBool() ? "DebugMode" : Utils.ColorString(Color.green, "デバッグモード")); + sb.Append(DebugModeManager.EnableTOHkDebugMode.OptionMeGetBool() ? "DebugMode" : Utils.ColorString(Color.green, "デバッグモード")); } var offset_x = 2.5f; //右端からのオフセット diff --git a/Patches/GameOptionsMenuPatch.cs b/Patches/GameOptionsMenuPatch.cs index 9ff7c5058..f138304c1 100644 --- a/Patches/GameOptionsMenuPatch.cs +++ b/Patches/GameOptionsMenuPatch.cs @@ -567,6 +567,7 @@ public static void Postfix(GameSettingMenu __instance) var template = GameObject.Find("Main Camera/PlayerOptionsMenu(Clone)/MainArea/GAME SETTINGS TAB/Scroller/SliderInner/GameOption_String(Clone)").GetComponent(); GameObject.Find("Main Camera/PlayerOptionsMenu(Clone)/MainArea/GAME SETTINGS TAB").SetActive(false); + GameObject.Find("Main Camera/PlayerOptionsMenu(Clone)/MainArea/ROLES TAB(Clone)/Gradient").SetActive(false); if (template == null) return; Dictionary list = new(); @@ -671,7 +672,7 @@ public static void Postfix(GameSettingMenu __instance) var tabButton = Object.Instantiate(templateTabButton, templateTabButton.transform.parent); tabButton.name = tab.ToString(); - tabButton.transform.position = templateTabButton.transform.position + new Vector3((0.762f * i * 0.8f) + (0.762f * i * w * 0.2f), 0f); + tabButton.transform.position = templateTabButton.transform.position + new Vector3((0.762f * i * 0.8f) + (0.762f * i * w * 0.2f), 0, -300f); Object.Destroy(tabButton.buttonText.gameObject); tabButton.inactiveSprites.GetComponent().sprite = UtilsSprite.LoadSprite($"TownOfHost.Resources.Tab.TabIcon_{tab}.png", 60); tabButton.activeSprites.GetComponent().sprite = UtilsSprite.LoadSprite($"TownOfHost.Resources.Tab.TabIcon_S_{tab}.png", 120); @@ -851,13 +852,13 @@ public static void Postfix(GameSettingMenu __instance) GameSettingMenuChangeTabPatch.meg = GetString("OptionResetMeg"); reset(); }), UtilsSprite.LoadSprite("TownOfHost.Resources.RESET-STG.png", 150f)); - CreateButton("OptionCopy", Color.green, new Vector2(7.3f, -0.035f), new Action(() => + CreateButton("OptionCopy", Color.green, new Vector2(7.89f, 0), new Action(() => { OptionSerializer.SaveToClipboard(); GameSettingMenuChangeTabPatch.meg = GetString("OptionCopyMeg"); reset(); }), UtilsSprite.LoadSprite("TownOfHost.Resources.COPY-STG.png", 180f), true); - CreateButton("OptionLoad", Color.green, new Vector2(7.3f + 0.125f, 0), new Action(() => + CreateButton("OptionLoad", Color.green, new Vector2(7.28f, 0), new Action(() => { OptionSerializer.LoadFromClipboard(); GameSettingMenuChangeTabPatch.meg = GetString("OptionLoadMeg"); @@ -867,8 +868,8 @@ public static void Postfix(GameSettingMenu __instance) static void CreateButton(string text, Color color, Vector2 position, Action action, Sprite sprite = null, bool csize = false) { - var ToggleButton = Object.Instantiate(csize ? HudManager.Instance.Chat.chatButton : HudManager.Instance.SettingsButton.GetComponent(), GameObject.Find("Main Camera/PlayerOptionsMenu(Clone)").transform); - ToggleButton.GetComponent().DistanceFromEdge += new Vector3(position.x, position.y, 0f); + var ToggleButton = Object.Instantiate(HudManager.Instance.SettingsButton.GetComponent(), GameObject.Find("Main Camera/PlayerOptionsMenu(Clone)").transform); + ToggleButton.GetComponent().DistanceFromEdge += new Vector3(position.x, 0, 200f); ToggleButton.transform.localScale -= new Vector3(0.25f * w, 0.25f * h); ToggleButton.name = text; diff --git a/Patches/HudPatch.cs b/Patches/HudPatch.cs index 52bbf4bf6..09b2e303e 100644 --- a/Patches/HudPatch.cs +++ b/Patches/HudPatch.cs @@ -145,7 +145,7 @@ public static void Postfix(HudManager __instance) LowerInfoText.fontSizeMax = 2.0f; } - LowerInfoText.text = roleClass?.GetLowerText(player, isForMeeting: GameStates.Meeting, isForHud: true) ?? ""; + LowerInfoText.text = roleClass?.GetLowerText(player, isForMeeting: GameStates.IsMeeting, isForHud: true) ?? ""; if (player.Is(CustomRoles.Amnesia)) LowerInfoText.text = ""; if (roleClass?.Jikaku() != CustomRoles.NotAssigned) LowerInfoText.text = ""; diff --git a/Patches/IntroPatch.cs b/Patches/IntroPatch.cs index 672f40308..50776d773 100644 --- a/Patches/IntroPatch.cs +++ b/Patches/IntroPatch.cs @@ -526,8 +526,6 @@ public static void Postfix(IntroCutscene __instance) if (GameStates.InGame && !GameStates.Meeting) UtilsNotifyRoles.NotifyRoles(); }, 15f, "Intro", true); - - UtilsNotifyRoles.NotifyRoles(NoCache: true); } } _ = new LateTask(() => Main.showkillbutton = true, 0.5f, "", true); diff --git a/Patches/MainManuNewsPatch.cs b/Patches/MainManuNewsPatch.cs index 7bd8aa1b5..5323d976d 100644 --- a/Patches/MainManuNewsPatch.cs +++ b/Patches/MainManuNewsPatch.cs @@ -786,11 +786,51 @@ public static void Init() }; AllModNews.Add(news); } - if (DateTime.Now.Year == 2025) { var news = new ModNews { Number = 100032, + Title = "...やぁ!!またあったネ", + SubTitle = "Town Of Host-K v.519.24.11", + ShortTitle = "●TOH-K v.519.24.11", + Text = "大型はないと思うけどちょくちょくこういうのは...()()()\n" + + "というか新年直ぐに.25にしたら新年と一緒じゃん。やったね。1/ 4~8にしようかしら?\n" + + "【バグ修正/仕様変更】\n" + + "・イビルテラーがそもそもピクリとも動かない問題の修正\n" + + "・クライアント視点LowerTextが正常に動作しなかった問題の修正\n" + + "・設定タブを切り替える時なんか-+ボタンが反応しちゃう問題の修正\n" + + "・オプションのコピー/ロードがチャットより前に出てくる問題の修正\n" + + "\n・処理をちょっと変更\n" + + "ケーキ屋復刻したラまたニュースに追記するネ。\n\nよらんより" + , + Date = "2024-12-08T00:00:00Z" + }; + AllModNews.Add(news); + } + if (DateTime.Now.Month is 12 && 20 <= DateTime.Now.Day) + { + var news = new ModNews + { + Number = 100033, + Title = "このメッセージは自動的に送信(?)されている", + SubTitle = "ケーキ屋の再登場だョ!!", + ShortTitle = "ケーキ屋復刻! ~ 1/8", + Text = "ケーキ屋が復刻したよ!\n" + + "やったね!期間は来月8日まで!\n" + + "なんで来月8日までって?フフフ...\n" + + "新年あけたら更に楽しくなるさ。\n" + + "\nそれじゃ。クリスマスケーキを頂こうか。" + + "\n\n\nby Yooooran" + , + Date = "2024-12-20T00:00:00Z" + }; + AllModNews.Add(news); + } + if (DateTime.Now.Year == 2025) + { + var news = new ModNews + { + Number = 100035, Title = "謹賀新年", SubTitle = "Town Of Host-K", ShortTitle = "TOH-Kからの御挨拶", diff --git a/Patches/MeetingHudPatch.cs b/Patches/MeetingHudPatch.cs index dc5dc4348..76a603fb9 100644 --- a/Patches/MeetingHudPatch.cs +++ b/Patches/MeetingHudPatch.cs @@ -77,26 +77,23 @@ public static void Prefix() Logger.Info($"------------会議開始 day:{UtilsGameLog.day}------------", "Phase"); ChatUpdatePatch.DoBlockChat = true; GameStates.AlreadyDied |= !PlayerCatch.IsAllAlive; - PlayerCatch.AllPlayerControls.Do(x => ReportDeadBodyPatch.WaitReport[x.PlayerId].Clear()); + PlayerCatch.OldAlivePlayerControles.Clear(); + foreach (var pc in PlayerCatch.AllPlayerControls) + { + ReportDeadBodyPatch.WaitReport[pc.PlayerId].Clear(); + + if (!pc.IsAlive()) + { + if (AntiBlackout.OverrideExiledPlayer) continue; + pc.RpcExileV2(); + pc.RpcSetRole(RoleTypes.CrewmateGhost, Main.SetRoleOverride); + }// 会議時に生きてたぜリスト追加 + else PlayerCatch.OldAlivePlayerControles.Add(pc); + } ReportDeadBodyPatch.DontReport.Clear(); MeetingStates.MeetingCalled = true; GameStates.Tuihou = false; - if (!AntiBlackout.OverrideExiledPlayer) - { - if (AmongUsClient.Instance.AmHost) - { - foreach (var Player in PlayerCatch.AllPlayerControls) - { - if (!Player.IsAlive() && (Player.GetCustomRole().IsImpostor() || (Player?.CanUseSabotageButton() ?? false))) - foreach (var pc in PlayerCatch.AllPlayerControls) - { - if (pc == PlayerControl.LocalPlayer) continue; - Player.RpcSetRoleDesync(RoleTypes.CrewmateGhost, pc.GetClientId()); - } - } - } - } if (Options.ExHideChatCommand.GetBool()) { _ = new LateTask(() => @@ -142,6 +139,13 @@ public static void Postfix(MeetingHud __instance) var p = PlayerCatch.AllAlivePlayerControls.OrderBy(x => x.PlayerId); var a = PlayerCatch.AllPlayerControls.Where(x => !x.IsAlive()).OrderBy(x => x.PlayerId); var list = p.ToArray().AddRangeToArray(a.ToArray()); + + HudManagerPatch.LowerInfoText.text = myRole?.GetLowerText(PlayerControl.LocalPlayer, isForMeeting: true, isForHud: true) ?? ""; + if (PlayerControl.LocalPlayer.Is(CustomRoles.Amnesia)) HudManagerPatch.LowerInfoText.text = ""; + if (myRole?.Jikaku() != CustomRoles.NotAssigned) HudManagerPatch.LowerInfoText.text = ""; + + HudManagerPatch.LowerInfoText.enabled = HudManagerPatch.LowerInfoText.text != ""; + foreach (var pva in __instance.playerStates) { var pc = PlayerCatch.GetPlayerById(pva.TargetPlayerId); @@ -149,7 +153,7 @@ public static void Postfix(MeetingHud __instance) var roleTextMeeting = UnityEngine.Object.Instantiate(pva.NameText); roleTextMeeting.transform.SetParent(pva.PlayerIcon.transform); - roleTextMeeting.transform.localPosition = new Vector3(3.25f, 1.02f, -50f); + roleTextMeeting.transform.localPosition = new Vector3(3.25f, 1.02f, -5f); roleTextMeeting.fontSize = 1.5f; (roleTextMeeting.enabled, roleTextMeeting.text) = UtilsRoleText.GetRoleNameAndProgressTextData(PlayerControl.LocalPlayer, pc, PlayerControl.LocalPlayer == pc); @@ -158,7 +162,7 @@ public static void Postfix(MeetingHud __instance) var suffixTextMeeting = UnityEngine.Object.Instantiate(pva.NameText); suffixTextMeeting.transform.SetParent(pva.PlayerIcon.transform); - suffixTextMeeting.transform.localPosition = new Vector3(3.25f, 0.02f, -50f); + suffixTextMeeting.transform.localPosition = new Vector3(3.25f, 0.02f, 0f); suffixTextMeeting.fontSize = 1.5f; suffixTextMeeting.gameObject.name = "suffixTextMeeting"; suffixTextMeeting.enableWordWrapping = false; @@ -167,7 +171,7 @@ public static void Postfix(MeetingHud __instance) // NameTextにSetParentすると後に作ったのにも付いてきちゃうからこっちに var MeetingInfo = UnityEngine.Object.Instantiate(pva.NameText); MeetingInfo.transform.SetParent(pva.PlayerIcon.transform); - MeetingInfo.transform.localPosition = new Vector3(3.13f, 1.71f, -50f); + MeetingInfo.transform.localPosition = new Vector3(3.13f, 1.71f, 0f); MeetingInfo.fontSize = 1.8f; MeetingInfo.gameObject.name = "MeetingInfo"; MeetingInfo.enableWordWrapping = false; @@ -368,7 +372,7 @@ public static void Postfix(MeetingHud __instance) continue; } } - if (RoleAddAddons.GetRoleAddon(seer.GetCustomRole(), out var data, seer) && data.GiveAddons.GetBool() && data.GiveGuesser.GetBool()) + if (RoleAddAddons.GetRoleAddon(seer.GetCustomRole(), out var data, seer) && data.GiveGuesser.GetBool()) { if (!seer.Data.IsDead && target == seer) fsb.Append(Utils.ColorString(UtilsRoleText.GetRoleColor(CustomRoles.Guesser), $"{GetString("GuessInfo")}\n")); diff --git a/Patches/OutroPatch.cs b/Patches/OutroPatch.cs index 133541c92..43ba4a0e0 100644 --- a/Patches/OutroPatch.cs +++ b/Patches/OutroPatch.cs @@ -171,7 +171,10 @@ public static void Postfix(EndGameManager __instance) switch (CustomWinnerHolder.WinnerTeam) { //通常勝利 - case CustomWinner.Crewmate: CustomWinnerColor = UtilsRoleText.GetRoleColorCode(CustomRoles.Crewmate); break; + case CustomWinner.Crewmate: + __instance.Foreground.material.color = Palette.CrewmateBlue; + CustomWinnerColor = UtilsRoleText.GetRoleColorCode(CustomRoles.Crewmate); + break; //特殊勝利 case CustomWinner.Terrorist: __instance.Foreground.material.color = Color.red; break; case CustomWinner.Lovers: __instance.BackgroundBar.material.color = UtilsRoleText.GetRoleColor(CustomRoles.Lovers); break; diff --git a/Patches/PlayerContorolPatch.cs b/Patches/PlayerContorolPatch.cs index 75233af88..b615cdf6c 100644 --- a/Patches/PlayerContorolPatch.cs +++ b/Patches/PlayerContorolPatch.cs @@ -17,6 +17,7 @@ using TownOfHost.Roles.Neutral; using AmongUs.Data; using static TownOfHost.Roles.Core.RoleBase; +using TownOfHost.Roles.Crewmate; namespace TownOfHost { @@ -181,24 +182,6 @@ public static void Prefix(PlayerControl __instance, [HarmonyArgument(0)] PlayerC if (isSucceeded) { - /* - if (!Camouflage.IsCamouflage && !Camouflager.NowUse) - if (__instance.GetRoleClass() is IUseTheShButton && AmongUsClient.Instance.AmHost && PlayerControl.LocalPlayer.PlayerId != __instance.PlayerId) - { - __instance.RpcShapeshift(__instance, false); - - foreach (var role in CustomRoleManager.AllActiveRoles.Values) - role.Colorchnge(); - - _ = new LateTask(() => - { - (__instance.GetRoleClass() as IUseTheShButton)?.Shape(__instance); - foreach (var role in CustomRoleManager.AllActiveRoles.Values) - role.Colorchnge(); - - if (Options.Onlyseepet.GetBool()) PlayerCatch.AllPlayerControls.Do(pc => pc.OnlySeeMePet(pc.Data.DefaultOutfit.PetId)); - }, 0.25f, "", true); - }*/ if (target.shapeshifting) { //シェイプシフトアニメーション中 @@ -236,8 +219,6 @@ public static void Postfix(PlayerControl __instance, [HarmonyArgument(0)] Player //以降ホストしか処理しない // 処理は全てCustomRoleManager側で行う CustomRoleManager.OnMurderPlayer(__instance, target); - //if (NoName.RoleInfo.IsEnable) - // NoName.tasks[__instance.PlayerId] += 5; } } [HarmonyPatch(typeof(PlayerControl), nameof(PlayerControl.Shapeshift))] @@ -417,6 +398,7 @@ public static bool Prefix(PlayerControl __instance, [HarmonyArgument(0)] PlayerC else targetm.RpcSetRoleDesync(Options.SkMadCanUseVent.GetBool() ? RoleTypes.Engineer : RoleTypes.Crewmate, pl.GetClientId()); } + NameColorManager.Add(targetm.PlayerId, shapeshifter.PlayerId, "#ff1919"); if (!Utils.RoleSendList.Contains(targetm.PlayerId)) Utils.RoleSendList.Add(targetm.PlayerId); PlayerState.GetByPlayerId(targetm.PlayerId).SetCountType(CountTypes.Crew); UtilsGameLog.LastLogRole[targetm.PlayerId] += "⇒" + Utils.ColorString(UtilsRoleText.GetRoleColor(targetm.GetCustomRole()), Translator.GetString($"{targetm.GetCustomRole()}")) + "" + UtilsRoleText.GetSubRolesText(targetm.PlayerId); @@ -526,7 +508,7 @@ public static bool Prefix(PlayerControl __instance, [HarmonyArgument(0)] Network if (!DontReport.TryAdd(__instance.PlayerId, (0, DontReportreson.wait))) DontReport[__instance.PlayerId] = (0, DontReportreson.wait); _ = new LateTask(() => { - if (!GameStates.Meeting) UtilsNotifyRoles.NotifyRoles(); + if (!GameStates.Meeting) UtilsNotifyRoles.NotifyRoles(SpecifySeer: __instance); }, 0.2f, "", true); return false; } @@ -548,33 +530,21 @@ public static bool Prefix(PlayerControl __instance, [HarmonyArgument(0)] Network foreach (var kvp in PlayerState.AllPlayerStates) { var pc = PlayerCatch.GetPlayerById(kvp.Key); - if (Options.ExMeetingblackout.GetBool()) + kvp.Value.LastRoom = pc?.GetPlainShipRoom(); + if (pc == null) continue; + + foreach (var pl in PlayerCatch.AllAlivePlayerControls) { - kvp.Value.IsBlackOut = true; + if (pl == null) continue; + if (pl.PlayerId == pc.PlayerId) continue; + pl.RpcSnapToDesync(pc, new Vector2(999f, 999f)); } - //Pos.TryAdd(pc.PlayerId, pc.GetTruePosition()); - if (pc == null) continue; - kvp.Value.LastRoom = pc.GetPlainShipRoom(); } + UtilsOption.MarkEveryoneDirtySettings(); AdminProvider.CalculateAdmin(true); - try - { - foreach (var pc in PlayerCatch.AllAlivePlayerControls) - { - if (pc == null) continue; - foreach (var pl in PlayerCatch.AllAlivePlayerControls) - { - if (pl == null) continue; - if (pl.PlayerId == pc.PlayerId) continue; - pl.RpcSnapToDesync(pc, new Vector2(999f, 999f)); - } - } - } - catch { Logger.Error($"ReportDeadBodyPathcのPrefixのtpでエラー!", "ReportDeadbodyPatch"); } - if (target != null) { UtilsGameLog.AddGameLog("Meeting", Utils.GetPlayerColor(target.PlayerId, true) + Translator.GetString("Meeting.Report") + "\n\t\t┗ " + string.Format(Translator.GetString("Meeting.Shoushu"), Utils.GetPlayerColor(__instance.PlayerId, true))); @@ -595,17 +565,17 @@ public static bool Prefix(PlayerControl __instance, [HarmonyArgument(0)] Network roleClass?.OnReportDeadBody(__instance, target); } - /* foreach (var pc in PlayerCatch.AllPlayerControls) { if (!pc) continue; - if (pc.Is(CustomRoles.UltraStar)) continue; - Camouflage.PlayerSkins.TryGetValue(pc.PlayerId, out var id); - pc.RpcChColor(pc, (byte)id.ColorId); - pc.RpcChColor(PlayerControl.LocalPlayer, (byte)id.ColorId); - }*/ - PlayerCatch.AllPlayerControls - .Do(pc => Camouflage.RpcSetSkin(pc, RevertToDefault: true, kyousei: true)); + if (!pc.IsAlive()) + { + pc.RpcExileV2(); + pc.RpcSetRole(RoleTypes.CrewmateGhost, Main.SetRoleOverride); + } + + Camouflage.RpcSetSkin(pc, RevertToDefault: true, kyousei: true); + } // var State = PlayerState.GetByPlayerId(__instance.PlayerId); if (State.NumberOfRemainingButtons > 0 && target is null) @@ -617,44 +587,11 @@ public static bool Prefix(PlayerControl __instance, [HarmonyArgument(0)] Network UtilsOption.SyncAllSettings(); - foreach (var pc in PlayerCatch.AllPlayerControls) - { - if (!pc) continue; - var isalive = pc.IsAlive(); - if (!isalive && (pc.GetCustomRole().IsImpostor() || ((pc.GetRoleClass() as IKiller)?.CanUseSabotageButton() ?? false))) - foreach (var Player in PlayerCatch.AllPlayerControls) - { - if (Player == PlayerControl.LocalPlayer) continue; - pc.RpcSetRoleDesync(RoleTypes.CrewmateGhost, Player.GetClientId()); - } - if (!isalive) pc.RpcExileV2(); - } - //サボ関係多分なしに~ //押したのなら強制で始める MeetingRoomManager.Instance.AssignSelf(__instance, target); DestroyableSingleton.Instance.OpenMeetingRoom(__instance); __instance.RpcStartMeeting(target); - - _ = new LateTask(() => - { - foreach (var kvp in PlayerState.AllPlayerStates) - { - kvp.Value.IsBlackOut = false; - } - UtilsOption.SyncAllSettings(); - //近アモでの処理が分からないんだけど会議中は位置参照じゃないことをいのる() - /* - //アンチテレポーターになっちゃった(・ ω <) - foreach (var data in Pos) - { - var id = data.Key; - var pos = data.Value; - - PlayerCatch.GetPlayerById(id)?.RpcSnapToForced(pos);//元の場所に。 - }*/ - //Pos.Clear(); - }, 4f, "AfterMeetingNotifyRoles", true); return false; } public static async void ChangeLocalNameAndRevert(string name, int time) @@ -696,34 +633,20 @@ public static void DieCheckReport(PlayerControl repo, NetworkedPlayerInfo target foreach (var kvp in PlayerState.AllPlayerStates) { var pc = PlayerCatch.GetPlayerById(kvp.Key); - if (Options.ExMeetingblackout.GetBool()) + kvp.Value.LastRoom = pc?.GetPlainShipRoom(); + + if (pc == null) continue; + foreach (var pl in PlayerCatch.AllAlivePlayerControls) { - kvp.Value.IsBlackOut = true; + if (pl == null) continue; + if (pl.PlayerId == pc.PlayerId) continue; + pl.RpcSnapToDesync(pc, new Vector2(999f, 999f)); } - //Pos.TryAdd(pc.PlayerId, pc.GetTruePosition()); - if (pc == null) continue; - kvp.Value.LastRoom = pc.GetPlainShipRoom(); } UtilsOption.MarkEveryoneDirtySettings(); AdminProvider.CalculateAdmin(true); - try - { - foreach (var pc in PlayerCatch.AllAlivePlayerControls) - { - if (pc == null) continue; - foreach (var pl in PlayerCatch.AllAlivePlayerControls) - { - if (pl == null) continue; - if (pl.PlayerId == pc.PlayerId) continue; - pl.RpcSnapToDesync(pc, new Vector2(999f, 999f)); - } - } - } - catch { Logger.Error($"DiecheckReportのtpでエラー!", "ReportDeadbodyPatch"); } - - if (Meetinginfo == "") { if (target != null) @@ -752,59 +675,26 @@ public static void DieCheckReport(PlayerControl repo, NetworkedPlayerInfo target roleClass?.OnReportDeadBody(repo, target); } - /* foreach (var pc in PlayerCatch.AllPlayerControls) { - if (pc.Is(CustomRoles.UltraStar)) continue; - var id = Camouflage.PlayerSkins[pc.PlayerId].ColorId; - pc.RpcChColor(pc, (byte)id); - pc.RpcChColor(PlayerControl.LocalPlayer, (byte)id); - }*/ - PlayerCatch.AllPlayerControls.Do(pc => Camouflage.RpcSetSkin(pc, RevertToDefault: true, kyousei: true)); + if (!pc) continue; + if (!pc.IsAlive()) + { + pc.RpcExileV2(); + pc.RpcSetRole(RoleTypes.CrewmateGhost, Main.SetRoleOverride); + } + Camouflage.RpcSetSkin(pc, RevertToDefault: true, kyousei: true); + } UtilsNotifyRoles.NotifyRoles(isForMeeting: true, NoCache: true); - foreach (var pc in PlayerCatch.AllPlayerControls) - { - var isalive = pc.IsAlive(); - if (pc == null) continue; - if (!isalive && (pc.GetCustomRole().IsImpostor() || ((pc.GetRoleClass() as IKiller)?.CanUseSabotageButton() ?? false))) - foreach (var Player in PlayerCatch.AllPlayerControls) - { - if (Player == PlayerControl.LocalPlayer) continue; - pc.RpcSetRoleDesync(RoleTypes.CrewmateGhost, Player.GetClientId()); - } - if (!isalive) pc.RpcExileV2(); - } - MeetingTimeManager.OnReportDeadBody(); - UtilsNotifyRoles.NotifyRoles(isForMeeting: true, NoCache: true); - UtilsOption.SyncAllSettings(); MeetingRoomManager.Instance.AssignSelf(repo, target); DestroyableSingleton.Instance.OpenMeetingRoom(repo); repo.RpcStartMeeting(target); - - _ = new LateTask(() => - { - foreach (var kvp in PlayerState.AllPlayerStates) - { - kvp.Value.IsBlackOut = false; - } - UtilsOption.SyncAllSettings(); - /* - foreach (var data in Pos) - { - var id = data.Key; - var pos = data.Value; - - PlayerCatch.GetPlayerById(id)?.RpcSnapToForced(pos); - } - Pos.Clear(); - */ - }, 4f, "AfterMeetingNotifyRoles", true); } public static Dictionary DontReport = new(); public static string Dontrepomark(PlayerControl seer, PlayerControl seen, bool isForMeeting = false) @@ -829,117 +719,77 @@ public static string Dontrepomark(PlayerControl seer, PlayerControl seen, bool i } public static bool CheckMeeting(PlayerControl repoter, NetworkedPlayerInfo target, bool checkdie = true) { - Logger.Info($"{repoter.Data?.PlayerName ?? "( ᐛ )"} => {target?.PlayerName ?? "ボタン"}", "CheckMeeting"); var c = false; if (target != null) - if (repoter.Is(CustomRoles.MassMedia)) + if (repoter.GetRoleClass() is MassMedia massMedia) { - foreach (var p in MassMedia.MassMedias) - { - if (p.Player == repoter) - { - if (p.Target == target.PlayerId) - c = true; - } - } + if (massMedia.Target == target.PlayerId) + c = true; } if (SuddenDeathMode.NowSuddenDeathMode) { - AddDontrepo(repoter.PlayerId, DontReportreson.CantUseButton); + AddDontrepo(repoter, DontReportreson.CantUseButton); return false; } - /*if (Utils.IsActive(SystemTypes.Comms) && Options.CommRepo.GetBool()) + RoleAddAddons.GetRoleAddon(repoter.GetCustomRole(), out var da, repoter, subrole: CustomRoles.NonReport); + var GiveNonReport = da.GiveNonReport.GetBool(); + var val = da.mode; + if (target == null) { - GameStates.Meeting = false; - WaitReport[__instance.PlayerId].Add(target); - Logger.Info("コミュサボ中はレポート出来なくするため、レポートをキャンセルします。", "ReportDeadBody"); - return false; - }*/ - if (RoleAddAddons.GetRoleAddon(repoter.GetCustomRole(), out var da, repoter, subrole: CustomRoles.NonReport) && da.GiveNonReport.GetBool()) - { - var val = da.mode; - if (val == RoleAddAddons.Convener.ConvenerAll && !c) - { - GameStates.Meeting = false; - Logger.Info($"NonReportの設定がALLだから通報を全てキャンセルする。", "ReportDeadBody"); - AddDontrepo(repoter.PlayerId, DontReportreson.NonReport); - return false; - } - if (target == null && val == RoleAddAddons.Convener.NotButton) + if (GiveNonReport && val is RoleAddAddons.Convener.ConvenerAll or RoleAddAddons.Convener.NotButton) { + Logger.Info($"役職でノンレポ(Mode: {val})だからキャンセル。", "ReportDeadBody"); GameStates.Meeting = false; - Logger.Info($"NonReportの設定がボタンのみだからこれはキャンセルする。", "ReportDeadBody"); - AddDontrepo(repoter.PlayerId, DontReportreson.NonReport); + AddDontrepo(repoter, DontReportreson.NonReport); return false; } - if (target != null && val == RoleAddAddons.Convener.NotReport && !c) + else { - GameStates.Meeting = false; - Logger.Info($"NonReportの設定がレポートのみだから通報をキャンセルする。", "ReportDeadBody"); - AddDontrepo(repoter.PlayerId, DontReportreson.NonReport); - return false; + if (repoter.Is(CustomRoles.NonReport) && NonReport.Mode is NonReport.Convener.ConvenerAll or NonReport.Convener.NotButton) + { + Logger.Info($"属性でノンレポ(Mode: {val})だからキャンセル。", "ReportDeadBody"); + GameStates.Meeting = false; + AddDontrepo(repoter, DontReportreson.NonReport); + return false; + } } } - else - if (repoter.Is(CustomRoles.NonReport)) + else if (!c) { - if (NonReport.Mode == NonReport.Convener.ConvenerAll && !c) + if (GiveNonReport && val is RoleAddAddons.Convener.ConvenerAll or RoleAddAddons.Convener.NotReport) { + Logger.Info($"NonReportの設定が{val}だからキャンセル。", "ReportDeadBody"); GameStates.Meeting = false; - Logger.Info($"NonReportの設定がALLだから通報を全てキャンセルする。", "ReportDeadBody"); - AddDontrepo(repoter.PlayerId, DontReportreson.NonReport); + AddDontrepo(repoter, DontReportreson.NonReport); return false; } - if (target == null && NonReport.Mode == NonReport.Convener.NotButton) - { - GameStates.Meeting = false; - Logger.Info($"NonReportの設定がボタンのみだからこれはキャンセルする。", "ReportDeadBody"); - AddDontrepo(repoter.PlayerId, DontReportreson.NonReport); - return false; - } - if (target != null && NonReport.Mode == NonReport.Convener.NotReport && !c) - { - GameStates.Meeting = false; - Logger.Info($"NonReportの設定がレポートのみだから通報をキャンセルする。", "ReportDeadBody"); - AddDontrepo(repoter.PlayerId, DontReportreson.NonReport); - return false; - } - } - - if (target != null) - { - var tage = PlayerCatch.GetPlayerById(target.PlayerId); - if (tage != null && (tage?.Is(CustomRoles.Transparent) ?? false) && !c) + else + if (repoter.Is(CustomRoles.NonReport) && NonReport.Mode is NonReport.Convener.ConvenerAll or NonReport.Convener.NotReport) { + Logger.Info($"属性でノンレポ(Mode: {val})だからキャンセル。", "ReportDeadBody"); GameStates.Meeting = false; - Logger.Info($"ターゲットがトランスパレントだから通報をキャンセルする。", "ReportDeadBody"); - AddDontrepo(repoter.PlayerId, DontReportreson.Transparent); + AddDontrepo(repoter, DontReportreson.NonReport); return false; } - if (Transparent.playerIdList.Contains(target.PlayerId)) + else + if (RoleAddAddons.GetRoleAddon(target?.Object.GetCustomRole() ?? CustomRoles.NotAssigned, out var d, target?.Object, subrole: CustomRoles.Transparent) && d.GiveTransparent.GetBool()) { GameStates.Meeting = false; - Logger.Info($"ターゲットがトランスパレントだから通報をキャンセルする。", "ReportDeadBody"); - AddDontrepo(repoter.PlayerId, DontReportreson.Transparent); + Logger.Info($"ターゲットが属性トランスパレントだから通報をキャンセルする。", "ReportDeadBody"); + AddDontrepo(repoter, DontReportreson.Transparent); return false; } - if (tage != null) - if (RoleAddAddons.GetRoleAddon(tage.GetCustomRole(), out var d, tage, subrole: CustomRoles.Transparent) && d.GiveAddons.GetBool() && d.GiveTransparent.GetBool() && !c) - { - GameStates.Meeting = false; - Logger.Info($"ターゲットがトランスパレントだから通報をキャンセルする。", "ReportDeadBody"); - AddDontrepo(repoter.PlayerId, DontReportreson.Transparent); - return false; - } - if (Musisuruoniku.TryGetValue(target.PlayerId, out var oniku) && oniku == false && !c) + else + if (target?.Object.Is(CustomRoles.Transparent) ?? false || Transparent.playerIdList.Contains(target.PlayerId)) { GameStates.Meeting = false; - Logger.Info($"ターゲットがなんらかの理由で無視されるようになってるので通報をキャンセルする。", "ReportDeadBody"); - AddDontrepo(repoter.PlayerId, DontReportreson.Other); + Logger.Info($"ターゲットが属性トランスパレントだから通報をキャンセルする。", "ReportDeadBody"); + AddDontrepo(repoter, DontReportreson.Transparent); return false; } } + if (!AmongUsClient.Instance.AmHost) return true; //通報者が死んでいる場合、本処理で会議がキャンセルされるのでここで止める @@ -957,7 +807,7 @@ public static bool CheckMeeting(PlayerControl repoter, NetworkedPlayerInfo targe { Logger.Info($"{role}によって会議はキャンセルされました。", "ReportDeadBody"); GameStates.Meeting = false; - AddDontrepo(repoter.PlayerId, r); + AddDontrepo(repoter, r); return false; } } @@ -969,23 +819,19 @@ public static bool CheckMeeting(PlayerControl repoter, NetworkedPlayerInfo targe { GameStates.Meeting = false; Logger.Info("使用可能ボタン回数が最大数を超えているため、ボタンはキャンセルされました。", "ReportDeadBody"); - AddDontrepo(repoter.PlayerId, DontReportreson.CantUseButton); + AddDontrepo(repoter, DontReportreson.CantUseButton); return false; } else Options.UsedButtonCount++; - if (Options.SyncedButtonCount.GetFloat() == Options.UsedButtonCount) - { - Logger.Info("使用可能ボタン回数が最大数に達しました。", "ReportDeadBody"); - } } return true; - void AddDontrepo(byte id, DontReportreson repo) + void AddDontrepo(PlayerControl pc, DontReportreson repo) { - if (!DontReport.TryAdd(id, (0, repo))) DontReport[id] = (0, repo); + if (!DontReport.TryAdd(pc.PlayerId, (0, repo))) DontReport[pc.PlayerId] = (0, repo); _ = new LateTask(() => { - if (!GameStates.Meeting) UtilsNotifyRoles.NotifyRoles(); + if (!GameStates.Meeting) UtilsNotifyRoles.NotifyRoles(SpecifySeer: pc); }, 0.2f, "", true); } } @@ -1100,7 +946,7 @@ public static void Postfix(PlayerControl __instance) ReportDeadBodyPatch.DontReport.Remove(__instance.PlayerId); _ = new LateTask(() => { - if (!GameStates.Meeting) UtilsNotifyRoles.NotifyRoles(); + if (!GameStates.Meeting) UtilsNotifyRoles.NotifyRoles(SpecifySeer: __instance); }, 0.2f, "", true); } else @@ -1153,46 +999,6 @@ public static void Postfix(PlayerControl __instance) { FallFromLadder.FixedUpdate(player); } - if (!GameStates.Meeting && GameStates.IsInTask && PlayerControl.LocalPlayer.IsAlive()) - { - if (Main.MessagesToSend.Count > 0) - { - var pc = PlayerCatch.AllAlivePlayerControls.OrderBy(x => x.PlayerId).FirstOrDefault(); - if (pc != null) - { - (string msg, byte sendTo, string title) = Main.MessagesToSend[0]; - if (sendTo != byte.MaxValue) - { - Main.MessagesToSend.RemoveAt(0); - var sendpc = PlayerCatch.GetPlayerById(sendTo); - int clientId = sendpc.GetClientId(); - if (sendpc == null) return; - var name = pc.Data.PlayerName; - if (clientId == -1) - { - pc.SetName(title); - DestroyableSingleton.Instance.Chat.AddChat(pc, msg); - pc.SetName(name); - } - var writer = CustomRpcSender.Create("MessagesToSend", SendOption.None); - writer.StartMessage(clientId); - writer.StartRpc(pc.NetId, (byte)RpcCalls.SetName) - .Write(player.Data.NetId) - .Write(title) - .EndRpc(); - writer.StartRpc(pc.NetId, (byte)RpcCalls.SendChat) - .Write(msg) - .EndRpc(); - writer.StartRpc(pc.NetId, (byte)RpcCalls.SetName) - .Write(player.Data.NetId) - .Write(pc.Data.PlayerName) - .EndRpc(); - writer.EndMessage(); - writer.SendMessage(); - } - } - } - } if (GameStates.IsInTask && Main.introDestroyed && isAlive && !player.IsModClient()) { Dictionary Distance = new(); @@ -1350,6 +1156,46 @@ public static void Postfix(PlayerControl __instance) } if (Main.NowSabotage) Main.sabotagetime += Time.fixedDeltaTime; + if (!GameStates.Meeting && PlayerControl.LocalPlayer.IsAlive()) + { + if (Main.MessagesToSend.Count > 0) + { + var pc = PlayerCatch.AllAlivePlayerControls.OrderBy(x => x.PlayerId).FirstOrDefault(); + if (pc != null) + { + (string msg, byte sendTo, string title) = Main.MessagesToSend[0]; + if (sendTo != byte.MaxValue) + { + Main.MessagesToSend.RemoveAt(0); + var sendpc = PlayerCatch.GetPlayerById(sendTo); + int clientId = sendpc.GetClientId(); + if (sendpc == null) return; + var name = pc.Data.PlayerName; + if (clientId == -1) + { + pc.SetName(title); + DestroyableSingleton.Instance.Chat.AddChat(pc, msg); + pc.SetName(name); + } + var writer = CustomRpcSender.Create("MessagesToSend", SendOption.None); + writer.StartMessage(clientId); + writer.StartRpc(pc.NetId, (byte)RpcCalls.SetName) + .Write(player.Data.NetId) + .Write(title) + .EndRpc(); + writer.StartRpc(pc.NetId, (byte)RpcCalls.SendChat) + .Write(msg) + .EndRpc(); + writer.StartRpc(pc.NetId, (byte)RpcCalls.SetName) + .Write(player.Data.NetId) + .Write(pc.Data.PlayerName) + .EndRpc(); + writer.EndMessage(); + writer.SendMessage(); + } + } + } + } //ラバーズ Lovers.LoversSuicide(); Lovers.RedLoversSuicide(); @@ -1414,12 +1260,12 @@ public static void Postfix(PlayerControl __instance) .Write(target.GetNextRpcSequenceId(RpcCalls.SetVisorStr)) .EndRpc(); sender.SendMessage(); - if (Options.Onlyseepet.GetBool()) PlayerCatch.AllPlayerControls.Do(pc => pc.OnlySeeMePet(pc.Data.DefaultOutfit.PetId)); } else Camouflage.RpcSetSkin(target); remove.Add(id); } + if (Options.Onlyseepet.GetBool()) PlayerCatch.AllPlayerControls.Do(pc => pc.OnlySeeMePet(pc.Data.DefaultOutfit.PetId)); remove.ForEach(task => Camouflage.ventplayr.Remove(task)); } } @@ -1432,18 +1278,16 @@ public static void Postfix(PlayerControl __instance) if (!__instance.CanUseKillButton()) target = null; HudManager.Instance.KillButton.SetTarget(target); } - if ((GameStates.InGame || GameStates.Intro) && (CustomRoles.Monochromer.IsEnable() || PlayerCatch.AllPlayerControls.Any(pc => pc.Is(CustomRoles.Monochromer)))) - { - foreach (var pc in PlayerCatch.AllPlayerControls) - { - if (!Camouflage.PlayerSkins.TryGetValue(pc.PlayerId, out var outfit)) continue; - if (pc == null || pc?.Data == null) continue; + } - pc.Data.DefaultOutfit.ColorId = outfit.ColorId; - pc.Data.DefaultOutfit.HatId = outfit.HatId; - pc.Data.DefaultOutfit.SkinId = outfit.SkinId; - pc.Data.DefaultOutfit.VisorId = outfit.VisorId; - } + if ((GameStates.InGame || GameStates.Intro) && PlayerCatch.AllPlayerControls.Any(pc => pc.Is(CustomRoles.Monochromer))) + { + if (!Camouflage.PlayerSkins.TryGetValue(__instance.PlayerId, out var outfit)) + { + __instance.Data.DefaultOutfit.ColorId = outfit.ColorId; + __instance.Data.DefaultOutfit.HatId = outfit.HatId; + __instance.Data.DefaultOutfit.SkinId = outfit.SkinId; + __instance.Data.DefaultOutfit.VisorId = outfit.VisorId; } } @@ -1494,6 +1338,7 @@ public static void Postfix(PlayerControl __instance) //変数定義 var seer = PlayerControl.LocalPlayer; var seerRole = seer.GetRoleClass(); + var seerSubrole = seer.GetCustomSubRoles(); var target = __instance; string name = "";//$"暇な人 KYけーわい\n■"; //if (seer.transform.position.y < -1) @@ -1574,6 +1419,7 @@ public static void Postfix(PlayerControl __instance) else { var targetlover = target.GetRiaju(); + var seerisonelover = seerSubrole.Contains(CustomRoles.OneLove); //ハートマークを付ける(会議中MOD視点) if ((targetlover == seer.GetRiaju() && targetlover is not CustomRoles.OneLove and not CustomRoles.NotAssigned) || (seer.Data.IsDead && target.IsRiaju() && targetlover != CustomRoles.OneLove)) @@ -1581,15 +1427,15 @@ public static void Postfix(PlayerControl __instance) Mark.Append(Utils.ColorString(UtilsRoleText.GetRoleColor(targetlover), "♥")); } else - if ((Lovers.OneLovePlayer.Ltarget == target.PlayerId && target.PlayerId != seer.PlayerId && seer.Is(CustomRoles.OneLove)) - || (target.Is(CustomRoles.OneLove) && target.PlayerId != seer.PlayerId && seer.Is(CustomRoles.OneLove)) - || (seer.Data.IsDead && target.Is(CustomRoles.OneLove) && !seer.Is(CustomRoles.OneLove))) + if ((Lovers.OneLovePlayer.Ltarget == target.PlayerId && target.PlayerId != seer.PlayerId && seerisonelover) + || (target.Is(CustomRoles.OneLove) && target.PlayerId != seer.PlayerId && seerisonelover) + || (seer.Data.IsDead && target.Is(CustomRoles.OneLove) && !seerisonelover)) { Mark.Append(Utils.ColorString(UtilsRoleText.GetRoleColor(CustomRoles.OneLove), "♡")); } - if ((target.Is(CustomRoles.Connecting) && seer.Is(CustomRoles.Connecting) - && !target.Is(CustomRoles.WolfBoy) && !seer.Is(CustomRoles.WolfBoy)) + if ((target.Is(CustomRoles.Connecting) && seerSubrole.Contains(CustomRoles.Connecting) + && !target.Is(CustomRoles.WolfBoy) && seerRole is not WolfBoy) || (target.Is(CustomRoles.Connecting) && seer.Data.IsDead)) { Mark.Append($"Ψ"); @@ -1611,7 +1457,7 @@ public static void Postfix(PlayerControl __instance) { if (((seerRole as Alien)?.modeProgresskiller == true && Alien.ProgressWorkhorseseen) || ((seerRole as JackalAlien)?.modeProgresskiller == true && JackalAlien.ProgressWorkhorseseen) - || (seer.Is(CustomRoles.ProgressKiller) && ProgressKiller.ProgressWorkhorseseen)) + || (seerRole is ProgressKiller) && ProgressKiller.ProgressWorkhorseseen) { Mark.Append($"♦"); } @@ -1625,7 +1471,7 @@ public static void Postfix(PlayerControl __instance) if ((Utils.IsActive(SystemTypes.Comms) && Options.CommsCamouflage.GetBool()) || (seer.Is(CustomRoles.Monochromer) && seer.IsAlive()) || Camouflager.NowUse - || (Options.SuddenCannotSeeName.GetBool() && !TemporaryName)) + || (SuddenDeathMode.SuddenCannotSeeName && !TemporaryName)) RealName = $"{RealName} "; } bool? canseedeathreasoncolor = seer.PlayerId.CanDeathReasonKillerColor() == true ? true : null; diff --git a/Patches/onGameStartedPatch.cs b/Patches/onGameStartedPatch.cs index b614f89a4..5a325d0d7 100644 --- a/Patches/onGameStartedPatch.cs +++ b/Patches/onGameStartedPatch.cs @@ -164,6 +164,7 @@ public static void Postfix(AmongUsClient __instance) PlayerControlPhantomPatch.cantuse.Clear(); Main.FixTaskNoPlayer.Clear(); Camouflage.ventplayr.Clear(); + PlayerCatch.OldAlivePlayerControles.Clear(); ReportDeadBodyPatch.DontReport.Clear(); RandomSpawn.SpawnMap.NextSporn.Clear(); RandomSpawn.SpawnMap.NextSpornName.Clear(); @@ -356,6 +357,7 @@ public static void Postfix() foreach (var pc in PlayerCatch.AllPlayerControls) { + if (!pc.Is(CustomRoles.GM)) PlayerCatch.OldAlivePlayerControles.Add(pc); pc.Data.IsDead = false; //プレイヤーの死を解除する var state = PlayerState.GetByPlayerId(pc.PlayerId); if (state.MainRole != CustomRoles.NotAssigned) continue; //既にカスタム役職が割り当てられていればスキップ diff --git a/Resources/string.csv b/Resources/string.csv index 0564d24a7..6c8349f7f 100644 --- a/Resources/string.csv +++ b/Resources/string.csv @@ -357,7 +357,7 @@ "KingInfo","","皆の者、我を称え、ひれ伏すが良い" "AmateurTellerInfo","","これって意味なんだっけ" "GaspInfo","","最後のあがきだ" -"CakeshopInfo","","美味しいケーキ!ねぇ!ほらそこの君も食べて!!\n食べてくれないとイタズラしちゃうぞ..!" +"CakeshopInfo","","美味しいケーキ!ねぇ!ほらそこの君も食べて!!\n食べた?ならプレゼント頂戴?食べてくれないとイタズラしちゃうぞ..!" "StolenerInfo","","あっ...盗らないでよ!!" "SnowmanInfo","","溶けきらないように..." "#CrewmateInfo" @@ -565,7 +565,7 @@ "EfficientInfoLong","","他のクルー役職よりタスクが多いが、タスクを完了させると、\n一定確率でもう一つタスクが完了する。\n効率化成功時、守護天使のバリアが見える。\n効率化成功後、3秒間の間タスクを完了させても効率化が出来ない" "KingInfoLong","","基本死亡しないが、死亡した時、クルー陣営に大きな損害をもたらす。\n通常キル、多くの特殊キルでも死亡しない。\nただし、会議で一定数票が集まってしまうと自身が追放されてしまう。\nクルー陣営には自身が君臨者であることが分かっているが人外には分からない。\n君臨者には天邪鬼,アムネシアは付与されない。" "AmateurTellerInfoLong","","既定のタスク数を完了した状態で会議で自投票すると占いモードに変更できる。\n占いモードの状態で自身以外の誰かに投票すると、投票先を占うことが出来る。\n占いには1ターンかかり、対象者が人外の場合、占われている事が分かってしまう。\n1会議で1人までしか占えない。" -"CakeshopInfoLong","","< 一周年限定役職 > \n会議後、全員にケーキを配るケーキ屋さん!\nケーキの効果時間は次の会議が終わるまで!!\n(会議後、次の会議が終わるまで全員にランダムな属性が1つ付与される。)\n追放されると誰かを道連れにする。\nケーキを受け取ってくれなかったらイタズラだから..ね??" +"CakeshopInfoLong","","< 一周年限定役職 > \n会議後、全員にケーキを配るケーキ屋さん!\nケーキの効果時間は次の会議が終わるまで!!\n(会議後、次の会議が終わるまで全員にランダムな属性が1つ付与される。)\n追放されると誰かを道連れにする。\nメリークリスマス!美味しいケーキをあげるから~プレゼントちょーだい!\n\nケーキを受け取ってくれなかったらイタズラだから..ね??" "StolenerInfoLong","","自身がキルされると、設定で付与している属性がキラーに付与される。\n自身が属性を使えるかは設定による。" "SnowmanInfoLong","","タスクターン中、視界がだんだん狭くなる。\nタスクを完了させるたびに視界が広がる。" "GaspInfoLong","","タスクを一定数完了させ、\n誰かにキルされると次の会議が始まるまでキラーの名前に★マークがつく。\n死体が残らない死に方をした場合でもマークがつく" @@ -1093,6 +1093,7 @@ "EvilTellerTellTime","","占いに必要な時間" "EvilTellerDistance","","占いに必要な範囲" "EvilTellertellrole","","対象の役職が変更されても分かる" +"EvilTellerCanTellCount","","占い可能回数" "ConnectSaverTageKillCooldown","use ability killcooldown","能力使用ターンのキルクール" "ConnectSaverPlayerCount","use abilities alive player count","能力発動に必要な生存人数" "ConnectSaverDeathReason","deathreason","キルしてない方の死因" diff --git a/Roles/AddOns/RoleAddAddons.cs b/Roles/AddOns/RoleAddAddons.cs index ab5642d23..b3285d65a 100644 --- a/Roles/AddOns/RoleAddAddons.cs +++ b/Roles/AddOns/RoleAddAddons.cs @@ -75,7 +75,7 @@ public RoleAddAddons(int idStart, TabGroup tab, CustomRoles role, CustomRoles ch this.IsImpostor = role.IsImpostor(); this.IdStart = idStart; this.Role = role; - GiveAddons = BooleanOptionItem.Create(idStart++, "addaddons", DefaaultOn, tab, false).SetParent(Options.CustomRoleSpawnChances[role]) + GiveAddons = BooleanOptionItem.Create(idStart++, "addaddons", DefaaultOn || NeutralKiller, tab, false).SetParent(Options.CustomRoleSpawnChances[role]) .SetValueFormat(OptionFormat.None); GiveGuesser = BooleanOptionItem.Create(idStart++, "GiveGuesser", false, tab, false).SetParent(GiveAddons); CanGuessTime = FloatOptionItem.Create(idStart++, "CanGuessTime", new(1, 15, 1), 3, tab, false).SetParent(GiveGuesser) @@ -140,6 +140,16 @@ public static RoleAddAddons Create(int idStart, TabGroup tab, CustomRoles role) { return new RoleAddAddons(idStart, tab, role); } + /// + /// 役職付与の属性
+ /// ストルナーとかが重いため必要な分だけ取り出す
+ /// GiveAddonがfalseの場合、全てデフォルト値になるのでチェックは基本不要 + ///
+ /// 役職 + /// 返すデータ + /// 付与されているプレイヤー + /// 必要な役職 + /// public static bool GetRoleAddon(CustomRoles role, out RoleAddAddons data, PlayerControl player = null, params CustomRoles[] subrole) { var haveaddon = false; diff --git a/Roles/Crewmate/Merlin.cs b/Roles/Crewmate/Merlin.cs deleted file mode 100644 index 2cbf047a1..000000000 --- a/Roles/Crewmate/Merlin.cs +++ /dev/null @@ -1,37 +0,0 @@ -/*using System.Linq; -using AmongUs.GameOptions; -using TownOfHost.Roles.Core; -using TownOfHost.Roles.Core.Interfaces; - -namespace TownOfHost.Roles.Crewmate; -public sealed class Merlin : RoleBase, IKillFlashSeeable -{ - public static readonly SimpleRoleInfo RoleInfo = - SimpleRoleInfo.Create( - typeof(Merlin), - player => new Merlin(player), - CustomRoles.Merlin, - () => RoleTypes.Crewmate, - CustomRoleTypes.Crewmate, - 29020, - null, - "mer", - "#8cffff", - combination: CombinationRoles.AssassinandMerlin - ); - public Merlin(PlayerControl player) - : base( - RoleInfo, - player - ) - { - foreach (var impostor in PlayerCatch.AllPlayerControls.Where(player => player.Is(CustomRoleTypes.Impostor))) - { - NameColorManager.Add(Player.PlayerId, impostor.PlayerId, impostor.GetRoleColorCode()); - } - } - //もし設定など入れたい場合は - //あああ = Assassin.設定名 - //って感じにこっちに持ってくればよい(←わかりずらい) -} -*/ \ No newline at end of file diff --git a/Roles/Crewmate/Stolener.cs b/Roles/Crewmate/Stolener.cs index 1329eea0a..e500c2b5f 100644 --- a/Roles/Crewmate/Stolener.cs +++ b/Roles/Crewmate/Stolener.cs @@ -58,7 +58,7 @@ public override void OnFixedUpdate(PlayerControl player) UtilsNotifyRoles.NotifyRoles(); if (kier is not null) - if (RoleAddAddons.GetRoleAddon(CustomRoles.Stolener, out var d, null, subrole: [CustomRoles.Guarding, CustomRoles.Speeding]) && d.GiveAddons.GetBool()) + if (RoleAddAddons.GetRoleAddon(CustomRoles.Stolener, out var d, null, subrole: [CustomRoles.Guarding, CustomRoles.Speeding])) { if (d.GiveGuarding.GetBool()) Main.Guard[kier.PlayerId] += d.Guard.GetInt(); if (d.GiveSpeeding.GetBool() && !kier.Is(CustomRoles.UltraStar)) Main.AllPlayerSpeed[kier.PlayerId] = d.Speed.GetFloat(); diff --git a/Roles/Crewmate/Taskstar.cs b/Roles/Crewmate/Taskstar.cs index 58fa8ee48..6b6397960 100644 --- a/Roles/Crewmate/Taskstar.cs +++ b/Roles/Crewmate/Taskstar.cs @@ -39,6 +39,7 @@ public override bool OnCompleteTask(uint taskid) if (IsTaskFinished) { Player.MarkDirtySettings(); + UtilsNotifyRoles.NotifyRoles(ForceLoop: true); } return true; diff --git a/Roles/Crewmate/VentBeginner.cs b/Roles/Crewmate/VentBeginner.cs new file mode 100644 index 000000000..ec9525681 --- /dev/null +++ b/Roles/Crewmate/VentBeginner.cs @@ -0,0 +1,84 @@ +/*NextUpdete +using AmongUs.GameOptions; + +using TownOfHost.Roles.Core; + +namespace TownOfHost.Roles.Crewmate; +public sealed class VentBeginner : RoleBase +{ + public static readonly SimpleRoleInfo RoleInfo = + SimpleRoleInfo.Create( + typeof(VentBeginner), + player => new VentBeginner(player), + CustomRoles.VentBeginner, + () => RoleTypes.Engineer, + CustomRoleTypes.Crewmate, + 22300, + SetupOptionItem, + "vb", + "#ff6666", + introSound: () => DestroyableSingleton.Instance.TaskCompleteSound + ); + public VentBeginner(PlayerControl player) + : base( + RoleInfo, + player + ) + { + first = FirstCooldown.GetFloat(); + SetAbilityCooldown = -1f; + } + + private static OptionItem FirstCooldown; + private float first; + private float SetAbilityCooldown; + + enum Options + { + FirstCooldown + } + + private static void SetupOptionItem() + { + FirstCooldown = FloatOptionItem.Create(RoleInfo, 10, Options.FirstCooldown, new(15f, 60f, 1f), 45f, false); + } + + public override bool OnCompleteTask(uint taskid) + { + if (IsTaskFinished) + { + Player.RpcSetCustomRole(CustomRoles.VentMaster); + return true; + } + Player.MarkDirtySettings(); + return true; + } + + public override bool CantVentIdo(PlayerPhysics physics, int ventId) + { + var state = Player.GetPlayerTaskState(); + return state.AllTasksCount / 1.5 >= state.AllTasksCount - state.CompletedTasksCount; + } + + public override bool OnEnterVent(PlayerPhysics physics, int ventId) + { + var state = Player.GetPlayerTaskState(); + if (state.AllTasksCount / 1.5 >= state.AllTasksCount - state.CompletedTasksCount) + { + SetAbilityCooldown = 0; + Player.MarkDirtySettings(); + Player.RpcResetAbilityCooldown(); + Player.MarkDirtySettings(); + } + return true; + } + + public override void ApplyGameOptions(IGameOptions opt) + { + var state = Player.GetPlayerTaskState(); + AURoleOptions.EngineerCooldown = SetAbilityCooldown != -1f ? SetAbilityCooldown : first - (first / state.AllTasksCount * state.CompletedTasksCount); + AURoleOptions.EngineerInVentMaxTime = 0; + SetAbilityCooldown = -1f; + } +} +*/ \ No newline at end of file diff --git a/Roles/Crewmate/VentOpener.cs b/Roles/Crewmate/VentOpener.cs new file mode 100644 index 000000000..f496f213c --- /dev/null +++ b/Roles/Crewmate/VentOpener.cs @@ -0,0 +1,133 @@ +/*NextUpdete +using AmongUs.GameOptions; +using System.Collections.Generic; +using UnityEngine; + +using TownOfHost.Roles.Core; + +namespace TownOfHost.Roles.Crewmate; +public sealed class VentOpener : RoleBase +{ + public static readonly SimpleRoleInfo RoleInfo = + SimpleRoleInfo.Create( + typeof(VentOpener), + player => new VentOpener(player), + CustomRoles.VentOpener, + () => RoleTypes.Engineer, + CustomRoleTypes.Crewmate, + 22370, + SetupOptionItem, + "vo", + "#fbe000", + introSound: () => GetIntroSound(RoleTypes.Engineer) + ); + public VentOpener(PlayerControl player) + : base( + RoleInfo, + player + ) + { + CustomRoleManager.OnEnterVentOthers.Add(OnEnterVentOthers); + ventid.Clear(); + count = OptionCount.GetFloat(); + cooldown = OptionCooldown.GetInt(); + Defo = count is 0; + fuhatu = !OptinoFuhatu.GetBool(); + Imp = OptionImp.GetBool(); + Mad = OptionMad.GetBool(); + Crew = OptionCrew.GetBool(); + Neutral = OptionNeutral.GetBool(); + taskc = OptionCanTaskcount.GetFloat(); + } + + private static OptionItem OptionCount; + private static OptionItem OptionCooldown; + private static OptionItem OptinoFuhatu; + private static OptionItem OptionImp; + private static OptionItem OptionCrew; + private static OptionItem OptionMad; + private static OptionItem OptionNeutral; + private static OptionItem OptionCanTaskcount; + static int cooldown; + static bool fuhatu; + static bool Imp; + static bool Crew; + static bool Mad; + static bool Neutral; + static bool Defo; + static float taskc; + float count; + + static Dictionary ventid = new(); + + enum OptionName + { + vocount, + Cooldown, + Fuhatu, + VoImp, + VoMad, + VoCrew, + VoNeutral, + cantaskcount + } + + private static void SetupOptionItem() + { + OptionCount = FloatOptionItem.Create(RoleInfo, 10, OptionName.vocount, new(0, 30, 1), 3, false); + OptionCooldown = IntegerOptionItem.Create(RoleInfo, 11, OptionName.Cooldown, new(0, 999, 1), 30, false); + OptinoFuhatu = BooleanOptionItem.Create(RoleInfo, 12, OptionName.Fuhatu, false, false); + OptionImp = BooleanOptionItem.Create(RoleInfo, 13, OptionName.VoImp, true, false); + OptionMad = BooleanOptionItem.Create(RoleInfo, 14, OptionName.VoMad, true, false); + OptionCrew = BooleanOptionItem.Create(RoleInfo, 15, OptionName.VoCrew, true, false); + OptionNeutral = BooleanOptionItem.Create(RoleInfo, 16, OptionName.VoNeutral, true, false); + OptionCanTaskcount = FloatOptionItem.Create(RoleInfo, 17, OptionName.cantaskcount, new(0, 99, 1), 5, false); + } + + public static bool OnEnterVentOthers(PlayerPhysics physics, int ventId) + { + ventid[physics.myPlayer.PlayerId] = ventId; + return true; + } + public override bool OnEnterVent(PlayerPhysics physics, int ventId) + { + if (count <= 0 && !Defo && MyTaskState.CompletedTasksCount < taskc) return false; + bool check = false; + foreach (var (playerid, id) in ventid) + { + var pc = PlayerCatch.GetPlayerById(playerid); + var role = pc.GetCustomRole(); + if (pc.inVent //ベントに入ってるか ↓設定とかのチェック + && ((role.IsImpostor() && Imp) + || (role.IsMadmate() && Mad) + || (role.IsCrewmate() && Crew) + || (role.IsNeutral() && Neutral))) + { + pc.MyPhysics?.RpcBootFromVent(id); + check = true; + } + } + if (check) + Player.KillFlash(false); + if ((check || fuhatu) && count > 0) + count--; + _ = new LateTask(() => Player.MyPhysics?.RpcBootFromVent(ventId), 0.5f); + UtilsNotifyRoles.NotifyRoles(false, Player); + return false; + } + public override bool CantVentIdo(PlayerPhysics physics, int ventId) => false; + public override string GetProgressText(bool comms = false,bool gamelog = false) => Defo ? "" : Utils.ColorString(count > 0 && MyTaskState.CompletedTasksCount >= taskc ? RoleInfo.RoleColor : Color.red, $"({count})"); + + public override void OnVentilationSystemUpdate(PlayerControl user, VentilationSystem.Operation Operation, int ventId) + { + if (Operation != VentilationSystem.Operation.Move) return; + ventid[user.PlayerId] = ventId; + } + + public override void ApplyGameOptions(IGameOptions opt) + { + AURoleOptions.EngineerCooldown = cooldown; + AURoleOptions.EngineerInVentMaxTime = 1; + } +} +*/ \ No newline at end of file diff --git a/Roles/Impostor/Assassin.cs b/Roles/Impostor/Assassin.cs deleted file mode 100644 index a51dfcfa1..000000000 --- a/Roles/Impostor/Assassin.cs +++ /dev/null @@ -1,159 +0,0 @@ -/*using System.Collections.Generic; -using AmongUs.GameOptions; - -using TownOfHost.Modules; -using TownOfHost.Roles.Core; -using TownOfHost.Roles.Core.Interfaces; -using static TownOfHost.Translator; - -namespace TownOfHost.Roles.Impostor; -public sealed class Assassin : RoleBase, IImpostor -{ - public static readonly SimpleRoleInfo RoleInfo = - SimpleRoleInfo.Create( - typeof(Assassin), - player => new Assassin(player), - CustomRoles.Assassin, - () => RoleTypes.Impostor, - CustomRoleTypes.Impostor, - 1902, - null, - "as", - tab: TabGroup.Combinations, - assignInfo: new RoleAssignInfo(CustomRoles.Assassin, CustomRoleTypes.Impostor) - { - AssignUnitRoles = new CustomRoles[2] { CustomRoles.Assassin, CustomRoles.Merlin } - }, - combination: CombinationRoles.AssassinandMerlin - ); - public Assassin(PlayerControl player) - : base( - RoleInfo, - player - ) - { - MeetingStates = 0; - hostname = null; - } - - static string hostname; - static int MeetingStates; - - //ここに書いておこう! - //この役職は実装しない予定だ! - //えなんでかって?SHRとかにあるかr((( - //配信とかで使ってあげてください( - //ちなみにマーリン死んでたら終わり☆ - - public override bool VotingResults(ref NetworkedPlayerInfo Exiled, ref bool IsTie, Dictionary vote, byte[] mostVotedPlayers, bool ClearAndExile) - { - if (Exiled != null) - { - if (Exiled.PlayerId == Player.PlayerId && MeetingStates is 0) - { - Exiled = null; - IsTie = true; - MeetingStates = 1; - } - } - if (MeetingStates is 2) - { - PlayerControl target; - if (Exiled is null) - target = Player; - else - target = PlayerCatch.GetPlayerById(Exiled.PlayerId); - if (target.Is(CustomRoles.Merlin)) - MeetingStates = 3; - Exiled = Player.Data; - IsTie = false; - _ = new LateTask(() => - { - var text = Main.AllPlayerNames[target.PlayerId]; - if (target.PlayerId == PlayerControl.LocalPlayer.PlayerId && Main.nickName != "") - text = Main.nickName; - text += $"は{GetString($"{CustomRoles.Merlin}")}{(MeetingStates is 3 ? "だ" : "ではなか")}った。"; - if (Is(PlayerControl.LocalPlayer)) - { - hostname = Main.nickName; - Main.nickName = text; - } - else - Player.RpcSetName(text); - }, 4f); - } - - return false; - } - - public override void OnExileWrapUp(NetworkedPlayerInfo exiled, ref bool DecidedWinner) - { - if (MeetingStates is not 2 and not 3) return; - - if (Is(PlayerControl.LocalPlayer)) - Main.nickName = hostname; - else - Player.RpcSetName(Main.AllPlayerNames[Player.PlayerId]); - - if (MeetingStates is 3) - { - CustomWinnerHolder.ResetAndSetWinner(CustomWinner.Impostor); - DecidedWinner = true; - } - MeetingStates = 0; - } - - public override void AfterMeetingTasks() - { - if (MeetingStates is 1) - { - _ = new LateTask(() => - { - Player.NoCheckStartMeeting(null); - MeetingStates = 2; - Utils.SendMessage("マーリンはだれ?", title: $"アサシン会議"); - }, 0.4f); - } - } - - public override void OnStartMeeting() - { - var sender = new CustomRpcSender("Assassin SoseiRPC", SendOption.Reliable, true); - sender.StartMessage(Player.GetClientId()); - var writer = sender.stream; - List sosei = new(); - writer.StartMessage(1); // Data - { - writer.WritePacked(GameData.Instance.NetId); - foreach (var info in GameData.Instance.AllPlayers.ToArray().Where(i => i.IsDead)) - { - info.IsDead = false; - writer.StartMessage(info.PlayerId); - info.Serialize(writer); - writer.EndMessage(); - sosei.Add(info.PlayerId); - } - writer.EndMessage(); - } - sender.EndMessage(); - - _ = new LateTask(() => - { - foreach (var id in sosei) - PlayerCatch.GetPlayerById(id).RpcExileV2(); - }, 3f); - } - - public override bool CheckVoteAsVoter(byte votedForId, PlayerControl voter) - { - if (MeetingStates is 2 && !Is(voter)) - return false; - return true; - } - public override (byte? votedForId, int? numVotes, bool doVote) ModifyVote(byte voterId, byte sourceVotedForId, bool isIntentional) - { - if (MeetingStates is 2) - MeetingVoteManager.Instance.ClearAndExile(Player.PlayerId, sourceVotedForId); - return (null, null, true); - } -}*/ \ No newline at end of file diff --git a/Roles/Impostor/Camouflager.cs b/Roles/Impostor/Camouflager.cs index 05d0274bc..42f3ab584 100644 --- a/Roles/Impostor/Camouflager.cs +++ b/Roles/Impostor/Camouflager.cs @@ -52,14 +52,11 @@ public override void ApplyGameOptions(IGameOptions opt) } public override void OnFixedUpdate(PlayerControl player) { - if (!AmongUsClient.Instance.AmHost) return; - if (!NowUse) return; - if (GameStates.Meeting) return; - if (Limit <= -50) return; + if (!AmongUsClient.Instance.AmHost || !NowUse || GameStates.Meeting || Limit <= -50) return; Limit -= Time.fixedDeltaTime; - if (VentPlayers.Count != 0) + if (VentPlayers.Count > 0) { var remove = new List(); foreach (var id in VentPlayers) @@ -95,12 +92,11 @@ public override void OnFixedUpdate(PlayerControl player) .Write(target.GetNextRpcSequenceId(RpcCalls.SetVisorStr)) .EndRpc(); sender.SendMessage(); - if (Options.Onlyseepet.GetBool()) PlayerCatch.AllPlayerControls.Do(pc => pc.OnlySeeMePet(pc.Data.DefaultOutfit.PetId)); } else Camouflage.RpcSetSkin(target); - remove.Add(id); } + if (Options.Onlyseepet.GetBool()) PlayerCatch.AllPlayerControls.Do(pc => pc.OnlySeeMePet(pc.Data.DefaultOutfit.PetId)); if (remove.Count != 0) remove.Do(id => VentPlayers.Remove(id)); } @@ -165,9 +161,8 @@ public void OnClick(ref bool resetkillcooldown, ref bool? fall) .Write(target.GetNextRpcSequenceId(RpcCalls.SetVisorStr)) .EndRpc(); sender.SendMessage(); - if (Options.Onlyseepet.GetBool()) PlayerCatch.AllPlayerControls.Do(pc => pc.OnlySeeMePet(pc.Data.DefaultOutfit.PetId)); - } + if (Options.Onlyseepet.GetBool()) PlayerCatch.AllPlayerControls.Do(pc => pc.OnlySeeMePet(pc.Data.DefaultOutfit.PetId)); Limit = OptionAblitytime.GetFloat(); NowUse = true; _ = new LateTask(() => diff --git a/Roles/Impostor/EvilTeller.cs b/Roles/Impostor/EvilTeller.cs index d77939888..34dfae0de 100644 --- a/Roles/Impostor/EvilTeller.cs +++ b/Roles/Impostor/EvilTeller.cs @@ -27,7 +27,7 @@ public EvilTeller(PlayerControl player) player ) { - Tellnow.Clear(); + TargetInfo = null; seentarget.Clear(); nowuse = false; fall = false; @@ -38,6 +38,7 @@ public EvilTeller(PlayerControl player) distance = optDistance.GetFloat(); tellroleteam = opttellroleteam.GetBool(); tellrole = opttellrole.GetBool(); + maxtellcount = optCanTellCount.GetInt(); } static OptionItem optcooldown; static OptionItem optkillcooldown; @@ -46,6 +47,7 @@ public EvilTeller(PlayerControl player) static OptionItem opttellroleteam; static OptionItem opttellrole; static OptionItem optusekillcoool; + static OptionItem optCanTellCount; static float cooldown; static float killcooldown; static float telltime; @@ -53,15 +55,28 @@ public EvilTeller(PlayerControl player) static bool tellroleteam; static bool tellrole; static bool usekillcool; - static Dictionary Tellnow = new(); + static int maxtellcount; bool nowuse; bool fall; static Dictionary seentarget = new(); - enum OptionName { EvilTellerTellTime, EvilTellerDistance, EvilTellertellrole } + enum OptionName { EvilTellerTellTime, EvilTellerDistance, EvilTellertellrole, EvilTellerCanTellCount } + + private TimerInfo TargetInfo; + public class TimerInfo + { + public byte TargetId; + public float Timer; + public TimerInfo(byte targetId, float timer) + { + TargetId = targetId; + Timer = timer; + } + } static void SetUpOptionItem() { optkillcooldown = FloatOptionItem.Create(RoleInfo, 10, GeneralOption.KillCooldown, OptionBaseCoolTime, 30f, false).SetValueFormat(OptionFormat.Seconds); optcooldown = FloatOptionItem.Create(RoleInfo, 11, GeneralOption.Cooldown, OptionBaseCoolTime, 30f, false).SetValueFormat(OptionFormat.Seconds); + optCanTellCount = IntegerOptionItem.Create(RoleInfo, 17, OptionName.EvilTellerCanTellCount, new(1, 99, 1), 3, false); opttelltime = FloatOptionItem.Create(RoleInfo, 12, OptionName.EvilTellerTellTime, new(0, 100, 0.5f), 5, false).SetValueFormat(OptionFormat.Seconds); optDistance = FloatOptionItem.Create(RoleInfo, 13, OptionName.EvilTellerDistance, new(1f, 30f, 0.25f), 1.75f, false); opttellroleteam = BooleanOptionItem.Create(RoleInfo, 14, "tRole", false, false); @@ -70,16 +85,18 @@ static void SetUpOptionItem() } public float CalculateKillCooldown() => killcooldown; public override void ApplyGameOptions(IGameOptions opt) => AURoleOptions.PhantomCooldown = fall ? 1 : (nowuse ? telltime : cooldown); - public void OnClick(ref bool resetkillcooldown, ref bool falla) + public void OnClick(ref bool resetkillcooldown, ref bool? fall) { - resetkillcooldown = true; - falla = true; + resetkillcooldown = false; + if (maxtellcount <= seentarget.Count) return; + fall = true; var target = Player.GetKillTarget(); if (target == null) { fall = true; return; } if (target.Is(CustomRoleTypes.Impostor)) { fall = true; return; } - if (seentarget.ContainsKey(target.PlayerId)) { fall = true; return; } - Tellnow.TryAdd(target.PlayerId, 0); + if (seentarget.ContainsKey(target.PlayerId) || TargetInfo != null) { fall = true; return; } + + TargetInfo = new(target.PlayerId, 0f); nowuse = true; fall = false; _ = new LateTask(() => @@ -94,10 +111,10 @@ public override string GetMark(PlayerControl seer, PlayerControl seen = null, bo if (isForMeeting) return ""; if (!seer.IsAlive()) return ""; - if (Tellnow.ContainsKey(seen.PlayerId)) return "◆"; + if (seen.PlayerId == (TargetInfo?.TargetId ?? byte.MaxValue)) return "◆"; return ""; } - public override void OnReportDeadBody(PlayerControl reporter, NetworkedPlayerInfo target) { fall = false; Tellnow.Clear(); nowuse = false; } + public override void OnReportDeadBody(PlayerControl reporter, NetworkedPlayerInfo target) { fall = false; TargetInfo = null; nowuse = false; } public override void OverrideDisplayRoleNameAsSeer(PlayerControl seen, ref bool enabled, ref Color roleColor, ref string roleText, ref bool addon) { if (!seen) return; @@ -131,54 +148,51 @@ public override void OverrideDisplayRoleNameAsSeer(PlayerControl seen, ref bool roleColor = UtilsRoleText.GetRoleColor(role); } } + public override string GetProgressText(bool comms = false, bool GameLog = false) => maxtellcount <= seentarget.Count ? $"({maxtellcount - seentarget.Count})" : $"({maxtellcount - seentarget.Count})"; public override void OnFixedUpdate(PlayerControl player) { if (!AmongUsClient.Instance.AmHost) return; - if (GameStates.IsInTask) + if (maxtellcount <= seentarget.Count) return; + + if (GameStates.IsInTask && TargetInfo != null) { - if (Tellnow.Count == 0) return; - List del = new(); - foreach (var data in Tellnow) + var et_target = PlayerCatch.GetPlayerById(TargetInfo.TargetId); + var et_time = TargetInfo.Timer; + if (!et_target.IsAlive()) { - var target = PlayerCatch.GetPlayerById(data.Key); - if (!target) - { - del.Add(target.PlayerId); - fall = true; - continue; - } - if (!target.IsAlive()) - { - del.Add(target.PlayerId); - fall = true; - continue; - } - if (telltime <= data.Value)//超えたなら消して追加 - { - fall = false; - seentarget.TryAdd(target.PlayerId, target.GetCustomRole()); - del.Add(target.PlayerId); - continue; - } - - float dis; - dis = Vector2.Distance(Player.transform.position, target.transform.position);//距離を出す - if (dis <= distance)//一定の距離にターゲットがいるならば時間をカウント - Tellnow[data.Key] += Time.fixedDeltaTime; - else//それ以外は削除 - { del.Add(target.PlayerId); fall = true; } + nowuse = false; + fall = true; + TargetInfo = null; } - if (del.Count != 0) + else if (telltime <= et_time) { nowuse = false; - del.ForEach(task => Tellnow.Remove(task)); - _ = new LateTask(() => + fall = false; + TargetInfo = null; + Player.RpcResetAbilityCooldown(kousin: true); + if (usekillcool && !fall) Player.SetKillCooldown(); + seentarget.TryAdd(et_target.PlayerId, et_target.GetCustomRole()); + + UtilsNotifyRoles.NotifyRoles(SpecifySeer: Player, ForceLoop: true); + } + else + { + float dis; + dis = Vector2.Distance(Player.transform.position, et_target.transform.position); + if (dis <= distance) + { + TargetInfo.Timer += Time.fixedDeltaTime; + } + else { - Player.RpcResetAbilityCooldown(kousin: true); + nowuse = false; + TargetInfo = null; + fall = true; UtilsNotifyRoles.NotifyRoles(SpecifySeer: Player); - if (usekillcool && !fall) Player.SetKillCooldown(); - }, 0.2f, "", true); + + Logger.Info($"Canceled: {Player.GetNameWithRole().RemoveHtmlTags()}", "CurseMaker"); + } } } } diff --git a/Roles/Neutral/CurseMaker.cs b/Roles/Neutral/CurseMaker.cs index 0728c3d31..3b63b1929 100644 --- a/Roles/Neutral/CurseMaker.cs +++ b/Roles/Neutral/CurseMaker.cs @@ -28,22 +28,38 @@ public CurseMaker(PlayerControl player) player ) { - count = 0; + distance = Distance.GetFloat(); + noroitime = NoroiTime.GetFloat(); + deltarn = OptionDelTarn.GetInt(); + KillCooldown = OptionKillCoolDown.GetFloat(); + shapcool = OptionShepeCooldown.GetFloat(); + Noroi.Clear(); - Norotteruto.Clear(); CanWin = false; fall = false; + + TargetInfo = null; } - static OptionItem Distance; - static OptionItem NoroiTime; - static OptionItem OptionDelTarn; - static OptionItem OptionKillCoolDown; - static OptionItem OptionShepeCooldown; + static OptionItem Distance; static float distance; + static OptionItem NoroiTime; static float noroitime; + static OptionItem OptionDelTarn; static int deltarn; + static OptionItem OptionKillCoolDown; static float KillCooldown; + static OptionItem OptionShepeCooldown; static float shapcool; - static Dictionary Norotteruto = new();//呪おうとしてる人達。 static Dictionary Noroi = new(); + public class TimerInfo + { + public byte TargetId; + public float Timer; + public TimerInfo(byte targetId, float timer) + { + TargetId = targetId; + Timer = timer; + } + } + public bool CanKill { get; private set; } = false; + private TimerInfo TargetInfo; public bool CanWin; - float count; bool fall; public static HashSet curseMakers = new(); enum OptionName @@ -77,9 +93,9 @@ public void OnCheckMurderAsKiller(MurderInfo info) fall = false; var (killer, target) = info.AttemptTuple; info.DoKill = false; - if (Noroi.ContainsKey(target.PlayerId)) return; + if (Noroi.ContainsKey(target.PlayerId) || TargetInfo != null) return; - Norotteruto.TryAdd(target.PlayerId, 0); + TargetInfo = new(target.PlayerId, 0f); Player.SetKillCooldown(target: target, delay: true); _ = new LateTask(() => UtilsNotifyRoles.NotifyRoles(SpecifySeer: Player), 0.4f, "CueseMaker"); } @@ -88,50 +104,47 @@ public override void OnFixedUpdate(PlayerControl player) { if (!AmongUsClient.Instance.AmHost) return; - if (GameStates.IsInTask) + if (GameStates.IsInTask && TargetInfo != null) { - if (Norotteruto.Count == 0) return; - List del = new(); - foreach (var NR in Norotteruto) + var cu_target = PlayerCatch.GetPlayerById(TargetInfo.TargetId); + var cu_time = TargetInfo.Timer; + if (!cu_target.IsAlive()) + { + fall = true; + Player.SetKillCooldown(); + TargetInfo = null; + } + else if (noroitime <= cu_time) + { + fall = false; + Player.SetKillCooldown(); + TargetInfo = null; + Noroi.Add(cu_target.PlayerId, 0); + UtilsNotifyRoles.NotifyRoles(); + } + else { - var np = PlayerCatch.GetPlayerById(NR.Key); - if (!np) + float dis; + dis = Vector2.Distance(Player.transform.position, cu_target.transform.position); + if (dis <= distance) { - del.Add(np.PlayerId); - fall = true; - continue; + TargetInfo.Timer += Time.fixedDeltaTime; } - if (!np.IsAlive()) + else { - del.Add(np.PlayerId); + TargetInfo = null; fall = true; - continue; - } - if (NoroiTime.GetFloat() <= NR.Value)//超えたなら消して追加 - { - Noroi.TryAdd(np.PlayerId, 0); - del.Add(np.PlayerId); - count++; - continue; - } + Player.SetKillCooldown(); + UtilsNotifyRoles.NotifyRoles(SpecifySeer: Player); - float dis; - dis = Vector2.Distance(Player.transform.position, np.transform.position);//距離を出す - if (dis <= Distance.GetFloat())//一定の距離にターゲットがいるならば時間をカウント - Norotteruto[NR.Key] += Time.fixedDeltaTime; - else//それ以外は削除 - { del.Add(np.PlayerId); fall = true; } - } - if (del.Count != 0) - { - del.Do(x => Norotteruto.Remove(x)); - _ = new LateTask(() => UtilsNotifyRoles.NotifyRoles(SpecifySeer: Player), 0.4f, "CueseMaker"); - Player.SetKillCooldown(delay: true); + Logger.Info($"Canceled: {Player.GetNameWithRole().RemoveHtmlTags()}", "CurseMaker"); + } } } } public override void OnReportDeadBody(PlayerControl a, NetworkedPlayerInfo target) { + TargetInfo = null; CanWin = false; if (Noroi.Count == 0) return; List DelList = new(); @@ -140,18 +153,18 @@ public override void OnReportDeadBody(PlayerControl a, NetworkedPlayerInfo targe var np = PlayerCatch.GetPlayerById(nr.Key); if (!np) DelList.Add(nr.Key); if (!np.IsAlive()) DelList.Add(nr.Key); - if (OptionDelTarn.GetInt() <= nr.Value + 1) DelList.Add(nr.Key); + if (deltarn <= nr.Value + 1) DelList.Add(nr.Key); Noroi[nr.Key] = nr.Value + 1; } - DelList.ForEach(task => { Noroi.Remove(task); count--; }); + DelList.ForEach(task => { Noroi.Remove(task); }); } public override string MeetingMeg() { - if (count == 0) return ""; + if (Noroi.Count == 0) return ""; if (!Player.IsAlive()) return ""; - return string.Format(Translator.GetString("CurseMakerMeetingMeg"), count); + return string.Format(Translator.GetString("CurseMakerMeetingMeg"), Noroi.Count); } public override bool NotifyRolesCheckOtherName => true; public bool CanUseKillButton() => true; @@ -159,10 +172,10 @@ public override string MeetingMeg() public bool CanUseSabotageButton() => false; public override void ApplyGameOptions(IGameOptions opt) { - AURoleOptions.PhantomCooldown = OptionShepeCooldown.GetFloat(); + AURoleOptions.PhantomCooldown = shapcool; opt.SetVision(false); } - public float CalculateKillCooldown() => fall ? 0.00000000001f : OptionKillCoolDown.GetFloat(); + public float CalculateKillCooldown() => fall ? 0.00000000001f : KillCooldown; public void OnClick(ref bool resetkillcooldown, ref bool? fall) { fall = true; @@ -188,7 +201,7 @@ public override string GetMark(PlayerControl seer, PlayerControl seen = null, bo seen ??= seer; if (Noroi.ContainsKey(seen.PlayerId)) return "†"; - if (Norotteruto.ContainsKey(seen.PlayerId)) + if (seen.PlayerId == (TargetInfo?.TargetId ?? byte.MaxValue)) return "◇"; return ""; } diff --git a/Roles/Neutral/JackalDoll.cs b/Roles/Neutral/JackalDoll.cs index 8d0f9cd90..a3cf12f1e 100644 --- a/Roles/Neutral/JackalDoll.cs +++ b/Roles/Neutral/JackalDoll.cs @@ -176,7 +176,7 @@ public static void Sidekick(PlayerControl pc, PlayerControl oyabun) pc.RpcSetRole(CanVent.GetBool() ? RoleTypes.Engineer : RoleTypes.Crewmate, true); //サイドキックがガード等発動しないため。 - if (RoleAddAddons.GetRoleAddon(CustomRoles.Jackaldoll, out var d, pc, subrole: [CustomRoles.Guarding, CustomRoles.Speeding]) && d.GiveAddons.GetBool()) + if (RoleAddAddons.GetRoleAddon(CustomRoles.Jackaldoll, out var d, pc, subrole: [CustomRoles.Guarding, CustomRoles.Speeding])) { if (d.GiveGuarding.GetBool()) Main.Guard[pc.PlayerId] += d.Guard.GetInt(); if (d.GiveSpeeding.GetBool()) Main.AllPlayerSpeed[pc.PlayerId] = d.Speed.GetFloat(); diff --git a/Roles/Neutral/SantaClaus.cs b/Roles/Neutral/SantaClaus.cs index 5b58d09e2..a90c6f798 100644 --- a/Roles/Neutral/SantaClaus.cs +++ b/Roles/Neutral/SantaClaus.cs @@ -67,7 +67,7 @@ public override void ApplyGameOptions(IGameOptions opt) } public override bool OnCompleteTask(uint taskid) { - if (AmongUsClient.Instance.AmHost && MyTaskState.IsTaskFinished) + if (AmongUsClient.Instance.AmHost && MyTaskState.IsTaskFinished && Player.IsAlive()) { havepresent++; UtilsNotifyRoles.NotifyRoles(); diff --git a/main.cs b/main.cs index a1d6abe1e..d944d3611 100644 --- a/main.cs +++ b/main.cs @@ -55,8 +55,8 @@ public class Main : BasePlugin // ========== //Sorry for many Japanese comments. public const string PluginGuid = "com.kymario.townofhost-k"; - public const string PluginVersion = "519.24"; - public const string PluginShowVersion = "519.24"; + public const string PluginVersion = "519.24.11"; + public const string PluginShowVersion = "519.24.11"; public const string ModVersion = ".24";//リリースver用バージョン変更 /// 配布するデバッグ版なのであればtrue。リリース時にはfalseにすること。