From a66e761cdff570625800d16c2a3f2bda6462a930 Mon Sep 17 00:00:00 2001
From: Gurge44 <90392754+Gurge44@users.noreply.github.com>
Date: Mon, 28 Aug 2023 09:29:25 +0200
Subject: [PATCH] Add files via upload
Update Patches folder
---
Patches/AnnouncementPatch.cs | 10 +-
Patches/ChatCommandPatch.cs | 107 +++++-----
Patches/ChatControlPatch.cs | 5 +-
Patches/CheckGameEndPatch.cs | 36 ++--
Patches/ClientPatch.cs | 4 +-
Patches/ControlPatch.cs | 17 +-
Patches/CredentialsPatch.cs | 146 +++++++------
Patches/DisconnectPatch.cs | 1 -
Patches/ExilePatch.cs | 4 +-
Patches/GameOptionsMenuPatch.cs | 2 +-
Patches/GameStartManagerPatch.cs | 8 +-
Patches/HudPatch.cs | 39 ++--
Patches/HudSpritePatch.cs | 33 ++-
Patches/IntroPatch.cs | 33 +--
Patches/LobbyListPatch.cs | 6 +-
Patches/MeetingHudPatch.cs | 154 ++++++++------
Patches/OutroPatch.cs | 4 +-
Patches/PlayerContorolPatch.cs | 337 +++++++++++++++++-------------
Patches/PlayerJoinAndLeftPatch.cs | 18 +-
Patches/SabotageSystemPatch.cs | 2 +-
Patches/ShipStatusPatch.cs | 52 ++---
Patches/onGameStartedPatch.cs | 121 ++++++-----
22 files changed, 648 insertions(+), 491 deletions(-)
diff --git a/Patches/AnnouncementPatch.cs b/Patches/AnnouncementPatch.cs
index 2539bef0b..e05009e28 100644
--- a/Patches/AnnouncementPatch.cs
+++ b/Patches/AnnouncementPatch.cs
@@ -1,11 +1,11 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using AmongUs.Data;
+using AmongUs.Data;
using AmongUs.Data.Player;
using Assets.InnerNet;
using HarmonyLib;
using Il2CppInterop.Runtime.InteropTypes.Arrays;
+using System;
+using System.Collections.Generic;
+using System.Linq;
namespace TOHE;
@@ -68,7 +68,7 @@ public class ModNewsHistory
};
AllModNews.Add(news);
- }
+ }
{
// TOHE v2.4.2
diff --git a/Patches/ChatCommandPatch.cs b/Patches/ChatCommandPatch.cs
index 4d8c6a155..839fb8212 100644
--- a/Patches/ChatCommandPatch.cs
+++ b/Patches/ChatCommandPatch.cs
@@ -2,17 +2,16 @@ using Assets.CoreScripts;
using HarmonyLib;
using Hazel;
using System;
-using System.IO;
using System.Collections.Generic;
+using System.IO;
using System.Linq;
using System.Text;
using System.Text.RegularExpressions;
using TOHE.Modules;
using TOHE.Roles.Crewmate;
+using TOHE.Roles.Impostor;
using UnityEngine;
using static TOHE.Translator;
-using TOHE.Roles.Impostor;
-using TOHE.Roles.Neutral;
namespace TOHE;
@@ -192,7 +191,7 @@ internal class ChatCommands
}
SendRolesInfo(subArgs, PlayerControl.LocalPlayer.PlayerId, isUp: true);
break;
-
+
case "/h":
case "/help":
canceled = true;
@@ -247,59 +246,59 @@ internal class ChatCommands
Utils.SendMessage(args.Skip(1).Join(delimiter: " "), title: $"{GetString("MessageFromTheHost")}");
break;
- case "/kick":
- canceled = true;
- // Check if the kick command is enabled in the settings
- if (Options.ApplyModeratorList.GetValue() == 0)
- {
- Utils.SendMessage(GetString("KickCommandDisabled"), PlayerControl.LocalPlayer.PlayerId);
- break;
- }
+ case "/kick":
+ canceled = true;
+ // Check if the kick command is enabled in the settings
+ if (Options.ApplyModeratorList.GetValue() == 0)
+ {
+ Utils.SendMessage(GetString("KickCommandDisabled"), PlayerControl.LocalPlayer.PlayerId);
+ break;
+ }
- // Check if the player has the necessary privileges to use the command
- if (!IsPlayerModerator(PlayerControl.LocalPlayer.FriendCode))
- {
- Utils.SendMessage(GetString("KickCommandNoAccess"), PlayerControl.LocalPlayer.PlayerId);
- break;
- }
+ // Check if the player has the necessary privileges to use the command
+ if (!IsPlayerModerator(PlayerControl.LocalPlayer.FriendCode))
+ {
+ Utils.SendMessage(GetString("KickCommandNoAccess"), PlayerControl.LocalPlayer.PlayerId);
+ break;
+ }
- subArgs = args.Length < 2 ? "" : args[1];
- if (string.IsNullOrEmpty(subArgs) || !byte.TryParse(subArgs, out byte kickPlayerId))
- {
- Utils.SendMessage(GetString("KickCommandInvalidID"), PlayerControl.LocalPlayer.PlayerId);
- break;
- }
+ subArgs = args.Length < 2 ? "" : args[1];
+ if (string.IsNullOrEmpty(subArgs) || !byte.TryParse(subArgs, out byte kickPlayerId))
+ {
+ Utils.SendMessage(GetString("KickCommandInvalidID"), PlayerControl.LocalPlayer.PlayerId);
+ break;
+ }
- if (kickPlayerId == 0)
- {
- Utils.SendMessage(GetString("KickCommandKickHost"), PlayerControl.LocalPlayer.PlayerId);
- break;
- }
+ if (kickPlayerId == 0)
+ {
+ Utils.SendMessage(GetString("KickCommandKickHost"), PlayerControl.LocalPlayer.PlayerId);
+ break;
+ }
- var kickedPlayer = Utils.GetPlayerById(kickPlayerId);
- if (kickedPlayer == null)
- {
- Utils.SendMessage(GetString("KickCommandInvalidID"), PlayerControl.LocalPlayer.PlayerId);
- break;
- }
+ var kickedPlayer = Utils.GetPlayerById(kickPlayerId);
+ if (kickedPlayer == null)
+ {
+ Utils.SendMessage(GetString("KickCommandInvalidID"), PlayerControl.LocalPlayer.PlayerId);
+ break;
+ }
- // Prevent moderators from kicking other moderators
- if (IsPlayerModerator(kickedPlayer.FriendCode))
- {
- Utils.SendMessage(GetString("KickCommandKickMod"), PlayerControl.LocalPlayer.PlayerId);
- break;
- }
+ // Prevent moderators from kicking other moderators
+ if (IsPlayerModerator(kickedPlayer.FriendCode))
+ {
+ Utils.SendMessage(GetString("KickCommandKickMod"), PlayerControl.LocalPlayer.PlayerId);
+ break;
+ }
- // Kick the specified player
- AmongUsClient.Instance.KickPlayer(kickedPlayer.GetClientId(), true);
- string kickedPlayerName = kickedPlayer.GetRealName();
- string textToSend = $"{kickedPlayerName} {GetString("KickCommandKicked")}";
- if (GameStates.IsInGame)
- {
- textToSend += $"{GetString("KickCommandKickedRole")} {GetString(kickedPlayer.GetCustomRole().ToString())}";
- }
- Utils.SendMessage(textToSend);
- break;
+ // Kick the specified player
+ AmongUsClient.Instance.KickPlayer(kickedPlayer.GetClientId(), true);
+ string kickedPlayerName = kickedPlayer.GetRealName();
+ string textToSend = $"{kickedPlayerName} {GetString("KickCommandKicked")}";
+ if (GameStates.IsInGame)
+ {
+ textToSend += $"{GetString("KickCommandKickedRole")} {GetString(kickedPlayer.GetCustomRole().ToString())}";
+ }
+ Utils.SendMessage(textToSend);
+ break;
case "/exe":
canceled = true;
if (GameStates.IsLobby)
@@ -696,7 +695,7 @@ internal class ChatCommands
string[] args = text.Split(' ');
string subArgs = "";
//if (text.Length >= 3) if (text[..2] == "/r" && text[..3] != "/rn") args[0] = "/r";
- // if (SpamManager.CheckSpam(player, text)) return;
+ // if (SpamManager.CheckSpam(player, text)) return;
if (GuessManager.GuesserMsg(player, text)) { canceled = true; return; }
if (Judge.TrialMsg(player, text)) { canceled = true; return; }
if (ParityCop.ParityCheckMsg(player, text)) { canceled = true; return; }
@@ -794,7 +793,7 @@ internal class ChatCommands
Utils.SendMessage(GetString("DisableUseCommand"), player.PlayerId);
}
break;
-
+
case "/quit":
case "/qt":
subArgs = args.Length < 2 ? "" : args[1];
@@ -900,7 +899,7 @@ internal class ChatCommands
default:
break;
}
- if (SpamManager.CheckSpam(player, text)) return;
+ if (SpamManager.CheckSpam(player, text)) return;
}
}
[HarmonyPatch(typeof(ChatController), nameof(ChatController.Update))]
diff --git a/Patches/ChatControlPatch.cs b/Patches/ChatControlPatch.cs
index b7ef8d794..88e3a7213 100644
--- a/Patches/ChatControlPatch.cs
+++ b/Patches/ChatControlPatch.cs
@@ -1,5 +1,6 @@
using AmongUs.Data;
using HarmonyLib;
+using System.Linq;
using UnityEngine;
namespace TOHE;
@@ -25,12 +26,12 @@ class ChatControllerUpdatePatch
ClipboardHelper.PutClipboardString(__instance.freeChatField.textArea.text);
__instance.freeChatField.textArea.SetText("");
}
- if (Input.GetKeyDown(KeyCode.UpArrow) && ChatCommands.ChatHistory.Count > 0)
+ if (Input.GetKeyDown(KeyCode.UpArrow) && ChatCommands.ChatHistory.Any())
{
CurrentHistorySelection = Mathf.Clamp(--CurrentHistorySelection, 0, ChatCommands.ChatHistory.Count - 1);
__instance.freeChatField.textArea.SetText(ChatCommands.ChatHistory[CurrentHistorySelection]);
}
- if (Input.GetKeyDown(KeyCode.DownArrow) && ChatCommands.ChatHistory.Count > 0)
+ if (Input.GetKeyDown(KeyCode.DownArrow) && ChatCommands.ChatHistory.Any())
{
CurrentHistorySelection++;
if (CurrentHistorySelection < ChatCommands.ChatHistory.Count)
diff --git a/Patches/CheckGameEndPatch.cs b/Patches/CheckGameEndPatch.cs
index 06fab2899..935a269d6 100644
--- a/Patches/CheckGameEndPatch.cs
+++ b/Patches/CheckGameEndPatch.cs
@@ -31,7 +31,7 @@ class GameEndChecker
// SoloKombat
if (Options.CurrentGameMode == CustomGameMode.SoloKombat)
{
- if (CustomWinnerHolder.WinnerIds.Count > 0 || CustomWinnerHolder.WinnerTeam != CustomWinner.Default)
+ if (CustomWinnerHolder.WinnerIds.Any() || CustomWinnerHolder.WinnerTeam != CustomWinner.Default)
{
ShipStatus.Instance.enabled = false;
StartEndGame(reason);
@@ -103,7 +103,7 @@ class GameEndChecker
{
CustomWinnerHolder.WinnerIds.Add(Romantic.BetPlayer[pc.PlayerId]);
}
-
+
}
//Main.AllPlayerControls
// .Where(pc => (pc.Is(CustomRoles.RuthlessRomantic) || (Romantic.BetPlayer.TryGetValue(pc.PlayerId, out var RomanticPartner)) && pc.PlayerId == RomanticPartner))
@@ -127,7 +127,7 @@ class GameEndChecker
foreach (var pc in Main.AllPlayerControls)
{
if (pc.Is(CustomRoles.Phantom) && pc.GetPlayerTaskState().IsTaskFinished && pc.Data.IsDead
- && (((CustomWinnerHolder.WinnerTeam == CustomWinner.Impostor || CustomWinnerHolder.WinnerTeam == CustomWinner.Crewmate || CustomWinnerHolder.WinnerTeam == CustomWinner.Jackal || CustomWinnerHolder.WinnerTeam == CustomWinner.BloodKnight || CustomWinnerHolder.WinnerTeam == CustomWinner.SerialKiller || CustomWinnerHolder.WinnerTeam == CustomWinner.Juggernaut || CustomWinnerHolder.WinnerTeam == CustomWinner.Ritualist || CustomWinnerHolder.WinnerTeam == CustomWinner.Poisoner || CustomWinnerHolder.WinnerTeam == CustomWinner.Succubus || CustomWinnerHolder.WinnerTeam == CustomWinner.Infectious || CustomWinnerHolder.WinnerTeam == CustomWinner.Jinx || CustomWinnerHolder.WinnerTeam == CustomWinner.Virus || CustomWinnerHolder.WinnerTeam == CustomWinner.Arsonist || CustomWinnerHolder.WinnerTeam == CustomWinner.Pelican || CustomWinnerHolder.WinnerTeam == CustomWinner.HexMaster || CustomWinnerHolder.WinnerTeam == CustomWinner.Wraith || CustomWinnerHolder.WinnerTeam == CustomWinner.Pestilence || CustomWinnerHolder.WinnerTeam == CustomWinner.Rogue || CustomWinnerHolder.WinnerTeam == CustomWinner.Spiritcaller) && (Options.PhantomSnatchesWin.GetBool()))))
+ && (((CustomWinnerHolder.WinnerTeam == CustomWinner.Impostor || CustomWinnerHolder.WinnerTeam == CustomWinner.Crewmate || CustomWinnerHolder.WinnerTeam == CustomWinner.Jackal || CustomWinnerHolder.WinnerTeam == CustomWinner.BloodKnight || CustomWinnerHolder.WinnerTeam == CustomWinner.SerialKiller || CustomWinnerHolder.WinnerTeam == CustomWinner.Juggernaut || CustomWinnerHolder.WinnerTeam == CustomWinner.Ritualist || CustomWinnerHolder.WinnerTeam == CustomWinner.Poisoner || CustomWinnerHolder.WinnerTeam == CustomWinner.Succubus || CustomWinnerHolder.WinnerTeam == CustomWinner.Infectious || CustomWinnerHolder.WinnerTeam == CustomWinner.Jinx || CustomWinnerHolder.WinnerTeam == CustomWinner.Virus || CustomWinnerHolder.WinnerTeam == CustomWinner.Arsonist || CustomWinnerHolder.WinnerTeam == CustomWinner.Pelican || CustomWinnerHolder.WinnerTeam == CustomWinner.HexMaster || CustomWinnerHolder.WinnerTeam == CustomWinner.Wraith || CustomWinnerHolder.WinnerTeam == CustomWinner.Pestilence || CustomWinnerHolder.WinnerTeam == CustomWinner.Rogue || CustomWinnerHolder.WinnerTeam == CustomWinner.Spiritcaller) && (Options.PhantomSnatchesWin.GetBool()))))
{
reason = GameOverReason.ImpostorByKill;
CustomWinnerHolder.ResetAndSetWinner(CustomWinner.Phantom);
@@ -137,7 +137,7 @@ class GameEndChecker
foreach (var pc in Main.AllPlayerControls)
{
if (pc.Is(CustomRoles.Famine) && !pc.Data.IsDead
- && (((CustomWinnerHolder.WinnerTeam == CustomWinner.Impostor || CustomWinnerHolder.WinnerTeam == CustomWinner.Crewmate || CustomWinnerHolder.WinnerTeam == CustomWinner.Jackal || CustomWinnerHolder.WinnerTeam == CustomWinner.BloodKnight || CustomWinnerHolder.WinnerTeam == CustomWinner.SerialKiller || CustomWinnerHolder.WinnerTeam == CustomWinner.Juggernaut || CustomWinnerHolder.WinnerTeam == CustomWinner.Ritualist || CustomWinnerHolder.WinnerTeam == CustomWinner.Poisoner || CustomWinnerHolder.WinnerTeam == CustomWinner.Succubus || CustomWinnerHolder.WinnerTeam == CustomWinner.Infectious || CustomWinnerHolder.WinnerTeam == CustomWinner.Jinx || CustomWinnerHolder.WinnerTeam == CustomWinner.Virus || CustomWinnerHolder.WinnerTeam == CustomWinner.Arsonist || CustomWinnerHolder.WinnerTeam == CustomWinner.Pelican || CustomWinnerHolder.WinnerTeam == CustomWinner.HexMaster || CustomWinnerHolder.WinnerTeam == CustomWinner.Wraith || CustomWinnerHolder.WinnerTeam == CustomWinner.Pestilence || CustomWinnerHolder.WinnerTeam == CustomWinner.Rogue))))
+ && (((CustomWinnerHolder.WinnerTeam == CustomWinner.Impostor || CustomWinnerHolder.WinnerTeam == CustomWinner.Crewmate || CustomWinnerHolder.WinnerTeam == CustomWinner.Jackal || CustomWinnerHolder.WinnerTeam == CustomWinner.BloodKnight || CustomWinnerHolder.WinnerTeam == CustomWinner.SerialKiller || CustomWinnerHolder.WinnerTeam == CustomWinner.Juggernaut || CustomWinnerHolder.WinnerTeam == CustomWinner.Ritualist || CustomWinnerHolder.WinnerTeam == CustomWinner.Poisoner || CustomWinnerHolder.WinnerTeam == CustomWinner.Succubus || CustomWinnerHolder.WinnerTeam == CustomWinner.Infectious || CustomWinnerHolder.WinnerTeam == CustomWinner.Jinx || CustomWinnerHolder.WinnerTeam == CustomWinner.Virus || CustomWinnerHolder.WinnerTeam == CustomWinner.Arsonist || CustomWinnerHolder.WinnerTeam == CustomWinner.Pelican || CustomWinnerHolder.WinnerTeam == CustomWinner.HexMaster || CustomWinnerHolder.WinnerTeam == CustomWinner.Wraith || CustomWinnerHolder.WinnerTeam == CustomWinner.Pestilence || CustomWinnerHolder.WinnerTeam == CustomWinner.Rogue))))
{
reason = GameOverReason.ImpostorByKill;
CustomWinnerHolder.ResetAndSetWinner(CustomWinner.Famine);
@@ -147,7 +147,7 @@ class GameEndChecker
foreach (var pc in Main.AllPlayerControls)
{
if (pc.Is(CustomRoles.CursedSoul) && !pc.Data.IsDead
- && (((CustomWinnerHolder.WinnerTeam == CustomWinner.Impostor || CustomWinnerHolder.WinnerTeam == CustomWinner.Crewmate || CustomWinnerHolder.WinnerTeam == CustomWinner.Jackal || CustomWinnerHolder.WinnerTeam == CustomWinner.BloodKnight || CustomWinnerHolder.WinnerTeam == CustomWinner.SerialKiller || CustomWinnerHolder.WinnerTeam == CustomWinner.Juggernaut || CustomWinnerHolder.WinnerTeam == CustomWinner.Ritualist || CustomWinnerHolder.WinnerTeam == CustomWinner.Poisoner || CustomWinnerHolder.WinnerTeam == CustomWinner.Succubus || CustomWinnerHolder.WinnerTeam == CustomWinner.Infectious || CustomWinnerHolder.WinnerTeam == CustomWinner.Jinx || CustomWinnerHolder.WinnerTeam == CustomWinner.Virus || CustomWinnerHolder.WinnerTeam == CustomWinner.Arsonist || CustomWinnerHolder.WinnerTeam == CustomWinner.Pelican || CustomWinnerHolder.WinnerTeam == CustomWinner.HexMaster || CustomWinnerHolder.WinnerTeam == CustomWinner.Wraith || CustomWinnerHolder.WinnerTeam == CustomWinner.Pestilence || CustomWinnerHolder.WinnerTeam == CustomWinner.Rogue || CustomWinnerHolder.WinnerTeam == CustomWinner.Jester || CustomWinnerHolder.WinnerTeam == CustomWinner.Executioner))))
+ && (((CustomWinnerHolder.WinnerTeam == CustomWinner.Impostor || CustomWinnerHolder.WinnerTeam == CustomWinner.Crewmate || CustomWinnerHolder.WinnerTeam == CustomWinner.Jackal || CustomWinnerHolder.WinnerTeam == CustomWinner.BloodKnight || CustomWinnerHolder.WinnerTeam == CustomWinner.SerialKiller || CustomWinnerHolder.WinnerTeam == CustomWinner.Juggernaut || CustomWinnerHolder.WinnerTeam == CustomWinner.Ritualist || CustomWinnerHolder.WinnerTeam == CustomWinner.Poisoner || CustomWinnerHolder.WinnerTeam == CustomWinner.Succubus || CustomWinnerHolder.WinnerTeam == CustomWinner.Infectious || CustomWinnerHolder.WinnerTeam == CustomWinner.Jinx || CustomWinnerHolder.WinnerTeam == CustomWinner.Virus || CustomWinnerHolder.WinnerTeam == CustomWinner.Arsonist || CustomWinnerHolder.WinnerTeam == CustomWinner.Pelican || CustomWinnerHolder.WinnerTeam == CustomWinner.HexMaster || CustomWinnerHolder.WinnerTeam == CustomWinner.Wraith || CustomWinnerHolder.WinnerTeam == CustomWinner.Pestilence || CustomWinnerHolder.WinnerTeam == CustomWinner.Rogue || CustomWinnerHolder.WinnerTeam == CustomWinner.Jester || CustomWinnerHolder.WinnerTeam == CustomWinner.Executioner))))
{
reason = GameOverReason.ImpostorByKill;
CustomWinnerHolder.ResetAndSetWinner(CustomWinner.CursedSoul);
@@ -266,7 +266,7 @@ class GameEndChecker
}
}
}
-
+
//FFF
if (CustomWinnerHolder.WinnerTeam != CustomWinner.Lovers && !CustomWinnerHolder.AdditionalWinnerTeams.Contains(AdditionalWinners.Lovers) && !CustomRolesHelper.RoleExist(CustomRoles.Lovers) && !CustomRolesHelper.RoleExist(CustomRoles.Ntr))
@@ -304,6 +304,18 @@ class GameEndChecker
CustomWinnerHolder.AdditionalWinnerTeams.Add(AdditionalWinners.Romantic);
}
}
+ //Ruthless Romantic
+ foreach (var pc in Main.AllPlayerControls.Where(x => x.Is(CustomRoles.RuthlessRomantic)))
+ {
+ if (Romantic.BetPlayer.TryGetValue(pc.PlayerId, out var betTarget) && (
+ CustomWinnerHolder.WinnerIds.Contains(betTarget) ||
+ (Main.PlayerStates.TryGetValue(betTarget, out var ps) && CustomWinnerHolder.WinnerRoles.Contains(ps.MainRole)
+ )))
+ {
+ CustomWinnerHolder.WinnerIds.Add(pc.PlayerId);
+ CustomWinnerHolder.AdditionalWinnerTeams.Add(AdditionalWinners.RuthlessRomantic);
+ }
+ }
//Vengeful Romantic win condition
foreach (var pc in Main.AllPlayerControls.Where(x => x.Is(CustomRoles.VengefulRomantic)))
{
@@ -354,7 +366,7 @@ class GameEndChecker
.Where(p => p.Is(CustomRoles.Lovers) && !CustomWinnerHolder.WinnerIds.Contains(p.PlayerId))
.Do(p => CustomWinnerHolder.WinnerIds.Add(p.PlayerId));
}
-
+
}
ShipStatus.Instance.enabled = false;
@@ -462,7 +474,7 @@ class GameEndChecker
return false;
}
- public bool CheckGameEndByLivingPlayers(out GameOverReason reason)
+ public static bool CheckGameEndByLivingPlayers(out GameOverReason reason)
{
reason = GameOverReason.ImpostorByKill;
@@ -678,9 +690,9 @@ class GameEndChecker
{
reason = GameOverReason.HumansByVote;
CustomWinnerHolder.ResetAndSetWinner(CustomWinner.Crewmate);
- // CustomWinnerHolder.WinnerRoles.Add(CustomRoles.Admired);
+ // CustomWinnerHolder.WinnerRoles.Add(CustomRoles.Admired);
}
-
+
else return false; //胜利条件未达成
return true;
@@ -693,12 +705,12 @@ class GameEndChecker
public override bool CheckForEndGame(out GameOverReason reason)
{
reason = GameOverReason.ImpostorByKill;
- if (CustomWinnerHolder.WinnerIds.Count > 0) return false;
+ if (CustomWinnerHolder.WinnerIds.Any()) return false;
if (CheckGameEndByLivingPlayers(out reason)) return true;
return false;
}
- public bool CheckGameEndByLivingPlayers(out GameOverReason reason)
+ public static bool CheckGameEndByLivingPlayers(out GameOverReason reason)
{
reason = GameOverReason.ImpostorByKill;
diff --git a/Patches/ClientPatch.cs b/Patches/ClientPatch.cs
index 973547b17..77492efc3 100644
--- a/Patches/ClientPatch.cs
+++ b/Patches/ClientPatch.cs
@@ -88,7 +88,7 @@ internal class BanMenuSetVisiblePatch
return false;
}
}
-[HarmonyPatch(typeof(InnerNetClient), nameof(InnerNet.InnerNetClient.CanBan))]
+[HarmonyPatch(typeof(InnerNetClient), nameof(InnerNetClient.CanBan))]
internal class InnerNetClientCanBanPatch
{
public static bool Prefix(InnerNet.InnerNetClient __instance, ref bool __result)
@@ -97,7 +97,7 @@ internal class InnerNetClientCanBanPatch
return false;
}
}
-[HarmonyPatch(typeof(InnerNet.InnerNetClient), nameof(InnerNet.InnerNetClient.KickPlayer))]
+[HarmonyPatch(typeof(InnerNet.InnerNetClient), nameof(InnerNetClient.KickPlayer))]
internal class KickPlayerPatch
{
public static void Prefix(InnerNet.InnerNetClient __instance, int clientId, bool ban)
diff --git a/Patches/ControlPatch.cs b/Patches/ControlPatch.cs
index 8b44965d0..f8fffa8c0 100644
--- a/Patches/ControlPatch.cs
+++ b/Patches/ControlPatch.cs
@@ -6,7 +6,6 @@ using System.Linq;
using System.Text;
using UnityEngine;
using static TOHE.Translator;
-using Object = UnityEngine.Object;
namespace TOHE;
@@ -95,13 +94,13 @@ internal class ControllerManagerUpdatePatch
if (GetKeysDown(KeyCode.F5, KeyCode.T))
{
Logger.Info("加载自定义翻译文件", "KeyCommand");
- Translator.LoadLangs();
+ LoadLangs();
Logger.SendInGame("Reloaded Custom Translation File");
}
if (GetKeysDown(KeyCode.F5, KeyCode.X))
{
Logger.Info("导出自定义翻译文件", "KeyCommand");
- Translator.ExportCustomTranslation();
+ ExportCustomTranslation();
Logger.SendInGame("Exported Custom Translation File");
}
//日志文件转储
@@ -118,7 +117,7 @@ internal class ControllerManagerUpdatePatch
//打开游戏目录
if (GetKeysDown(KeyCode.F10))
{
- System.Diagnostics.Process.Start(System.Environment.CurrentDirectory);
+ System.Diagnostics.Process.Start(Environment.CurrentDirectory);
}
//-- 下面是主机专用的命令--//
@@ -146,13 +145,13 @@ internal class ControllerManagerUpdatePatch
Logger.Info("倒计时修改为0", "KeyCommand");
GameStartManager.Instance.countDownTimer = 0;
}
-
+
//倒计时取消
if (Input.GetKeyDown(KeyCode.C) && GameStates.IsCountDown)
{
Logger.Info("重置倒计时", "KeyCommand");
GameStartManager.Instance.ResetStartState();
- Logger.SendInGame(Translator.GetString("CancelStartCountDown"));
+ Logger.SendInGame(GetString("CancelStartCountDown"));
}
//显示当前有效设置的说明
if (GetKeysDown(KeyCode.N, KeyCode.LeftShift, KeyCode.LeftControl))
@@ -170,7 +169,7 @@ internal class ControllerManagerUpdatePatch
if (GetKeysDown(KeyCode.Delete, KeyCode.LeftControl))
{
OptionItem.AllOptions.ToArray().Where(x => x.Id > 0).Do(x => x.SetValueNoRpc(x.DefaultValue));
- Logger.SendInGame(Translator.GetString("RestTOHESetting"));
+ Logger.SendInGame(GetString("RestTOHESetting"));
if (!(!AmongUsClient.Instance.AmHost || PlayerControl.AllPlayerControls.Count <= 1 || (AmongUsClient.Instance.AmHost == false && PlayerControl.LocalPlayer == null)))
{
MessageWriter writer = AmongUsClient.Instance.StartRpcImmediately(PlayerControl.LocalPlayer.NetId, (byte)CustomRPC.RestTOHESetting, SendOption.Reliable, -1);
@@ -185,7 +184,7 @@ internal class ControllerManagerUpdatePatch
Main.PlayerStates[PlayerControl.LocalPlayer.PlayerId].deathReason = PlayerState.DeathReason.etc;
PlayerControl.LocalPlayer.RpcExileV2();
Main.PlayerStates[PlayerControl.LocalPlayer.PlayerId].SetDead();
- Utils.SendMessage(Translator.GetString("HostKillSelfByCommand"), title: $"{Translator.GetString("DefaultSystemMessageTitle")}");
+ Utils.SendMessage(GetString("HostKillSelfByCommand"), title: $"{GetString("DefaultSystemMessageTitle")}");
}
//切换日志是否也在游戏中输出
if (GetKeysDown(KeyCode.F2, KeyCode.LeftControl))
@@ -236,7 +235,7 @@ internal class ControllerManagerUpdatePatch
if (Input.GetKeyDown(KeyCode.Y))
{
RPC.SyncCustomSettingsRPC();
- Logger.SendInGame(Translator.GetString("SyncCustomSettingsRPC"));
+ Logger.SendInGame(GetString("SyncCustomSettingsRPC"));
}
//入门测试
diff --git a/Patches/CredentialsPatch.cs b/Patches/CredentialsPatch.cs
index 5028f32a9..a61571320 100644
--- a/Patches/CredentialsPatch.cs
+++ b/Patches/CredentialsPatch.cs
@@ -1,9 +1,7 @@
using HarmonyLib;
-using Il2CppMono.Security;
using System;
using System.Linq;
using System.Text;
-using TMPro;
using UnityEngine;
using static TOHE.Translator;
@@ -55,12 +53,12 @@ internal class VersionShowerStartPatch
private static void Postfix(VersionShower __instance)
{
- Main.credentialsText = $"\r{Main.ModName} v{Main.PluginDisplayVersion} by Gurge44";
- // Main.credentialsText = $"\r\nTOHE SolarLoonieEdit v{Main.PluginDisplayVersion}";
+ Main.credentialsText = $"\r{Main.ModName} v{Main.PluginDisplayVersion} by Gurge44";
+ // Main.credentialsText = $"\r\nTOHE SolarLoonieEdit v{Main.PluginDisplayVersion}";
if (Main.IsAprilFools) Main.credentialsText = $"\r\nTown Of Host v11.45.14";
#if DEBUG
- // Main.credentialsText += $"\r\nModified by Loonie";
- Main.credentialsText += $"\r\nBy KARPED1EM & Loonie";
+ // Main.credentialsText += $"\r\nModified by Loonie";
+ //Main.credentialsText += $"\r\nBy KARPED1EM & Loonie";
#endif
#if RELEASE
@@ -95,33 +93,33 @@ internal class VersionShowerStartPatch
// ColorUtility.TryParseHtmlString(Main.ModColor, out var col);
// SpecialEventText.color = col;
//}
- /*else if (!Main.IsAprilFools)
- {
- SpecialEventText.text = $"{Main.MainMenuText}";
- SpecialEventText.fontSize = 0.9f;
- SpecialEventText.color = Color.white;
- SpecialEventText.alignment = TextAlignmentOptions.TopRight;
- SpecialEventText.transform.position = new Vector3(4.6f, 2.725f, 0);
- }
+ /*else if (!Main.IsAprilFools)
+ {
+ SpecialEventText.text = $"{Main.MainMenuText}";
+ SpecialEventText.fontSize = 0.9f;
+ SpecialEventText.color = Color.white;
+ SpecialEventText.alignment = TextAlignmentOptions.TopRight;
+ SpecialEventText.transform.position = new Vector3(4.6f, 2.725f, 0);
+ }
- if ((OVersionShower = GameObject.Find("VersionShower")) != null && !Main.IsAprilFools)
- {
- OVersionShower.transform.localScale = new Vector3(0.6f, 0.6f, 1f);
- OVersionShower.transform.position = new Vector3(-7.3f, 3.9f, 0f);
- if (TitleLogoPatch.amongUsLogo != null)
- {
- if (VisitText == null && ModUpdater.visit > 0)
- {
- VisitText = Object.Instantiate(__instance.text);
- VisitText.text = string.Format(GetString("TOHEVisitorCount"), Main.ModColor, ModUpdater.visit);
- VisitText.color = Color.white;
- VisitText.fontSize = 1.2f;
- //VisitText.alignment = TMPro.TextAlignmentOptions.Top;
- OVersionShower.transform.localScale = new Vector3(0.6f, 0.6f, 1f);
- VisitText.transform.position = new Vector3(-5.3f, 2.75f, 0f);
- }
- }
- }*/
+ if ((OVersionShower = GameObject.Find("VersionShower")) != null && !Main.IsAprilFools)
+ {
+ OVersionShower.transform.localScale = new Vector3(0.6f, 0.6f, 1f);
+ OVersionShower.transform.position = new Vector3(-7.3f, 3.9f, 0f);
+ if (TitleLogoPatch.amongUsLogo != null)
+ {
+ if (VisitText == null && ModUpdater.visit > 0)
+ {
+ VisitText = Object.Instantiate(__instance.text);
+ VisitText.text = string.Format(GetString("TOHEVisitorCount"), Main.ModColor, ModUpdater.visit);
+ VisitText.color = Color.white;
+ VisitText.fontSize = 1.2f;
+ //VisitText.alignment = TMPro.TextAlignmentOptions.Top;
+ OVersionShower.transform.localScale = new Vector3(0.6f, 0.6f, 1f);
+ VisitText.transform.position = new Vector3(-5.3f, 2.75f, 0f);
+ }
+ }
+ }*/
}
}
@@ -138,22 +136,22 @@ internal class TitleLogoPatch
private static void Postfix(MainMenuManager __instance)
{
- /*if (Main.IsAprilFools)
- {
- if ((amongUsLogo = GameObject.Find("bannerLogo_AmongUs")) != null)
- {
- amongUsLogo.transform.localScale *= 0.4f;
- amongUsLogo.transform.position += Vector3.up * 0.25f;
- }
+ /*if (Main.IsAprilFools)
+ {
+ if ((amongUsLogo = GameObject.Find("bannerLogo_AmongUs")) != null)
+ {
+ amongUsLogo.transform.localScale *= 0.4f;
+ amongUsLogo.transform.position += Vector3.up * 0.25f;
+ }
- var tohLogo = new GameObject("titleLogo_TOH");
- tohLogo.transform.position = Vector3.up;
- tohLogo.transform.localScale *= 1.2f;
- var renderer = tohLogo.AddComponent();
- renderer.sprite = Utils.LoadSprite("TOHE.Resources.Images.TownOfHost-Logo.png", 300f);
+ var tohLogo = new GameObject("titleLogo_TOH");
+ tohLogo.transform.position = Vector3.up;
+ tohLogo.transform.localScale *= 1.2f;
+ var renderer = tohLogo.AddComponent();
+ renderer.sprite = Utils.LoadSprite("TOHE.Resources.Images.TownOfHost-Logo.png", 300f);
- return;
- }*/
+ return;
+ }*/
//if ((amongUsLogo = GameObject.Find("bannerLogo_AmongUs")) != null)
//{
@@ -191,60 +189,60 @@ internal class TitleLogoPatch
BottomButtons.transform.position = new Vector3(0f, -2.71f, 0f);
}*/
- /* if ((Ambience = GameObject.Find("Ambience")) != null)
- {
- Ambience.SetActive(false);
- var CustomBG = new GameObject("CustomBG");
- CustomBG.transform.position = new Vector3(2.095f, -0.25f, 520f);
- var bgRenderer = CustomBG.AddComponent();
- bgRenderer.sprite = Utils.LoadSprite("TOHE.Resources.Images.TOHE-BG.jpg", 245f);
- } */
+ /* if ((Ambience = GameObject.Find("Ambience")) != null)
+ {
+ Ambience.SetActive(false);
+ var CustomBG = new GameObject("CustomBG");
+ CustomBG.transform.position = new Vector3(2.095f, -0.25f, 520f);
+ var bgRenderer = CustomBG.AddComponent();
+ bgRenderer.sprite = Utils.LoadSprite("TOHE.Resources.Images.TOHE-BG.jpg", 245f);
+ } */
if ((Ambience = GameObject.Find("Ambience")) != null)
{
try
{
SpriteRenderer activeSpriteRender = __instance.playButton.activeSprites.GetComponent();
- activeSpriteRender.color = new Color(1f, 0f, 0.62f);
+ activeSpriteRender.color = new Color(0.99f, 0.55f, 0.56f);
SpriteRenderer inactiveSpriteRender = __instance.playButton.inactiveSprites.GetComponent();
- inactiveSpriteRender.color = new Color(1f, 0f, 0.35f);
+ inactiveSpriteRender.color = new Color(1f, 0.31f, 0.09f);
inactiveSpriteRender.sprite = activeSpriteRender.sprite;
- __instance.playButton.activeTextColor = Color.white;
- __instance.playButton.inactiveTextColor = Color.white;
+ __instance.playButton.activeTextColor = new Color(0.08f, 0.03f, 0.12f);
+ __instance.playButton.inactiveTextColor = new Color(0.08f, 0.03f, 0.12f);
- __instance.inventoryButton.inactiveSprites.GetComponent().color = new Color(0.95f, 0f, 1f);
- __instance.inventoryButton.activeSprites.GetComponent().color = new Color(1f, 0f, 0.85f);
+ __instance.inventoryButton.inactiveSprites.GetComponent().color = new Color(0.11f, 0.13f, 0.59f);
+ __instance.inventoryButton.activeSprites.GetComponent().color = new Color(0.63f, 0.53f, 0.89f);
__instance.inventoryButton.activeTextColor = Color.white;
__instance.inventoryButton.inactiveTextColor = Color.white;
- __instance.shopButton.inactiveSprites.GetComponent().color = new Color(1f, 0f, 0.85f);
- __instance.shopButton.activeSprites.GetComponent().color = new Color(1f, 0f, 0.85f);
+ __instance.shopButton.inactiveSprites.GetComponent().color = new Color(0.11f, 0.13f, 0.59f);
+ __instance.shopButton.activeSprites.GetComponent().color = new Color(0.63f, 0.53f, 0.89f);
__instance.shopButton.activeTextColor = Color.white;
__instance.shopButton.inactiveTextColor = Color.white;
- __instance.newsButton.inactiveSprites.GetComponent().color = new Color(0.82f, 0f, 1f);
- __instance.newsButton.activeSprites.GetComponent().color = new Color(1f, 0f, 0.85f);
+ __instance.newsButton.inactiveSprites.GetComponent().color = new Color(0.69f, 0.2f, 0.65f);
+ __instance.newsButton.activeSprites.GetComponent().color = new Color(0.97f, 0.41f, 0.61f);
__instance.newsButton.activeTextColor = Color.white;
__instance.newsButton.inactiveTextColor = Color.white;
- __instance.myAccountButton.inactiveSprites.GetComponent().color = new Color(0.95f, 0f, 1f);
- __instance.myAccountButton.activeSprites.GetComponent().color = new Color(1f, 0f, 0.85f);
+ __instance.myAccountButton.inactiveSprites.GetComponent().color = new Color(0.69f, 0.2f, 0.65f);
+ __instance.myAccountButton.activeSprites.GetComponent().color = new Color(0.97f, 0.41f, 0.61f);
__instance.myAccountButton.activeTextColor = Color.white;
__instance.myAccountButton.inactiveTextColor = Color.white;
- __instance.settingsButton.inactiveSprites.GetComponent().color = new Color(1f, 0f, 0.85f);
- __instance.settingsButton.activeSprites.GetComponent().color = new Color(1f, 0f, 0.85f);
+ __instance.settingsButton.inactiveSprites.GetComponent().color = new Color(0.69f, 0.2f, 0.65f);
+ __instance.settingsButton.activeSprites.GetComponent().color = new Color(0.97f, 0.41f, 0.61f);
__instance.settingsButton.activeTextColor = Color.white;
__instance.settingsButton.inactiveTextColor = Color.white;
- __instance.quitButton.inactiveSprites.GetComponent().color = new Color(1f, 0f, 0.35f);
- __instance.quitButton.activeSprites.GetComponent().color = new Color(1f, 0f, 0.62f);
+ __instance.quitButton.inactiveSprites.GetComponent().color = new Color(0.27f, 0.21f, 0.7f);
+ __instance.quitButton.activeSprites.GetComponent().color = new Color(0.42f, 0.3f, 0.8f);
__instance.quitButton.activeTextColor = Color.white;
__instance.quitButton.inactiveTextColor = Color.white;
- __instance.creditsButton.inactiveSprites.GetComponent().color = new Color(0.5f, 0f, 0.85f);
- __instance.creditsButton.activeSprites.GetComponent().color = new Color(1f, 0f, 0.85f);
+ __instance.creditsButton.inactiveSprites.GetComponent().color = new Color(0.18f, 0.2f, 0.59f);
+ __instance.creditsButton.activeSprites.GetComponent().color = new Color(0.96f, 0.88f, 0.86f);
__instance.creditsButton.activeTextColor = Color.white;
__instance.creditsButton.inactiveTextColor = Color.white;
@@ -256,7 +254,7 @@ internal class TitleLogoPatch
var CustomBG = new GameObject("CustomBG");
CustomBG.transform.position = new Vector3(0f, 0f, 520f);
var bgRenderer = CustomBG.AddComponent();
- bgRenderer.sprite = Utils.LoadSprite("TOHE.Resources.Images.PL.png", 245f);
+ bgRenderer.sprite = Utils.LoadSprite("TOHE.Resources.Images.bg.png", 180f);
__instance.screenTint.gameObject.transform.localPosition += new Vector3(1000f, 0f);
__instance.screenTint.enabled = false;
@@ -272,7 +270,7 @@ internal class TitleLogoPatch
GameObject.Find("Shine").transform.gameObject.SetActive(false);
- leftPanel.GetComponentsInChildren(true).Where(r => r.name == "Shine").Do(r => r.color = new Color(1f, 0f, 0.35f, 0.2f));
+ leftPanel.GetComponentsInChildren(true).Where(r => r.name == "Shine").Do(r => r.color = new Color(0f, 0f, 1f, 0.1f));
//leftPanel.GetComponents().Where(r => r.name == "Shine").Do(r => r.color = new Color(1f, 0f, 0f));
leftPanel.gameObject.GetComponent().enabled = false;
diff --git a/Patches/DisconnectPatch.cs b/Patches/DisconnectPatch.cs
index ed58f70f4..080d1b3ee 100644
--- a/Patches/DisconnectPatch.cs
+++ b/Patches/DisconnectPatch.cs
@@ -1,5 +1,4 @@
using HarmonyLib;
-using static TOHE.Translator;
namespace TOHE;
diff --git a/Patches/ExilePatch.cs b/Patches/ExilePatch.cs
index 881a434d8..6c2bc6769 100644
--- a/Patches/ExilePatch.cs
+++ b/Patches/ExilePatch.cs
@@ -58,7 +58,7 @@ class ExileControllerWrapUpPatch
exiled.IsDead = true;
Main.PlayerStates[exiled.PlayerId].deathReason = PlayerState.DeathReason.Vote;
- var role = exiled.GetCustomRole();
+ var role = exiled.GetCustomRole();
//判断冤罪师胜利
if (Main.AllPlayerControls.Any(x => x.Is(CustomRoles.Innocent) && !x.IsAlive() && x.GetRealKiller()?.PlayerId == exiled.PlayerId))
@@ -121,6 +121,7 @@ class ExileControllerWrapUpPatch
CustomRoles.DovesOfNeace or
CustomRoles.QuickShooter or
CustomRoles.Addict or
+ CustomRoles.Alchemist or
CustomRoles.ShapeshifterTOHE or
CustomRoles.Wildling or
CustomRoles.Twister or
@@ -129,6 +130,7 @@ class ExileControllerWrapUpPatch
CustomRoles.Devourer or
CustomRoles.Nuker or
CustomRoles.Assassin or
+ CustomRoles.Undertaker or
CustomRoles.Camouflager or
CustomRoles.Disperser or
CustomRoles.Escapee or
diff --git a/Patches/GameOptionsMenuPatch.cs b/Patches/GameOptionsMenuPatch.cs
index 976c98566..4ce8dcf30 100644
--- a/Patches/GameOptionsMenuPatch.cs
+++ b/Patches/GameOptionsMenuPatch.cs
@@ -167,7 +167,7 @@ public class GameOptionsMenuUpdatePatch
TabGroup.NeutralRoles => "#7f8c8d",
TabGroup.Addons => "#ff9ace",
TabGroup.OtherRoles => "#76b8e0",
- // TabGroup.CovenRoles => "#8e44ad",
+ // TabGroup.CovenRoles => "#8e44ad",
_ => "#ffffff",
};
if (__instance.transform.parent.parent.name != tab + "Tab") continue;
diff --git a/Patches/GameStartManagerPatch.cs b/Patches/GameStartManagerPatch.cs
index 965da63a8..97e86b7d0 100644
--- a/Patches/GameStartManagerPatch.cs
+++ b/Patches/GameStartManagerPatch.cs
@@ -6,10 +6,10 @@ using System;
using System.Collections.Generic;
using System.Linq;
using TMPro;
-using UnityEngine;
using TOHE.Roles.Neutral;
-using Object = UnityEngine.Object;
+using UnityEngine;
using static TOHE.Translator;
+using Object = UnityEngine.Object;
namespace TOHE;
@@ -36,7 +36,7 @@ public class GameStartManagerPatch
// Reset lobby countdown timer
timer = 600f;
- HideName = UnityEngine.Object.Instantiate(__instance.GameRoomNameCode, __instance.GameRoomNameCode.transform);
+ HideName = Object.Instantiate(__instance.GameRoomNameCode, __instance.GameRoomNameCode.transform);
HideName.text = ColorUtility.TryParseHtmlString(Main.HideColor.Value, out _)
? $"{Main.HideName.Value}"
: $"{Main.HideName.Value}";
@@ -217,7 +217,7 @@ public class GameStartRandomMap
Utils.SendMessage(msg);
return false;
}
-
+
Options.DefaultKillCooldown = Main.NormalOptions.KillCooldown;
Main.LastKillCooldown.Value = Main.NormalOptions.KillCooldown;
diff --git a/Patches/HudPatch.cs b/Patches/HudPatch.cs
index 314f32063..3cc3f6b64 100644
--- a/Patches/HudPatch.cs
+++ b/Patches/HudPatch.cs
@@ -73,9 +73,9 @@ class HudManagerPatch
else
__instance.AbilityButton.OverrideText(GetString("FireWorksInstallAtionButtonText"));
break;
- case CustomRoles.SerialKiller:
- SerialKiller.GetAbilityButtonText(__instance, player);
- break;
+ //case CustomRoles.SerialKiller:
+ // SerialKiller.GetAbilityButtonText(__instance, player);
+ // break;
case CustomRoles.Warlock:
bool curse = Main.isCurseAndKill.TryGetValue(player.PlayerId, out bool wcs) && wcs;
if (!shapeshifting && !curse)
@@ -187,6 +187,7 @@ class HudManagerPatch
break;
case CustomRoles.Twister:
__instance.AbilityButton.OverrideText(GetString("TwisterButtonText"));
+ __instance.AbilityButton.SetUsesRemaining((int)Twister.TwistLimit[player.PlayerId]);
break;
case CustomRoles.ImperiusCurse:
__instance.AbilityButton.OverrideText(GetString("ImperiusCurseButtonText"));
@@ -200,6 +201,7 @@ class HudManagerPatch
break;
case CustomRoles.Camouflager:
__instance.AbilityButton.OverrideText(GetString("CamouflagerShapeshiftText"));
+ if (Camouflager.CamoLimit.TryGetValue(PlayerControl.LocalPlayer.PlayerId, out var x)) __instance.AbilityButton.SetUsesRemaining((int)x);
break;
case CustomRoles.OverKiller:
__instance.KillButton.OverrideText(GetString("OverKillerButtonText"));
@@ -208,6 +210,10 @@ class HudManagerPatch
Assassin.SetKillButtonText(player.PlayerId);
Assassin.GetAbilityButtonText(__instance, player.PlayerId);
break;
+ case CustomRoles.Undertaker:
+ Undertaker.SetKillButtonText(player.PlayerId);
+ Undertaker.GetAbilityButtonText(__instance, player.PlayerId);
+ break;
case CustomRoles.Hacker:
Hacker.GetAbilityButtonText(__instance, player.PlayerId);
break;
@@ -226,6 +232,7 @@ class HudManagerPatch
break;
case CustomRoles.Disperser:
__instance.AbilityButton.OverrideText(GetString("DisperserVentButtonText"));
+ __instance.AbilityButton.SetUsesRemaining((int)Disperser.DisperserLimit[player.PlayerId]);
break;
case CustomRoles.Swooper:
__instance.ImpostorVentButton.OverrideText(GetString(Swooper.IsInvis(PlayerControl.LocalPlayer.PlayerId) ? "SwooperRevertVentButtonText" : "SwooperVentButtonText"));
@@ -300,6 +307,10 @@ class HudManagerPatch
case CustomRoles.Deputy:
__instance.KillButton.OverrideText(GetString("DeputyHandcuffText"));
break;
+ case CustomRoles.Hangman:
+ if (shapeshifting) __instance.KillButton.OverrideText(GetString("HangmanKillButtonTextDuringSS"));
+ __instance.AbilityButton.SetUsesRemaining((int)Hangman.HangLimit[player.PlayerId]);
+ break;
case CustomRoles.Sidekick:
__instance.KillButton.OverrideText(GetString("KillButtonText"));
__instance.ImpostorVentButton.OverrideText(GetString("ReportButtonText"));
@@ -308,8 +319,12 @@ class HudManagerPatch
case CustomRoles.Addict:
__instance.AbilityButton.OverrideText(GetString("AddictVentButtonText"));
break;
+ case CustomRoles.Alchemist:
+ __instance.AbilityButton.OverrideText(GetString("AlchemistVentButtonText"));
+ break;
case CustomRoles.Dazzler:
__instance.AbilityButton.OverrideText(GetString("DazzleButtonText"));
+ if (Dazzler.DazzleLimit.TryGetValue(PlayerControl.LocalPlayer.PlayerId, out var y)) __instance.AbilityButton.SetUsesRemaining((int)y);
break;
case CustomRoles.Deathpact:
__instance.AbilityButton.OverrideText(GetString("DeathpactButtonText"));
@@ -536,7 +551,7 @@ class SetHudActivePatch
case CustomRoles.Glitch:
Glitch.SetHudActive(__instance, isActive);
break;
-
+
}
foreach (var subRole in Main.PlayerStates[player.PlayerId].SubRoles)
@@ -546,10 +561,10 @@ class SetHudActivePatch
case CustomRoles.Oblivious:
__instance.ReportButton.ToggleVisible(false);
break;
- case CustomRoles.Mare:
- if (!Utils.IsActive(SystemTypes.Electrical))
- __instance.KillButton.ToggleVisible(false);
- break;
+ //case CustomRoles.Mare:
+ // if (!Utils.IsActive(SystemTypes.Electrical))
+ // __instance.KillButton.ToggleVisible(false);
+ // break;
}
}
__instance.KillButton.ToggleVisible(player.CanUseKillButton());
@@ -622,14 +637,14 @@ class TaskPanelBehaviourPatch
{
var text = sb.ToString().TrimEnd('\n').TrimEnd('\r');
if (!Utils.HasTasks(player.Data, false) && sb.ToString().Count(s => (s == '\n')) >= 2)
- text = $"{ Utils.ColorString(Utils.GetRoleColor(player.GetCustomRole()).ShadeColor(0.2f), GetString("FakeTask"))}\r\n{text}";
- AllText += $"\r\n\r\n{text}";
+ text = $"{Utils.ColorString(Utils.GetRoleColor(player.GetCustomRole()).ShadeColor(0.2f), GetString("FakeTask"))}\r\n{text}";
+ AllText += $"\r\n\r\n{text}";
}
if (MeetingStates.FirstMeeting)
{
- AllText += $"\r\n\r\n{GetString("PressF1ShowMainRoleDes")}";
- if (Main.PlayerStates.TryGetValue(PlayerControl.LocalPlayer.PlayerId, out var ps) && ps.SubRoles.Count >= 1)
+ AllText += $"\r\n\r\n{GetString("PressF1ShowMainRoleDes")}";
+ if (Main.PlayerStates.TryGetValue(PlayerControl.LocalPlayer.PlayerId, out var ps) && ps.SubRoles.Any())
AllText += $"\r\n{GetString("PressF2ShowAddRoleDes")}";
AllText += "";
}
diff --git a/Patches/HudSpritePatch.cs b/Patches/HudSpritePatch.cs
index 8e9b55460..35703d0f9 100644
--- a/Patches/HudSpritePatch.cs
+++ b/Patches/HudSpritePatch.cs
@@ -1,5 +1,4 @@
using HarmonyLib;
-using TOHE.Modules;
using TOHE.Roles.Impostor;
using UnityEngine;
@@ -52,6 +51,14 @@ public static class HudSpritePatch
newAbilityButton = CustomButton.Get("Assassinate");
}
break;
+ case CustomRoles.Undertaker:
+ if (!shapeshifting)
+ {
+ newKillButton = CustomButton.Get("Mark");
+ if (Assassin.MarkedPlayer.ContainsKey(player.PlayerId))
+ newAbilityButton = CustomButton.Get("Assassinate");
+ }
+ break;
case CustomRoles.Disperser:
if (!shapeshifting)
{
@@ -136,6 +143,30 @@ public static class HudSpritePatch
case CustomRoles.CursedSoul:
newKillButton = CustomButton.Get("Soul");
break;
+ case CustomRoles.TimeMaster:
+ newAbilityButton = CustomButton.Get("Time Master");
+ break;
+ case CustomRoles.Mario:
+ newAbilityButton = CustomButton.Get("Happy");
+ break;
+ case CustomRoles.Sheriff:
+ newKillButton = CustomButton.Get("Kill");
+ break;
+ case CustomRoles.Swooper:
+ newAbilityButton = CustomButton.Get("invisible");
+ break;
+ case CustomRoles.Chameleon:
+ newAbilityButton = CustomButton.Get("invisible");
+ break;
+ case CustomRoles.Wraith:
+ newAbilityButton = CustomButton.Get("invisible");
+ break;
+ case CustomRoles.Escapee:
+ newAbilityButton = CustomButton.Get("abscond");
+ break;
+ case CustomRoles.Farseer:
+ newKillButton = CustomButton.Get("prophecies");
+ break;
case CustomRoles.Warlock:
if (!shapeshifting)
{
diff --git a/Patches/IntroPatch.cs b/Patches/IntroPatch.cs
index f6e32ce01..9a70fa831 100644
--- a/Patches/IntroPatch.cs
+++ b/Patches/IntroPatch.cs
@@ -3,7 +3,6 @@ using HarmonyLib;
using System;
using System.Linq;
using System.Threading.Tasks;
-using TOHE.Modules;
using UnityEngine;
using static TOHE.Translator;
@@ -122,7 +121,7 @@ class BeginCrewmatePatch
__instance.overlayHandle.color = Palette.ImpostorRed;
return false;
}
- else if (PlayerControl.LocalPlayer.Is(CustomRoles.Crewpostor))
+ else if (PlayerControl.LocalPlayer.Is(CustomRoles.Crewpostor))
{
teamToDisplay = new Il2CppSystem.Collections.Generic.List();
teamToDisplay.Add(PlayerControl.LocalPlayer);
@@ -130,7 +129,7 @@ class BeginCrewmatePatch
__instance.overlayHandle.color = Palette.ImpostorRed;
return false;
}
- else if (PlayerControl.LocalPlayer.GetCustomRole().IsMadmate())
+ else if (PlayerControl.LocalPlayer.GetCustomRole().IsMadmate())
{
teamToDisplay = new Il2CppSystem.Collections.Generic.List();
teamToDisplay.Add(PlayerControl.LocalPlayer);
@@ -138,7 +137,7 @@ class BeginCrewmatePatch
__instance.overlayHandle.color = Palette.ImpostorRed;
return false;
}
-
+
return true;
}
public static void Postfix(IntroCutscene __instance, ref Il2CppSystem.Collections.Generic.List teamToDisplay)
@@ -180,6 +179,7 @@ class BeginCrewmatePatch
break;
case CustomRoles.Workaholic:
+ case CustomRoles.Speedrunner:
case CustomRoles.Snitch:
case CustomRoles.TaskManager:
PlayerControl.LocalPlayer.Data.Role.IntroSound = DestroyableSingleton.Instance.TaskCompleteSound;
@@ -211,6 +211,7 @@ class BeginCrewmatePatch
case CustomRoles.Sheriff:
case CustomRoles.Veteran:
case CustomRoles.SwordsMan:
+ case CustomRoles.Minimalism:
case CustomRoles.Reverie:
case CustomRoles.NiceGuesser:
PlayerControl.LocalPlayer.Data.Role.IntroSound = PlayerControl.LocalPlayer.KillSfx;
@@ -230,9 +231,6 @@ class BeginCrewmatePatch
case CustomRoles.Dictator:
PlayerControl.LocalPlayer.Data.Role.IntroSound = HudManager.Instance.Chat.messageSound;
break;
- case CustomRoles.Minimalism:
- PlayerControl.LocalPlayer.Data.Role.IntroSound = PlayerControl.LocalPlayer.KillSfx;
- break;
}
if (PlayerControl.LocalPlayer.Is(CustomRoles.Madmate))
@@ -240,8 +238,8 @@ class BeginCrewmatePatch
__instance.TeamTitle.text = GetString("TeamMadmate");
__instance.TeamTitle.color = __instance.BackgroundBar.material.color = new Color32(255, 25, 25, byte.MaxValue);
PlayerControl.LocalPlayer.Data.Role.IntroSound = GetIntroSound(RoleTypes.Impostor);
- __instance.ImpostorText.gameObject.SetActive(true);
- __instance.ImpostorText.text = GetString("SubText.Madmate");
+ __instance.ImpostorText.gameObject.SetActive(true);
+ __instance.ImpostorText.text = GetString("SubText.Madmate");
}
if (PlayerControl.LocalPlayer.Is(CustomRoles.Parasite))
@@ -249,8 +247,8 @@ class BeginCrewmatePatch
__instance.TeamTitle.text = GetString("TeamMadmate");
__instance.TeamTitle.color = __instance.BackgroundBar.material.color = new Color32(255, 25, 25, byte.MaxValue);
PlayerControl.LocalPlayer.Data.Role.IntroSound = GetIntroSound(RoleTypes.Impostor);
- __instance.ImpostorText.gameObject.SetActive(true);
- __instance.ImpostorText.text = GetString("SubText.Madmate");
+ __instance.ImpostorText.gameObject.SetActive(true);
+ __instance.ImpostorText.text = GetString("SubText.Madmate");
}
if (PlayerControl.LocalPlayer.Is(CustomRoles.Crewpostor))
@@ -258,8 +256,8 @@ class BeginCrewmatePatch
__instance.TeamTitle.text = GetString("TeamMadmate");
__instance.TeamTitle.color = __instance.BackgroundBar.material.color = new Color32(255, 25, 25, byte.MaxValue);
PlayerControl.LocalPlayer.Data.Role.IntroSound = GetIntroSound(RoleTypes.Impostor);
- __instance.ImpostorText.gameObject.SetActive(true);
- __instance.ImpostorText.text = GetString("SubText.Madmate");
+ __instance.ImpostorText.gameObject.SetActive(true);
+ __instance.ImpostorText.text = GetString("SubText.Madmate");
}
if (Options.CurrentGameMode == CustomGameMode.SoloKombat)
@@ -356,6 +354,15 @@ class BeginImpostorPatch
__instance.overlayHandle.color = Palette.CrewmateBlue;
return false;
}
+ else if (role is CustomRoles.Romantic or CustomRoles.RuthlessRomantic or CustomRoles.VengefulRomantic or CustomRoles.NSerialKiller or CustomRoles.Jackal or CustomRoles.CursedSoul or CustomRoles.Amnesiac or CustomRoles.Arsonist or CustomRoles.Sidekick or CustomRoles.Innocent or CustomRoles.Pelican or CustomRoles.Pursuer or CustomRoles.Revolutionist or CustomRoles.FFF or CustomRoles.Gamer or CustomRoles.Glitch or CustomRoles.Juggernaut or CustomRoles.DarkHide or CustomRoles.Provocateur or CustomRoles.BloodKnight or CustomRoles.NSerialKiller or CustomRoles.Maverick or CustomRoles.NWitch or CustomRoles.Totocalcio or CustomRoles.Succubus or CustomRoles.Pelican or CustomRoles.Infectious or CustomRoles.Virus or CustomRoles.Pickpocket or CustomRoles.Traitor or CustomRoles.PlagueBearer or CustomRoles.Pestilence or CustomRoles.Spiritcaller)
+ {
+ yourTeam = new Il2CppSystem.Collections.Generic.List();
+ yourTeam.Add(PlayerControl.LocalPlayer);
+ foreach (var pc in Main.AllPlayerControls.Where(x => !x.AmOwner)) yourTeam.Add(pc);
+ __instance.BeginCrewmate(yourTeam);
+ __instance.overlayHandle.color = new Color32(127, 140, 141, byte.MaxValue);
+ return false;
+ }
BeginCrewmatePatch.Prefix(__instance, ref yourTeam);
return true;
}
diff --git a/Patches/LobbyListPatch.cs b/Patches/LobbyListPatch.cs
index 659dbd860..d674a41b5 100644
--- a/Patches/LobbyListPatch.cs
+++ b/Patches/LobbyListPatch.cs
@@ -1,8 +1,4 @@
-using HarmonyLib;
-using Il2CppSystem;
-using Il2CppSystem.Collections.Generic;
-using InnerNet;
-//using UnityEngine;
+//using UnityEngine;
namespace TOHE;
diff --git a/Patches/MeetingHudPatch.cs b/Patches/MeetingHudPatch.cs
index bea434732..c8db82ebf 100644
--- a/Patches/MeetingHudPatch.cs
+++ b/Patches/MeetingHudPatch.cs
@@ -1,4 +1,3 @@
-using AmongUs.GameOptions;
using HarmonyLib;
using System;
using System.Collections.Generic;
@@ -21,7 +20,7 @@ class CheckForEndVotingPatch
if (Medic.IsEnable) Medic.OnCheckMark();
//Meeting Skip with vote counting on keystroke (m + delete)
var shouldSkip = false;
- if (Input.GetKeyDown(KeyCode.F6))
+ if (Input.GetKeyDown(KeyCode.F6))
{
shouldSkip = true;
}
@@ -51,7 +50,7 @@ class CheckForEndVotingPatch
}
}
-//催眠师催眠
+ //催眠师催眠
if (pc.Is(CustomRoles.Dictator) && pva.DidVote && pc.PlayerId != pva.VotedFor && pva.VotedFor < 253 && !pc.Data.IsDead)
{
@@ -177,6 +176,7 @@ class CheckForEndVotingPatch
if (CheckRole(ps.TargetPlayerId, CustomRoles.Divinator) && Divinator.HideVote.GetBool()) continue;
//隐藏抹除者的票
if (CheckRole(ps.TargetPlayerId, CustomRoles.Eraser) && Eraser.HideVote.GetBool()) continue;
+ if (CheckRole(ps.TargetPlayerId, CustomRoles.NiceEraser) && NiceEraser.HideVote.GetBool()) continue;
if (CheckRole(ps.TargetPlayerId, CustomRoles.Tracker) && Tracker.HideVote.GetBool()) continue;
@@ -190,7 +190,7 @@ class CheckForEndVotingPatch
VoterId = ps.TargetPlayerId,
VotedForId = ps.VotedFor
});
-
+
if (CheckRole(ps.TargetPlayerId, CustomRoles.Mayor) && !Options.MayorHideVote.GetBool()) //Mayorの投票数
{
for (var i2 = 0; i2 < Options.MayorAdditionalVote.GetFloat(); i2++)
@@ -331,8 +331,8 @@ class CheckForEndVotingPatch
var coloredRole = Utils.GetDisplayRoleName(exileId, true);
if (Options.ConfirmEgoistOnEject.GetBool() && player.Is(CustomRoles.Egoist))
coloredRole = Utils.ColorString(Utils.GetRoleColor(CustomRoles.Egoist), GetRoleString("Temp.Blank") + coloredRole.RemoveHtmlTags());
- // if (Options.ConfirmSidekickOnEject.GetBool() && player.Is(CustomRoles.Sidekick))
- // coloredRole = Utils.ColorString(Utils.GetRoleColor(CustomRoles.Sidekick), GetRoleString("Temp.Blank") + coloredRole.RemoveHtmlTags());
+ // if (Options.ConfirmSidekickOnEject.GetBool() && player.Is(CustomRoles.Sidekick))
+ // coloredRole = Utils.ColorString(Utils.GetRoleColor(CustomRoles.Sidekick), GetRoleString("Temp.Blank") + coloredRole.RemoveHtmlTags());
if (Options.ConfirmLoversOnEject.GetBool() && player.Is(CustomRoles.Lovers))
coloredRole = Utils.ColorString(Utils.GetRoleColor(CustomRoles.Lovers), GetRoleString("Temp.Blank") + coloredRole.RemoveHtmlTags());
if (Options.RascalAppearAsMadmate.GetBool() && player.Is(CustomRoles.Rascal))
@@ -386,20 +386,19 @@ class CheckForEndVotingPatch
}
break;
}
+
var DecidedWinner = false;
- //小丑胜利
- /* if (crole == CustomRoles.Jester)
+
+ if (crole == CustomRoles.Jester)
{
name = string.Format(GetString("ExiledJester"), realName, coloredRole);
DecidedWinner = true;
}
- //处刑人胜利
if (Executioner.CheckExileTarget(exiledPlayer, DecidedWinner, true))
{
name = string.Format(GetString("ExiledExeTarget"), realName, coloredRole);
DecidedWinner = true;
}
- //冤罪师胜利
if (Main.AllPlayerControls.Any(x => x.Is(CustomRoles.Innocent) && !x.IsAlive() && x.GetRealKiller()?.PlayerId == exileId))
{
if (!(!Options.InnocentCanWinByImp.GetBool() && crole.IsImpostor()))
@@ -408,19 +407,20 @@ class CheckForEndVotingPatch
else name = string.Format(GetString("ExiledInnocentTargetInOneLine"), realName, coloredRole);
DecidedWinner = true;
}
- } */
+ }
if (DecidedWinner) name += "";
- if (Options.ShowImpRemainOnEject.GetBool() && !DecidedWinner)
+ else if (Options.ShowImpRemainOnEject.GetBool() && !DecidedWinner)
{
name += "\n";
string comma = neutralnum > 0 ? "," : "";
- if (impnum == 0) name += GetString("NoImpRemain") + comma;
- if (impnum == 1) name += GetString("OneImpRemain") + comma;
- if (impnum == 2) name += GetString("TwoImpRemain") + comma;
- if (impnum == 3) name += GetString("ThreeImpRemain") + comma;
- // else name += string.Format(GetString("ImpRemain"), impnum) + comma;
- if (Options.ShowNKRemainOnEject.GetBool() && neutralnum > 0)
+ if (impnum == 0 && neutralnum == 0) name += GetString("GG");
+ else if (impnum == 0) name += GetString("NoImpRemain") + comma;
+ else if (impnum == 1) name += GetString("OneImpRemain") + comma;
+ else if (impnum == 2) name += GetString("TwoImpRemain") + comma;
+ else if (impnum == 3) name += GetString("ThreeImpRemain") + comma;
+ // else name += string.Format(GetString("ImpRemain"), impnum) + comma;
+ else if (Options.ShowNKRemainOnEject.GetBool() && neutralnum > 0)
name += string.Format(GetString("NeutralRemain"), neutralnum);
}
@@ -462,8 +462,8 @@ class CheckForEndVotingPatch
Virus.OnCheckForEndVoting(deathReason, playerIds);
foreach (var playerId in playerIds)
{
- // Baker.OnCheckForEndVoting(playerId);
-
+ // Baker.OnCheckForEndVoting(playerId);
+
//Loversの後追い
if (CustomRoles.Lovers.IsEnable() && !Main.isLoversDead && Main.LoversPlayers.Find(lp => lp.PlayerId == playerId) != null)
FixedUpdatePatch.LoversSuicide(playerId, true);
@@ -541,10 +541,10 @@ static class ExtendedMeetingHud
&& ps.TargetPlayerId != ps.VotedFor
) VoteNum += Options.VindicatorAdditionalVote.GetInt();
if (Options.DualVotes.GetBool())
- {
- if (CheckForEndVotingPatch.CheckRole(ps.TargetPlayerId, CustomRoles.DualPersonality)
- && ps.TargetPlayerId != ps.VotedFor
- ) VoteNum += VoteNum;
+ {
+ if (CheckForEndVotingPatch.CheckRole(ps.TargetPlayerId, CustomRoles.DualPersonality)
+ && ps.TargetPlayerId != ps.VotedFor
+ ) VoteNum += VoteNum;
}
//窃票者附加票数
if (CheckForEndVotingPatch.CheckRole(ps.TargetPlayerId, CustomRoles.TicketsStealer))
@@ -591,7 +591,7 @@ class MeetingHudStartPatch
sb.Append($"\n\n" + GetString($"Lovers") + Utils.GetRoleMode(CustomRoles.Lovers) + GetString($"LoversInfoLong"));
AddMsg(sb.ToString(), pc.PlayerId);
}
- if (msgToSend.Count >= 1)
+ if (msgToSend.Any())
{
var msgTemp = msgToSend.ToList();
new LateTask(() => { msgTemp.Do(x => Utils.SendMessage(x.Item1, x.Item2, x.Item3)); }, 3f, "Skill Description First Meeting");
@@ -760,7 +760,7 @@ class MeetingHudStartPatch
roleTextMeeting.text = Farseer.RandomRole[PlayerControl.LocalPlayer.PlayerId];
roleTextMeeting.text += Farseer.GetTaskState();
}
-
+
if (EvilTracker.IsTrackTarget(PlayerControl.LocalPlayer, pc) && EvilTracker.CanSeeLastRoomInMeeting)
{
roleTextMeeting.text = EvilTracker.GetArrowAndLastRoom(PlayerControl.LocalPlayer, pc);
@@ -816,12 +816,12 @@ class MeetingHudStartPatch
//自分自身の名前の色を変更
//NameColorManager準拠の処理
pva.NameText.text = pva.NameText.text.ApplyNameColorData(seer, target, true);
-
+
// Guesser Mode //
if (Options.GuesserMode.GetBool())
{
- if (Options.CrewmatesCanGuess.GetBool() && seer.GetCustomRole().IsCrewmate() && !seer.Is(CustomRoles.Judge) && !seer.Is(CustomRoles.ParityCop))
+ if (Options.CrewmatesCanGuess.GetBool() && seer.GetCustomRole().IsCrewmate() && !seer.Is(CustomRoles.Judge) && !seer.Is(CustomRoles.Lookout) && !seer.Is(CustomRoles.ParityCop))
if (!seer.Data.IsDead && !target.Data.IsDead)
pva.NameText.text = Utils.ColorString(Utils.GetRoleColor(seer.GetCustomRole()), target.PlayerId.ToString()) + " " + pva.NameText.text;
if (Options.ImpostorsCanGuess.GetBool() && seer.GetCustomRole().IsImpostor() && !seer.Is(CustomRoles.Councillor))
@@ -839,34 +839,34 @@ class MeetingHudStartPatch
if (seer.KnowDeathReason(target))
sb.Append($"({Utils.ColorString(Utils.GetRoleColor(CustomRoles.Doctor), Utils.GetVitalText(target.PlayerId))})");
- /* if (seer.KnowDeadTeam(target))
- {
- if (target.Is(CustomRoleTypes.Crewmate) && !(target.Is(CustomRoles.Madmate) || target.Is(CustomRoles.Egoist) || target.Is(CustomRoles.Charmed) || target.Is(CustomRoles.Recruit) || target.Is(CustomRoles.Infected) || target.Is(CustomRoles.Contagious) || target.Is(CustomRoles.Rogue) || target.Is(CustomRoles.Rascal) || target.Is(CustomRoles.Soulless) || !target.Is(CustomRoles.Admired)))
- sb.Append(Utils.ColorString(Utils.GetRoleColor(CustomRoles.Bait), "★"));
+ /* if (seer.KnowDeadTeam(target))
+ {
+ if (target.Is(CustomRoleTypes.Crewmate) && !(target.Is(CustomRoles.Madmate) || target.Is(CustomRoles.Egoist) || target.Is(CustomRoles.Charmed) || target.Is(CustomRoles.Recruit) || target.Is(CustomRoles.Infected) || target.Is(CustomRoles.Contagious) || target.Is(CustomRoles.Rogue) || target.Is(CustomRoles.Rascal) || target.Is(CustomRoles.Soulless) || !target.Is(CustomRoles.Admired)))
+ sb.Append(Utils.ColorString(Utils.GetRoleColor(CustomRoles.Bait), "★"));
- if (target.Is(CustomRoleTypes.Impostor) || target.Is(CustomRoles.Madmate) || target.Is(CustomRoles.Rascal) || target.Is(CustomRoles.Parasite) || target.Is(CustomRoles.Refugee) || target.Is(CustomRoles.Crewpostor) || target.Is(CustomRoles.Convict) || !target.Is(CustomRoles.Admired))
- sb.Append(Utils.ColorString(Utils.GetRoleColor(CustomRoles.Impostor), "★"));
+ if (target.Is(CustomRoleTypes.Impostor) || target.Is(CustomRoles.Madmate) || target.Is(CustomRoles.Rascal) || target.Is(CustomRoles.Parasite) || target.Is(CustomRoles.Refugee) || target.Is(CustomRoles.Crewpostor) || target.Is(CustomRoles.Convict) || !target.Is(CustomRoles.Admired))
+ sb.Append(Utils.ColorString(Utils.GetRoleColor(CustomRoles.Impostor), "★"));
- if (target.Is(CustomRoleTypes.Neutral) || target.Is(CustomRoles.Rogue) || target.Is(CustomRoles.Contagious) || target.Is(CustomRoles.Charmed) || target.Is(CustomRoles.Recruit) || target.Is(CustomRoles.Infected) || target.Is(CustomRoles.Egoist) || target.Is(CustomRoles.Soulless) || !target.Is(CustomRoles.Admired) || !target.Is(CustomRoles.Parasite) || !target.Is(CustomRoles.Refugee) || !target.Is(CustomRoles.Crewpostor) || !target.Is(CustomRoles.Convict))
- sb.Append(Utils.ColorString(Utils.GetRoleColor(CustomRoles.Executioner), "★"));
+ if (target.Is(CustomRoleTypes.Neutral) || target.Is(CustomRoles.Rogue) || target.Is(CustomRoles.Contagious) || target.Is(CustomRoles.Charmed) || target.Is(CustomRoles.Recruit) || target.Is(CustomRoles.Infected) || target.Is(CustomRoles.Egoist) || target.Is(CustomRoles.Soulless) || !target.Is(CustomRoles.Admired) || !target.Is(CustomRoles.Parasite) || !target.Is(CustomRoles.Refugee) || !target.Is(CustomRoles.Crewpostor) || !target.Is(CustomRoles.Convict))
+ sb.Append(Utils.ColorString(Utils.GetRoleColor(CustomRoles.Executioner), "★"));
- }
- if (seer.KnowLivingTeam(target))
- {
- if (target.Is(CustomRoleTypes.Crewmate) && !(target.Is(CustomRoles.Madmate) || target.Is(CustomRoles.Egoist) || target.Is(CustomRoles.Charmed) || target.Is(CustomRoles.Recruit) || target.Is(CustomRoles.Infected) || target.Is(CustomRoles.Contagious) || target.Is(CustomRoles.Rogue) || target.Is(CustomRoles.Rascal) || target.Is(CustomRoles.Admired)))
- sb.Append(Utils.ColorString(Utils.GetRoleColor(CustomRoles.Bait), "★"));
+ }
+ if (seer.KnowLivingTeam(target))
+ {
+ if (target.Is(CustomRoleTypes.Crewmate) && !(target.Is(CustomRoles.Madmate) || target.Is(CustomRoles.Egoist) || target.Is(CustomRoles.Charmed) || target.Is(CustomRoles.Recruit) || target.Is(CustomRoles.Infected) || target.Is(CustomRoles.Contagious) || target.Is(CustomRoles.Rogue) || target.Is(CustomRoles.Rascal) || target.Is(CustomRoles.Admired)))
+ sb.Append(Utils.ColorString(Utils.GetRoleColor(CustomRoles.Bait), "★"));
- if (target.Is(CustomRoleTypes.Impostor) || target.Is(CustomRoles.Madmate) || target.Is(CustomRoles.Rascal) || target.Is(CustomRoles.Parasite) || target.Is(CustomRoles.Refugee) || target.Is(CustomRoles.Crewpostor) || target.Is(CustomRoles.Convict) || !target.Is(CustomRoles.Admired))
- sb.Append(Utils.ColorString(Utils.GetRoleColor(CustomRoles.Impostor), "★"));
+ if (target.Is(CustomRoleTypes.Impostor) || target.Is(CustomRoles.Madmate) || target.Is(CustomRoles.Rascal) || target.Is(CustomRoles.Parasite) || target.Is(CustomRoles.Refugee) || target.Is(CustomRoles.Crewpostor) || target.Is(CustomRoles.Convict) || !target.Is(CustomRoles.Admired))
+ sb.Append(Utils.ColorString(Utils.GetRoleColor(CustomRoles.Impostor), "★"));
- if (target.Is(CustomRoleTypes.Neutral) || target.Is(CustomRoles.Rogue) || target.Is(CustomRoles.Contagious) || target.Is(CustomRoles.Charmed) || target.Is(CustomRoles.Recruit) || target.Is(CustomRoles.Infected) || target.Is(CustomRoles.Egoist) || target.Is(CustomRoles.Soulless) || !target.Is(CustomRoles.Admired) || !target.Is(CustomRoles.Parasite) || !target.Is(CustomRoles.Refugee) || !target.Is(CustomRoles.Crewpostor) || !target.Is(CustomRoles.Convict))
- sb.Append(Utils.ColorString(Utils.GetRoleColor(CustomRoles.Executioner), "★"));
+ if (target.Is(CustomRoleTypes.Neutral) || target.Is(CustomRoles.Rogue) || target.Is(CustomRoles.Contagious) || target.Is(CustomRoles.Charmed) || target.Is(CustomRoles.Recruit) || target.Is(CustomRoles.Infected) || target.Is(CustomRoles.Egoist) || target.Is(CustomRoles.Soulless) || !target.Is(CustomRoles.Admired) || !target.Is(CustomRoles.Parasite) || !target.Is(CustomRoles.Refugee) || !target.Is(CustomRoles.Crewpostor) || !target.Is(CustomRoles.Convict))
+ sb.Append(Utils.ColorString(Utils.GetRoleColor(CustomRoles.Executioner), "★"));
- } */
+ } */
//インポスター表示
switch (seer.GetCustomRole().GetCustomRoleTypes())
{
@@ -891,10 +891,10 @@ class MeetingHudStartPatch
sb.Append(Executioner.TargetMark(seer, target));
break;
case CustomRoles.Lawyer:
- // sb.Append(Lawyer.TargetMark(seer, target));
+ // sb.Append(Lawyer.TargetMark(seer, target));
break;
- // case CustomRoles.Jackal:
- // case CustomRoles.Sidekick:
+ // case CustomRoles.Jackal:
+ // case CustomRoles.Sidekick:
case CustomRoles.Poisoner:
case CustomRoles.NSerialKiller:
case CustomRoles.RuthlessRomantic:
@@ -913,14 +913,14 @@ class MeetingHudStartPatch
break;
case CustomRoles.Jackal:
case CustomRoles.Sidekick:
- // if (target.Is(CustomRoles.Sidekick))
- // sb.Append(Utils.ColorString(Utils.GetRoleColor(CustomRoles.Jackal), " ♥")); //変更対象にSnitchマークをつける
+ // if (target.Is(CustomRoles.Sidekick))
+ // sb.Append(Utils.ColorString(Utils.GetRoleColor(CustomRoles.Jackal), " ♥")); //変更対象にSnitchマークをつける
sb.Append(Snitch.GetWarningMark(seer, target));
break;
- /* case CustomRoles.Monarch:
- if (target.Is(CustomRoles.Knighted))
- sb.Append(Utils.ColorString(Utils.GetRoleColor(CustomRoles.Knighted), " 亗")); //変更対象にSnitchマークをつける
- break; */
+ /* case CustomRoles.Monarch:
+ if (target.Is(CustomRoles.Knighted))
+ sb.Append(Utils.ColorString(Utils.GetRoleColor(CustomRoles.Knighted), " 亗")); //変更対象にSnitchマークをつける
+ break; */
case CustomRoles.EvilTracker:
sb.Append(EvilTracker.GetTargetMark(seer, target));
break;
@@ -945,11 +945,18 @@ class MeetingHudStartPatch
if (!seer.Data.IsDead && !target.Data.IsDead)
pva.NameText.text = Utils.ColorString(Utils.GetRoleColor(seer.Is(CustomRoles.NiceGuesser) ? CustomRoles.NiceGuesser : CustomRoles.EvilGuesser), target.PlayerId.ToString()) + " " + pva.NameText.text;
break;
- // case CustomRoles.Guesser:
+ case CustomRoles.Guesser:
+ if (!seer.Data.IsDead && !target.Data.IsDead)
+ pva.NameText.text = Utils.ColorString(Utils.GetRoleColor(CustomRoles.Guesser), target.PlayerId.ToString()) + " " + pva.NameText.text;
+ break;
case CustomRoles.Judge:
if (!seer.Data.IsDead && !target.Data.IsDead)
pva.NameText.text = Utils.ColorString(Utils.GetRoleColor(CustomRoles.Judge), target.PlayerId.ToString()) + " " + pva.NameText.text;
break;
+ case CustomRoles.Lookout:
+ if (!seer.Data.IsDead && !target.Data.IsDead)
+ pva.NameText.text = Utils.ColorString(Utils.GetRoleColor(CustomRoles.Lookout), target.PlayerId.ToString()) + " " + pva.NameText.text;
+ break;
case CustomRoles.Doomsayer:
if (!seer.Data.IsDead && !target.Data.IsDead)
pva.NameText.text = Utils.ColorString(Utils.GetRoleColor(CustomRoles.Doomsayer), target.PlayerId.ToString()) + " " + pva.NameText.text;
@@ -958,7 +965,7 @@ class MeetingHudStartPatch
if (!seer.Data.IsDead && !target.Data.IsDead)
pva.NameText.text = Utils.ColorString(Utils.GetRoleColor(CustomRoles.ParityCop), target.PlayerId.ToString()) + " " + pva.NameText.text;
break;
-
+
case CustomRoles.Councillor:
if (!seer.Data.IsDead && !target.Data.IsDead)
pva.NameText.text = Utils.ColorString(Utils.GetRoleColor(CustomRoles.Councillor), target.PlayerId.ToString()) + " " + pva.NameText.text;
@@ -974,6 +981,17 @@ class MeetingHudStartPatch
break;
}
+ foreach (var SeerSubRole in seer.GetCustomSubRoles())
+ {
+ switch (SeerSubRole)
+ {
+ case CustomRoles.Guesser:
+ if (!seer.Data.IsDead && !target.Data.IsDead)
+ pva.NameText.text = Utils.ColorString(Utils.GetRoleColor(CustomRoles.Guesser), target.PlayerId.ToString()) + " " + pva.NameText.text;
+ break;
+ }
+ }
+
bool isLover = false;
foreach (var subRole in target.GetCustomSubRoles())
{
@@ -986,18 +1004,18 @@ class MeetingHudStartPatch
isLover = true;
}
break;
- /* case CustomRoles.Sidekick:
- if (seer.Is(CustomRoles.Sidekick) && target.Is(CustomRoles.Sidekick) && Options.SidekickKnowOtherSidekick.GetBool())
- {
- sb.Append(Utils.ColorString(Utils.GetRoleColor(CustomRoles.Jackal), " ♥")); //変更対象にSnitchマークをつける
- sb.Append(Snitch.GetWarningMark(seer, target));
- }
- break; */
- // case CustomRoles.Guesser:
- // if (!seer.Data.IsDead && !target.Data.IsDead)
- // pva.NameText.text = Utils.ColorString(Utils.GetRoleColor(seer.GetCustomRole()), target.PlayerId.ToString()) + " " + pva.NameText.text;
+ /* case CustomRoles.Sidekick:
+ if (seer.Is(CustomRoles.Sidekick) && target.Is(CustomRoles.Sidekick) && Options.SidekickKnowOtherSidekick.GetBool())
+ {
+ sb.Append(Utils.ColorString(Utils.GetRoleColor(CustomRoles.Jackal), " ♥")); //変更対象にSnitchマークをつける
+ sb.Append(Snitch.GetWarningMark(seer, target));
+ }
+ break; */
+ // case CustomRoles.Guesser:
+ // if (!seer.Data.IsDead && !target.Data.IsDead)
+ // pva.NameText.text = Utils.ColorString(Utils.GetRoleColor(seer.GetCustomRole()), target.PlayerId.ToString()) + " " + pva.NameText.text;
- // break;
+ // break;
}
}
diff --git a/Patches/OutroPatch.cs b/Patches/OutroPatch.cs
index f5a0a5c20..6c667e0b6 100644
--- a/Patches/OutroPatch.cs
+++ b/Patches/OutroPatch.cs
@@ -121,7 +121,7 @@ class SetEverythingUpPatch
{
CustomWinnerText = GetWinnerRoleName(winnerRole);
CustomWinnerColor = Utils.GetRoleColorCode(winnerRole);
- // __instance.WinText.color = Utils.GetRoleColor(winnerRole);
+ // __instance.WinText.color = Utils.GetRoleColor(winnerRole);
__instance.BackgroundBar.material.color = Utils.GetRoleColor(winnerRole);
if (winnerRole.IsNeutral())
{
@@ -132,7 +132,7 @@ class SetEverythingUpPatch
{
__instance.WinText.text = GetString("GameOver");
__instance.WinText.color = Utils.GetRoleColor(CustomRoles.GM);
- __instance.BackgroundBar.material.color = Utils.GetRoleColor(winnerRole);
+ __instance.BackgroundBar.material.color = Utils.GetRoleColor(winnerRole);
}
switch (CustomWinnerHolder.WinnerTeam)
{
diff --git a/Patches/PlayerContorolPatch.cs b/Patches/PlayerContorolPatch.cs
index 805471364..017c30b42 100644
--- a/Patches/PlayerContorolPatch.cs
+++ b/Patches/PlayerContorolPatch.cs
@@ -1,12 +1,12 @@
+using AmongUs.GameOptions;
+using HarmonyLib;
+using Hazel;
+using InnerNet;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
-using AmongUs.GameOptions;
-using HarmonyLib;
-using Hazel;
-using InnerNet;
using TOHE.Modules;
using TOHE.Roles.AddOns.Crewmate;
using TOHE.Roles.Crewmate;
@@ -167,6 +167,7 @@ class CheckMurderPatch
if (Counterfeiter.OnClientMurder(killer)) return false;
if (Pursuer.OnClientMurder(killer)) return false;
if (Addict.IsImmortal(target)) return false;
+ if (Alchemist.IsProtected) return false;
//判定凶手技能
if (killer.PlayerId != target.PlayerId)
@@ -209,13 +210,17 @@ class CheckMurderPatch
if (Main.isCurseAndKill[killer.PlayerId]) killer.RpcGuardAndKill(target);
return false;
case CustomRoles.Witness:
- if (Main.AllKillers.TryGetValue(target.PlayerId, out var killerId) && target.PlayerId == killerId)
+ killer.SetKillCooldown();
+ if (Main.AllKillers.ContainsKey(target.PlayerId))
killer.Notify(GetString("WitnessFoundKiller"));
else killer.Notify(GetString("WitnessFoundInnocent"));
return false;
case CustomRoles.Assassin:
if (!Assassin.OnCheckMurder(killer, target)) return false;
break;
+ case CustomRoles.Undertaker:
+ if (!Undertaker.OnCheckMurder(killer, target)) return false;
+ break;
case CustomRoles.Famine:
Baker.FamineKilledTasks(target.PlayerId);
break;
@@ -240,18 +245,20 @@ class CheckMurderPatch
Utils.NotifyRoles(SpecifySeer: killer);
return false;
case CustomRoles.Capitalism:
- if (!Main.CapitalismAddTask.ContainsKey(target.PlayerId))
- Main.CapitalismAddTask.Add(target.PlayerId, 0);
- Main.CapitalismAddTask[target.PlayerId]++;
- if (!Main.CapitalismAssignTask.ContainsKey(target.PlayerId))
- Main.CapitalismAssignTask.Add(target.PlayerId, 0);
- Main.CapitalismAssignTask[target.PlayerId]++;
- Logger.Info($"资本主义 {killer.GetRealName()} 又开始祸害人了:{target.GetRealName()}", "Capitalism Add Task");
- //killer.RpcGuardAndKill(killer);
- killer.SetKillCooldown();
- return false;
- /* case CustomRoles.Bomber:
- return false; */
+ return killer.CheckDoubleTrigger(target, () =>
+ {
+ if (!Main.CapitalismAddTask.ContainsKey(target.PlayerId))
+ Main.CapitalismAddTask.Add(target.PlayerId, 0);
+ Main.CapitalismAddTask[target.PlayerId]++;
+ if (!Main.CapitalismAssignTask.ContainsKey(target.PlayerId))
+ Main.CapitalismAssignTask.Add(target.PlayerId, 0);
+ Main.CapitalismAssignTask[target.PlayerId]++;
+ Logger.Info($"资本主义 {killer.GetRealName()} 又开始祸害人了:{target.GetRealName()}", "Capitalism Add Task");
+ //killer.RpcGuardAndKill(killer);
+ killer.SetKillCooldown(Options.CapitalismSkillCooldown.GetFloat());
+ });
+ /* case CustomRoles.Bomber:
+ return false; */
case CustomRoles.Gangster:
if (Gangster.OnCheckMurder(killer, target))
return false;
@@ -405,7 +412,7 @@ class CheckMurderPatch
if (!Sheriff.OnCheckMurder(killer, target))
return false;
break;
- case CustomRoles.CopyCat:
+ case CustomRoles.CopyCat:
if (!CopyCat.OnCheckMurder(killer, target))
return false;
break;
@@ -440,7 +447,7 @@ class CheckMurderPatch
// Consigliere
if (killer.Is(CustomRoles.EvilDiviner))
{
-
+
if (!EvilDiviner.OnCheckMurder(killer, target))
return false;
}
@@ -460,24 +467,25 @@ class CheckMurderPatch
{
target.RpcMurderPlayerV3(target);
//killer.RpcGuardAndKill(killer);
- // target.RpcGuardAndKill(target);
+ // target.RpcGuardAndKill(target);
target.SetRealKiller(killer);
killer.SetKillCooldown();
RPC.PlaySoundRPC(killer.PlayerId, Sounds.KillSound);
- return false;
- }
- if (killer.Is(CustomRoles.Mare) && !Utils.IsActive(SystemTypes.Electrical))
- {
return false;
}
- /* if (killer.Is(CustomRoles.Minimalism))
+ if (killer.Is(CustomRoles.Mare))
{
+ killer.ResetKillCooldown();
return true;
- } */
+ }
+ /* if (killer.Is(CustomRoles.Minimalism))
+ {
+ return true;
+ } */
if (killer.Is(CustomRoles.Ritualist))
{
-
+
if (!Ritualist.OnCheckMurder(killer, target))
return false;
}
@@ -487,14 +495,14 @@ class CheckMurderPatch
{
if (!target.Is(CustomRoles.Pestilence))
{
- Utils.TP(target.NetTransform, Pelican.GetBlackRoomPS());
- target.SetRealKiller(killer);
- Main.PlayerStates[target.PlayerId].SetDead();
- target.RpcMurderPlayerV3(target);
- killer.SetKillCooldown();
- RPC.PlaySoundRPC(killer.PlayerId, Sounds.KillSound);
- NameNotifyManager.Notify(target, Utils.ColorString(Utils.GetRoleColor(CustomRoles.Scavenger), GetString("KilledByScavenger")));
- return false;
+ Utils.TP(target.NetTransform, Pelican.GetBlackRoomPS());
+ target.SetRealKiller(killer);
+ Main.PlayerStates[target.PlayerId].SetDead();
+ target.RpcMurderPlayerV3(target);
+ killer.SetKillCooldown();
+ RPC.PlaySoundRPC(killer.PlayerId, Sounds.KillSound);
+ NameNotifyManager.Notify(target, Utils.ColorString(Utils.GetRoleColor(CustomRoles.Scavenger), GetString("KilledByScavenger")));
+ return false;
}
if (target.Is(CustomRoles.Pestilence))
{
@@ -582,7 +590,7 @@ class CheckMurderPatch
if (Options.OppoImmuneToAttacksWhenTasksDone.GetBool())
{
if (target.Is(CustomRoles.Opportunist) && target.AllTasksCompleted())
- return false;
+ return false;
}
// Monarch immune to kills when a living player is knighted
@@ -649,14 +657,14 @@ class CheckMurderPatch
return false;
}
}
- // if (target.Is(CustomRoles.Diseased))
- // {
-
- //// killer.RpcGuardAndKill(killer);
- // // killer.SetKillCooldownV3(Main.AllPlayerKillCooldown[killer.PlayerId] *= Options.DiseasedMultiplier.GetFloat());
- // // killer.ResetKillCooldown();
- // // killer.SyncSettings();
- // }
+ // if (target.Is(CustomRoles.Diseased))
+ // {
+
+ //// killer.RpcGuardAndKill(killer);
+ // // killer.SetKillCooldownV3(Main.AllPlayerKillCooldown[killer.PlayerId] *= Options.DiseasedMultiplier.GetFloat());
+ // // killer.ResetKillCooldown();
+ // // killer.SyncSettings();
+ // }
if (Main.ForCrusade.Contains(target.PlayerId))
{
foreach (var player in Main.AllPlayerControls)
@@ -728,17 +736,17 @@ class CheckMurderPatch
{
if (!killer.Is(CustomRoles.Pestilence))
{
- killer.SetRealKiller(target);
- target.RpcMurderPlayerV3(killer);
- Logger.Info($"{target.GetRealName()} 老兵反弹击杀:{killer.GetRealName()}", "Veteran Kill");
- return false;
+ killer.SetRealKiller(target);
+ target.RpcMurderPlayerV3(killer);
+ Logger.Info($"{target.GetRealName()} 老兵反弹击杀:{killer.GetRealName()}", "Veteran Kill");
+ return false;
}
if (killer.Is(CustomRoles.Pestilence))
{
- target.SetRealKiller(killer);
- killer.RpcMurderPlayerV3(target);
- Logger.Info($"{target.GetRealName()} 老兵反弹击杀:{target.GetRealName()}", "Pestilence Reflect");
- return false;
+ target.SetRealKiller(killer);
+ killer.RpcMurderPlayerV3(target);
+ Logger.Info($"{target.GetRealName()} 老兵反弹击杀:{target.GetRealName()}", "Pestilence Reflect");
+ return false;
}
}
break;
@@ -749,44 +757,44 @@ class CheckMurderPatch
foreach (var player in Main.AllPlayerControls)
{
if (!killer.Is(CustomRoles.Pestilence))
- {
- if (Main.TimeMasterBackTrack.ContainsKey(player.PlayerId))
{
- var position = Main.TimeMasterBackTrack[player.PlayerId];
- Utils.TP(player.NetTransform, position);
+ if (Main.TimeMasterBackTrack.ContainsKey(player.PlayerId))
+ {
+ var position = Main.TimeMasterBackTrack[player.PlayerId];
+ Utils.TP(player.NetTransform, position);
+ }
}
}
- }
killer.SetKillCooldown(target: target, forceAnime: true);
return false;
}
break;
case CustomRoles.Masochist:
-
- killer.SetKillCooldown(target: target, forceAnime: true);
- Main.MasochistKillMax[target.PlayerId]++;
- // killer.RPCPlayCustomSound("DM");
+
+ killer.SetKillCooldown(target: target, forceAnime: true);
+ Main.MasochistKillMax[target.PlayerId]++;
+ // killer.RPCPlayCustomSound("DM");
target.Notify(string.Format(GetString("MasochistKill"), Main.MasochistKillMax[target.PlayerId]));
- if (Main.MasochistKillMax[target.PlayerId] >= Options.MasochistKillMax.GetInt())
- {
- CustomWinnerHolder.ResetAndSetWinner(CustomWinner.Masochist);
- CustomWinnerHolder.WinnerIds.Add(target.PlayerId);
- }
+ if (Main.MasochistKillMax[target.PlayerId] >= Options.MasochistKillMax.GetInt())
+ {
+ CustomWinnerHolder.ResetAndSetWinner(CustomWinner.Masochist);
+ CustomWinnerHolder.WinnerIds.Add(target.PlayerId);
+ }
return false;
case CustomRoles.Glitch:
- if (killer.Is(CustomRoles.Pestilence)) break;
- killer.SetRealKiller(target);
- target.RpcMurderPlayerV3(killer);
- Logger.Info($"{target.GetRealName()} 老兵反弹击杀:{killer.GetRealName()}", "Glitch Kill");
- Main.PlayerStates[killer.PlayerId].deathReason = PlayerState.DeathReason.Hack;
- return false;
+ if (killer.Is(CustomRoles.Pestilence)) break;
+ killer.SetRealKiller(target);
+ target.RpcMurderPlayerV3(killer);
+ Logger.Info($"{target.GetRealName()} 老兵反弹击杀:{killer.GetRealName()}", "Glitch Kill");
+ Main.PlayerStates[killer.PlayerId].deathReason = PlayerState.DeathReason.Hack;
+ return false;
//检查明星附近是否有人
case CustomRoles.SuperStar:
if (Main.AllAlivePlayerControls.Where(x =>
x.PlayerId != killer.PlayerId &&
x.PlayerId != target.PlayerId &&
Vector2.Distance(x.GetTruePosition(), target.GetTruePosition()) < 2f
- ).ToList().Count >= 1) return false;
+ ).ToList().Any()) return false;
break;
//玩家被击杀事件
case CustomRoles.Gamer:
@@ -951,8 +959,8 @@ class MurderPlayerPatch
//if ((Romantic.BetPlayer.TryGetValue(target.PlayerId, out var RomanticPartner) && target.PlayerId == RomanticPartner) && target.PlayerId != killer.PlayerId)
// VengefulRomantic.PartnerKiller.Add(killer.PlayerId, 1);
- Main.AllKillers.Add(killer.PlayerId, 1);
- new LateTask(() => { Main.AllKillers.Remove(killer.PlayerId); }, Options.WitnessTime.GetInt());
+ Main.AllKillers.Remove(killer.PlayerId);
+ Main.AllKillers.Add(killer.PlayerId, Utils.GetTimeStamp());
switch (target.GetCustomRole())
{
@@ -991,11 +999,35 @@ class MurderPlayerPatch
case CustomRoles.Hacker:
Hacker.HackLimit[killer.PlayerId] += Hacker.HackerAbilityUseGainWithEachKill.GetFloat();
break;
+ case CustomRoles.Camouflager:
+ Camouflager.CamoLimit[killer.PlayerId] += Camouflager.CamoAbilityUseGainWithEachKill.GetFloat();
+ break;
+ case CustomRoles.Councillor:
+ Councillor.MurderLimit[killer.PlayerId] += Councillor.CouncillorAbilityUseGainWithEachKill.GetFloat();
+ break;
+ case CustomRoles.Dazzler:
+ Dazzler.DazzleLimit[killer.PlayerId] += Dazzler.DazzlerAbilityUseGainWithEachKill.GetFloat();
+ break;
+ case CustomRoles.Disperser:
+ Disperser.DisperserLimit[killer.PlayerId] += Disperser.DisperserAbilityUseGainWithEachKill.GetFloat();
+ break;
+ case CustomRoles.EvilDiviner:
+ EvilDiviner.DivinationCount[killer.PlayerId] += EvilDiviner.EDAbilityUseGainWithEachKill.GetFloat();
+ break;
+ case CustomRoles.Swooper:
+ Swooper.SwoopLimit[killer.PlayerId] += Swooper.SwooperAbilityUseGainWithEachKill.GetFloat();
+ break;
+ case CustomRoles.Hangman:
+ Hangman.HangLimit[killer.PlayerId] += Hangman.HangmanAbilityUseGainWithEachKill.GetFloat();
+ break;
+ case CustomRoles.Twister:
+ Twister.TwistLimit[killer.PlayerId] += Twister.TwisterAbilityUseGainWithEachKill.GetFloat();
+ break;
}
if (killer.Is(CustomRoles.TicketsStealer) && killer.PlayerId != target.PlayerId)
killer.Notify(string.Format(GetString("TicketsStealerGetTicket"), ((Main.AllPlayerControls.Count(x => x.GetRealKiller()?.PlayerId == killer.PlayerId) + 1) * Options.TicketsPerKill.GetFloat()).ToString("0.0#####")));
-
+
if (killer.Is(CustomRoles.Pickpocket) && killer.PlayerId != target.PlayerId)
killer.Notify(string.Format(GetString("PickpocketGetVote"), ((Main.AllPlayerControls.Count(x => x.GetRealKiller()?.PlayerId == killer.PlayerId) + 1) * Pickpocket.VotesPerKill.GetFloat()).ToString("0.0#####")));
@@ -1005,9 +1037,9 @@ class MurderPlayerPatch
var rp = pcList[IRandom.Instance.Next(0, pcList.Count)];
if (!rp.Is(CustomRoles.Pestilence))
{
- Main.PlayerStates[rp.PlayerId].deathReason = PlayerState.DeathReason.Revenge;
- rp.SetRealKiller(target);
- rp.RpcMurderPlayerV3(rp);
+ Main.PlayerStates[rp.PlayerId].deathReason = PlayerState.DeathReason.Revenge;
+ rp.SetRealKiller(target);
+ rp.RpcMurderPlayerV3(rp);
}
}
@@ -1103,7 +1135,7 @@ class ShapeshiftPatch
cpdistance.Add(p, dis);
Logger.Info($"{p?.Data?.PlayerName}の位置{dis}", "Warlock");
}
- if (cpdistance.Count >= 1)
+ if (cpdistance.Any())
{
var min = cpdistance.OrderBy(c => c.Value).FirstOrDefault();//一番小さい値を取り出す
PlayerControl targetw = min.Key;
@@ -1179,7 +1211,7 @@ class ShapeshiftPatch
//自分が最後の生き残りの場合は勝利のために死なない
if (Options.BomberDiesInExplosion.GetBool())
{
- if (totalAlive > 0 && !GameStates.IsEnded)
+ if (totalAlive > 0 && !GameStates.IsEnded)
{
Main.PlayerStates[shapeshifter.PlayerId].deathReason = PlayerState.DeathReason.Bombed;
shapeshifter.RpcMurderPlayerV3(shapeshifter);
@@ -1213,9 +1245,9 @@ class ShapeshiftPatch
{
var totalAlive = Main.AllAlivePlayerControls.Count();
//自分が最後の生き残りの場合は勝利のために死なない
- // if (Options.BomberDiesInExplosion.GetBool())
+ // if (Options.BomberDiesInExplosion.GetBool())
{
- if (totalAlive > 0 && !GameStates.IsEnded)
+ if (totalAlive > 0 && !GameStates.IsEnded)
{
Main.PlayerStates[shapeshifter.PlayerId].deathReason = PlayerState.DeathReason.Bombed;
shapeshifter.RpcMurderPlayerV3(shapeshifter);
@@ -1228,6 +1260,9 @@ class ShapeshiftPatch
case CustomRoles.Assassin:
Assassin.OnShapeshift(shapeshifter, shapeshifting);
break;
+ case CustomRoles.Undertaker:
+ Undertaker.OnShapeshift(shapeshifter, shapeshifting);
+ break;
case CustomRoles.ImperiusCurse:
if (shapeshifting)
{
@@ -1247,10 +1282,13 @@ class ShapeshiftPatch
break;
case CustomRoles.Camouflager:
if (shapeshifting)
- Camouflager.OnShapeshift();
+ Camouflager.OnShapeshift(shapeshifter, shapeshifting);
if (!shapeshifting)
Camouflager.OnReportDeadBody();
break;
+ case CustomRoles.Hangman:
+ if (Hangman.HangLimit[shapeshifter.PlayerId] < 1 && shapeshifting) shapeshifter.SetKillCooldown(Hangman.ShapeshiftDuration.GetFloat() + 1f);
+ break;
case CustomRoles.Hacker:
Hacker.OnShapeshift(shapeshifter, shapeshifting, target);
break;
@@ -1263,15 +1301,15 @@ class ShapeshiftPatch
Dazzler.OnShapeshift(shapeshifter, target);
break;
case CustomRoles.Deathpact:
- if (shapeshifting)
+ if (shapeshifting)
Deathpact.OnShapeshift(shapeshifter, target);
break;
case CustomRoles.Devourer:
- if (shapeshifting)
+ if (shapeshifting)
Devourer.OnShapeshift(shapeshifter, target);
break;
case CustomRoles.Twister:
- Twister.TwistPlayers(shapeshifter);
+ Twister.TwistPlayers(shapeshifter, shapeshifting);
break;
}
@@ -1328,7 +1366,7 @@ class ReportDeadBodyPatch
var killerRole = killer?.GetCustomRole();
//杀戮机器无法报告或拍灯
- // if (__instance.Is(CustomRoles.Minimalism)) return false;
+ // if (__instance.Is(CustomRoles.Minimalism)) return false;
//禁止小黑人报告
if (((Utils.IsActive(SystemTypes.Comms) && Options.CommsCamouflage.GetBool()) || Camouflager.IsActive) && Options.DisableReportWhenCC.GetBool()) return false;
@@ -1350,7 +1388,7 @@ class ReportDeadBodyPatch
{
__instance.Notify(GetString("BloodhoundNoTrack"));
}
-
+
return false;
}
if (Vulture.UnreportablePlayers.Contains(target.PlayerId)) return false;
@@ -1369,8 +1407,8 @@ class ReportDeadBodyPatch
{
new LateTask(() =>
{
- if (GameStates.IsInTask)
- {
+ if (GameStates.IsInTask)
+ {
//__instance.RpcGuardAndKill(__instance);
__instance.Notify(GetString("VultureCooldownUp"));
}
@@ -1386,22 +1424,24 @@ class ReportDeadBodyPatch
// 清洁工来扫大街咯
if (__instance.Is(CustomRoles.Cleaner))
{
+ if (__instance.killTimer > 0) return true;
Main.CleanerBodies.Remove(target.PlayerId);
Main.CleanerBodies.Add(target.PlayerId);
//__instance.RpcGuardAndKill(__instance);
__instance.Notify(GetString("CleanerCleanBody"));
- // __instance.ResetKillCooldown();
+ // __instance.ResetKillCooldown();
__instance.SetKillCooldown(Options.KillCooldownAfterCleaning.GetFloat());
Logger.Info($"{__instance.GetRealName()} 清理了 {target.PlayerName} 的尸体", "Cleaner");
return false;
}
if (__instance.Is(CustomRoles.Medusa))
{
+ if (__instance.killTimer > 0) return true;
Main.MedusaBodies.Remove(target.PlayerId);
Main.MedusaBodies.Add(target.PlayerId);
__instance.RpcGuardAndKill(__instance);
__instance.Notify(GetString("MedusaStoneBody"));
- // __instance.ResetKillCooldown();
+ // __instance.ResetKillCooldown();
__instance.SetKillCooldown(Medusa.KillCooldownAfterStoneGazing.GetFloat());
Logger.Info($"{__instance.GetRealName()} stoned {target.PlayerName} body", "Medusa");
return false;
@@ -1425,7 +1465,7 @@ class ReportDeadBodyPatch
if (!tpc.Is(CustomRoles.Bait) || (tpc.Is(CustomRoles.Bait) && Options.ObliviousBaitImmune.GetBool())) /* && (target?.Object != null)*/
{
return false;
- }
+ }
}
if (__instance.Is(CustomRoles.Unlucky) && (target?.Object == null || !target.Object.Is(CustomRoles.Bait)))
@@ -1465,7 +1505,7 @@ class ReportDeadBodyPatch
__instance.RpcMurderPlayerV3(__instance);
RPC.PlaySoundRPC(killerID2, Sounds.KillSound);
return false;
- }
+ }
}
if (target.Object.Is(CustomRoles.Unreportable)) return false;
@@ -1563,7 +1603,7 @@ class ReportDeadBodyPatch
NiceEraser.OnReportDeadBody();
Hacker.OnReportDeadBody();
Judge.OnReportDeadBody();
- // Councillor.OnReportDeadBody();
+ // Councillor.OnReportDeadBody();
Greedier.OnReportDeadBody();
Tracker.OnReportDeadBody();
Addict.OnReportDeadBody();
@@ -1577,7 +1617,7 @@ class ReportDeadBodyPatch
Tracefinder.OnReportDeadBody(player, target);
Mediumshiper.OnReportDeadBody(target);
Spiritualist.OnReportDeadBody(target);
-
+
foreach (var x in Main.RevolutionistStart)
{
var tar = Utils.GetPlayerById(x.Key);
@@ -1648,7 +1688,7 @@ class FixedUpdatePatch
if (GameStates.IsLobby && ((ModUpdater.hasUpdate && ModUpdater.forceUpdate) || ModUpdater.isBroken || !Main.AllowPublicRoom) && AmongUsClient.Instance.IsGamePublic)
AmongUsClient.Instance.ChangeGamePublic(false);
- if (GameStates.IsInTask && ReportDeadBodyPatch.CanReport[__instance.PlayerId] && ReportDeadBodyPatch.WaitReport[__instance.PlayerId].Count > 0)
+ if (GameStates.IsInTask && ReportDeadBodyPatch.CanReport[__instance.PlayerId] && ReportDeadBodyPatch.WaitReport[__instance.PlayerId].Any())
{
var info = ReportDeadBodyPatch.WaitReport[__instance.PlayerId][0];
ReportDeadBodyPatch.WaitReport[__instance.PlayerId].Clear();
@@ -1922,13 +1962,15 @@ class FixedUpdatePatch
CustomWinnerHolder.ResetAndSetWinner(CustomWinner.Vulture);
CustomWinnerHolder.WinnerIds.Add(player.PlayerId);
}
-
+
+ if (Main.AllKillers.TryGetValue(player.PlayerId, out var ktime) && ktime + Options.WitnessTime.GetInt() < Utils.GetTimeStamp()) Main.AllKillers.Remove(player.PlayerId);
Pelican.OnFixedUpdate();
BallLightning.OnFixedUpdate();
Swooper.OnFixedUpdate(player);
Wraith.OnFixedUpdate(player);
Chameleon.OnFixedUpdate(player);
+ Alchemist.OnFixedUpdate(player);
BloodKnight.OnFixedUpdate(player);
Spiritcaller.OnFixedUpdate(player);
@@ -1958,7 +2000,7 @@ class FixedUpdatePatch
}
}
}
- if (targetDistance.Count() != 0)
+ if (targetDistance.Count != 0)
{
var min = targetDistance.OrderBy(c => c.Value).FirstOrDefault();//一番値が小さい
PlayerControl target = Utils.GetPlayerById(min.Key);
@@ -1992,7 +2034,7 @@ class FixedUpdatePatch
float dis;
foreach (var target in Main.AllAlivePlayerControls)
{
-
+
{
if (target.PlayerId != player.PlayerId && !target.Is(CustomRoles.NWitch) && !target.Is(CustomRoles.Glitch) && !target.Is(CustomRoles.Pestilence))
{
@@ -2001,7 +2043,7 @@ class FixedUpdatePatch
}
}
}
- if (targetDistance.Count() != 0)
+ if (targetDistance.Count != 0)
{
var min = targetDistance.OrderBy(c => c.Value).FirstOrDefault();//一番値が小さい
PlayerControl target = Utils.GetPlayerById(min.Key);
@@ -2032,7 +2074,7 @@ class FixedUpdatePatch
if (GameStates.IsInGame && Main.RefixCooldownDelay <= 0)
foreach (var pc in Main.AllPlayerControls)
{
- if (pc.Is(CustomRoles.Vampire) || pc.Is(CustomRoles.Warlock) || pc.Is(CustomRoles.Assassin))
+ if (pc.Is(CustomRoles.Vampire) || pc.Is(CustomRoles.Warlock) || pc.Is(CustomRoles.Assassin) || pc.Is(CustomRoles.Undertaker))
Main.AllPlayerKillCooldown[pc.PlayerId] = Options.DefaultKillCooldown * 2;
if (pc.Is(CustomRoles.Poisoner))
Main.AllPlayerKillCooldown[pc.PlayerId] = Options.DefaultKillCooldown * 2;
@@ -2130,7 +2172,7 @@ class FixedUpdatePatch
else if (Main.GodMode.Value) RoleText.enabled = true;
else RoleText.enabled = false; //そうでなければロールを非表示
if (!PlayerControl.LocalPlayer.Data.IsDead && PlayerControl.LocalPlayer.IsRevealedPlayer(__instance) && __instance.Is(CustomRoles.Trickster))
- {
+ {
RoleText.text = Farseer.RandomRole[PlayerControl.LocalPlayer.PlayerId];
RoleText.text += Farseer.GetTaskState();
}
@@ -2189,27 +2231,34 @@ class FixedUpdatePatch
if (target.Is(CustomRoles.Marshall) && target.GetPlayerTaskState().IsTaskFinished) //targetがタスクを終わらせたマッドスニッチ
Mark.Append(Utils.ColorString(Utils.GetRoleColor(CustomRoles.Marshall), "★")); //targetにマーク付与
}
- /* if (seer.Is(CustomRoles.Jackal)) //seerがインポスター
- {
- if (target.Is(CustomRoles.Sidekick)) //targetがタスクを終わらせたマッドスニッチ
- Mark.Append(Utils.ColorString(Utils.GetRoleColor(CustomRoles.Jackal), " ♥")); //targetにマーク付与
- }
- /* if (seer.Is(CustomRoles.Monarch)) //seerがインポスター
- {
- if (target.Is(CustomRoles.Knighted)) //targetがタスクを終わらせたマッドスニッチ
- Mark.Append(Utils.ColorString(Utils.GetRoleColor(CustomRoles.Knighted), " 亗")); //targetにマーク付与
- } */
+ /* if (seer.Is(CustomRoles.Jackal)) //seerがインポスター
+ {
+ if (target.Is(CustomRoles.Sidekick)) //targetがタスクを終わらせたマッドスニッチ
+ Mark.Append(Utils.ColorString(Utils.GetRoleColor(CustomRoles.Jackal), " ♥")); //targetにマーク付与
+ }
+ /* if (seer.Is(CustomRoles.Monarch)) //seerがインポスター
+ {
+ if (target.Is(CustomRoles.Knighted)) //targetがタスクを終わらせたマッドスニッチ
+ Mark.Append(Utils.ColorString(Utils.GetRoleColor(CustomRoles.Knighted), " 亗")); //targetにマーク付与
+ } */
- /* if (seer.Is(CustomRoles.Sidekick)) //seerがインポスター
- {
- if (target.Is(CustomRoles.Sidekick) && Options.SidekickKnowOtherSidekick.GetBool()) //targetがタスクを終わらせたマッドスニッチ
- Mark.Append(Utils.ColorString(Utils.GetRoleColor(CustomRoles.Jackal), " ♥")); //targetにマーク付与
- } */
+ /* if (seer.Is(CustomRoles.Sidekick)) //seerがインポスター
+ {
+ if (target.Is(CustomRoles.Sidekick) && Options.SidekickKnowOtherSidekick.GetBool()) //targetがタスクを終わらせたマッドスニッチ
+ Mark.Append(Utils.ColorString(Utils.GetRoleColor(CustomRoles.Jackal), " ♥")); //targetにマーク付与
+ } */
if (seer.GetCustomRole().IsCrewmate() && seer.Is(CustomRoles.Madmate) && Marshall.MadmateCanFindMarshall) //seerがインポスター
{
if (target.Is(CustomRoles.Marshall) && target.GetPlayerTaskState().IsTaskFinished) //targetがタスクを終わらせたマッドスニッチ
Mark.Append(Utils.ColorString(Utils.GetRoleColor(CustomRoles.Marshall), "★")); //targetにマーク付与
}
+ if (seer.Is(CustomRoles.Lookout))
+ {
+ if (seer.IsAlive() && target.IsAlive())
+ {
+ Mark.Append(Utils.ColorString(Utils.GetRoleColor(CustomRoles.Lookout), " " + target.PlayerId.ToString()) + " ");
+ }
+ }
//インポスター/キル可能なニュートラルがタスクが終わりそうなSnitchを確認できる
Mark.Append(Snitch.GetWarningMark(seer, target));
@@ -2219,7 +2268,7 @@ class FixedUpdatePatch
if (PlagueBearer.isPlagued(seer.PlayerId, target.PlayerId))
{
Mark.Append($"●");
- // PlagueBearer.SendRPC(seer, target);
+ // PlagueBearer.SendRPC(seer, target);
}
}
@@ -2264,7 +2313,7 @@ class FixedUpdatePatch
Mark.Append(Executioner.TargetMark(seer, target));
- // Mark.Append(Lawyer.TargetMark(seer, target));
+ // Mark.Append(Lawyer.TargetMark(seer, target));
Mark.Append(Gamer.TargetMark(seer, target));
@@ -2437,11 +2486,11 @@ class FixedUpdatePatch
{
if (partnerPlayer.Is(CustomRoles.Lovers))
{
- Main.PlayerStates[partnerPlayer.PlayerId].deathReason = PlayerState.DeathReason.FollowingSuicide;
- if (isExiled)
- CheckForEndVotingPatch.TryAddAfterMeetingDeathPlayers(PlayerState.DeathReason.FollowingSuicide, partnerPlayer.PlayerId);
- else
- partnerPlayer.RpcMurderPlayerV3(partnerPlayer);
+ Main.PlayerStates[partnerPlayer.PlayerId].deathReason = PlayerState.DeathReason.FollowingSuicide;
+ if (isExiled)
+ CheckForEndVotingPatch.TryAddAfterMeetingDeathPlayers(PlayerState.DeathReason.FollowingSuicide, partnerPlayer.PlayerId);
+ else
+ partnerPlayer.RpcMurderPlayerV3(partnerPlayer);
}
}
}
@@ -2492,10 +2541,10 @@ class EnterVentPatch
pc?.ReportDeadBody(null);
}
}
- /* if (pc.Is(CustomRoles.Wraith)) // THIS WAS FOR WEREWOLF TESTING PURPOSES, PLEASE IGNORE
- {
- pc?.MyPhysics?.RpcBootFromVent(__instance.Id);
- } */
+ /* if (pc.Is(CustomRoles.Wraith)) // THIS WAS FOR WEREWOLF TESTING PURPOSES, PLEASE IGNORE
+ {
+ pc?.MyPhysics?.RpcBootFromVent(__instance.Id);
+ } */
if (pc.Is(CustomRoles.Paranoia))
{
@@ -2521,8 +2570,8 @@ class EnterVentPatch
Utils.NotifyRoles(SpecifySeer: pc);
if (pc.AmOwner)
{
- // if (Main.MarioVentCount[pc.PlayerId] % 5 == 0) CustomSoundsManager.Play("MarioCoin");
- // else CustomSoundsManager.Play("MarioJump");
+ // if (Main.MarioVentCount[pc.PlayerId] % 5 == 0) CustomSoundsManager.Play("MarioCoin");
+ // else CustomSoundsManager.Play("MarioJump");
}
if (AmongUsClient.Instance.AmHost && Main.MarioVentCount[pc.PlayerId] >= Options.MarioVentNumWin.GetInt())
{
@@ -2541,6 +2590,7 @@ class EnterVentPatch
Swooper.OnEnterVent(pc, __instance);
Wraith.OnEnterVent(pc, __instance);
Addict.OnEnterVent(pc, __instance);
+ Alchemist.OnEnterVent(pc, __instance.Id);
Chameleon.OnEnterVent(pc, __instance);
Lurker.OnEnterVent(pc);
@@ -2556,8 +2606,8 @@ class EnterVentPatch
pc.Notify(GetString("VeteranOnGuard"), Options.VeteranSkillDuration.GetFloat());
pc.MarkDirtySettings();
}
- else
- {
+ else
+ {
pc.Notify(GetString("OutOfAbilityUsesDoMoreTasks"));
}
}
@@ -2623,17 +2673,17 @@ class EnterVentPatch
{
Main.DovesOfNeaceNumOfUsed[pc.PlayerId] -= 1;
//pc.RpcGuardAndKill(pc);
- Main.AllAlivePlayerControls.Where(x =>
+ Main.AllAlivePlayerControls.Where(x =>
pc.Is(CustomRoles.Madmate) ?
(x.CanUseKillButton() && x.GetCustomRole().IsCrewmate()) :
(x.CanUseKillButton())
).Do(x =>
{
- x.RPCPlayCustomSound("Dove");
- x.ResetKillCooldown();
- x.SetKillCooldown();
- if (x.Is(CustomRoles.SerialKiller))
- { SerialKiller.OnReportDeadBody(); }
+ x.RPCPlayCustomSound("Dove");
+ x.ResetKillCooldown();
+ x.SetKillCooldown();
+ if (x.Is(CustomRoles.SerialKiller))
+ { SerialKiller.OnReportDeadBody(); }
x.Notify(Utils.ColorString(Utils.GetRoleColor(CustomRoles.DovesOfNeace), GetString("DovesOfNeaceSkillNotify")));
});
pc.RPCPlayCustomSound("Dove");
@@ -2742,6 +2792,9 @@ class CoEnterVentPatch
if (__instance.myPlayer.Is(CustomRoles.Chameleon))
Chameleon.OnCoEnterVent(__instance, id);
+ if (__instance.myPlayer.Is(CustomRoles.Alchemist) && Alchemist.PotionID == 6)
+ Alchemist.OnCoEnterVent(__instance, id);
+
//if (__instance.myPlayer.Is(CustomRoles.DovesOfNeace)) __instance.myPlayer.Notify(GetString("DovesOfNeaceMaxUsage"));
//if (__instance.myPlayer.Is(CustomRoles.Veteran)) __instance.myPlayer.Notify(GetString("OutOfAbilityUsesDoMoreTasks"));
//if (__instance.myPlayer.Is(CustomRoles.Grenadier)) __instance.myPlayer.Notify(GetString("OutOfAbilityUsesDoMoreTasks"));
@@ -2784,7 +2837,7 @@ class PlayerControlCompleteTaskPatch
taskState.AllTasksCount += Main.CapitalismAddTask[player.PlayerId];
Main.CapitalismAddTask.Remove(player.PlayerId);
taskState.CompletedTasksCount++;
- GameData.Instance.RpcSetTasks(player.PlayerId, new byte[0]); //タスクを再配布
+ GameData.Instance.RpcSetTasks(player.PlayerId, Array.Empty()); //タスクを再配布
player.SyncSettings();
Utils.NotifyRoles(SpecifySeer: player);
return false;
@@ -2850,7 +2903,7 @@ class PlayerControlSetRolePatch
{
ghostRoles[seer] = RoleTypes.GuardianAngel;
}
- else if((self && targetIsKiller) || (!seerIsKiller && (target.Is(CustomRoleTypes.Impostor) || Main.ResetCamPlayerList.Contains(target.PlayerId) || (target.Is(CustomRoles.Pickpocket)) || (target.Is(CustomRoles.Medusa)) || (target.Is(CustomRoles.Amnesiac)) || (target.Is(CustomRoles.Refugee)))))
+ else if ((self && targetIsKiller) || (!seerIsKiller && (target.Is(CustomRoleTypes.Impostor) || Main.ResetCamPlayerList.Contains(target.PlayerId) || (target.Is(CustomRoles.Pickpocket)) || (target.Is(CustomRoles.Medusa)) || (target.Is(CustomRoles.Amnesiac)) || (target.Is(CustomRoles.Refugee)))))
{
ghostRoles[seer] = RoleTypes.ImpostorGhost;
}
diff --git a/Patches/PlayerJoinAndLeftPatch.cs b/Patches/PlayerJoinAndLeftPatch.cs
index ce2dcae8d..cafd56518 100644
--- a/Patches/PlayerJoinAndLeftPatch.cs
+++ b/Patches/PlayerJoinAndLeftPatch.cs
@@ -176,15 +176,15 @@ class OnPlayerLeftPatch
Logger.SendInGame(string.Format(GetString("PlayerLeftByAU-Anticheat"), data?.PlayerName));
break;
case DisconnectReasons.Error:
- Logger.SendInGame(string.Format(GetString("PlayerLeftByError"), data?.PlayerName));
- new LateTask(() =>
- {
- CustomWinnerHolder.ResetAndSetWinner(CustomWinner.Error);
- GameManager.Instance.enabled = false;
- GameManager.Instance.RpcEndGame(GameOverReason.ImpostorDisconnect, false);
- }, 3f, "Disconnect Error Auto-end");
+ Logger.SendInGame(string.Format(GetString("PlayerLeftByError"), data?.PlayerName));
+ new LateTask(() =>
+ {
+ CustomWinnerHolder.ResetAndSetWinner(CustomWinner.Error);
+ GameManager.Instance.enabled = false;
+ GameManager.Instance.RpcEndGame(GameOverReason.ImpostorDisconnect, false);
+ }, 3f, "Disconnect Error Auto-end");
- break;
+ break;
}
Logger.Info($"{data?.PlayerName}(ClientID:{data?.Id}/FriendCode:{data?.FriendCode})断开连接(理由:{reason},Ping:{AmongUsClient.Instance.Ping})", "Session");
@@ -279,7 +279,7 @@ class CreatePlayerPatch
if (!AmongUsClient.Instance.IsGameStarted && client.Character != null)
{
Main.isChatCommand = true;
- // Utils.SendMessage($"{GetString("Message.YTPlanNotice")} {PlayerControl.LocalPlayer.FriendCode.GetDevUser().UpName}", client.Character.PlayerId);
+ // Utils.SendMessage($"{GetString("Message.YTPlanNotice")} {PlayerControl.LocalPlayer.FriendCode.GetDevUser().UpName}", client.Character.PlayerId);
}
}, 3.3f, "DisplayUpWarnning");
}
diff --git a/Patches/SabotageSystemPatch.cs b/Patches/SabotageSystemPatch.cs
index 4af330f19..57309fc48 100644
--- a/Patches/SabotageSystemPatch.cs
+++ b/Patches/SabotageSystemPatch.cs
@@ -28,7 +28,7 @@ public static class HeliSabotageSystemPatch
{
if (!__instance.IsActive || !Options.SabotageTimeControl.GetBool())
return;
- if (AirshipStatus.Instance != null)
+ if (ShipStatus.Instance != null)
if (__instance.Countdown >= Options.AirshipReactorTimeLimit.GetFloat())
__instance.Countdown = Options.AirshipReactorTimeLimit.GetFloat();
}
diff --git a/Patches/ShipStatusPatch.cs b/Patches/ShipStatusPatch.cs
index 2122304b2..e7e6599d4 100644
--- a/Patches/ShipStatusPatch.cs
+++ b/Patches/ShipStatusPatch.cs
@@ -52,7 +52,7 @@ class RepairSystemPatch
if (Options.DisableCloseDoor.GetBool() && systemType == SystemTypes.Doors) return false;
//Note: "SystemTypes.Laboratory" сauses bugs in the Host, it is better not to use
- if (player.Is(CustomRoles.Fool) &&
+ if (player.Is(CustomRoles.Fool) &&
(systemType is
SystemTypes.Reactor or
SystemTypes.LifeSupp or
@@ -60,30 +60,31 @@ class RepairSystemPatch
SystemTypes.Electrical))
{ return false; }
- if (player.Is(CustomRoles.Unlucky) && player.IsAlive() &&
+ if (player.Is(CustomRoles.Unlucky) && player.IsAlive() &&
(systemType is
SystemTypes.Doors))
- {
- var Ue = IRandom.Instance;
- if (Ue.Next(0, 100) < Options.UnluckySabotageSuicideChance.GetInt())
- {
- player.RpcMurderPlayerV3(player);
- Main.PlayerStates[player.PlayerId].deathReason = PlayerState.DeathReason.Suicide;
- return false;
- }
- }
+ {
+ var Ue = IRandom.Instance;
+ if (Ue.Next(0, 100) < Options.UnluckySabotageSuicideChance.GetInt())
+ {
+ player.RpcMurderPlayerV3(player);
+ Main.PlayerStates[player.PlayerId].deathReason = PlayerState.DeathReason.Suicide;
+ return false;
+ }
+ }
- /*if (player.Is(CustomRoles.Madmate) && !Options.MadmateCanFixSabotage.GetBool() &&
- (systemType is
- SystemTypes.Reactor or
- SystemTypes.LifeSupp or
- SystemTypes.Comms or
- SystemTypes.Electrical))
- { return false; }*/
+ /*if (player.Is(CustomRoles.Madmate) && !Options.MadmateCanFixSabotage.GetBool() &&
+ (systemType is
+ SystemTypes.Reactor or
+ SystemTypes.LifeSupp or
+ SystemTypes.Comms or
+ SystemTypes.Electrical))
+ { return false; }*/
//SabotageMaster
if (player.Is(CustomRoles.SabotageMaster))
SabotageMaster.RepairSystem(__instance, systemType, amount);
+ if (player.Is(CustomRoles.Alchemist) && Alchemist.FixNextSabo) Alchemist.RepairSystem(systemType, amount);
if (systemType == SystemTypes.Electrical && 0 <= amount && amount <= 4)
{
@@ -108,13 +109,13 @@ class RepairSystemPatch
if (player.Is(CustomRoles.Glitch) && (player.IsAlive())) return true;
return false;
}
- /*if (systemType == SystemTypes.Doors && AmongUsClient.Instance.NetworkMode != NetworkModes.FreePlay)
- {
- if (player.Is(CustomRoleTypes.Impostor) && (player.IsAlive() || !Options.DeadImpCantSabotage.GetBool())) return true;
- if (player.Is(CustomRoles.Jackal) && Jackal.CanUseSabotage.GetBool()) return true;
- if (player.Is(CustomRoles.Parasite) && (player.IsAlive() || !Options.DeadImpCantSabotage.GetBool())) return true;
- return false;
- }*/
+ /*if (systemType == SystemTypes.Doors && AmongUsClient.Instance.NetworkMode != NetworkModes.FreePlay)
+ {
+ if (player.Is(CustomRoleTypes.Impostor) && (player.IsAlive() || !Options.DeadImpCantSabotage.GetBool())) return true;
+ if (player.Is(CustomRoles.Jackal) && Jackal.CanUseSabotage.GetBool()) return true;
+ if (player.Is(CustomRoles.Parasite) && (player.IsAlive() || !Options.DeadImpCantSabotage.GetBool())) return true;
+ return false;
+ }*/
if (systemType == SystemTypes.Security && amount == 1)
{
@@ -166,6 +167,7 @@ class SwitchSystemRepairPatch
{
if (player.Is(CustomRoles.SabotageMaster))
SabotageMaster.SwitchSystemRepair(__instance, amount);
+ if (player.Is(CustomRoles.Alchemist) && Alchemist.FixNextSabo) Alchemist.SwitchSystemRepair(__instance, amount);
}
}
[HarmonyPatch(typeof(ShipStatus), nameof(ShipStatus.Start))]
diff --git a/Patches/onGameStartedPatch.cs b/Patches/onGameStartedPatch.cs
index f926fd20c..21c9256a2 100644
--- a/Patches/onGameStartedPatch.cs
+++ b/Patches/onGameStartedPatch.cs
@@ -5,9 +5,9 @@ using System;
using System.Collections.Generic;
using System.Linq;
using TOHE.Modules;
+using TOHE.Roles.AddOns.Common;
using TOHE.Roles.AddOns.Crewmate;
using TOHE.Roles.AddOns.Impostor;
-using TOHE.Roles.AddOns.Common;
using TOHE.Roles.Crewmate;
using TOHE.Roles.Impostor;
using TOHE.Roles.Neutral;
@@ -40,6 +40,7 @@ internal class ChangeRoleSettings
Main.AllPlayerCustomRoles = new Dictionary();
Main.WarlockTimer = new();
Main.AssassinTimer = new();
+ Main.UndertakerTimer = new();
Main.isDoused = new();
Main.isDraw = new();
Main.isRevealed = new();
@@ -66,6 +67,7 @@ internal class ChangeRoleSettings
Main.KilledDiseased = new();
Main.KilledAntidote = new();
Main.WorkaholicAlive = new();
+ Main.SpeedrunnerAlive = new();
Main.BaitAlive = new();
Main.BoobyTrapBody = new();
Main.KillerOfBoobyTrapBody = new();
@@ -185,7 +187,7 @@ internal class ChangeRoleSettings
FireWorks.Init();
Sniper.Init();
TimeThief.Init();
- // Mare.Init();
+ // Mare.Init();
Witch.Init();
HexMaster.Init();
SabotageMaster.Init();
@@ -222,7 +224,9 @@ internal class ChangeRoleSettings
Divinator.Init();
Oracle.Init();
Eraser.Init();
+ NiceEraser.Init();
Assassin.Init();
+ Undertaker.Init();
Sans.Init();
Juggernaut.Init();
Hacker.Init();
@@ -255,6 +259,7 @@ internal class ChangeRoleSettings
DoubleShot.Init();
Dazzler.Init();
Addict.Init();
+ Alchemist.Init();
Deathpact.Init();
Tracefinder.Init();
Devourer.Init();
@@ -273,6 +278,8 @@ internal class ChangeRoleSettings
PlagueBearer.Init();
Reverie.Init();
Doomsayer.Init();
+ Disperser.Init();
+ Twister.Init();
//Pirate.Init();
@@ -318,7 +325,7 @@ internal class SelectRolesPatch
PlayerControl.LocalPlayer.Data.IsDead = true;
Main.PlayerStates[PlayerControl.LocalPlayer.PlayerId].SetDead();
}
-
+
SelectCustomRoles();
SelectAddonRoles();
@@ -481,9 +488,9 @@ internal class SelectRolesPatch
case CustomRoles.Sniper:
Sniper.Add(pc.PlayerId);
break;
- /* case CustomRoles.Mare:
- Mare.Add(pc.PlayerId);
- break; */
+ /* case CustomRoles.Mare:
+ Mare.Add(pc.PlayerId);
+ break; */
case CustomRoles.Vampire:
Vampire.Add(pc.PlayerId);
break;
@@ -500,7 +507,7 @@ internal class SelectRolesPatch
break;
case CustomRoles.Farseer:
foreach (var ar in Main.AllPlayerControls)
- {
+ {
Main.isRevealed.Add((pc.PlayerId, ar.PlayerId), false);
}
Farseer.RandomRole.Add(pc.PlayerId, Farseer.GetRandomCrewRoleString());
@@ -616,9 +623,15 @@ internal class SelectRolesPatch
case CustomRoles.Eraser:
Eraser.Add(pc.PlayerId);
break;
+ case CustomRoles.NiceEraser:
+ NiceEraser.Add(pc.PlayerId);
+ break;
case CustomRoles.Assassin:
Assassin.Add(pc.PlayerId);
break;
+ case CustomRoles.Undertaker:
+ Undertaker.Add(pc.PlayerId);
+ break;
case CustomRoles.Sans:
Sans.Add(pc.PlayerId);
break;
@@ -640,6 +653,12 @@ internal class SelectRolesPatch
case CustomRoles.Councillor:
Councillor.Add(pc.PlayerId);
break;
+ case CustomRoles.Camouflager:
+ Camouflager.Add(pc.PlayerId);
+ break;
+ case CustomRoles.Twister:
+ Twister.Add(pc.PlayerId);
+ break;
case CustomRoles.Mortician:
Mortician.Add(pc.PlayerId);
break;
@@ -739,6 +758,9 @@ internal class SelectRolesPatch
case CustomRoles.Addict:
Addict.Add(pc.PlayerId);
break;
+ case CustomRoles.Alchemist:
+ Alchemist.Add(pc.PlayerId);
+ break;
case CustomRoles.Deathpact:
Deathpact.Add(pc.PlayerId);
break;
@@ -769,9 +791,12 @@ internal class SelectRolesPatch
case CustomRoles.Doomsayer:
Doomsayer.Add(pc.PlayerId);
break;
- //case CustomRoles.Pirate:
- // Pirate.Add(pc.PlayerId);
- // break;
+ case CustomRoles.Disperser:
+ Disperser.Add(pc.PlayerId);
+ break;
+ //case CustomRoles.Pirate:
+ // Pirate.Add(pc.PlayerId);
+ // break;
}
foreach (var subRole in pc.GetCustomSubRoles())
{
@@ -886,47 +911,47 @@ internal class SelectRolesPatch
SetColorPatch.IsAntiGlitchDisabled = false;
}
private static void ForceAssignRole(CustomRoles role, List AllPlayers, CustomRpcSender sender, RoleTypes BaseRole, RoleTypes hostBaseRole = RoleTypes.Crewmate, bool skip = false, int Count = -1)
- {
- var count = 1;
+ {
+ var count = 1;
- if (Count != -1)
- count = Count;
- for (var i = 0; i < count; i++)
+ if (Count != -1)
+ count = Count;
+ for (var i = 0; i < count; i++)
+ {
+ if (AllPlayers.Count <= 0) break;
+ var rand = new System.Random();
+ var player = AllPlayers[rand.Next(0, AllPlayers.Count)];
+ AllPlayers.Remove(player);
+ Main.AllPlayerCustomRoles[player.PlayerId] = role;
+ if (!skip)
{
- if (AllPlayers.Count <= 0) break;
- var rand = new System.Random();
- var player = AllPlayers[rand.Next(0, AllPlayers.Count)];
- AllPlayers.Remove(player);
- Main.AllPlayerCustomRoles[player.PlayerId] = role;
- if (!skip)
+ if (!player.IsModClient())
{
- if (!player.IsModClient())
+ int playerCID = player.GetClientId();
+ sender.RpcSetRole(player, BaseRole, playerCID);
+ //Desyncする人視点で他プレイヤーを科学者にするループ
+ foreach (var pc in PlayerControl.AllPlayerControls)
{
- int playerCID = player.GetClientId();
- sender.RpcSetRole(player, BaseRole, playerCID);
- //Desyncする人視点で他プレイヤーを科学者にするループ
- foreach (var pc in PlayerControl.AllPlayerControls)
- {
- if (pc == player) continue;
- sender.RpcSetRole(pc, RoleTypes.Scientist, playerCID);
- }
- //他視点でDesyncする人の役職を科学者にするループ
- foreach (var pc in PlayerControl.AllPlayerControls)
- {
- if (pc == player) continue;
- if (pc.PlayerId == 0) player.SetRole(RoleTypes.Scientist); //ホスト視点用
- else sender.RpcSetRole(player, RoleTypes.Scientist, pc.GetClientId());
- }
+ if (pc == player) continue;
+ sender.RpcSetRole(pc, RoleTypes.Scientist, playerCID);
}
- else
+ //他視点でDesyncする人の役職を科学者にするループ
+ foreach (var pc in PlayerControl.AllPlayerControls)
{
- //ホストは別の役職にする
- player.SetRole(hostBaseRole); //ホスト視点用
- sender.RpcSetRole(player, hostBaseRole);
+ if (pc == player) continue;
+ if (pc.PlayerId == 0) player.SetRole(RoleTypes.Scientist); //ホスト視点用
+ else sender.RpcSetRole(player, RoleTypes.Scientist, pc.GetClientId());
}
}
+ else
+ {
+ //ホストは別の役職にする
+ player.SetRole(hostBaseRole); //ホスト視点用
+ sender.RpcSetRole(player, hostBaseRole);
+ }
}
}
+ }
private static void AssignLoversRolesFromList()
{
@@ -944,14 +969,14 @@ internal class SelectRolesPatch
var allPlayers = new List();
foreach (var pc in Main.AllPlayerControls)
{
- if (pc.Is(CustomRoles.GM)
- || (pc.HasSubRole() && pc.GetCustomSubRoles().Count >= Options.NoLimitAddonsNumMax.GetInt())
- || pc.Is(CustomRoles.Ntr)
- || pc.Is(CustomRoles.Dictator)
- || pc.Is(CustomRoles.God)
- || pc.Is(CustomRoles.FFF)
+ if (pc.Is(CustomRoles.GM)
+ || (pc.HasSubRole() && pc.GetCustomSubRoles().Count >= Options.NoLimitAddonsNumMax.GetInt())
+ || pc.Is(CustomRoles.Ntr)
+ || pc.Is(CustomRoles.Dictator)
+ || pc.Is(CustomRoles.God)
+ || pc.Is(CustomRoles.FFF)
|| pc.Is(CustomRoles.Bomber)
- || pc.Is(CustomRoles.Nuker)
+ || pc.Is(CustomRoles.Nuker)
|| pc.Is(CustomRoles.Provocateur)
|| (pc.GetCustomRole().IsCrewmate() && !Options.CrewCanBeInLove.GetBool())
|| (pc.GetCustomRole().IsNeutral() && !Options.NeutralCanBeInLove.GetBool())