mirror of
https://github.com/Gurge44/EndlessHostRoles.git
synced 2026-10-23 10:46:55 +00:00
Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
087fe9288d | ||
|
|
817c786c2f | ||
|
|
ab3b2e517d | ||
|
|
16170126da | ||
|
|
cb8b161cac | ||
|
|
b1ef23682e |
No files matched your search
@@ -1,5 +1,4 @@
|
||||
using AmongUs.GameOptions;
|
||||
using HarmonyLib;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
@@ -82,6 +81,8 @@ internal class CustomRoleSelector
|
||||
|
||||
foreach (var id in Main.SetRoles.Keys.Where(id => Utils.GetPlayerById(id) == null).ToArray()) Main.SetRoles.Remove(id);
|
||||
|
||||
Dictionary<CustomRoles, (int ASSIGNED, int COUNT)> RoleCounts = [];
|
||||
|
||||
System.Collections.IList list = Enum.GetValues(typeof(CustomRoles));
|
||||
for (int i1 = 0; i1 < list.Count; i1++)
|
||||
{
|
||||
@@ -100,10 +101,14 @@ internal class CustomRoleSelector
|
||||
case CustomRoles.NotAssigned:
|
||||
continue;
|
||||
}
|
||||
for (int i = 0; i < role.GetCount(); i++)
|
||||
var roleCount = role.GetCount();
|
||||
RoleCounts[role] = (0, roleCount);
|
||||
for (int i = 0; i < roleCount; i++)
|
||||
roleList.Add(role);
|
||||
}
|
||||
|
||||
Logger.Info(string.Join(", ", RoleCounts.Select(x => $"{x.Key}: {x.Value.COUNT}")), "RoleCounts");
|
||||
|
||||
// Career setting: priority
|
||||
for (int i2 = 0; i2 < roleList.Count; i2++)
|
||||
{
|
||||
@@ -168,9 +173,22 @@ internal class CustomRoleSelector
|
||||
for (int i = 0; i < optImpNum; i++)
|
||||
{
|
||||
ImpOnList.Add(CustomRoles.ImpostorTOHE);
|
||||
Logger.Warn("No Impostor roles are enabled, adding a vanilla impostor to the game", "CustomRoleSelector");
|
||||
}
|
||||
}
|
||||
|
||||
LogRoleChancePool();
|
||||
|
||||
void LogRoleChancePool()
|
||||
{
|
||||
Logger.Info(string.Join(", ", ImpRateList.Select(p => p.ToString())), "ImpChancePool");
|
||||
Logger.Info(string.Join(", ", NeutralKillingRateList.Select(p => p.ToString())), "NKChancePool");
|
||||
Logger.Info(string.Join(", ", NonNeutralKillingRateList.Select(p => p.ToString())), "NNKChancePool");
|
||||
Logger.Info(string.Join(", ", roleRateList.Select(p => p.ToString())), "CrewChancePool");
|
||||
|
||||
Logger.Info(string.Join(", ", RoleCounts.Select(p => $"{p.Key}: {p.Value.ASSIGNED}/{p.Value.COUNT}")), "AssignedCount");
|
||||
}
|
||||
|
||||
// Assign roles set to ALWAYS (impostors)
|
||||
while (ImpOnList.Count > 0)
|
||||
{
|
||||
@@ -188,10 +206,12 @@ internal class CustomRoleSelector
|
||||
while (ImpRateList.Count > 0)
|
||||
{
|
||||
var select = ImpRateList[rd.Next(0, ImpRateList.Count)];
|
||||
while (ImpRateList.Contains(select)) ImpRateList.Remove(select);
|
||||
var (ASSIGNED, COUNT) = RoleCounts[select];
|
||||
rolesToAssign.Add(select);
|
||||
readyRoleNum++;
|
||||
Logger.Info(select.ToString() + " added to the impostor role waiting list", "CustomRoleSelector");
|
||||
RoleCounts[select] = (ASSIGNED + 1, COUNT);
|
||||
if (ASSIGNED + 1 >= COUNT) while (ImpRateList.Contains(select)) ImpRateList.Remove(select);
|
||||
if (readyRoleNum >= playerCount) goto EndOfAssign;
|
||||
if (readyRoleNum >= optImpNum) break;
|
||||
}
|
||||
@@ -216,11 +236,13 @@ internal class CustomRoleSelector
|
||||
while (NonNeutralKillingRateList.Count > 0 && optNonNeutralKillingNum > 0)
|
||||
{
|
||||
var select = NonNeutralKillingRateList[rd.Next(0, NonNeutralKillingRateList.Count)];
|
||||
while (NonNeutralKillingRateList.Contains(select)) NonNeutralKillingRateList.Remove(select);
|
||||
var (ASSIGNED, COUNT) = RoleCounts[select];
|
||||
rolesToAssign.Add(select);
|
||||
readyRoleNum++;
|
||||
readyNonNeutralKillingNum += select.GetCount();
|
||||
Logger.Info(select.ToString() + " added to neutral role waiting list", "CustomRoleSelector");
|
||||
RoleCounts[select] = (ASSIGNED + 1, COUNT);
|
||||
if (ASSIGNED + 1 >= COUNT) while (NonNeutralKillingRateList.Contains(select)) NonNeutralKillingRateList.Remove(select);
|
||||
if (readyRoleNum >= playerCount) goto EndOfAssign;
|
||||
if (readyNonNeutralKillingNum >= optNonNeutralKillingNum) break;
|
||||
}
|
||||
@@ -245,11 +267,13 @@ internal class CustomRoleSelector
|
||||
while (NeutralKillingRateList.Count > 0 && optNeutralKillingNum > 0)
|
||||
{
|
||||
var select = NeutralKillingRateList[rd.Next(0, NeutralKillingRateList.Count)];
|
||||
while (NeutralKillingRateList.Contains(select)) NeutralKillingRateList.Remove(select);
|
||||
var (ASSIGNED, COUNT) = RoleCounts[select];
|
||||
rolesToAssign.Add(select);
|
||||
readyRoleNum++;
|
||||
readyNeutralKillingNum += select.GetCount();
|
||||
Logger.Info(select.ToString() + " added to neutral role waiting list", "CustomRoleSelector");
|
||||
RoleCounts[select] = (ASSIGNED + 1, COUNT);
|
||||
if (ASSIGNED + 1 >= COUNT) while (NeutralKillingRateList.Contains(select)) NeutralKillingRateList.Remove(select);
|
||||
if (readyRoleNum >= playerCount) goto EndOfAssign;
|
||||
if (readyNeutralKillingNum >= optNeutralKillingNum) break;
|
||||
}
|
||||
@@ -271,16 +295,20 @@ internal class CustomRoleSelector
|
||||
while (roleRateList.Count > 0)
|
||||
{
|
||||
var select = roleRateList[rd.Next(0, roleRateList.Count)];
|
||||
while (roleRateList.Contains(select)) roleRateList.Remove(select);
|
||||
var (ASSIGNED, COUNT) = RoleCounts[select];
|
||||
rolesToAssign.Add(select);
|
||||
readyRoleNum++;
|
||||
Logger.Info(select.ToString() + " joined the crew role waiting list", "CustomRoleSelector");
|
||||
RoleCounts[select] = (ASSIGNED + 1, COUNT);
|
||||
if (ASSIGNED + 1 >= COUNT) while (roleRateList.Contains(select)) roleRateList.Remove(select);
|
||||
if (readyRoleNum >= playerCount) goto EndOfAssign;
|
||||
}
|
||||
}
|
||||
|
||||
EndOfAssign:
|
||||
|
||||
LogRoleChancePool();
|
||||
|
||||
if (rd.Next(0, 100) < Options.SunnyboyChance.GetInt() && rolesToAssign.Remove(CustomRoles.Jester)) rolesToAssign.Add(CustomRoles.Sunnyboy);
|
||||
if (rd.Next(0, 100) < Sans.BardChance.GetInt() && rolesToAssign.Remove(CustomRoles.Sans)) rolesToAssign.Add(CustomRoles.Bard);
|
||||
if (rd.Next(0, 100) < Options.NukerChance.GetInt() && rolesToAssign.Remove(CustomRoles.Bomber)) rolesToAssign.Add(CustomRoles.Nuker);
|
||||
|
||||
@@ -1106,6 +1106,7 @@ internal static class CustomRolesHelper
|
||||
{
|
||||
return role is
|
||||
CustomRoles.Sheriff or
|
||||
CustomRoles.Admirer or
|
||||
CustomRoles.Medic or
|
||||
CustomRoles.CopyCat or
|
||||
//CustomRoles.Reverie or
|
||||
@@ -1131,6 +1132,7 @@ internal static class CustomRolesHelper
|
||||
CustomRoles.Mayor or
|
||||
CustomRoles.Paranoia or
|
||||
CustomRoles.Grenadier or
|
||||
CustomRoles.Veteran or
|
||||
CustomRoles.Lighter or
|
||||
CustomRoles.SecurityGuard or
|
||||
CustomRoles.DovesOfNeace or
|
||||
@@ -1139,6 +1141,11 @@ internal static class CustomRolesHelper
|
||||
CustomRoles.Sapper or
|
||||
CustomRoles.CameraMan or
|
||||
CustomRoles.NiceHacker or
|
||||
CustomRoles.Druid or
|
||||
CustomRoles.Tunneler or
|
||||
CustomRoles.Tornado or
|
||||
CustomRoles.Sentinel or
|
||||
CustomRoles.Lookout or
|
||||
CustomRoles.Sniper or
|
||||
CustomRoles.Warlock or
|
||||
CustomRoles.Assassin or
|
||||
@@ -1154,7 +1161,10 @@ internal static class CustomRolesHelper
|
||||
CustomRoles.Glitch or
|
||||
CustomRoles.Magician or
|
||||
CustomRoles.WeaponMaster or
|
||||
CustomRoles.Veteran;
|
||||
CustomRoles.Enderman or
|
||||
CustomRoles.Mycologist or
|
||||
CustomRoles.Hookshot or
|
||||
CustomRoles.Sprayer;
|
||||
}
|
||||
public static bool NeedUpdateOnLights(this CustomRoles role)
|
||||
{
|
||||
@@ -1776,7 +1786,7 @@ internal static class CustomRolesHelper
|
||||
_ => role.IsImpostorTeam() ? CountTypes.Impostor : CountTypes.Crew,
|
||||
};
|
||||
|
||||
public static bool HasSubRole(this PlayerControl pc) => Main.PlayerStates[pc.PlayerId].SubRoles.Any();
|
||||
public static bool HasSubRole(this PlayerControl pc) => Main.PlayerStates[pc.PlayerId].SubRoles.Count > 0;
|
||||
}
|
||||
public enum CustomRoleTypes
|
||||
{
|
||||
|
||||
@@ -384,7 +384,7 @@ static class ExtendedPlayerControl
|
||||
public static string GetSubRoleName(this PlayerControl player, bool forUser = false)
|
||||
{
|
||||
var SubRoles = Main.PlayerStates[player.PlayerId].SubRoles.ToArray();
|
||||
if (!SubRoles.Any()) return string.Empty;
|
||||
if (SubRoles.Length == 0) return string.Empty;
|
||||
var sb = new StringBuilder();
|
||||
foreach (CustomRoles role in SubRoles)
|
||||
{
|
||||
|
||||
@@ -41,7 +41,7 @@ public class PlayerGameOptionsSender(PlayerControl player) : GameOptionsSender
|
||||
|
||||
public static void SetDirtyToAllV3()
|
||||
{
|
||||
foreach (var sender in AllSenders.OfType<PlayerGameOptionsSender>().Where(sender => !sender.IsDirty && sender.player.IsAlive() && ((Main.GrenadierBlinding.Any() && (sender.player.GetCustomRole().IsImpostor() || (sender.player.GetCustomRole().IsNeutral() && Options.GrenadierCanAffectNeutral.GetBool()))) || (Main.MadGrenadierBlinding.Any() && !sender.player.GetCustomRole().IsImpostorTeam() && !sender.player.Is(CustomRoles.Madmate)))).ToArray())
|
||||
foreach (var sender in AllSenders.OfType<PlayerGameOptionsSender>().Where(sender => !sender.IsDirty && sender.player.IsAlive() && ((Main.GrenadierBlinding.Count > 0 && (sender.player.GetCustomRole().IsImpostor() || (sender.player.GetCustomRole().IsNeutral() && Options.GrenadierCanAffectNeutral.GetBool()))) || (Main.MadGrenadierBlinding.Count > 0 && !sender.player.GetCustomRole().IsImpostorTeam() && !sender.player.Is(CustomRoles.Madmate)))).ToArray())
|
||||
{
|
||||
sender.SetDirty();
|
||||
}
|
||||
@@ -668,11 +668,11 @@ public class PlayerGameOptionsSender(PlayerControl player) : GameOptionsSender
|
||||
Main.KillGhoul.Add(player.PlayerId);
|
||||
}
|
||||
if (
|
||||
(Main.GrenadierBlinding.Any() &&
|
||||
(Main.GrenadierBlinding.Count > 0 &&
|
||||
(player.GetCustomRole().IsImpostor() ||
|
||||
(player.GetCustomRole().IsNeutral() && Options.GrenadierCanAffectNeutral.GetBool()))
|
||||
) || (
|
||||
Main.MadGrenadierBlinding.Any() && !player.GetCustomRole().IsImpostorTeam() && !player.Is(CustomRoles.Madmate))
|
||||
Main.MadGrenadierBlinding.Count > 0 && !player.GetCustomRole().IsImpostorTeam() && !player.Is(CustomRoles.Madmate))
|
||||
)
|
||||
{
|
||||
{
|
||||
@@ -684,7 +684,7 @@ public class PlayerGameOptionsSender(PlayerControl player) : GameOptionsSender
|
||||
|
||||
switch (player.GetCustomRole())
|
||||
{
|
||||
case CustomRoles.Lighter when Main.Lighter.Any():
|
||||
case CustomRoles.Lighter when Main.Lighter.Count > 0:
|
||||
opt.SetVisionV2();
|
||||
if (Utils.IsActive(SystemTypes.Electrical)) opt.SetFloat(FloatOptionNames.CrewLightMod, Options.LighterVisionOnLightsOut.GetFloat() * 5);
|
||||
else opt.SetFloat(FloatOptionNames.CrewLightMod, Options.LighterVisionNormal.GetFloat());
|
||||
@@ -710,7 +710,7 @@ public class PlayerGameOptionsSender(PlayerControl player) : GameOptionsSender
|
||||
opt.SetFloat(FloatOptionNames.ImpostorLightMod, Sentinel.LoweredVision.GetFloat());
|
||||
}
|
||||
|
||||
/* if ((Main.FlashbangInProtect.Any() && Main.ForFlashbang.Contains(player.PlayerId) && (!player.GetCustomRole().IsCrewmate())))
|
||||
/* if ((Main.FlashbangInProtect.Count > 0 && Main.ForFlashbang.Contains(player.PlayerId) && (!player.GetCustomRole().IsCrewmate())))
|
||||
{
|
||||
opt.SetVision(false);
|
||||
opt.SetFloat(FloatOptionNames.CrewLightMod, Options.FlashbangVision.GetFloat());
|
||||
|
||||
@@ -322,7 +322,7 @@ public class TaskState
|
||||
foreach (SystemTypes sys in Enum.GetValues(typeof(SystemTypes)))
|
||||
if (Utils.IsActive(sys)) SysList.Add(sys);
|
||||
|
||||
if (SysList.Any())
|
||||
if (SysList.Count > 0)
|
||||
{
|
||||
var SbSys = SysList[IRandom.Instance.Next(0, SysList.Count)];
|
||||
|
||||
|
||||
+3
-3
@@ -66,7 +66,7 @@ public static class Utils
|
||||
_ = new LateTask(() =>
|
||||
{
|
||||
AmongUsClient.Instance.ExitGame(DisconnectReasons.Custom);
|
||||
Logger.Fatal($"{text} 错误,已断开游戏", "Anti-black");
|
||||
Logger.Fatal($"{text} error, disconnected from game", "Anti-black");
|
||||
}, 8f, "Anti-Black Exit Game");
|
||||
}
|
||||
}
|
||||
@@ -75,7 +75,7 @@ public static class Utils
|
||||
{
|
||||
foreach (PlayerControl pc in Main.AllAlivePlayerControls)
|
||||
{
|
||||
TP(pc.NetTransform, location);
|
||||
pc.TP(location);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1926,7 +1926,7 @@ public static class Utils
|
||||
}
|
||||
}
|
||||
}
|
||||
return playerRooms.Any() ? playerRooms : null;
|
||||
return playerRooms.Count > 0 ? playerRooms : null;
|
||||
}
|
||||
public static PlayerControl GetPlayerById(int PlayerId) => Main.AllPlayerControls.FirstOrDefault(pc => pc.PlayerId == PlayerId);
|
||||
public static GameData.PlayerInfo GetPlayerInfoById(int PlayerId) => GameData.Instance.AllPlayers.ToArray().FirstOrDefault(info => info.PlayerId == PlayerId);
|
||||
|
||||
@@ -28,7 +28,7 @@ class GameEndChecker
|
||||
|
||||
if (Options.CurrentGameMode is CustomGameMode.SoloKombat or CustomGameMode.FFA or CustomGameMode.MoveAndStop)
|
||||
{
|
||||
if (CustomWinnerHolder.WinnerIds.Any() || CustomWinnerHolder.WinnerTeam != CustomWinner.Default)
|
||||
if (CustomWinnerHolder.WinnerIds.Count > 0 || CustomWinnerHolder.WinnerTeam != CustomWinner.Default)
|
||||
{
|
||||
ShipStatus.Instance.enabled = false;
|
||||
StartEndGame(reason);
|
||||
@@ -533,7 +533,7 @@ class GameEndChecker
|
||||
public override bool CheckForEndGame(out GameOverReason reason)
|
||||
{
|
||||
reason = GameOverReason.ImpostorByKill;
|
||||
if (CustomWinnerHolder.WinnerIds.Any()) return false;
|
||||
if (CustomWinnerHolder.WinnerIds.Count > 0) return false;
|
||||
if (CheckGameEndByLivingPlayers(out reason)) return true;
|
||||
return false;
|
||||
}
|
||||
@@ -561,7 +561,7 @@ class GameEndChecker
|
||||
public override bool CheckForEndGame(out GameOverReason reason)
|
||||
{
|
||||
reason = GameOverReason.ImpostorByKill;
|
||||
if (CustomWinnerHolder.WinnerIds.Any()) return false;
|
||||
if (CustomWinnerHolder.WinnerIds.Count > 0) return false;
|
||||
if (CheckGameEndByLivingPlayers(out reason)) return true;
|
||||
return false;
|
||||
}
|
||||
@@ -618,7 +618,7 @@ class GameEndChecker
|
||||
public override bool CheckForEndGame(out GameOverReason reason)
|
||||
{
|
||||
reason = GameOverReason.ImpostorByKill;
|
||||
if (CustomWinnerHolder.WinnerIds.Any()) return false;
|
||||
if (CustomWinnerHolder.WinnerIds.Count > 0) return false;
|
||||
if (CheckGameEndByLivingPlayers(out reason)) return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
+2
-2
@@ -69,7 +69,7 @@ class HudManagerPatch
|
||||
OverriddenRolesText.fontSize = OverriddenRolesText.fontSizeMax = OverriddenRolesText.fontSizeMin = 2f;
|
||||
}
|
||||
|
||||
if (Main.SetRoles.Any() || Main.SetAddOns.Any())
|
||||
if (Main.SetRoles.Count > 0 || Main.SetAddOns.Count > 0)
|
||||
{
|
||||
Dictionary<byte, string> resultText = [];
|
||||
bool first = true;
|
||||
@@ -81,7 +81,7 @@ class HudManagerPatch
|
||||
resultText[item.Key] = text;
|
||||
first = false;
|
||||
}
|
||||
if (!Main.SetRoles.Any()) first = true;
|
||||
if (Main.SetRoles.Count == 0) first = true;
|
||||
foreach (var item in Main.SetAddOns)
|
||||
{
|
||||
for (int i = 0; i < item.Value.Count; i++)
|
||||
|
||||
@@ -330,7 +330,7 @@ class ExternalRpcPetPatch
|
||||
cpdistance.Add(p, dis);
|
||||
Logger.Info($"{p?.Data?.PlayerName}'s distance: {dis}", "Warlock");
|
||||
}
|
||||
if (cpdistance.Any())
|
||||
if (cpdistance.Count > 0)
|
||||
{
|
||||
var min = cpdistance.OrderBy(c => c.Value).FirstOrDefault();
|
||||
PlayerControl targetw = min.Key;
|
||||
|
||||
+127
-124
@@ -692,6 +692,7 @@ class CheckMurderPatch
|
||||
killer.Notify("....", dur);
|
||||
_ = new LateTask(() =>
|
||||
{
|
||||
if (Vector2.Distance(killer.Pos(), target.Pos()) > 2f) return;
|
||||
target.TP(Pelican.GetBlackRoomPS());
|
||||
target.Suicide(PlayerState.DeathReason.Kill, killer);
|
||||
killer.SetKillCooldown();
|
||||
@@ -1425,7 +1426,7 @@ class ShapeshiftPatch
|
||||
cpdistance.Add(p, dis);
|
||||
Logger.Info($"{p?.Data?.PlayerName}の位置{dis}", "Warlock");
|
||||
}
|
||||
if (cpdistance.Any())
|
||||
if (cpdistance.Count > 0)
|
||||
{
|
||||
var min = cpdistance.OrderBy(c => c.Value).FirstOrDefault();
|
||||
PlayerControl targetw = min.Key;
|
||||
@@ -2018,7 +2019,7 @@ class FixedUpdatePatch
|
||||
|
||||
public static async void Postfix(PlayerControl __instance)
|
||||
{
|
||||
if (!DevManager.DevUserList.Any(x => x.Code == EOSManager.Instance.friendCode && x.IsUp) && !Main.UseVersionProtocol.Value)
|
||||
if (!Main.UseVersionProtocol.Value && !DevManager.DevUserList.Any(x => x.Code == EOSManager.Instance.friendCode && x.IsUp))
|
||||
{
|
||||
Main.UseVersionProtocol.Value = true;
|
||||
}
|
||||
@@ -2026,18 +2027,19 @@ class FixedUpdatePatch
|
||||
if (__instance == null) return;
|
||||
if (!GameStates.IsModHost) return;
|
||||
|
||||
if (GameStates.IsInTask && ReportDeadBodyPatch.CanReport[__instance.PlayerId] && ReportDeadBodyPatch.WaitReport[__instance.PlayerId].Any())
|
||||
byte id = __instance.PlayerId;
|
||||
if (GameStates.IsInTask && ReportDeadBodyPatch.CanReport[id] && ReportDeadBodyPatch.WaitReport[id].Count > 0)
|
||||
{
|
||||
if (Glitch.hackedIdList.ContainsKey(__instance.PlayerId))
|
||||
if (Glitch.hackedIdList.ContainsKey(id))
|
||||
{
|
||||
__instance.Notify(string.Format(GetString("HackedByGlitch"), "Report"));
|
||||
Logger.Info("Dead Body Report Blocked (player is hacked by Glitch)", "FixedUpdate.ReportDeadBody");
|
||||
ReportDeadBodyPatch.WaitReport[__instance.PlayerId].Clear();
|
||||
ReportDeadBodyPatch.WaitReport[id].Clear();
|
||||
}
|
||||
else
|
||||
{
|
||||
var info = ReportDeadBodyPatch.WaitReport[__instance.PlayerId][0];
|
||||
ReportDeadBodyPatch.WaitReport[__instance.PlayerId].Clear();
|
||||
var info = ReportDeadBodyPatch.WaitReport[id][0];
|
||||
ReportDeadBodyPatch.WaitReport[id].Clear();
|
||||
Logger.Info($"{__instance.GetNameWithRole().RemoveHtmlTags()}:通報可能になったため通報処理を行います", "ReportDeadbody");
|
||||
__instance.ReportDeadBody(info);
|
||||
}
|
||||
@@ -2045,17 +2047,17 @@ class FixedUpdatePatch
|
||||
|
||||
if (Options.DontUpdateDeadPlayers.GetBool() && !__instance.IsAlive())
|
||||
{
|
||||
DeadBufferTime.TryAdd(__instance.PlayerId, IRandom.Instance.Next(50, 70));
|
||||
DeadBufferTime[__instance.PlayerId]--;
|
||||
if (DeadBufferTime[__instance.PlayerId] > 0) return;
|
||||
else DeadBufferTime[__instance.PlayerId] = IRandom.Instance.Next(50, 70);
|
||||
DeadBufferTime.TryAdd(id, IRandom.Instance.Next(50, 70));
|
||||
DeadBufferTime[id]--;
|
||||
if (DeadBufferTime[id] > 0) return;
|
||||
else DeadBufferTime[id] = IRandom.Instance.Next(50, 70);
|
||||
}
|
||||
|
||||
if (Options.LowLoadMode.GetBool())
|
||||
{
|
||||
BufferTime.TryAdd(__instance.PlayerId, 10);
|
||||
BufferTime[__instance.PlayerId]--;
|
||||
if (BufferTime[__instance.PlayerId] % 2 == 1 && Options.DeepLowLoad.GetBool()) return;
|
||||
BufferTime.TryAdd(id, 10);
|
||||
BufferTime[id]--;
|
||||
if (BufferTime[id] % 2 == 1 && Options.DeepLowLoad.GetBool()) return;
|
||||
}
|
||||
|
||||
//if (Options.DeepLowLoad.GetBool()) await Task.Run(() => { DoPostfix(__instance); });
|
||||
@@ -2073,12 +2075,13 @@ class FixedUpdatePatch
|
||||
public static Task DoPostfix(PlayerControl __instance)
|
||||
{
|
||||
var player = __instance;
|
||||
var playerId = player.PlayerId;
|
||||
|
||||
bool lowLoad = false;
|
||||
if (Options.LowLoadMode.GetBool())
|
||||
{
|
||||
if (BufferTime[player.PlayerId] > 0) lowLoad = true;
|
||||
else BufferTime[player.PlayerId] = 10;
|
||||
if (BufferTime[playerId] > 0) lowLoad = true;
|
||||
else BufferTime[playerId] = 10;
|
||||
}
|
||||
|
||||
if (Sniper.IsEnable) Sniper.OnFixedUpdate(player);
|
||||
@@ -2088,11 +2091,8 @@ class FixedUpdatePatch
|
||||
NameNotifyManager.OnFixedUpdate(player);
|
||||
TargetArrow.OnFixedUpdate(player);
|
||||
LocateArrow.OnFixedUpdate(player);
|
||||
}
|
||||
|
||||
if (!lowLoad)
|
||||
{
|
||||
if (RPCHandlerPatch.ReportDeadBodyRPCs.Remove(player.PlayerId))
|
||||
if (RPCHandlerPatch.ReportDeadBodyRPCs.Remove(playerId))
|
||||
Logger.Info($"Cleared ReportDeadBodyRPC Count for {player.GetRealName().RemoveHtmlTags()}", "FixedUpdatePatch");
|
||||
}
|
||||
|
||||
@@ -2123,14 +2123,14 @@ class FixedUpdatePatch
|
||||
}
|
||||
}
|
||||
|
||||
if (!Main.KillTimers.ContainsKey(player.PlayerId))
|
||||
Main.KillTimers.Add(player.PlayerId, 10f);
|
||||
else if (!player.inVent && !player.MyPhysics.Animations.IsPlayingEnterVentAnimation() && Main.KillTimers[player.PlayerId] > 0)
|
||||
Main.KillTimers[player.PlayerId] -= Time.fixedDeltaTime;
|
||||
if (!Main.KillTimers.ContainsKey(playerId))
|
||||
Main.KillTimers.Add(playerId, 10f);
|
||||
else if (!player.inVent && !player.MyPhysics.Animations.IsPlayingEnterVentAnimation() && Main.KillTimers[playerId] > 0)
|
||||
Main.KillTimers[playerId] -= Time.fixedDeltaTime;
|
||||
|
||||
if (GameStates.IsInTask) KeepProtection.OnFixedUpdate();
|
||||
|
||||
if (DoubleTrigger.FirstTriggerTimer.Any()) DoubleTrigger.OnFixedUpdate(player);
|
||||
if (DoubleTrigger.FirstTriggerTimer.Count > 0) DoubleTrigger.OnFixedUpdate(player);
|
||||
switch (player.GetCustomRole())
|
||||
{
|
||||
case CustomRoles.Vampire:
|
||||
@@ -2217,13 +2217,13 @@ class FixedUpdatePatch
|
||||
player.RpcSetCustomRole(CustomRoles.Pestilence);
|
||||
player.Notify(GetString("PlagueBearerToPestilence"));
|
||||
player.RpcGuardAndKill(player);
|
||||
if (!PlagueBearer.PestilenceList.Contains(player.PlayerId))
|
||||
PlagueBearer.PestilenceList.Add(player.PlayerId);
|
||||
PlagueBearer.SetKillCooldownPestilence(player.PlayerId);
|
||||
PlagueBearer.playerIdList.Remove(player.PlayerId);
|
||||
if (!PlagueBearer.PestilenceList.Contains(playerId))
|
||||
PlagueBearer.PestilenceList.Add(playerId);
|
||||
PlagueBearer.SetKillCooldownPestilence(playerId);
|
||||
PlagueBearer.playerIdList.Remove(playerId);
|
||||
}
|
||||
|
||||
if (!lowLoad && Main.PlayerStates.TryGetValue(player.PlayerId, out var playerState) && GameStates.IsInTask)
|
||||
if (!lowLoad && Main.PlayerStates.TryGetValue(playerId, out var playerState) && GameStates.IsInTask)
|
||||
{
|
||||
if (playerState.SubRoles.Contains(CustomRoles.Damocles))
|
||||
{
|
||||
@@ -2237,12 +2237,16 @@ class FixedUpdatePatch
|
||||
|
||||
if (!lowLoad && Options.UsePets.GetBool() && GameStates.IsInTask)
|
||||
{
|
||||
if (Main.AbilityCD.TryGetValue(player.PlayerId, out var timer) && timer.START_TIMESTAMP + timer.TOTALCD < GetTimeStamp())
|
||||
if (Main.AbilityCD.TryGetValue(playerId, out var timer))
|
||||
{
|
||||
Main.AbilityCD.Remove(player.PlayerId);
|
||||
if (timer.START_TIMESTAMP + timer.TOTALCD < GetTimeStamp())
|
||||
{
|
||||
Main.AbilityCD.Remove(playerId);
|
||||
}
|
||||
if (!player.IsModClient()) NotifyRoles(SpecifySeer: player, SpecifyTarget: player);
|
||||
}
|
||||
if (Main.AbilityCD.ContainsKey(player.PlayerId) && !player.IsModClient()) NotifyRoles(SpecifySeer: player, SpecifyTarget: player);
|
||||
|
||||
if (Main.AbilityCD.ContainsKey(playerId) && !player.IsModClient()) NotifyRoles(SpecifySeer: player, SpecifyTarget: player);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2252,7 +2256,7 @@ class FixedUpdatePatch
|
||||
Duellist.OnFixedUpdate();
|
||||
}
|
||||
|
||||
if (GameStates.IsInTask && Agitater.IsEnable && Agitater.AgitaterHasBombed && Agitater.CurrentBombedPlayer == player.PlayerId)
|
||||
if (GameStates.IsInTask && Agitater.IsEnable && Agitater.AgitaterHasBombed && Agitater.CurrentBombedPlayer == playerId)
|
||||
{
|
||||
if (!player.IsAlive())
|
||||
{
|
||||
@@ -2266,13 +2270,13 @@ class FixedUpdatePatch
|
||||
foreach (var target in PlayerControl.AllPlayerControls)
|
||||
{
|
||||
if (!target.IsAlive()) continue;
|
||||
if (target.PlayerId != player.PlayerId && target.PlayerId != Agitater.LastBombedPlayer && !target.Data.IsDead)
|
||||
if (target.PlayerId != playerId && target.PlayerId != Agitater.LastBombedPlayer && !target.Data.IsDead)
|
||||
{
|
||||
dis = Vector2.Distance(agitaterPos, target.transform.position);
|
||||
targetDistance.Add(target.PlayerId, dis);
|
||||
}
|
||||
}
|
||||
if (targetDistance.Any())
|
||||
if (targetDistance.Count > 0)
|
||||
{
|
||||
var min = targetDistance.OrderBy(c => c.Value).FirstOrDefault();
|
||||
PlayerControl target = GetPlayerById(min.Key);
|
||||
@@ -2285,53 +2289,53 @@ class FixedUpdatePatch
|
||||
|
||||
|
||||
#region 女巫处理
|
||||
if (GameStates.IsInTask && Main.WarlockTimer.ContainsKey(player.PlayerId))//処理を1秒遅らせる
|
||||
if (GameStates.IsInTask && Main.WarlockTimer.ContainsKey(playerId))//処理を1秒遅らせる
|
||||
{
|
||||
if (player.IsAlive())
|
||||
{
|
||||
if (Main.WarlockTimer[player.PlayerId] >= 1f)
|
||||
if (Main.WarlockTimer[playerId] >= 1f)
|
||||
{
|
||||
player.RpcResetAbilityCooldown();
|
||||
Main.isCursed = false;//変身クールを1秒に変更
|
||||
player.MarkDirtySettings();
|
||||
Main.WarlockTimer.Remove(player.PlayerId);
|
||||
Main.WarlockTimer.Remove(playerId);
|
||||
}
|
||||
else Main.WarlockTimer[player.PlayerId] = Main.WarlockTimer[player.PlayerId] + Time.fixedDeltaTime;//時間をカウント
|
||||
else Main.WarlockTimer[playerId] = Main.WarlockTimer[playerId] + Time.fixedDeltaTime;//時間をカウント
|
||||
}
|
||||
else
|
||||
{
|
||||
Main.WarlockTimer.Remove(player.PlayerId);
|
||||
Main.WarlockTimer.Remove(playerId);
|
||||
}
|
||||
}
|
||||
//ターゲットのリセット
|
||||
#endregion
|
||||
|
||||
#region 纵火犯浇油处理
|
||||
if (GameStates.IsInTask && Main.ArsonistTimer.ContainsKey(player.PlayerId))//アーソニストが誰かを塗っているとき
|
||||
if (GameStates.IsInTask && Main.ArsonistTimer.ContainsKey(playerId))//アーソニストが誰かを塗っているとき
|
||||
{
|
||||
var arTarget = Main.ArsonistTimer[player.PlayerId].PLAYER;
|
||||
if (!player.IsAlive() || Pelican.IsEaten(player.PlayerId))
|
||||
var arTarget = Main.ArsonistTimer[playerId].PLAYER;
|
||||
if (!player.IsAlive() || Pelican.IsEaten(playerId))
|
||||
{
|
||||
Main.ArsonistTimer.Remove(player.PlayerId);
|
||||
Main.ArsonistTimer.Remove(playerId);
|
||||
NotifyRoles(SpecifySeer: __instance, SpecifyTarget: arTarget, ForceLoop: true);
|
||||
RPC.ResetCurrentDousingTarget(player.PlayerId);
|
||||
RPC.ResetCurrentDousingTarget(playerId);
|
||||
}
|
||||
else
|
||||
{
|
||||
var ar_target = Main.ArsonistTimer[player.PlayerId].PLAYER;//塗られる人
|
||||
var ar_time = Main.ArsonistTimer[player.PlayerId].TIMER;//塗った時間
|
||||
var ar_target = Main.ArsonistTimer[playerId].PLAYER;//塗られる人
|
||||
var ar_time = Main.ArsonistTimer[playerId].TIMER;//塗った時間
|
||||
if (!ar_target.IsAlive())
|
||||
{
|
||||
Main.ArsonistTimer.Remove(player.PlayerId);
|
||||
Main.ArsonistTimer.Remove(playerId);
|
||||
}
|
||||
else if (ar_time >= Options.ArsonistDouseTime.GetFloat())//時間以上一緒にいて塗れた時
|
||||
{
|
||||
player.SetKillCooldown();
|
||||
Main.ArsonistTimer.Remove(player.PlayerId);//塗が完了したのでDictionaryから削除
|
||||
Main.isDoused[(player.PlayerId, ar_target.PlayerId)] = true;//塗り完了
|
||||
Main.ArsonistTimer.Remove(playerId);//塗が完了したのでDictionaryから削除
|
||||
Main.isDoused[(playerId, ar_target.PlayerId)] = true;//塗り完了
|
||||
player.RpcSetDousedPlayer(ar_target, true);
|
||||
NotifyRoles(SpecifySeer: player, SpecifyTarget: arTarget, ForceLoop: true);//名前変更
|
||||
RPC.ResetCurrentDousingTarget(player.PlayerId);
|
||||
RPC.ResetCurrentDousingTarget(playerId);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -2340,13 +2344,13 @@ class FixedUpdatePatch
|
||||
float dis = Vector2.Distance(player.transform.position, ar_target.transform.position);//距離を出す
|
||||
if (dis <= range)//一定の距離にターゲットがいるならば時間をカウント
|
||||
{
|
||||
Main.ArsonistTimer[player.PlayerId] = (ar_target, ar_time + Time.fixedDeltaTime);
|
||||
Main.ArsonistTimer[playerId] = (ar_target, ar_time + Time.fixedDeltaTime);
|
||||
}
|
||||
else//それ以外は削除
|
||||
{
|
||||
Main.ArsonistTimer.Remove(player.PlayerId);
|
||||
Main.ArsonistTimer.Remove(playerId);
|
||||
NotifyRoles(SpecifySeer: player, SpecifyTarget: arTarget, ForceLoop: true);
|
||||
RPC.ResetCurrentDousingTarget(player.PlayerId);
|
||||
RPC.ResetCurrentDousingTarget(playerId);
|
||||
|
||||
Logger.Info($"Canceled: {player.GetNameWithRole().RemoveHtmlTags()}", "Arsonist");
|
||||
}
|
||||
@@ -2356,31 +2360,31 @@ class FixedUpdatePatch
|
||||
#endregion
|
||||
|
||||
#region 革命家拉人处理
|
||||
if (GameStates.IsInTask && Main.RevolutionistTimer.ContainsKey(player.PlayerId))//当革命家拉拢一个玩家时
|
||||
if (GameStates.IsInTask && Main.RevolutionistTimer.ContainsKey(playerId))//当革命家拉拢一个玩家时
|
||||
{
|
||||
var rvTarget = Main.RevolutionistTimer[player.PlayerId].PLAYER;
|
||||
if (!player.IsAlive() || Pelican.IsEaten(player.PlayerId))
|
||||
var rvTarget = Main.RevolutionistTimer[playerId].PLAYER;
|
||||
if (!player.IsAlive() || Pelican.IsEaten(playerId))
|
||||
{
|
||||
Main.RevolutionistTimer.Remove(player.PlayerId);
|
||||
Main.RevolutionistTimer.Remove(playerId);
|
||||
NotifyRoles(SpecifySeer: player, SpecifyTarget: rvTarget, ForceLoop: true);
|
||||
RPC.ResetCurrentDrawTarget(player.PlayerId);
|
||||
RPC.ResetCurrentDrawTarget(playerId);
|
||||
}
|
||||
else
|
||||
{
|
||||
var rv_target = Main.RevolutionistTimer[player.PlayerId].PLAYER;//拉拢的人
|
||||
var rv_time = Main.RevolutionistTimer[player.PlayerId].TIMER;//拉拢时间
|
||||
var rv_target = Main.RevolutionistTimer[playerId].PLAYER;//拉拢的人
|
||||
var rv_time = Main.RevolutionistTimer[playerId].TIMER;//拉拢时间
|
||||
if (!rv_target.IsAlive())
|
||||
{
|
||||
Main.RevolutionistTimer.Remove(player.PlayerId);
|
||||
Main.RevolutionistTimer.Remove(playerId);
|
||||
}
|
||||
else if (rv_time >= Options.RevolutionistDrawTime.GetFloat())//在一起时间超过多久
|
||||
{
|
||||
player.SetKillCooldown();
|
||||
Main.RevolutionistTimer.Remove(player.PlayerId);//拉拢完成从字典中删除
|
||||
Main.isDraw[(player.PlayerId, rv_target.PlayerId)] = true;//完成拉拢
|
||||
Main.RevolutionistTimer.Remove(playerId);//拉拢完成从字典中删除
|
||||
Main.isDraw[(playerId, rv_target.PlayerId)] = true;//完成拉拢
|
||||
player.RpcSetDrawPlayer(rv_target, true);
|
||||
NotifyRoles(SpecifySeer: player, SpecifyTarget: rv_target, ForceLoop: true);
|
||||
RPC.ResetCurrentDrawTarget(player.PlayerId);
|
||||
RPC.ResetCurrentDrawTarget(playerId);
|
||||
if (IRandom.Instance.Next(1, 100) <= Options.RevolutionistKillProbability.GetInt())
|
||||
{
|
||||
rv_target.SetRealKiller(player);
|
||||
@@ -2396,13 +2400,13 @@ class FixedUpdatePatch
|
||||
float dis = Vector2.Distance(player.transform.position, rv_target.transform.position);//超出距离
|
||||
if (dis <= range)//在一定距离内则计算时间
|
||||
{
|
||||
Main.RevolutionistTimer[player.PlayerId] = (rv_target, rv_time + Time.fixedDeltaTime);
|
||||
Main.RevolutionistTimer[playerId] = (rv_target, rv_time + Time.fixedDeltaTime);
|
||||
}
|
||||
else//否则删除
|
||||
{
|
||||
Main.RevolutionistTimer.Remove(player.PlayerId);
|
||||
Main.RevolutionistTimer.Remove(playerId);
|
||||
NotifyRoles(SpecifySeer: __instance, SpecifyTarget: rv_target);
|
||||
RPC.ResetCurrentDrawTarget(player.PlayerId);
|
||||
RPC.ResetCurrentDrawTarget(playerId);
|
||||
|
||||
Logger.Info($"Canceled: {__instance.GetNameWithRole().RemoveHtmlTags()}", "Revolutionist");
|
||||
}
|
||||
@@ -2411,18 +2415,18 @@ class FixedUpdatePatch
|
||||
}
|
||||
if (GameStates.IsInTask && player.IsDrawDone() && player.IsAlive())
|
||||
{
|
||||
if (Main.RevolutionistStart.ContainsKey(player.PlayerId)) //如果存在字典
|
||||
if (Main.RevolutionistStart.ContainsKey(playerId)) //如果存在字典
|
||||
{
|
||||
if (Main.RevolutionistLastTime.ContainsKey(player.PlayerId))
|
||||
if (Main.RevolutionistLastTime.ContainsKey(playerId))
|
||||
{
|
||||
long nowtime = GetTimeStamp();
|
||||
if (Main.RevolutionistLastTime[player.PlayerId] != nowtime) Main.RevolutionistLastTime[player.PlayerId] = nowtime;
|
||||
int time = (int)(Main.RevolutionistLastTime[player.PlayerId] - Main.RevolutionistStart[player.PlayerId]);
|
||||
if (Main.RevolutionistLastTime[playerId] != nowtime) Main.RevolutionistLastTime[playerId] = nowtime;
|
||||
int time = (int)(Main.RevolutionistLastTime[playerId] - Main.RevolutionistStart[playerId]);
|
||||
int countdown = Options.RevolutionistVentCountDown.GetInt() - time;
|
||||
Main.RevolutionistCountdown.Clear();
|
||||
if (countdown <= 0)//倒计时结束
|
||||
{
|
||||
GetDrawPlayerCount(player.PlayerId, out var y);
|
||||
GetDrawPlayerCount(playerId, out var y);
|
||||
foreach (var pc in y.Where(x => x != null && x.IsAlive()))
|
||||
{
|
||||
pc.Suicide(PlayerState.DeathReason.Sacrifice);
|
||||
@@ -2432,17 +2436,17 @@ class FixedUpdatePatch
|
||||
}
|
||||
else
|
||||
{
|
||||
Main.RevolutionistCountdown.Add(player.PlayerId, countdown);
|
||||
Main.RevolutionistCountdown.Add(playerId, countdown);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
Main.RevolutionistLastTime.TryAdd(player.PlayerId, Main.RevolutionistStart[player.PlayerId]);
|
||||
Main.RevolutionistLastTime.TryAdd(playerId, Main.RevolutionistStart[playerId]);
|
||||
}
|
||||
}
|
||||
else //如果不存在字典
|
||||
{
|
||||
Main.RevolutionistStart.TryAdd(player.PlayerId, GetTimeStamp());
|
||||
Main.RevolutionistStart.TryAdd(playerId, GetTimeStamp());
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
@@ -2457,44 +2461,44 @@ class FixedUpdatePatch
|
||||
switch (player.GetCustomRole())
|
||||
{
|
||||
case CustomRoles.Veteran when GameStates.IsInTask:
|
||||
if (Main.VeteranInProtect.TryGetValue(player.PlayerId, out var vtime) && vtime + Options.VeteranSkillDuration.GetInt() < now)
|
||||
if (Main.VeteranInProtect.TryGetValue(playerId, out var vtime) && vtime + Options.VeteranSkillDuration.GetInt() < now)
|
||||
{
|
||||
Main.VeteranInProtect.Remove(player.PlayerId);
|
||||
Main.VeteranInProtect.Remove(playerId);
|
||||
player.RpcResetAbilityCooldown();
|
||||
player.Notify(string.Format(GetString("VeteranOffGuard"), (int)Main.VeteranNumOfUsed[player.PlayerId]));
|
||||
player.Notify(string.Format(GetString("VeteranOffGuard"), (int)Main.VeteranNumOfUsed[playerId]));
|
||||
}
|
||||
break;
|
||||
|
||||
case CustomRoles.Express when GameStates.IsInTask:
|
||||
if (Main.ExpressSpeedUp.TryGetValue(player.PlayerId, out var etime) && etime + Options.ExpressSpeedDur.GetInt() < now)
|
||||
if (Main.ExpressSpeedUp.TryGetValue(playerId, out var etime) && etime + Options.ExpressSpeedDur.GetInt() < now)
|
||||
{
|
||||
Main.ExpressSpeedUp.Remove(player.PlayerId);
|
||||
Main.AllPlayerSpeed[player.PlayerId] = Main.ExpressSpeedNormal;
|
||||
Main.ExpressSpeedUp.Remove(playerId);
|
||||
Main.AllPlayerSpeed[playerId] = Main.ExpressSpeedNormal;
|
||||
player.MarkDirtySettings();
|
||||
}
|
||||
break;
|
||||
|
||||
case CustomRoles.Grenadier when GameStates.IsInTask:
|
||||
if (Main.GrenadierBlinding.TryGetValue(player.PlayerId, out var gtime) && gtime + Options.GrenadierSkillDuration.GetInt() < now)
|
||||
if (Main.GrenadierBlinding.TryGetValue(playerId, out var gtime) && gtime + Options.GrenadierSkillDuration.GetInt() < now)
|
||||
{
|
||||
Main.GrenadierBlinding.Remove(player.PlayerId);
|
||||
Main.GrenadierBlinding.Remove(playerId);
|
||||
player.RpcResetAbilityCooldown();
|
||||
player.Notify(string.Format(GetString("GrenadierSkillStop"), (int)Main.GrenadierNumOfUsed[player.PlayerId]));
|
||||
player.Notify(string.Format(GetString("GrenadierSkillStop"), (int)Main.GrenadierNumOfUsed[playerId]));
|
||||
MarkEveryoneDirtySettingsV3();
|
||||
}
|
||||
if (Main.MadGrenadierBlinding.TryGetValue(player.PlayerId, out var mgtime) && mgtime + Options.GrenadierSkillDuration.GetInt() < now)
|
||||
if (Main.MadGrenadierBlinding.TryGetValue(playerId, out var mgtime) && mgtime + Options.GrenadierSkillDuration.GetInt() < now)
|
||||
{
|
||||
Main.MadGrenadierBlinding.Remove(player.PlayerId);
|
||||
Main.MadGrenadierBlinding.Remove(playerId);
|
||||
player.RpcResetAbilityCooldown();
|
||||
player.Notify(string.Format(GetString("GrenadierSkillStop"), (int)Main.GrenadierNumOfUsed[player.PlayerId]));
|
||||
player.Notify(string.Format(GetString("GrenadierSkillStop"), (int)Main.GrenadierNumOfUsed[playerId]));
|
||||
MarkEveryoneDirtySettingsV3();
|
||||
}
|
||||
break;
|
||||
|
||||
case CustomRoles.Lighter when GameStates.IsInTask:
|
||||
if (Main.Lighter.TryGetValue(player.PlayerId, out var ltime) && ltime + Options.LighterSkillDuration.GetInt() < now)
|
||||
if (Main.Lighter.TryGetValue(playerId, out var ltime) && ltime + Options.LighterSkillDuration.GetInt() < now)
|
||||
{
|
||||
Main.Lighter.Remove(player.PlayerId);
|
||||
Main.Lighter.Remove(playerId);
|
||||
player.RpcResetAbilityCooldown();
|
||||
player.Notify(GetString("LighterSkillStop"));
|
||||
player.MarkDirtySettings();
|
||||
@@ -2502,33 +2506,33 @@ class FixedUpdatePatch
|
||||
break;
|
||||
|
||||
case CustomRoles.SecurityGuard when GameStates.IsInTask:
|
||||
if (Main.BlockSabo.TryGetValue(player.PlayerId, out var stime) && stime + Options.SecurityGuardSkillDuration.GetInt() < now)
|
||||
if (Main.BlockSabo.TryGetValue(playerId, out var stime) && stime + Options.SecurityGuardSkillDuration.GetInt() < now)
|
||||
{
|
||||
Main.BlockSabo.Remove(player.PlayerId);
|
||||
Main.BlockSabo.Remove(playerId);
|
||||
player.RpcResetAbilityCooldown();
|
||||
player.Notify(GetString("SecurityGuardSkillStop"));
|
||||
}
|
||||
break;
|
||||
|
||||
case CustomRoles.TimeMaster when GameStates.IsInTask:
|
||||
if (Main.TimeMasterInProtect.TryGetValue(player.PlayerId, out var ttime) && ttime + Options.TimeMasterSkillDuration.GetInt() < now)
|
||||
if (Main.TimeMasterInProtect.TryGetValue(playerId, out var ttime) && ttime + Options.TimeMasterSkillDuration.GetInt() < now)
|
||||
{
|
||||
Main.TimeMasterInProtect.Remove(player.PlayerId);
|
||||
Main.TimeMasterInProtect.Remove(playerId);
|
||||
player.RpcResetAbilityCooldown();
|
||||
player.Notify(GetString("TimeMasterSkillStop"), (int)Main.TimeMasterNumOfUsed[player.PlayerId]);
|
||||
player.Notify(GetString("TimeMasterSkillStop"), (int)Main.TimeMasterNumOfUsed[playerId]);
|
||||
}
|
||||
break;
|
||||
|
||||
case CustomRoles.Mario when Main.MarioVentCount[player.PlayerId] > Options.MarioVentNumWin.GetInt() && GameStates.IsInTask:
|
||||
Main.MarioVentCount[player.PlayerId] = Options.MarioVentNumWin.GetInt();
|
||||
case CustomRoles.Mario when Main.MarioVentCount[playerId] > Options.MarioVentNumWin.GetInt() && GameStates.IsInTask:
|
||||
Main.MarioVentCount[playerId] = Options.MarioVentNumWin.GetInt();
|
||||
CustomWinnerHolder.ResetAndSetWinner(CustomWinner.Mario); //马里奥这个多动症赢了
|
||||
CustomWinnerHolder.WinnerIds.Add(player.PlayerId);
|
||||
CustomWinnerHolder.WinnerIds.Add(playerId);
|
||||
break;
|
||||
|
||||
case CustomRoles.Vulture when Vulture.BodyReportCount[player.PlayerId] >= Vulture.NumberOfReportsToWin.GetInt() && GameStates.IsInTask:
|
||||
Vulture.BodyReportCount[player.PlayerId] = Vulture.NumberOfReportsToWin.GetInt();
|
||||
case CustomRoles.Vulture when Vulture.BodyReportCount[playerId] >= Vulture.NumberOfReportsToWin.GetInt() && GameStates.IsInTask:
|
||||
Vulture.BodyReportCount[playerId] = Vulture.NumberOfReportsToWin.GetInt();
|
||||
CustomWinnerHolder.ResetAndSetWinner(CustomWinner.Vulture);
|
||||
CustomWinnerHolder.WinnerIds.Add(player.PlayerId);
|
||||
CustomWinnerHolder.WinnerIds.Add(playerId);
|
||||
break;
|
||||
|
||||
case CustomRoles.Pelican:
|
||||
@@ -2576,41 +2580,41 @@ class FixedUpdatePatch
|
||||
break;
|
||||
}
|
||||
|
||||
if (Main.AllKillers.TryGetValue(player.PlayerId, out var ktime) && ktime + Options.WitnessTime.GetInt() < now) Main.AllKillers.Remove(player.PlayerId);
|
||||
if (Main.AllKillers.TryGetValue(playerId, out var ktime) && ktime + Options.WitnessTime.GetInt() < now) Main.AllKillers.Remove(playerId);
|
||||
if (GameStates.IsInTask && player.IsAlive() && Options.LadderDeath.GetBool()) FallFromLadder.FixedUpdate(player);
|
||||
if (GameStates.IsInGame) LoversSuicide();
|
||||
|
||||
#region 傀儡师处理
|
||||
if (GameStates.IsInTask && Main.PuppeteerList.ContainsKey(player.PlayerId))
|
||||
if (GameStates.IsInTask && Main.PuppeteerList.ContainsKey(playerId))
|
||||
{
|
||||
if (!player.IsAlive() || Pelican.IsEaten(player.PlayerId))
|
||||
if (!player.IsAlive() || Pelican.IsEaten(playerId))
|
||||
{
|
||||
Main.PuppeteerList.Remove(player.PlayerId);
|
||||
Main.PuppeteerDelayList.Remove(player.PlayerId);
|
||||
Main.PuppeteerDelay.Remove(player.PlayerId);
|
||||
Main.PuppeteerList.Remove(playerId);
|
||||
Main.PuppeteerDelayList.Remove(playerId);
|
||||
Main.PuppeteerDelay.Remove(playerId);
|
||||
}
|
||||
else if (Main.PuppeteerDelayList[player.PlayerId] + Options.PuppeteerManipulationEndsAfterTime.GetInt() < now && Options.PuppeteerManipulationEndsAfterFixedTime.GetBool())
|
||||
else if (Main.PuppeteerDelayList[playerId] + Options.PuppeteerManipulationEndsAfterTime.GetInt() < now && Options.PuppeteerManipulationEndsAfterFixedTime.GetBool())
|
||||
{
|
||||
Main.PuppeteerList.Remove(player.PlayerId);
|
||||
Main.PuppeteerDelayList.Remove(player.PlayerId);
|
||||
Main.PuppeteerDelay.Remove(player.PlayerId);
|
||||
Main.PuppeteerList.Remove(playerId);
|
||||
Main.PuppeteerDelayList.Remove(playerId);
|
||||
Main.PuppeteerDelay.Remove(playerId);
|
||||
Main.AllAlivePlayerControls.Where(x => x.Is(CustomRoles.Puppeteer)).Do(x => NotifyRoles(SpecifySeer: x, SpecifyTarget: player));
|
||||
}
|
||||
else if (Main.PuppeteerDelayList[player.PlayerId] + Main.PuppeteerDelay[player.PlayerId] < now)
|
||||
else if (Main.PuppeteerDelayList[playerId] + Main.PuppeteerDelay[playerId] < now)
|
||||
{
|
||||
Vector2 puppeteerPos = player.transform.position;//PuppeteerListのKeyの位置
|
||||
Dictionary<byte, float> targetDistance = [];
|
||||
float dis;
|
||||
foreach (PlayerControl target in Main.AllAlivePlayerControls)
|
||||
{
|
||||
if (target.PlayerId == player.PlayerId || target.Is(CustomRoles.Pestilence)) continue;
|
||||
if (target.PlayerId == playerId || target.Is(CustomRoles.Pestilence)) continue;
|
||||
if (target.Is(CustomRoles.Puppeteer) && !Options.PuppeteerPuppetCanKillPuppeteer.GetBool()) continue;
|
||||
if (target.Is(CustomRoleTypes.Impostor) && !Options.PuppeteerPuppetCanKillImpostors.GetBool()) continue;
|
||||
|
||||
dis = Vector2.Distance(puppeteerPos, target.transform.position);
|
||||
targetDistance.Add(target.PlayerId, dis);
|
||||
}
|
||||
if (targetDistance.Any())
|
||||
if (targetDistance.Count > 0)
|
||||
{
|
||||
var min = targetDistance.OrderBy(c => c.Value).FirstOrDefault();//一番値が小さい
|
||||
PlayerControl target = GetPlayerById(min.Key);
|
||||
@@ -2619,15 +2623,15 @@ class FixedUpdatePatch
|
||||
{
|
||||
if (player.RpcCheckAndMurder(target, true))
|
||||
{
|
||||
var puppeteerId = Main.PuppeteerList[player.PlayerId];
|
||||
var puppeteerId = Main.PuppeteerList[playerId];
|
||||
RPC.PlaySoundRPC(puppeteerId, Sounds.KillSound);
|
||||
target.SetRealKiller(GetPlayerById(puppeteerId));
|
||||
player.Kill(target);
|
||||
player.MarkDirtySettings();
|
||||
target.MarkDirtySettings();
|
||||
Main.PuppeteerList.Remove(player.PlayerId);
|
||||
Main.PuppeteerDelayList.Remove(player.PlayerId);
|
||||
Main.PuppeteerDelay.Remove(player.PlayerId);
|
||||
Main.PuppeteerList.Remove(playerId);
|
||||
Main.PuppeteerDelayList.Remove(playerId);
|
||||
Main.PuppeteerDelay.Remove(playerId);
|
||||
NotifyRoles(SpecifySeer: player, SpecifyTarget: player);
|
||||
NotifyRoles(SpecifySeer: target, SpecifyTarget: target);
|
||||
}
|
||||
@@ -2678,7 +2682,7 @@ class FixedUpdatePatch
|
||||
{
|
||||
if (GameStates.IsLobby)
|
||||
{
|
||||
if (Main.playerVersion.TryGetValue(__instance.PlayerId, out var ver))
|
||||
if (Main.playerVersion.TryGetValue(playerId, out var ver))
|
||||
{
|
||||
if (Main.ForkId != ver.forkId) // フォークIDが違う場合
|
||||
__instance.cosmetics.nameText.text = $"<color=#ff0000><size=1.2>{ver.forkId}</size>\n{__instance?.name}</color>";
|
||||
@@ -2690,11 +2694,11 @@ class FixedUpdatePatch
|
||||
}
|
||||
if (GameStates.IsInGame)
|
||||
{
|
||||
var RoleTextData = GetRoleText(PlayerControl.LocalPlayer.PlayerId, __instance.PlayerId);
|
||||
var RoleTextData = GetRoleText(PlayerControl.LocalPlayer.PlayerId, playerId);
|
||||
|
||||
//if (Options.CurrentGameMode == CustomGameMode.HideAndSeek)
|
||||
//{
|
||||
// var hasRole = main.AllPlayerCustomRoles.TryGetValue(__instance.PlayerId, out var role);
|
||||
// var hasRole = main.AllPlayerCustomRoles.TryGetValue(playerId, out var role);
|
||||
// if (hasRole) RoleTextData = Utils.GetRoleTextHideAndSeek(__instance.Data.Role.Role, role);
|
||||
//}
|
||||
RoleText.text = RoleTextData.Item1;
|
||||
@@ -3017,8 +3021,7 @@ class FixedUpdatePatch
|
||||
}*/
|
||||
|
||||
//Devourer
|
||||
bool targetDevoured = Devourer.HideNameOfConsumedPlayer.GetBool() && Devourer.PlayerSkinsCosumed.Any(a => a.Value.Contains(target.PlayerId));
|
||||
if (targetDevoured)
|
||||
if (Devourer.HideNameOfConsumedPlayer.GetBool() && Devourer.PlayerSkinsCosumed.Any(a => a.Value.Contains(target.PlayerId)))
|
||||
RealName = GetString("DevouredName");
|
||||
|
||||
// Camouflage
|
||||
|
||||
@@ -257,7 +257,7 @@ class CreatePlayerPatch
|
||||
if (Main.OverrideWelcomeMsg != string.Empty) Utils.SendMessage(Main.OverrideWelcomeMsg, client.Character.PlayerId);
|
||||
else TemplateManager.SendTemplate("welcome", client.Character.PlayerId, true);
|
||||
}, 3f, "Welcome Message");
|
||||
if (Main.OverrideWelcomeMsg == string.Empty && Main.PlayerStates.Any() && Main.clientIdList.Contains(client.Id))
|
||||
if (Main.OverrideWelcomeMsg == string.Empty && Main.PlayerStates.Count > 0 && Main.clientIdList.Contains(client.Id))
|
||||
{
|
||||
if (Options.AutoDisplayKillLog.GetBool())
|
||||
{
|
||||
|
||||
@@ -96,7 +96,7 @@ class RepairSystemPatch
|
||||
if (Options.DisableAirshipCargoLightsPanel.GetBool() && Vector2.Distance(player.transform.position, new(30.56f, 2.12f)) <= 2f) return false;
|
||||
break;
|
||||
case SystemTypes.Sabotage when AmongUsClient.Instance.NetworkMode != NetworkModes.FreePlay:
|
||||
if (Main.BlockSabo.Any()) return false;
|
||||
if (Main.BlockSabo.Count > 0) return false;
|
||||
if (Glitch.hackedIdList.ContainsKey(player.PlayerId))
|
||||
{
|
||||
player.Notify(string.Format(Translator.GetString("HackedByGlitch"), "Sabotage"));
|
||||
@@ -218,7 +218,7 @@ class CloseDoorsPatch
|
||||
{
|
||||
bool allow = !Options.DisableSabotage.GetBool() && Options.CurrentGameMode is not CustomGameMode.SoloKombat and not CustomGameMode.FFA and not CustomGameMode.MoveAndStop;
|
||||
|
||||
if (Main.BlockSabo.Any()) allow = false;
|
||||
if (Main.BlockSabo.Count > 0) allow = false;
|
||||
if (Options.DisableCloseDoor.GetBool()) allow = false;
|
||||
|
||||
Logger.Info($"({room}) => {(allow ? "Allowed" : "Blocked")}", "DoorClose");
|
||||
|
||||
@@ -478,6 +478,9 @@ internal class SelectRolesPatch
|
||||
}
|
||||
}
|
||||
|
||||
if (nimbleList.Count == 0) nimbleSpawn = false;
|
||||
if (physicistList.Count == 0) physicistSpawn = false;
|
||||
|
||||
if (Main.SetAddOns.Values.Any(x => x.Contains(CustomRoles.Nimble)))
|
||||
{
|
||||
nimbleSpawn = true;
|
||||
@@ -574,8 +577,8 @@ internal class SelectRolesPatch
|
||||
AssignCustomRole(kv.Value, kv.Key);
|
||||
}
|
||||
|
||||
if (Main.NimblePlayer != byte.MaxValue) Main.PlayerStates[Main.NimblePlayer].SetSubRole(CustomRoles.Nimble);
|
||||
if (Main.PhysicistPlayer != byte.MaxValue) Main.PlayerStates[Main.PhysicistPlayer].SetSubRole(CustomRoles.Physicist);
|
||||
if (Main.PlayerStates.TryGetValue(Main.NimblePlayer, out var nimbleState)) nimbleState.SetSubRole(CustomRoles.Nimble);
|
||||
if (Main.PlayerStates.TryGetValue(Main.PhysicistPlayer, out var physicistState)) physicistState.SetSubRole(CustomRoles.Physicist);
|
||||
|
||||
foreach (var item in Main.SetAddOns)
|
||||
{
|
||||
@@ -1201,7 +1204,7 @@ internal class SelectRolesPatch
|
||||
catch (Exception ex)
|
||||
{
|
||||
Utils.ErrorEnd("Select Role Postfix");
|
||||
Logger.Fatal(ex.ToString(), "Select Role Prefix");
|
||||
Logger.Fatal(ex.ToString(), "Select Role Postfix");
|
||||
}
|
||||
}
|
||||
private static void AssignDesyncRole(CustomRoles role, PlayerControl player, Dictionary<byte, CustomRpcSender> senders, Dictionary<(byte, byte), RoleTypes> rolesMap, RoleTypes BaseRole, RoleTypes hostBaseRole = RoleTypes.Crewmate)
|
||||
@@ -1265,7 +1268,7 @@ internal class SelectRolesPatch
|
||||
count = Count;
|
||||
for (var i = 0; i < count; i++)
|
||||
{
|
||||
if (!AllPlayers.Any()) break;
|
||||
if (AllPlayers.Count == 0) break;
|
||||
var rand = IRandom.Instance;
|
||||
var player = AllPlayers[rand.Next(0, AllPlayers.Count)];
|
||||
AllPlayers.Remove(player);
|
||||
|
||||
@@ -2530,7 +2530,7 @@
|
||||
"DivinatorCheck.Result12","<b>{0}</b>是玩家、僵尸、网红、大明星、死亡契约或吞噬者其中之一","<b>{0}</b> is either Demon, Enderman, Doormaster, Zombie, Celebrity, Super Star, Deathpact, or Devourer","","",""
|
||||
"DivinatorCheck.Result13","<b>{0}</b>是神,神谕,幻想家,检查员其中之一","<b>{0}</b> is either God, Oracle, Gambler, Insight, Visionary, Nice Eraser, Swapper, or Inspector","","",""
|
||||
"DivinatorCheck.Result14","<b>{0}</b>是隐匿者、市长、被害妄想症、小偷或卫道士其中之一","<b>{0}</b> is either Anonymous, Mastermind, Tunneler, Spy, Mayor, Paranoid, Pickpocket, or Vindicator","","",""
|
||||
"DivinatorCheck.Result15","<b>{0}</b>是传染性的、病毒的、君主的、革命者的或魅魔的其中之一","<b>{0}</b> is either Infectious, Detour, Virus, Agitater, Monarch, Revolutionist, Express, or Cultist","","",""
|
||||
"DivinatorCheck.Result15","<b>{0}</b>是传染性的、病毒的、君主的、革命者的或魅魔的其中之一","<b>{0}</b> is either Infectious, Detour, Virus, Agitator, Monarch, Revolutionist, Express, or Cultist","","",""
|
||||
"DivinatorCheck.Result16","<b>{0}</b>是冤罪师、受虐狂、抑制者、修理工或破坏者其中之一","<b>{0}</b> is either Innocent, Gaulois, Sapper, Refugee, Bandit, Inhibitor, Mechanic, or Saboteur","","",""
|
||||
"DivinatorCheck.Result17","<b>{0}</b>是医生、马里奥、小丑、潜伏者还是阳光开朗大男孩其中之一","<b>{0}</b> is either Medic, Vector, Analyzer, RiftMaker, Jester, The Glitch, Lurker, or Sunnyboy","","",""
|
||||
"DivinatorCheck.Result18","<b>{0}</b>是黑手党、惩罚者、教父、缺点者、幸运儿或失败者其中之一","<b>{0}</b> is either Nemesis, Hitman, Gangster, Glitch, Luckey, or Underdog","","",""
|
||||
@@ -3376,7 +3376,7 @@
|
||||
"PrefixB.Physicist","","<color=#ffffff>(</color>Physicist<color=#ffffff>)</color> ","","",""
|
||||
|
||||
"## Agitater"
|
||||
"Agitater","煽动者","Agitater","Агитатор","","Agitador"
|
||||
"Agitater","煽动者","Agitator","Агитатор","","Agitador"
|
||||
"AgitaterInfo","这个炸弹给你了!","Pass a Bomb onto others","Вот тебе подарок в виде бомбы","","Pásale la patata caliente a otros"
|
||||
"AgitaterInfoLong","(中立阵营):\n煽动者的击杀是使用炸弹。对一名玩家使用你的击杀按钮来传递炸弹,每轮只能传递一次。收到炸弹的玩家收到炸弹时会收到通知,他们需要通过靠近一名玩家将炸弹传递给另一名玩家。","(Neutrals):\nAs the Agitater, your premise is essentially Hot Potato.\n\nUse your kill button on a player to pass the bomb.\nThis can only be done once per round.\n\nThe player who receives the bomb will be notified when receiving said bomb, in which they need to pass it to another player by getting near a player.\n\nWhen a meeting is called, the player with the bomb dies.\n\nIf trying to pass to Pestilence or a Veteran on alert, the bombed player dies instead.\nOptionally, the Agitater cannot receive the bomb.","(Нейтрал):\nКак Агитатор, ваша задача - это, по сути, Догонялки.\n\nИспользуйте кнопку Убийства на игроке, чтобы передать бомбу.\nЭто можно сделать только один раз за раунд.\n\nИгрок, получивший бомбу, будет уведомлен о получении бомбы, в котором он должен передать ее другому игроку, подойдя к нему. \n\nКогда объявляется собрание, игрок с бомбой погибает.\n\nЕсли он пытается передать бомбу Чуме или ветерану, находящемуся в состоянии боевой готовности, то вместо него погибает игрок, получивший бомбу.\nОпционально, Агитатор не может получить бомбу.","","(Neutros):\nTu función de Agitador es esencialmente el juego de la Patata Caliente.\n\nUsa tu botón de matar en un jugador para pasar una bomba.\nEsto solo se puede hacer una vez por ronda.\n\nEl jugador que reciba la bomba será notificado cuando la reciba, y deberá pasarla a otro jugador acercándose a el.\n\nCuando se llame una reunión, el jugador con la bomba morirá.\n\nIntentar pasar la bomba a la Pestilencia o a un Veterano en alerta te matará.\nOpcionalmente, el Agitador no podrá recibir la bomba."
|
||||
"AgitaterBombCooldown","<color=#F4A460>煽动者</color>炸弹冷却时间","<color=#F4A460>Agitater</color> bomb coolodown","Откат бомбы <color=#F4A460>Агитатора</color>","",""
|
||||
|
||||
|
Can't render this file because it is too large.
|
@@ -89,6 +89,11 @@ namespace TOHE.Roles.AddOns.Crewmate
|
||||
{
|
||||
if (pc.Is(CustomRoles.Stressed))
|
||||
{
|
||||
if (!pc.GetPlayerTaskState().hasTasks)
|
||||
{
|
||||
Main.PlayerStates[pc.PlayerId].RemoveSubRole(CustomRoles.Stressed);
|
||||
continue;
|
||||
}
|
||||
Timers.Add(pc.PlayerId, StartingTime);
|
||||
LastUpdates.Add(pc.PlayerId, GetTimeStamp() + 1);
|
||||
}
|
||||
@@ -117,7 +122,7 @@ namespace TOHE.Roles.AddOns.Crewmate
|
||||
}
|
||||
|
||||
if (pc.IsModClient() && pc.PlayerId != 0) SendRPC(pc.PlayerId, Timers[pc.PlayerId], LastUpdates[pc.PlayerId]);
|
||||
if (pc.PlayerId != 0) NotifyRoles(SpecifySeer: pc, SpecifyTarget: pc);
|
||||
if (!pc.IsModClient()) NotifyRoles(SpecifySeer: pc, SpecifyTarget: pc);
|
||||
}
|
||||
|
||||
public static void SendRPC(byte id, int time, long lastUpdate)
|
||||
|
||||
@@ -66,9 +66,7 @@ namespace TOHE.Roles.Crewmate
|
||||
}
|
||||
public static void OnFixedUpdate(PlayerControl pc)
|
||||
{
|
||||
if (pc == null) return;
|
||||
if (!pc.Is(CustomRoles.Aid)) return;
|
||||
if (!ShieldedPlayers.Any()) return;
|
||||
if (pc == null || !pc.Is(CustomRoles.Aid) || ShieldedPlayers.Count == 0) return;
|
||||
|
||||
bool change = false;
|
||||
|
||||
|
||||
@@ -94,7 +94,7 @@ namespace TOHE.Roles.Crewmate
|
||||
{
|
||||
shieldedPlayers.Remove(shieldedId);
|
||||
}
|
||||
if (clearAll && shieldedPlayers.Any()) shieldedPlayers.Clear();
|
||||
if (clearAll && shieldedPlayers.Count > 0) shieldedPlayers.Clear();
|
||||
}
|
||||
public static string GetProgressText(byte playerId)
|
||||
{
|
||||
|
||||
@@ -163,7 +163,7 @@
|
||||
if (!seer.Is(CustomRoles.Bloodhound)) return string.Empty;
|
||||
if (target != null && seer.PlayerId != target.PlayerId) return string.Empty;
|
||||
if (GameStates.IsMeeting) return string.Empty;
|
||||
if (BloodhoundTargets.ContainsKey(seer.PlayerId) && BloodhoundTargets[seer.PlayerId].Any())
|
||||
if (BloodhoundTargets.ContainsKey(seer.PlayerId) && BloodhoundTargets[seer.PlayerId].Count > 0)
|
||||
{
|
||||
var arrows = string.Empty;
|
||||
foreach (byte targetId in BloodhoundTargets[seer.PlayerId].ToArray())
|
||||
|
||||
@@ -171,13 +171,11 @@ namespace TOHE.Roles.Crewmate
|
||||
|
||||
public static void OnFixedUpdate()
|
||||
{
|
||||
if (!IsEnable) return;
|
||||
if (!GameStates.IsInTask) return;
|
||||
if (!Triggers.Any() && !TriggerDelays.Any()) return;
|
||||
if (!IsEnable || !GameStates.IsInTask || Triggers.Count == 0 && TriggerDelays.Count == 0) return;
|
||||
|
||||
long now = GetTimeStamp();
|
||||
|
||||
if (TriggerDelays.Any())
|
||||
if (TriggerDelays.Count > 0)
|
||||
{
|
||||
foreach (var x in TriggerDelays.ToArray())
|
||||
{
|
||||
@@ -200,7 +198,7 @@ namespace TOHE.Roles.Crewmate
|
||||
}
|
||||
}
|
||||
|
||||
if (Triggers.Any())
|
||||
if (Triggers.Count > 0)
|
||||
{
|
||||
foreach (var pc in Main.AllAlivePlayerControls.Where(pc => !playerIdList.Contains(pc.PlayerId)).ToArray()) // Check for all alive players except Druids - Worst case scenario it's 14 loops
|
||||
{
|
||||
|
||||
@@ -15,6 +15,10 @@ namespace TOHE.Roles.Crewmate
|
||||
var vents = UnityEngine.Object.FindObjectsOfType<Vent>();
|
||||
var vent = vents[IRandom.Instance.Next(0, vents.Count)];
|
||||
physics.RpcBootFromVent(vent.Id);
|
||||
_ = new LateTask(() =>
|
||||
{
|
||||
pc.TPtoRndVent();
|
||||
}, 0.55f, "Mole TP");
|
||||
}, 0.5f, "Mole BootFromVent");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -167,7 +167,7 @@ public static class ParityCop
|
||||
|
||||
if (((target1.Is(Team.Impostor) || target1.GetCustomSubRoles().Any(role => role.IsImpostorTeamV3())) && (target2.Is(Team.Impostor) || target2.GetCustomSubRoles().Any(role => role.IsImpostorTeamV3()))) ||
|
||||
((target1.Is(Team.Neutral) || target1.GetCustomSubRoles().Any(role => role.IsNeutralTeamV2())) && (target2.Is(Team.Neutral) || target2.GetCustomSubRoles().Any(role => role.IsNeutralTeamV2()))) ||
|
||||
(target1.Is(Team.Crewmate) && (target1.GetCustomSubRoles().Any(role => role.IsCrewmateTeamV2()) || (!target1.GetCustomSubRoles().Any())) && target2.Is(Team.Crewmate) && (target2.GetCustomSubRoles().Any(role => role.IsCrewmateTeamV2()) || !target2.GetCustomSubRoles().Any())))
|
||||
(target1.Is(Team.Crewmate) && (target1.GetCustomSubRoles().Any(role => role.IsCrewmateTeamV2()) || (target1.GetCustomSubRoles().Count == 0)) && target2.Is(Team.Crewmate) && (target2.GetCustomSubRoles().Any(role => role.IsCrewmateTeamV2()) || target2.GetCustomSubRoles().Count == 0)))
|
||||
{
|
||||
_ = new LateTask(() =>
|
||||
{
|
||||
@@ -210,11 +210,11 @@ public static class ParityCop
|
||||
string roleT1 = string.Empty, roleT2 = string.Empty;
|
||||
if (target1.Is(Team.Impostor) || target1.GetCustomSubRoles().Any(role => role.IsImpostorTeamV3())) roleT1 = "Impostor";
|
||||
else if (target1.Is(Team.Neutral) || target1.GetCustomSubRoles().Any(role => role.IsNeutralTeamV2())) roleT1 = "Neutral";
|
||||
else if (target1.Is(Team.Crewmate) && (target1.GetCustomSubRoles().Any(role => role.IsCrewmateTeamV2()) || (!target1.GetCustomSubRoles().Any())))
|
||||
else if (target1.Is(Team.Crewmate) && (target1.GetCustomSubRoles().Any(role => role.IsCrewmateTeamV2()) || (target1.GetCustomSubRoles().Count == 0)))
|
||||
|
||||
if (target2.Is(Team.Impostor) || target2.GetCustomSubRoles().Any(role => role.IsImpostorTeamV3())) roleT2 = "Impostor";
|
||||
else if (target2.Is(Team.Neutral) || target2.GetCustomSubRoles().Any(role => role.IsNeutralTeamV2())) roleT2 = "Neutral";
|
||||
else if (target2.Is(Team.Crewmate) && (target2.GetCustomSubRoles().Any(role => role.IsCrewmateTeamV2()) || !target2.GetCustomSubRoles().Any())) roleT2 = "Crewmate";
|
||||
else if (target2.Is(Team.Crewmate) && (target2.GetCustomSubRoles().Any(role => role.IsCrewmateTeamV2()) || target2.GetCustomSubRoles().Count == 0)) roleT2 = "Crewmate";
|
||||
|
||||
_ = new LateTask(() =>
|
||||
{
|
||||
|
||||
@@ -39,7 +39,7 @@ public static class Psychic
|
||||
{
|
||||
playerIdList.Add(playerId);
|
||||
}
|
||||
public static bool IsEnable => playerIdList.Any();
|
||||
public static bool IsEnable => playerIdList.Count > 0;
|
||||
private static void SendRPC()
|
||||
{
|
||||
if (!IsEnable || !Utils.DoRPC) return;
|
||||
@@ -67,7 +67,7 @@ public static class Psychic
|
||||
}
|
||||
public static void OnReportDeadBody()
|
||||
{
|
||||
if (Fresh.GetBool() || RedPlayer == null || !RedPlayer.Any())
|
||||
if (Fresh.GetBool() || RedPlayer == null || RedPlayer.Count == 0)
|
||||
GetRedName();
|
||||
}
|
||||
public static void GetRedName()
|
||||
@@ -96,14 +96,14 @@ public static class Psychic
|
||||
if (ENum < 1) goto EndOfSelect;
|
||||
|
||||
RedPlayer = [];
|
||||
for (int i = 0; i < ENum && BadList.Any(); i++)
|
||||
for (int i = 0; i < ENum && BadList.Count > 0; i++)
|
||||
{
|
||||
RedPlayer.Add(BadList[IRandom.Instance.Next(0, BadList.Count)]);
|
||||
BadList.RemoveAll(RedPlayer.Contains);
|
||||
}
|
||||
|
||||
AllList.RemoveAll(RedPlayer.Contains);
|
||||
for (int i = 0; i < BNum && AllList.Any(); i++)
|
||||
for (int i = 0; i < BNum && AllList.Count > 0; i++)
|
||||
{
|
||||
RedPlayer.Add(AllList[IRandom.Instance.Next(0, AllList.Count)]);
|
||||
AllList.RemoveAll(RedPlayer.Contains);
|
||||
|
||||
@@ -112,7 +112,7 @@ namespace TOHE.Roles.Crewmate
|
||||
|
||||
public static void SetupCustomOption()
|
||||
{
|
||||
SetupSingleRoleOptions(Id, TabGroup.CrewmateRoles, CustomRoles.Sentinel, 1);
|
||||
SetupRoleOptions(Id, TabGroup.CrewmateRoles, CustomRoles.Sentinel);
|
||||
PatrolCooldown = CreateCDSetting(Id + 2, TabGroup.CrewmateRoles, CustomRoles.Sentinel);
|
||||
PatrolDuration = IntegerOptionItem.Create(Id + 3, "SentinelPatrolDuration", new(1, 90, 1), 5, TabGroup.CrewmateRoles, false)
|
||||
.SetParent(CustomRoleSpawnChances[CustomRoles.Sentinel])
|
||||
|
||||
@@ -110,7 +110,7 @@ namespace TOHE.Roles.Crewmate
|
||||
{
|
||||
if (pc == null) return;
|
||||
if (!pc.Is(CustomRoles.Spy)) return;
|
||||
if (!SpyRedNameList.Any()) return;
|
||||
if (SpyRedNameList.Count == 0) return;
|
||||
|
||||
bool change = false;
|
||||
|
||||
|
||||
@@ -106,7 +106,7 @@ namespace TOHE.Roles.Crewmate
|
||||
}
|
||||
public static void OnFixedUpdate(PlayerControl tornadoPc)
|
||||
{
|
||||
if (!IsEnable || !GameStates.IsInTask || !Tornados.Any()) return;
|
||||
if (!IsEnable || !GameStates.IsInTask || Tornados.Count == 0) return;
|
||||
|
||||
var Random = IRandom.Instance;
|
||||
var NotifyString = GetString("TeleportedByTornado");
|
||||
|
||||
@@ -108,9 +108,9 @@ namespace TOHE.Roles.Impostor
|
||||
notify = true;
|
||||
}
|
||||
|
||||
if ((notify || chargePercent == 100) && !pc.IsModClient())
|
||||
if (notify && !pc.IsModClient())
|
||||
{
|
||||
pc.Notify(string.Format(Translator.GetString("ChronomancerPercent"), chargePercent));
|
||||
pc.Notify(string.Format(Translator.GetString("ChronomancerPercent"), chargePercent), 300f);
|
||||
}
|
||||
|
||||
if (beforeCharge != chargePercent && pc.IsModClient() && pc.PlayerId != 0)
|
||||
|
||||
@@ -81,7 +81,7 @@ namespace TOHE.Roles.Impostor
|
||||
public static void OnFixedUpdate()
|
||||
{
|
||||
if (!IsEnable) return;
|
||||
if (!DuelPair.Any()) return;
|
||||
if (DuelPair.Count == 0) return;
|
||||
foreach (var pair in DuelPair)
|
||||
{
|
||||
var duellist = GetPlayerById(pair.Key);
|
||||
|
||||
@@ -196,7 +196,7 @@ public static class EvilTracker
|
||||
ImpostorsId[trackerId].RemoveWhere(id => Main.PlayerStates[id].IsDead);
|
||||
|
||||
var sb = new StringBuilder(80);
|
||||
if (ImpostorsId[trackerId].Any())
|
||||
if (ImpostorsId[trackerId].Count > 0)
|
||||
{
|
||||
sb.Append($"<color={Utils.GetRoleColorCode(CustomRoles.Impostor)}>");
|
||||
foreach (var impostorId in ImpostorsId[trackerId])
|
||||
|
||||
@@ -218,10 +218,7 @@ namespace TOHE.Roles.Impostor
|
||||
|
||||
public static void OnFixedUpdate(PlayerControl player)
|
||||
{
|
||||
if (!GameStates.IsInTask) return;
|
||||
if (player == null) return;
|
||||
if (!player.Is(CustomRoles.Gambler)) return;
|
||||
if (!waitingDelayedKills.Any() && !isSpeedChange.Any() && !isVisionChange.Any() && !isShielded.Any()) return;
|
||||
if (!GameStates.IsInTask || player == null || !player.Is(CustomRoles.Gambler) || (waitingDelayedKills.Count == 0 && isSpeedChange.Count == 0 && isVisionChange.Count == 0 && isShielded.Count == 0)) return;
|
||||
|
||||
bool sync = false;
|
||||
|
||||
|
||||
@@ -151,7 +151,6 @@ namespace TOHE.Roles.Impostor
|
||||
{
|
||||
NotifyRoles(SpecifySeer: pc, SpecifyTarget: pc);
|
||||
SendRPCSyncPistolCD();
|
||||
Logger.Info($"Pistol 1 CD: {Pistol1CD}; Pistol 2 CD: {Pistol2CD}", "debug");
|
||||
}
|
||||
}
|
||||
public static bool OnCheckMurder(PlayerControl killer, PlayerControl target)
|
||||
|
||||
@@ -70,9 +70,7 @@ namespace TOHE.Roles.Impostor
|
||||
|
||||
public static void OnFixedUpdate()
|
||||
{
|
||||
if (!IsEnable) return;
|
||||
if (GameStates.IsMeeting) return;
|
||||
if (!ManipulatedPlayers.Any() && !ManipulateDelays.Any()) return;
|
||||
if (!IsEnable || GameStates.IsMeeting || ManipulatedPlayers.Count == 0 && ManipulateDelays.Count == 0) return;
|
||||
|
||||
foreach (var x in ManipulateDelays)
|
||||
{
|
||||
|
||||
@@ -62,11 +62,7 @@ namespace TOHE.Roles.Impostor
|
||||
|
||||
public static void OnFixedUpdate(PlayerControl pc)
|
||||
{
|
||||
if (pc == null) return;
|
||||
if (!Bombs.Any()) return;
|
||||
if (!GameStates.IsInTask) return;
|
||||
if (!pc.IsAlive()) return;
|
||||
if (!pc.Is(CustomRoles.Sapper)) return;
|
||||
if (pc == null || Bombs.Count == 0 || !GameStates.IsInTask || !pc.IsAlive() || !pc.Is(CustomRoles.Sapper)) return;
|
||||
|
||||
foreach (var bomb in Bombs.Where(bomb => bomb.Value + Delay.GetInt() < GetTimeStamp()))
|
||||
{
|
||||
|
||||
@@ -222,7 +222,7 @@ public static class Sniper
|
||||
|
||||
var targets = GetSnipeTargets(sniper);
|
||||
|
||||
if (targets.Any())
|
||||
if (targets.Count > 0)
|
||||
{
|
||||
//一番正確な対象がターゲット
|
||||
var snipedTarget = targets.OrderBy(c => c.Value).First().Key;
|
||||
@@ -313,7 +313,7 @@ public static class Sniper
|
||||
//エイムアシスト中のスナイパー
|
||||
if (0.5f < AimTime[seerId] && (!AimAssistOneshot || AimTime[seerId] < 1.0f))
|
||||
{
|
||||
if (GetSnipeTargets(Utils.GetPlayerById(seerId)).Any())
|
||||
if (GetSnipeTargets(Utils.GetPlayerById(seerId)).Count > 0)
|
||||
{
|
||||
return $"<size=200%>{Utils.ColorString(Palette.ImpostorRed, "◎")}</size>";
|
||||
}
|
||||
|
||||
@@ -37,11 +37,11 @@
|
||||
// }
|
||||
// public static bool IsEnable()
|
||||
// {
|
||||
// return playerIdList.Any();
|
||||
// return playerIdList.Count > 0;
|
||||
// }
|
||||
// public static bool IsNEnable()
|
||||
// {
|
||||
// return NplayerIdList.Any();
|
||||
// return NplayerIdList.Count > 0;
|
||||
// }
|
||||
// public static bool IsNAlive()
|
||||
// {
|
||||
|
||||
@@ -69,7 +69,7 @@ namespace TOHE.Roles.Neutral
|
||||
}
|
||||
public static void OnFixedUpdate()
|
||||
{
|
||||
if (!IsEnable || !GameStates.IsInTask || !EncasedPlayers.Any()) return;
|
||||
if (!IsEnable || !GameStates.IsInTask || EncasedPlayers.Count == 0) return;
|
||||
|
||||
long now = GetTimeStamp();
|
||||
foreach (var id in EncasedPlayers.Where(item => item.Value + ExplodeDelay.GetInt() < now).Select(item => item.Key).ToArray())
|
||||
|
||||
@@ -201,8 +201,7 @@ public static class HexMaster
|
||||
foreach (PlayerControl pc in Main.AllAlivePlayerControls)
|
||||
{
|
||||
var dic = HexedPlayer.Where(x => x.Value.Contains(pc.PlayerId));
|
||||
if (!dic.Any())
|
||||
continue;
|
||||
if (!dic.Any()) continue;
|
||||
var whichId = dic.FirstOrDefault().Key;
|
||||
var hexmaster = Utils.GetPlayerById(whichId);
|
||||
if (hexmaster != null && hexmaster.IsAlive())
|
||||
|
||||
@@ -124,7 +124,7 @@ public static class Magician
|
||||
switch (CardId)
|
||||
{
|
||||
case 1: // Slowness for everyone nearby
|
||||
if (TempSpeeds.Any()) RevertSpeedChanges(true);
|
||||
if (TempSpeeds.Count > 0) RevertSpeedChanges(true);
|
||||
var list = GetPlayersInRadius(SlownessRadius.GetFloat(), pc.Pos());
|
||||
foreach (var x in list)
|
||||
{
|
||||
@@ -170,7 +170,7 @@ public static class Magician
|
||||
|
||||
var targets = GetSnipeTargets(sniper);
|
||||
|
||||
if (targets.Any())
|
||||
if (targets.Count > 0)
|
||||
{
|
||||
var snipedTarget = targets.OrderBy(c => c.Value).First().Key;
|
||||
snipedTarget.CheckMurder(snipedTarget);
|
||||
@@ -247,7 +247,7 @@ public static class Magician
|
||||
if (!GameStates.IsInTask) return;
|
||||
if (Pelican.IsEaten(pc.PlayerId) || pc.Data.IsDead) return;
|
||||
|
||||
if (TempSpeeds.Any()) RevertSpeedChanges(false);
|
||||
if (TempSpeeds.Count > 0) RevertSpeedChanges(false);
|
||||
|
||||
if (PortalMarks.Count == 2 && lastTP + 5 < GetTimeStamp())
|
||||
{
|
||||
@@ -291,7 +291,7 @@ public static class Magician
|
||||
}
|
||||
}
|
||||
|
||||
if (BlindPPL.Any())
|
||||
if (BlindPPL.Count > 0)
|
||||
{
|
||||
foreach (var x in BlindPPL.Where(x => x.Value + BlindDur.GetInt() < GetTimeStamp()))
|
||||
{
|
||||
@@ -300,7 +300,7 @@ public static class Magician
|
||||
}
|
||||
}
|
||||
|
||||
if (Bombs.Any())
|
||||
if (Bombs.Count > 0)
|
||||
{
|
||||
foreach (var bomb in Bombs.Where(bomb => bomb.Value + BombDelay.GetInt() < GetTimeStamp()))
|
||||
{
|
||||
|
||||
@@ -177,7 +177,7 @@ public static class Pelican
|
||||
{
|
||||
if (!GameStates.IsInTask)
|
||||
{
|
||||
if (eatenList.Any())
|
||||
if (eatenList.Count > 0)
|
||||
{
|
||||
eatenList.Clear();
|
||||
SyncEatenList(byte.MaxValue);
|
||||
|
||||
@@ -256,7 +256,7 @@ namespace TOHE.Roles.Neutral
|
||||
}
|
||||
public static void DirectInfect(PlayerControl player)
|
||||
{
|
||||
if (!playerIdList.Any() || player == null) return;
|
||||
if (playerIdList.Count == 0 || player == null) return;
|
||||
Logger.Info($"InfectRate [{player.GetNameWithRole()}]: 100%", "PlagueDoctor");
|
||||
InfectInfos[player.PlayerId] = 100;
|
||||
SendRPC(player.PlayerId, 100);
|
||||
|
||||
@@ -104,7 +104,7 @@ namespace TOHE.Roles.Neutral
|
||||
}
|
||||
public static void OnFixedUpdate()
|
||||
{
|
||||
if (!IsEnable || !GameStates.IsInTask || !Traps.Any()) return;
|
||||
if (!IsEnable || !GameStates.IsInTask || Traps.Count == 0) return;
|
||||
|
||||
long now = GetTimeStamp();
|
||||
|
||||
|
||||
+1
-1
@@ -7,7 +7,7 @@
|
||||
<Description>TOHE+</Description>
|
||||
<Authors>Gurge44</Authors>
|
||||
<langVersion>preview</langVersion>
|
||||
<AmongUs>E:\Program Files\AmongUs</AmongUs>
|
||||
<AmongUs>D:\Epic Games\AmongUs</AmongUs>
|
||||
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
|
||||
<Optimize>True</Optimize>
|
||||
<AssemblyName>$(MSBuildProjectName)+</AssemblyName>
|
||||
|
||||
@@ -33,8 +33,8 @@ public class Main : BasePlugin
|
||||
public static ConfigEntry<string> DebugKeyInput { get; private set; }
|
||||
public static readonly string MainMenuText = " ";
|
||||
public const string PluginGuid = "com.gurge44.toheplus";
|
||||
public const string PluginVersion = "2.1.1";
|
||||
public const string PluginDisplayVersion = "2.1.1";
|
||||
public const string PluginVersion = "2.1.2";
|
||||
public const string PluginDisplayVersion = "2.1.2";
|
||||
public static readonly string SupportedAUVersion = "2023.10.24";
|
||||
public const int PluginCreate = 3;
|
||||
public const bool Canary = false;
|
||||
|
||||
Reference in new issue
Block a user