Rework CheckGameEndPatch, Fix Postman & Romantic bugs

This commit is contained in:
Gurge44 committed 2023-10-22 21:10:05 +02:00
1 parent d66430cf1c
commit ce05c157cc
9 files changed
+108 -293

No files matched your search

+5
View File
@@ -712,6 +712,9 @@ public static class Utils
if (SKTime <= 20) ProgressText.Append(ColorString(SKColor, $"<color=#777777>-</color> {SKTime}s"));
}
break;
case CustomRoles.Postman:
ProgressText.Append(Postman.GetProgressText(playerId));
break;
case CustomRoles.BountyHunter:
if (BountyHunter.ChangeTimer.ContainsKey(playerId))
{
@@ -2677,6 +2680,8 @@ public static class Utils
Executioner.ChangeRoleByTarget(target);
if (Lawyer.Target.ContainsValue(target.PlayerId))
Lawyer.ChangeRoleByTarget(target);
if (Postman.Target == target.PlayerId)
Postman.OnTargetDeath();
FixedUpdatePatch.LoversSuicide(target.PlayerId, onMeeting);
}
+71 -268
View File
@@ -5,6 +5,7 @@ using System.Collections.Generic;
using System.Linq;
using TOHE.Roles.Neutral;
using static TOHE.Translator;
using static TOHE.Utils;
namespace TOHE;
@@ -229,7 +230,7 @@ class GameEndChecker
{
foreach (var pc in Main.AllPlayerControls.Where(x => x.Is(CustomRoles.Lovers)))
{
if (CustomWinnerHolder.WinnerIds.Any(x => Utils.GetPlayerById(x).Is(CustomRoles.Lovers)))
if (CustomWinnerHolder.WinnerIds.Any(x => GetPlayerById(x).Is(CustomRoles.Lovers)))
{
CustomWinnerHolder.WinnerIds.Add(pc.PlayerId);
CustomWinnerHolder.AdditionalWinnerTeams.Add(AdditionalWinners.Lovers);
@@ -257,7 +258,7 @@ class GameEndChecker
//中立共同胜利
if (Options.NeutralWinTogether.GetBool() && CustomWinnerHolder.WinnerIds.Any(x => Utils.GetPlayerById(x) != null && Utils.GetPlayerById(x).GetCustomRole().IsNeutral()))
if (Options.NeutralWinTogether.GetBool() && CustomWinnerHolder.WinnerIds.Any(x => GetPlayerById(x) != null && GetPlayerById(x).GetCustomRole().IsNeutral()))
{
foreach (var pc in Main.AllPlayerControls)
if (pc.GetCustomRole().IsNeutral() && !CustomWinnerHolder.WinnerIds.Contains(pc.PlayerId))
@@ -267,7 +268,7 @@ class GameEndChecker
{
foreach (var id in CustomWinnerHolder.WinnerIds)
{
var pc = Utils.GetPlayerById(id);
var pc = GetPlayerById(id);
if (pc == null || !pc.GetCustomRole().IsNeutral()) continue;
foreach (var tar in Main.AllPlayerControls)
if (!CustomWinnerHolder.WinnerIds.Contains(tar.PlayerId) && tar.GetCustomRole() == pc.GetCustomRole())
@@ -387,45 +388,48 @@ class GameEndChecker
if (CustomRolesHelper.RoleExist(CustomRoles.Sunnyboy) && Main.AllAlivePlayerControls.Count() > 1) return false;
byte Imp = (byte)Utils.AlivePlayersCount(CountTypes.Impostor);
byte Jackal = (byte)Utils.AlivePlayersCount(CountTypes.Jackal);
byte Pel = (byte)Utils.AlivePlayersCount(CountTypes.Pelican);
byte Crew = (byte)Utils.AlivePlayersCount(CountTypes.Crew);
byte Gam = (byte)Utils.AlivePlayersCount(CountTypes.Gamer);
byte BK = (byte)Utils.AlivePlayersCount(CountTypes.BloodKnight);
byte Pois = (byte)Utils.AlivePlayersCount(CountTypes.Poisoner);
byte CM = (byte)Utils.AlivePlayersCount(CountTypes.Succubus);
byte Hex = (byte)Utils.AlivePlayersCount(CountTypes.HexMaster);
byte Wraith = (byte)Utils.AlivePlayersCount(CountTypes.Wraith);
byte Pestilence = (byte)Utils.AlivePlayersCount(CountTypes.Pestilence);
byte PB = (byte)Utils.AlivePlayersCount(CountTypes.PlagueBearer);
byte SK = (byte)Utils.AlivePlayersCount(CountTypes.NSerialKiller);
byte WM = (byte)Utils.AlivePlayersCount(CountTypes.WeaponMaster);
byte MG = (byte)Utils.AlivePlayersCount(CountTypes.Magician);
byte RL = (byte)Utils.AlivePlayersCount(CountTypes.Reckless);
byte EC = (byte)Utils.AlivePlayersCount(CountTypes.Eclipse);
byte PM = (byte)Utils.AlivePlayersCount(CountTypes.Pyromaniac);
byte HH = (byte)Utils.AlivePlayersCount(CountTypes.HeadHunter);
byte VG = (byte)Utils.AlivePlayersCount(CountTypes.Vengeance);
byte IM = (byte)Utils.AlivePlayersCount(CountTypes.Imitator);
byte WW = (byte)Utils.AlivePlayersCount(CountTypes.Werewolf);
byte RR = (byte)Utils.AlivePlayersCount(CountTypes.RuthlessRomantic);
//byte Witch = Utils.AlivePlayersCount(CountTypes.NWitch);
byte Juggy = (byte)Utils.AlivePlayersCount(CountTypes.Juggernaut);
byte Vamp = (byte)Utils.AlivePlayersCount(CountTypes.Infectious);
byte Virus = (byte)Utils.AlivePlayersCount(CountTypes.Virus);
byte Rogue = (byte)Utils.AlivePlayersCount(CountTypes.Rogue);
byte DH = (byte)Utils.AlivePlayersCount(CountTypes.DarkHide);
byte Jinx = (byte)Utils.AlivePlayersCount(CountTypes.Jinx);
byte Rit = (byte)Utils.AlivePlayersCount(CountTypes.Ritualist);
byte PP = (byte)Utils.AlivePlayersCount(CountTypes.Pickpocket);
byte Traitor = (byte)Utils.AlivePlayersCount(CountTypes.Traitor);
byte Med = (byte)Utils.AlivePlayersCount(CountTypes.Medusa);
byte SC = (byte)Utils.AlivePlayersCount(CountTypes.Spiritcaller);
byte Glitch = (byte)Utils.AlivePlayersCount(CountTypes.Glitch);
byte Arso = (byte)Utils.AlivePlayersCount(CountTypes.Arsonist);
byte Bandit = (byte)Utils.AlivePlayersCount(CountTypes.Bandit);
byte Agi = (byte)Utils.AlivePlayersCount(CountTypes.Agitater);
int Imp = AlivePlayersCount(CountTypes.Impostor);
int Crew = AlivePlayersCount(CountTypes.Crew);
Dictionary<(CustomRoles?, CustomWinner), int> roleCounts = new()
{
{ (null, CustomWinner.Jackal), AlivePlayersCount(CountTypes.Jackal) },
{ (CustomRoles.Pelican, CustomWinner.Pelican), AlivePlayersCount(CountTypes.Pelican) },
{ (CustomRoles.Gamer, CustomWinner.Gamer), AlivePlayersCount(CountTypes.Gamer) },
{ (CustomRoles.Poisoner, CustomWinner.Poisoner), AlivePlayersCount(CountTypes.Poisoner) },
{ (CustomRoles.BloodKnight, CustomWinner.BloodKnight), AlivePlayersCount(CountTypes.BloodKnight) },
{ (null, CustomWinner.Succubus), AlivePlayersCount(CountTypes.Succubus) },
{ (CustomRoles.HexMaster, CustomWinner.HexMaster), AlivePlayersCount(CountTypes.HexMaster) },
{ (CustomRoles.Wraith, CustomWinner.Wraith), AlivePlayersCount(CountTypes.Wraith) },
{ (CustomRoles.Pestilence, CustomWinner.Pestilence), AlivePlayersCount(CountTypes.Pestilence) },
{ (CustomRoles.PlagueBearer, CustomWinner.Plaguebearer), AlivePlayersCount(CountTypes.PlagueBearer) },
{ (CustomRoles.NSerialKiller, CustomWinner.SerialKiller), AlivePlayersCount(CountTypes.NSerialKiller) },
{ (CustomRoles.WeaponMaster, CustomWinner.WeaponMaster), AlivePlayersCount(CountTypes.WeaponMaster) },
{ (CustomRoles.Magician, CustomWinner.Magician), AlivePlayersCount(CountTypes.Magician) },
{ (CustomRoles.Reckless, CustomWinner.Reckless), AlivePlayersCount(CountTypes.Reckless) },
{ (CustomRoles.Eclipse, CustomWinner.Eclipse), AlivePlayersCount(CountTypes.Eclipse) },
{ (CustomRoles.Pyromaniac, CustomWinner.Pyromaniac), AlivePlayersCount(CountTypes.Pyromaniac) },
{ (CustomRoles.HeadHunter, CustomWinner.HeadHunter), AlivePlayersCount(CountTypes.HeadHunter) },
{ (CustomRoles.Vengeance, CustomWinner.Vengeance), AlivePlayersCount(CountTypes.Vengeance) },
{ (CustomRoles.Imitator, CustomWinner.Imitator), AlivePlayersCount(CountTypes.Imitator) },
{ (CustomRoles.Werewolf, CustomWinner.Werewolf), AlivePlayersCount(CountTypes.Werewolf) },
{ (null, CustomWinner.RuthlessRomantic), AlivePlayersCount(CountTypes.RuthlessRomantic) },
{ (CustomRoles.Juggernaut, CustomWinner.Juggernaut), AlivePlayersCount(CountTypes.Juggernaut) },
{ (null, CustomWinner.Infectious), AlivePlayersCount(CountTypes.Infectious) },
{ (null, CustomWinner.Virus), AlivePlayersCount(CountTypes.Virus) },
{ (null, CustomWinner.Rogue), AlivePlayersCount(CountTypes.Rogue) },
{ (CustomRoles.DarkHide, CustomWinner.DarkHide), AlivePlayersCount(CountTypes.DarkHide) },
{ (CustomRoles.Jinx, CustomWinner.Jinx), AlivePlayersCount(CountTypes.Jinx) },
{ (CustomRoles.Ritualist, CustomWinner.Ritualist), AlivePlayersCount(CountTypes.Ritualist) },
{ (CustomRoles.Pickpocket, CustomWinner.Pickpocket), AlivePlayersCount(CountTypes.Pickpocket) },
{ (CustomRoles.Traitor, CustomWinner.Traitor), AlivePlayersCount(CountTypes.Traitor) },
{ (CustomRoles.Medusa, CustomWinner.Medusa), AlivePlayersCount(CountTypes.Medusa) },
{ (null, CustomWinner.Spiritcaller), AlivePlayersCount(CountTypes.Spiritcaller) },
{ (CustomRoles.Glitch, CustomWinner.Glitch), AlivePlayersCount(CountTypes.Glitch) },
{ (CustomRoles.Arsonist, CustomWinner.Arsonist), AlivePlayersCount(CountTypes.Arsonist) },
{ (CustomRoles.Bandit, CustomWinner.Bandit), AlivePlayersCount(CountTypes.Bandit) },
{ (CustomRoles.Agitater, CustomWinner.Agitater), AlivePlayersCount(CountTypes.Agitater) },
};
foreach (var x in Main.AllAlivePlayerControls)
{
@@ -434,27 +438,15 @@ class GameEndChecker
if (x.GetCustomRole().IsImpostor() && x.Is(CustomRoles.Admired) && x.Is(CustomRoles.DualPersonality)) Crew++;
if (x.GetCustomRole().IsNeutral() && x.Is(CustomRoles.Admired) && x.Is(CustomRoles.DualPersonality)) Crew++;
if (x.GetCustomRole().IsCrewmate() && x.Is(CustomRoles.Admired) && x.Is(CustomRoles.DualPersonality)) Crew++;
if (x.Is(CustomRoles.Charmed) && x.Is(CustomRoles.DualPersonality)) CM++;
if (x.Is(CustomRoles.Sidekick) && x.Is(CustomRoles.DualPersonality)) Jackal++;
if (x.Is(CustomRoles.Recruit) && x.Is(CustomRoles.DualPersonality)) Jackal++;
if (x.Is(CustomRoles.Infected) && x.Is(CustomRoles.DualPersonality)) Vamp++;
if (x.Is(CustomRoles.Contagious) && x.Is(CustomRoles.DualPersonality)) Virus++;
if (x.Is(CustomRoles.Charmed) && x.Is(CustomRoles.DualPersonality)) roleCounts[(CustomRoles.Succubus, CustomWinner.Succubus)]++;
if (x.Is(CustomRoles.Sidekick) && x.Is(CustomRoles.DualPersonality)) roleCounts[(CustomRoles.Jackal, CustomWinner.Jackal)]++;
if (x.Is(CustomRoles.Recruit) && x.Is(CustomRoles.DualPersonality)) roleCounts[(CustomRoles.Jackal, CustomWinner.Jackal)]++;
if (x.Is(CustomRoles.Infected) && x.Is(CustomRoles.DualPersonality)) roleCounts[(CustomRoles.Infectious, CustomWinner.Infectious)]++;
if (x.Is(CustomRoles.Contagious) && x.Is(CustomRoles.DualPersonality)) roleCounts[(CustomRoles.Virus, CustomWinner.Virus)]++;
if (x.Is(CustomRoles.Madmate) && x.Is(CustomRoles.DualPersonality)) Imp++;
}
//Imp += (byte)Main.AllAlivePlayerControls.Count(x => x.GetCustomRole().IsImpostor() && x.Is(CustomRoles.DualPersonality));
//Crew += (byte)Main.AllAlivePlayerControls.Count(x => x.GetCustomRole().IsCrewmate() && x.Is(CustomRoles.DualPersonality));
//Crew += (byte)Main.AllAlivePlayerControls.Count(x => x.GetCustomRole().IsImpostor() && x.Is(CustomRoles.Admired) && x.Is(CustomRoles.DualPersonality));
//Crew += (byte)Main.AllAlivePlayerControls.Count(x => x.GetCustomRole().IsNeutral() && x.Is(CustomRoles.Admired) && x.Is(CustomRoles.DualPersonality));
//Crew += (byte)Main.AllAlivePlayerControls.Count(x => x.GetCustomRole().IsCrewmate() && x.Is(CustomRoles.Admired) && x.Is(CustomRoles.DualPersonality));
//CM += (byte)Main.AllAlivePlayerControls.Count(x => x.Is(CustomRoles.Charmed) && x.Is(CustomRoles.DualPersonality));
//Jackal += (byte)Main.AllAlivePlayerControls.Count(x => x.Is(CustomRoles.Sidekick) && x.Is(CustomRoles.DualPersonality));
//Jackal += (byte)Main.AllAlivePlayerControls.Count(x => x.Is(CustomRoles.Recruit) && x.Is(CustomRoles.DualPersonality));
//Vamp += (byte)Main.AllAlivePlayerControls.Count(x => x.Is(CustomRoles.Infected) && x.Is(CustomRoles.DualPersonality));
//Virus += (byte)Main.AllAlivePlayerControls.Count(x => x.Is(CustomRoles.Contagious) && x.Is(CustomRoles.DualPersonality));
//Imp += (byte)Main.AllAlivePlayerControls.Count(x => x.Is(CustomRoles.Madmate) && x.Is(CustomRoles.DualPersonality));
int totalNKAlive = new int[] { Jackal, Pel, Gam, BK, Pois, CM, Hex, Wraith, Pestilence, PB, SK, EC, PM, HH, VG, IM, WW, RR, Juggy, Vamp, Virus, Rogue, DH, Jinx, Rit, PP, Traitor, Med, SC, Glitch, Arso, Bandit, Agi, WM, MG, RL }.Sum();
int totalNKAlive = roleCounts.Values.Sum();
CustomWinner? winner = null;
CustomRoles? rl = null;
@@ -484,225 +476,36 @@ class GameEndChecker
winner = CustomWinner.Crewmate;
}
else return false;
if (winner != null)
CustomWinnerHolder.ResetAndSetWinner((CustomWinner)winner);
if (winner != null) CustomWinnerHolder.ResetAndSetWinner((CustomWinner)winner);
return true;
}
else
{
if (Imp >= 1) return false; // both imps and NKs are alive, game must continue
else if (Crew > totalNKAlive) return false; // Imps are dead, but crew still outnumbers NKs (game must continue)
else if (Crew > totalNKAlive) return false; // Imps are dead, but crew still outnumbers NKs, game must continue
else // Imps dead, Crew <= NK, Checking if all NKs alive are in 1 team
{
if (Rit == totalNKAlive)
var aliveCounts = roleCounts.Values.Where(x => x > 0).ToList();
if (aliveCounts.Count > 1) return false; // There are multiple types of NKs alive, game must continue
else if (aliveCounts.Count == 1) // There is only one type of NK alive, they've won
{
reason = GameOverReason.ImpostorByKill;
winner = CustomWinner.Ritualist;
rl = CustomRoles.Ritualist;
foreach (var keyValuePair in roleCounts.Where(keyValuePair => keyValuePair.Value == aliveCounts[0]))
{
reason = GameOverReason.ImpostorByKill;
winner = keyValuePair.Key.Item2;
rl = keyValuePair.Key.Item1;
break;
}
}
else if (Traitor == totalNKAlive)
else
{
reason = GameOverReason.ImpostorByKill;
winner = CustomWinner.Traitor;
rl = CustomRoles.Traitor;
Logger.Fatal("Error while selecting NK winner", "CheckGameEndPatch.CheckGameEndByLivingPlayers");
Logger.SendInGame("There was an error while selecting the winner. Please report this bug to the developer! (Do /dump to get logs)");
CustomWinnerHolder.ResetAndSetWinner(CustomWinner.Error);
return true;
}
else if (Med == totalNKAlive)
{
reason = GameOverReason.ImpostorByKill;
winner = CustomWinner.Medusa;
rl = CustomRoles.Medusa;
}
else if (PP == totalNKAlive)
{
reason = GameOverReason.ImpostorByKill;
winner = CustomWinner.Pickpocket;
rl = CustomRoles.Pickpocket;
}
else if (Jackal == totalNKAlive)
{
reason = GameOverReason.ImpostorByKill;
winner = CustomWinner.Jackal;
}
else if (Vamp == totalNKAlive)
{
reason = GameOverReason.ImpostorByKill;
winner = CustomWinner.Infectious;
}
else if (DH == totalNKAlive)
{
reason = GameOverReason.ImpostorByKill;
winner = CustomWinner.DarkHide;
}
else if (Rogue == totalNKAlive)
{
reason = GameOverReason.ImpostorByKill;
winner = CustomWinner.Rogue;
}
else if (Wraith == totalNKAlive)
{
reason = GameOverReason.ImpostorByKill;
winner = CustomWinner.Wraith;
rl = CustomRoles.Wraith;
}
else if (Agi == totalNKAlive)
{
reason = GameOverReason.ImpostorByKill;
winner = CustomWinner.Agitater;
}
else if (Pestilence == totalNKAlive)
{
reason = GameOverReason.ImpostorByKill;
winner = CustomWinner.Pestilence;
rl = CustomRoles.Pestilence;
}
else if (PB == totalNKAlive)
{
reason = GameOverReason.ImpostorByKill;
winner = CustomWinner.Plaguebearer;
rl = CustomRoles.PlagueBearer;
}
else if (Juggy == totalNKAlive)
{
reason = GameOverReason.ImpostorByKill;
winner = CustomWinner.Juggernaut;
rl = CustomRoles.Juggernaut;
}
else if (EC == totalNKAlive)
{
reason = GameOverReason.ImpostorByKill;
winner = CustomWinner.Eclipse;
rl = CustomRoles.Eclipse;
}
else if (HH == totalNKAlive)
{
reason = GameOverReason.ImpostorByKill;
winner = CustomWinner.HeadHunter;
rl = CustomRoles.HeadHunter;
}
else if (VG == totalNKAlive)
{
reason = GameOverReason.ImpostorByKill;
winner = CustomWinner.Vengeance;
rl = CustomRoles.Vengeance;
}
else if (PM == totalNKAlive)
{
reason = GameOverReason.ImpostorByKill;
winner = CustomWinner.Pyromaniac;
rl = CustomRoles.Pyromaniac;
}
else if (MG == totalNKAlive)
{
reason = GameOverReason.ImpostorByKill;
winner = CustomWinner.Magician;
rl = CustomRoles.Magician;
}
else if (WM == totalNKAlive)
{
reason = GameOverReason.ImpostorByKill;
winner = CustomWinner.WeaponMaster;
rl = CustomRoles.WeaponMaster;
}
else if (RL == totalNKAlive)
{
reason = GameOverReason.ImpostorByKill;
winner = CustomWinner.Reckless;
rl = CustomRoles.Reckless;
}
else if (Hex == totalNKAlive)
{
reason = GameOverReason.ImpostorByKill;
winner = CustomWinner.HexMaster;
rl = CustomRoles.HexMaster;
}
else if (Bandit == totalNKAlive)
{
reason = GameOverReason.ImpostorByKill;
winner = CustomWinner.Bandit;
rl = CustomRoles.Bandit;
}
else if (RR == totalNKAlive)
{
reason = GameOverReason.ImpostorByKill;
winner = CustomWinner.RuthlessRomantic;
}
else if (WW == totalNKAlive)
{
reason = GameOverReason.ImpostorByKill;
winner = CustomWinner.Werewolf;
rl = CustomRoles.Werewolf;
}
else if (IM == totalNKAlive)
{
reason = GameOverReason.ImpostorByKill;
winner = CustomWinner.Imitator;
rl = CustomRoles.Imitator;
}
else if (Arso == totalNKAlive)
{
reason = GameOverReason.ImpostorByKill;
winner = CustomWinner.Arsonist;
rl = CustomRoles.Arsonist;
}
else if (Glitch == totalNKAlive)
{
reason = GameOverReason.ImpostorByKill;
winner = CustomWinner.Glitch;
rl = CustomRoles.Glitch;
}
else if (Jinx == totalNKAlive)
{
reason = GameOverReason.ImpostorByKill;
winner = CustomWinner.Jinx;
rl = CustomRoles.Jinx;
}
else if (SK == totalNKAlive)
{
reason = GameOverReason.ImpostorByKill;
winner = CustomWinner.SerialKiller;
rl = CustomRoles.NSerialKiller;
}
else if (Pel == totalNKAlive)
{
reason = GameOverReason.ImpostorByKill;
winner = CustomWinner.Pelican;
rl = CustomRoles.Pelican;
}
else if (Gam == totalNKAlive)
{
reason = GameOverReason.ImpostorByKill;
winner = CustomWinner.Gamer;
rl = CustomRoles.Gamer;
}
else if (BK == totalNKAlive)
{
reason = GameOverReason.ImpostorByKill;
winner = CustomWinner.BloodKnight;
rl = CustomRoles.BloodKnight;
}
else if (Pois == totalNKAlive)
{
reason = GameOverReason.ImpostorByKill;
winner = CustomWinner.Poisoner;
rl = CustomRoles.Poisoner;
}
else if (Virus == totalNKAlive)
{
reason = GameOverReason.ImpostorByKill;
winner = CustomWinner.Virus;
}
else if (SC == totalNKAlive)
{
reason = GameOverReason.ImpostorByKill;
winner = CustomWinner.Spiritcaller;
}
else if (CM == totalNKAlive)
{
reason = GameOverReason.ImpostorByKill;
winner = CustomWinner.Succubus;
}
else return false;
if (winner != null) CustomWinnerHolder.ResetAndSetWinner((CustomWinner)winner);
if (rl != null) CustomWinnerHolder.WinnerRoles.Add((CustomRoles)rl);
return true;
@@ -763,7 +566,7 @@ class GameEndChecker
if (winner == null) winnerId = 0;
else winnerId = winner.PlayerId;
Logger.Warn($"Winner: {Utils.GetPlayerById(winnerId).GetRealName().RemoveHtmlTags()}", "FFA");
Logger.Warn($"Winner: {GetPlayerById(winnerId).GetRealName().RemoveHtmlTags()}", "FFA");
CustomWinnerHolder.WinnerIds = new()
{
+1
View File
@@ -459,6 +459,7 @@ class HudManagerPatch
CustomRoles.Doormaster => Doormaster.GetHudText(player),
CustomRoles.Tether => Tether.GetHudText(player),
CustomRoles.WeaponMaster => WeaponMaster.GetHudAndProgressText(),
CustomRoles.Postman => Postman.GetHudText(player),
CustomRoles.Sapper => !Options.UsePets.GetBool() || !Main.SapperCD.TryGetValue(player.PlayerId, out var cd) ? string.Empty : string.Format(GetString("CDPT"), Sapper.ShapeshiftCooldown.GetInt() - (now - cd) + 1),
CustomRoles.CameraMan => !Options.UsePets.GetBool() || !Main.CameraManCD.TryGetValue(player.PlayerId, out var cd) ? string.Empty : string.Format(GetString("CDPT"), CameraMan.VentCooldown.GetInt() - (now - cd) + 1),
CustomRoles.Mayor => !Options.UsePets.GetBool() || !Main.MayorCD.TryGetValue(player.PlayerId, out var cd) ? string.Empty : string.Format(GetString("CDPT"), Options.DefaultKillCooldown - (now - cd) + 1),
+1 -1
View File
@@ -102,7 +102,7 @@ public class MainMenuManagerPatch
{
freeplayButton.GetComponent<PassiveButton>().OnClick = new();
freeplayButton.GetComponent<PassiveButton>().OnClick.AddListener((Action)(() => Application.OpenURL("https://tohe.cc")));
__instance.StartCoroutine(Effects.Lerp(0.01f, new Action<float>((p) => freeplayButton.transform.GetChild(0).GetComponent<TMPro.TMP_Text>().SetText(Translator.GetString("Website")))));
__instance.StartCoroutine(Effects.Lerp(0.01f, new Action<float>((p) => freeplayButton.transform.GetChild(0).GetComponent<TMPro.TMP_Text>().SetText(GetString("Website")))));
}
#endif
+2 -2
View File
@@ -44,7 +44,7 @@ class CheckProtectPatch
{
if (__instance.Data.IsDead)
{
Logger.Info("守護をブロックしました。", "CheckProtect");
Logger.Info("Blocked", "CheckProtect");
return false;
}
}
@@ -1046,7 +1046,7 @@ class MurderPlayerPatch
if (Postman.Target == target.PlayerId)
{
Postman.OnTargetDeath(killer, target);
Postman.OnTargetDeath();
}
if (target.Is(CustomRoles.Bait))
+2
View File
@@ -136,6 +136,8 @@ class OnPlayerLeftPatch
Pelican.OnPelicanDied(data.Character.PlayerId);
if (Spiritualist.SpiritualistTarget == data.Character.PlayerId)
Spiritualist.RemoveTarget();
if (data.Character.PlayerId == Postman.Target)
Postman.SetNewTarget();
if (Main.PlayerStates[data.Character.PlayerId].deathReason == PlayerState.DeathReason.etc) //死因が設定されていなかったら
{
Main.PlayerStates[data.Character.PlayerId].deathReason = PlayerState.DeathReason.Disconnected;
+1 -1
View File
@@ -1562,7 +1562,7 @@
"HackDuration","","Hack Duration","","",""
"MimicCooldown","","Mimic Cooldown","","",""
"MimicDuration","","Mimic Duration","","",""
"HackedByGlitch","","<color=#39FF14>You are hacked by The Glitch, you can't {0}.</color>","","",""
"HackedByGlitch","","<color=#ffff00>You are hacked, you can't {0}.</color>","","",""
"BKProtectDuration","免疫伤害持续时间","Protection Duration","Длительность щита","免疫傷害持續時間",""
"TotocalcioMaxBetTimes","下注次数上限","Maximum Number of Follows","Максимальное количество следований","追隨次數上限",""
"TotocalcioBetCooldown","下注冷却时间","Follow Cooldown","Откат следований","追隨冷卻時間",""
Can't render this file because it is too large.
+15 -14
View File
@@ -1,8 +1,9 @@
using AmongUs.GameOptions;
using AmongUs.GameOptions;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using static TOHE.Options;
using static TOHE.Translator;
namespace TOHE.Roles.Neutral;
@@ -39,7 +40,7 @@ public static class Postman
public static void Add(byte playerId)
{
playerIdList.Add(playerId);
SetNewTarget();
_ = new LateTask(SetNewTarget, 8f, "Set Postman First Target");
if (!AmongUsClient.Instance.AmHost) return;
if (!Main.ResetCamPlayerList.Contains(playerId))
@@ -48,7 +49,7 @@ public static class Postman
public static bool IsEnable => playerIdList.Any();
public static void SetKillCooldown(byte id) => Main.AllPlayerKillCooldown[id] = KillCooldown.GetFloat();
public static void ApplyGameOptions(IGameOptions opt) => opt.SetVision(HasImpostorVision.GetBool());
private static void SetNewTarget()
public static void SetNewTarget()
{
byte tempTarget = byte.MaxValue;
@@ -84,7 +85,7 @@ public static class Postman
if (target.PlayerId == Target)
{
SetNewTarget();
killer.NotifyPostman(Translator.GetString("PostmanCorrectDeliver"));
killer.NotifyPostman(GetString("PostmanCorrectDeliver"));
}
else
{
@@ -93,20 +94,20 @@ public static class Postman
}
}
public static void OnTargetDeath(PlayerControl killer, PlayerControl target)
public static void OnTargetDeath()
{
if (killer == null || target == null) return;
if (IsFinished) return;
var postman = Utils.GetPlayerById(playerIdList[0]);
if (DieWhenTargetDies.GetBool())
{
killer.RpcMurderPlayerV3(killer);
Main.PlayerStates[killer.PlayerId].deathReason = PlayerState.DeathReason.Suicide;
postman.RpcMurderPlayerV3(postman);
Main.PlayerStates[postman.PlayerId].deathReason = PlayerState.DeathReason.Suicide;
}
else
{
SetNewTarget();
killer.NotifyPostman(Translator.GetString("PostmanTargetDied"));
postman.NotifyPostman(GetString("PostmanTargetDied"));
}
}
@@ -115,8 +116,8 @@ public static class Postman
var sb = new StringBuilder();
sb.AppendLine(baseText);
if (!IsFinished) sb.AppendLine(string.Format(Translator.GetString("PostmanGetNewTarget"), Utils.GetPlayerById(Target)));
else sb.AppendLine(Translator.GetString("PostmanDone"));
if (!IsFinished) sb.AppendLine(string.Format(GetString("PostmanGetNewTarget"), Utils.GetPlayerById(Target)));
else sb.AppendLine(GetString("PostmanDone"));
pc.Notify(sb.ToString());
}
@@ -125,14 +126,14 @@ public static class Postman
{
var sb = new StringBuilder();
if (!IsFinished) sb.AppendLine(string.Format(Translator.GetString("PostmanTarget"), Utils.GetPlayerById(Target)));
else sb.AppendLine(Translator.GetString("PostmanDone"));
if (!IsFinished) sb.AppendLine(string.Format(GetString("PostmanTarget"), Utils.GetPlayerById(Target)));
else sb.AppendLine(GetString("PostmanDone"));
return sb.ToString();
}
public static string GetProgressText(byte playerId)
{
return !IsFinished ? string.Format(Translator.GetString("PostmanTarget"), Utils.GetPlayerById(Target)) : string.Empty;
return !IsFinished ? string.Format(GetString("PostmanTarget"), Utils.GetPlayerById(Target)) : "<color=#00ff00>✓</color>";
}
}
+10 -7
View File
@@ -207,17 +207,20 @@ public static class Romantic
Logger.Info($"Crew/nnk Romantic Partner Died changing {pc.GetNameWithRole().RemoveHtmlTags()} to Vengeful romantic", "Romantic");
var killerId = player.GetRealKiller().PlayerId;
VengefulRomantic.Add(pc.PlayerId, killerId);
VengefulRomantic.SendRPC(pc.PlayerId);
pc.RpcSetCustomRole(CustomRoles.VengefulRomantic);
if (Utils.GetPlayerById(killerId) != null)
{
VengefulRomantic.Add(pc.PlayerId, killerId);
VengefulRomantic.SendRPC(pc.PlayerId);
pc.RpcSetCustomRole(CustomRoles.VengefulRomantic);
}
}, 0.2f, "Convert to Vengeful Romantic");
}
Utils.NotifyRoles(SpecifySeer: Utils.GetPlayerById(Romantic));
Utils.NotifyRoles(SpecifySeer: pc);
Utils.GetPlayerById(Romantic).ResetKillCooldown();
Utils.GetPlayerById(Romantic).SetKillCooldown();
Utils.GetPlayerById(Romantic).MarkDirtySettings();
pc.ResetKillCooldown();
pc.SetKillCooldown();
pc.MarkDirtySettings();
}
}