some fixes

This commit is contained in:
Gurge44 committed 2026-05-19 10:25:43 +02:00
1 parent 016bd001c7
commit 1c15040e14
24 files changed
+174 -104

No files matched your search

+52 -37
View File
@@ -13,32 +13,32 @@ public static class Mingle
public static readonly HashSet<string> HasPlayedFCs = [];
public static bool GameGoing;
public static DateTime GameStartDateTime;
public static Dictionary<SystemTypes, int> RequiredPlayerCount = [];
public static HashSet<SystemTypes> AllRooms = [];
private static DateTime GameStartDateTime;
private static Dictionary<SystemTypes, int> RequiredPlayerCount = [];
private static HashSet<SystemTypes> AllRooms = [];
private static readonly StringBuilder Suffix = new();
public static long TimeEndTS;
public static long LastUpdateTS;
public static int Time;
public static bool DontEndGame;
private static long TimeEndTS;
private static long LastUpdateTS;
private static int Time;
private static bool CheckForGameEnd;
public static int TimeLimit;
public static int TimeDecreaseOnNoDeath;
public static int ExtraTimeOnAirship;
public static int ExtraTimeOnFungle;
public static bool DisplayCurrentPlayerCountInEachRoom;
public static int MinTime;
public static int MaxRequiredPlayersPerRoom;
public static int MaxWinningPlayers;
private static int TimeLimit;
private static int TimeDecreaseOnNoDeath;
private static int ExtraTimeOnAirship;
private static int ExtraTimeOnFungle;
private static bool DisplayCurrentPlayerCountInEachRoom;
private static int MinTime;
private static int MaxRequiredPlayersPerRoom;
private static int MaxWinningPlayers;
public static OptionItem TimeLimitOption;
public static OptionItem TimeDecreaseOnNoDeathOption;
public static OptionItem ExtraTimeOnAirshipOption;
public static OptionItem ExtraTimeOnFungleOption;
public static OptionItem DisplayCurrentPlayerCountInEachRoomOption;
public static OptionItem MinTimeOption;
public static OptionItem MaxRequiredPlayersPerRoomOption;
public static OptionItem MaxWinningPlayersOption;
private static OptionItem TimeLimitOption;
private static OptionItem TimeDecreaseOnNoDeathOption;
private static OptionItem ExtraTimeOnAirshipOption;
private static OptionItem ExtraTimeOnFungleOption;
private static OptionItem DisplayCurrentPlayerCountInEachRoomOption;
private static OptionItem MinTimeOption;
private static OptionItem MaxRequiredPlayersPerRoomOption;
private static OptionItem MaxWinningPlayersOption;
public static OptionItem ChatDuringGameOption;
public static void SetupCustomOption()
@@ -112,7 +112,8 @@ public static class Mingle
public static bool CheckGameEnd(out GameOverReason reason)
{
reason = GameOverReason.ImpostorsByKill;
if (GameStates.IsEnded || !GameGoing || TimeEndTS > Utils.TimeStamp) return false;
if (GameStates.IsEnded || !GameGoing || !CheckForGameEnd) return false;
CheckForGameEnd = false;
var aapc = Main.CachedAlivePlayerControls();
switch (aapc.Count)
@@ -127,7 +128,7 @@ public static class Mingle
CustomWinnerHolder.ResetAndSetWinner(CustomWinner.Error);
Logger.Warn("No players alive. Force ending the game", "Mingle");
return true;
case var p when p <= MaxWinningPlayers && !DontEndGame:
case var p when p <= MaxWinningPlayers:
CustomWinnerHolder.WinnerIds = aapc.Select(x => x.PlayerId).ToHashSet();
Logger.Info($"Winners: {string.Join(", ", aapc.Select(x => x.GetRealName().RemoveHtmlTags()))}", "Mingle");
Main.DoBlockNameChange = true;
@@ -298,8 +299,6 @@ public static class Mingle
private static void KillPlayers()
{
DontEndGame = true;
try
{
var aapc = Main.CachedAlivePlayerControls();
@@ -340,7 +339,7 @@ public static class Mingle
}
finally
{
DontEndGame = false;
CheckForGameEnd = true;
}
}
@@ -348,6 +347,8 @@ public static class Mingle
public static void HandleDisconnect()
{
CheckForGameEnd = true;
SystemTypes decreaseRoom = AllRooms.First(x => RequiredPlayerCount.TryGetValue(x, out var required) && GetNumPlayersInRoom(x) < required);
if (RequiredPlayerCount[decreaseRoom] <= 1) RequiredPlayerCount.Remove(decreaseRoom);
@@ -383,19 +384,33 @@ public static class Mingle
}
else
{
Dictionary<SystemTypes, int> numPlayersInRoom = Main.EnumerateAlivePlayerControls().Select(x => (pc: x, room: x.GetPlainShipRoom())).GroupBy(x => !x.room ? SystemTypes.Outside : x.room.RoomId).ToDictionary(x => x.Key, x => x.Count());
var aapc = Main.CachedAlivePlayerControls();
var frames = 0;
yield return null;
if (RequiredPlayerCount.All(x => numPlayersInRoom.GetValueOrDefault(x.Key, 0) == x.Value))
foreach ((SystemTypes room, int requiredCount) in RequiredPlayerCount)
{
Main.EnumerateAlivePlayerControls().NotifyPlayers(Utils.ColorString(Color.green, "✓"), 3f);
yield return null;
Time = Math.Max(Time - TimeDecreaseOnNoDeath, MinTime);
StartNewRound();
yield break;
int count = 0;
for (int index = 0; index < aapc.Count; index++)
if (aapc[index].IsInRoom(room) && ++count > requiredCount)
goto Skip;
if (count != requiredCount)
goto Skip;
if (frames < 28)
{
yield return null;
frames++;
}
}
Time = Math.Max(Time - TimeDecreaseOnNoDeath, MinTime);
StartNewRound();
yield break;
}
Skip:
yield return null;
+2 -2
View File
@@ -186,7 +186,7 @@ internal static class CustomTeamManager
CustomTeam lastTeam = GetCustomTeam(lastPlayer.PlayerId);
WinnerTeam = lastTeam;
CustomWinnerHolder.ResetAndSetWinner(CustomWinner.CustomTeam);
CustomWinnerHolder.SetWinnerOrAdditonalWinner(CustomWinner.CustomTeam);
CustomWinnerHolder.WinnerIds = [lastPlayer.PlayerId];
return true;
}
@@ -242,7 +242,7 @@ internal static class CustomTeamManager
}
WinnerTeam = onlyTeam;
CustomWinnerHolder.ResetAndSetWinner(CustomWinner.CustomTeam);
CustomWinnerHolder.SetWinnerOrAdditonalWinner(CustomWinner.CustomTeam);
CustomWinnerHolder.WinnerIds = winners;
return true;
}
+6 -6
View File
@@ -88,15 +88,15 @@ public static class CustomWinnerHolder
WinnerTeam = (CustomWinner)reader.ReadPackedInt32();
AdditionalWinnerTeams = [];
int AdditionalWinnerTeamsCount = reader.ReadPackedInt32();
for (var i = 0; i < AdditionalWinnerTeamsCount; i++) AdditionalWinnerTeams.Add((AdditionalWinners)reader.ReadPackedInt32());
int additionalWinnerTeamsCount = reader.ReadPackedInt32();
for (var i = 0; i < additionalWinnerTeamsCount; i++) AdditionalWinnerTeams.Add((AdditionalWinners)reader.ReadPackedInt32());
WinnerRoles = [];
int WinnerRolesCount = reader.ReadPackedInt32();
for (var i = 0; i < WinnerRolesCount; i++) WinnerRoles.Add((CustomRoles)reader.ReadPackedInt32());
int winnerRolesCount = reader.ReadPackedInt32();
for (var i = 0; i < winnerRolesCount; i++) WinnerRoles.Add((CustomRoles)reader.ReadPackedInt32());
WinnerIds = [];
int WinnerIdsCount = reader.ReadPackedInt32();
for (var i = 0; i < WinnerIdsCount; i++) WinnerIds.Add(reader.ReadByte());
int winnerIdsCount = reader.ReadPackedInt32();
for (var i = 0; i < winnerIdsCount; i++) WinnerIds.Add(reader.ReadByte());
}
}
+2 -15
View File
@@ -67,12 +67,13 @@ public abstract class GameOptionsSender
for (byte i = 0; i < count; i++)
{
Il2CppSystem.Object logicComponent = GameManager.Instance.LogicComponents[i];
if (logicComponent.TryCast<LogicOptions>(out _)) SendOptionsArray(optionArray, i);
if (logicComponent.TryCast<LogicOptions>(out _)) yield return SendOptionsArrayAsync(optionArray, i);
yield return WaitFrameIfNecessary();
}
}
protected abstract void SendOptionsArray(Il2CppStructArray<byte> optionArray, byte logicOptionsIndex);
protected abstract IEnumerator SendOptionsArrayAsync(Il2CppStructArray<byte> optionArray, byte logicOptionsIndex);
public abstract IGameOptions BuildGameOptions();
@@ -108,20 +109,6 @@ public abstract class GameOptionsSender
for (var index = 0; index < AllSenders.Count; index++)
{
yield return WaitFrameIfNecessary();
if (PackedWriter != null && (PackedWriter.Length > 1000 || PackedWriterMessages >= AmongUsClient.Instance.GetMaxMessagePackingLimit()))
{
PackedWriter.EndMessage();
var qa = DataFlagRateLimiter.Enqueue(() => AmongUsClient.Instance.SendOrDisconnect(PackedWriter));
yield return qa.Wait();
PackedWriterMessages = 0;
if (qa.Dropped) break;
PackedWriter.Clear(SendOption.Reliable);
PackedWriter.StartMessage(26);
PackedWriter.WritePacked(AmongUsClient.Instance.GameId);
}
yield return WaitFrameIfNecessary();
if (index >= AllSenders.Count) break;
GameOptionsSender sender = AllSenders[index];
@@ -1,4 +1,5 @@
using System;
using System.Collections;
using AmongUs.GameOptions;
using Hazel;
using Il2CppInterop.Runtime.InteropTypes.Arrays;
@@ -42,9 +43,19 @@ public sealed class NormalGameOptionsSender : GameOptionsSender
return BasedGameOptions;
}
protected override IEnumerator SendOptionsArrayAsync(Il2CppStructArray<byte> optionArray, byte logicOptionsIndex)
{
yield return DataFlagRateLimiter.Enqueue(SendOptionsAction(optionArray, logicOptionsIndex)).Wait();
}
protected override void SendOptionsArray(Il2CppStructArray<byte> optionArray, byte logicOptionsIndex)
{
DataFlagRateLimiter.Enqueue(() =>
DataFlagRateLimiter.Enqueue(SendOptionsAction(optionArray, logicOptionsIndex));
}
private static Action SendOptionsAction(Il2CppStructArray<byte> optionArray, byte logicOptionsIndex)
{
return () =>
{
MessageWriter writer = MessageWriter.Get(SendOption.Reliable);
@@ -68,6 +79,6 @@ public sealed class NormalGameOptionsSender : GameOptionsSender
AmongUsClient.Instance.SendOrDisconnect(writer);
writer.Recycle();
});
};
}
}
@@ -79,21 +79,6 @@ public sealed class PlayerGameOptionsSender(PlayerControl player) : GameOptionsS
if (allSender is PlayerGameOptionsSender { IsDirty: true } sender)
{
if (PackedWriter != null && (PackedWriter.Length > 500 || PackedWriterMessages >= AmongUsClient.Instance.GetMaxMessagePackingLimit()))
{
PackedWriter.EndMessage();
var capturedWriter = PackedWriter;
DataFlagRateLimiter.Enqueue(() =>
{
AmongUsClient.Instance.SendOrDisconnect(capturedWriter);
capturedWriter.Recycle();
}, cleanup: capturedWriter.Recycle);
PackedWriterMessages = 0;
PackedWriter = MessageWriter.Get(SendOption.Reliable);
PackedWriter.StartMessage(26);
PackedWriter.WritePacked(AmongUsClient.Instance.GameId);
}
sender.SendGameOptions();
sender.IsDirty = false;
}
@@ -217,9 +202,58 @@ public sealed class PlayerGameOptionsSender(PlayerControl player) : GameOptionsS
yield return base.SendGameOptionsAsync();
}
protected override IEnumerator SendOptionsArrayAsync(Il2CppStructArray<byte> optionArray, byte logicOptionsIndex)
{
if (PackedWriter.Length > 1000 || PackedWriterMessages >= AmongUsClient.Instance.GetMaxMessagePackingLimit())
{
PackedWriter.EndMessage();
var qa = DataFlagRateLimiter.Enqueue(() => AmongUsClient.Instance.SendOrDisconnect(PackedWriter));
yield return qa.Wait();
PackedWriterMessages = 0;
if (qa.Dropped)
{
Main.Instance.StopCoroutine(ActiveCoroutine);
ActiveCoroutine = null;
PackedWriter.Recycle();
PackedWriter = null;
yield return null;
yield break;
}
PackedWriter.Clear(SendOption.Reliable);
PackedWriter.StartMessage(26);
PackedWriter.WritePacked(AmongUsClient.Instance.GameId);
}
yield return WaitFrameIfNecessary();
PackedWriterMessages++;
PackedWriter.StartMessage(6);
{
PackedWriter.Write(AmongUsClient.Instance.GameId);
PackedWriter.WritePacked(player.OwnerId);
PackedWriter.StartMessage(1);
{
PackedWriter.WritePacked(GameManager.Instance.NetId);
PackedWriter.StartMessage(logicOptionsIndex);
{
PackedWriter.WriteBytesAndSize(optionArray);
}
PackedWriter.EndMessage();
}
PackedWriter.EndMessage();
}
PackedWriter.EndMessage();
Logger.Info($"PackedWriter message write complete - Length: {PackedWriter.Length}, Messages: {PackedWriterMessages}", "SendOptionsArrayAsync");
}
protected override void SendOptionsArray(Il2CppStructArray<byte> optionArray, byte logicOptionsIndex)
{
if (PackedWriter == null)
if (PackedWriter == null) // Single write
{
DataFlagRateLimiter.Enqueue(() =>
{
@@ -249,6 +283,21 @@ public sealed class PlayerGameOptionsSender(PlayerControl player) : GameOptionsS
});
return;
}
if (PackedWriter.Length > 1000 || PackedWriterMessages >= AmongUsClient.Instance.GetMaxMessagePackingLimit())
{
PackedWriter.EndMessage();
var capturedWriter = PackedWriter;
DataFlagRateLimiter.Enqueue(() =>
{
AmongUsClient.Instance.SendOrDisconnect(capturedWriter);
capturedWriter.Recycle();
}, cleanup: capturedWriter.Recycle);
PackedWriterMessages = 0;
PackedWriter = MessageWriter.Get(SendOption.Reliable);
PackedWriter.StartMessage(26);
PackedWriter.WritePacked(AmongUsClient.Instance.GameId);
}
PackedWriterMessages++;
@@ -270,7 +319,7 @@ public sealed class PlayerGameOptionsSender(PlayerControl player) : GameOptionsS
}
PackedWriter.EndMessage();
Logger.Info($"PackedWriter message write complete - Length: {PackedWriter.Length}, Messages: {PackedWriterMessages}", "GameOptionsSender");
Logger.Info($"PackedWriter message write complete - Length: {PackedWriter.Length}, Messages: {PackedWriterMessages}", "SendOptionsArray");
}
public static void RemoveSender(PlayerControl player)
+2 -1
View File
@@ -1697,7 +1697,7 @@ public static class Utils
else if (pc.IsAlive()) pc.Suicide(PlayerState.DeathReason.Bombed, terrorist.Object);
}
CustomWinnerHolder.ResetAndSetWinner(CustomWinner.Terrorist);
CustomWinnerHolder.ShiftWinnerAndSetWinner(CustomWinner.Terrorist);
CustomWinnerHolder.WinnerIds.Add(terrorist.PlayerId);
}
}
@@ -1924,6 +1924,7 @@ public static class Utils
// ============================================================================
int fullRpcSizeLimit = Options.MessageRpcSizeLimit.GetInt();
if (vanilla && fullRpcSizeLimit > 1200) fullRpcSizeLimit = 1200;
string resetName = Main.AllPlayerNames.GetValueOrDefault(sender.PlayerId, string.Empty);
// --------------------------------------------------------------------------
+14 -7
View File
@@ -32,7 +32,7 @@ internal static class ExileControllerWrapUpPatch
Logger.Info("The exiled player is an impostor, but the Innocent cannot win due to the settings", "Exeiled Winner Check");
else
{
CustomWinnerHolder.ResetAndSetWinner(CustomWinner.Innocent);
CustomWinnerHolder.SetWinnerOrAdditonalWinner(CustomWinner.Innocent);
Main.EnumeratePlayerControls()
.Where(x => x.Is(CustomRoles.Innocent) && !x.IsAlive() && x.GetRealKiller()?.PlayerId == exiled.PlayerId)
@@ -216,15 +216,22 @@ internal static class ExileControllerWrapUpPatch
finally { WrapUpFinalizer(); }
}
}
[HarmonyPatch(typeof(AirshipExileController), nameof(AirshipExileController.WrapUpAndSpawn))]
private static class AirshipExileControllerPatchAndroid
[HarmonyPatch]
static class AirshipExileControllerPatch
{
public static void Postfix(AirshipExileController __instance)
public static System.Reflection.MethodBase TargetMethod()
{
if (Main.LIMap) return;
return Utils.GetStateMachineMoveNext<AirshipExileController>(nameof(AirshipExileController.WrapUpAndSpawn));
}
public static void Postfix(Il2CppInterop.Runtime.InteropTypes.Il2CppObjectBase __instance, ref bool __result)
{
var wrapper = new StateMachineWrapper<AirshipExileController>(__instance);
if (wrapper.State != 1 || !__result || Main.LIMap) return;
try { WrapUpPostfix(__instance.initData.networkedPlayer); }
try { WrapUpPostfix(wrapper.Instance.initData.networkedPlayer); }
finally { WrapUpFinalizer(); }
}
}
+1 -1
View File
@@ -32,7 +32,7 @@ static class ShowRoleMoveNextPatch
{
var wrapper = new StateMachineWrapper<IntroCutscene>(__instance);
if (wrapper.GetField<int>("__1__state") != 1 || !__result) return;
if (wrapper.State != 1 || !__result) return;
GameStates.InGame = true;
SetUpRoleTextPatch.Postfix(wrapper.Instance);
+1 -1
View File
@@ -692,7 +692,7 @@ internal static class MurderPlayerPatch
if (Main.FirstDied == string.Empty && target.Is(CustomRoles.Youtuber))
{
CustomSoundsManager.RPCPlayCustomSoundAll("Congrats");
CustomWinnerHolder.ResetAndSetWinner(CustomWinner.Youtuber);
CustomWinnerHolder.SetWinnerOrAdditonalWinner(CustomWinner.Youtuber);
CustomWinnerHolder.WinnerIds.Add(target.PlayerId);
}
+1 -1
View File
@@ -131,7 +131,7 @@ public class SpellCaster : CovenBase
{
if (IsWinConditionMet())
{
CustomWinnerHolder.ResetAndSetWinner(CustomWinner.Coven);
CustomWinnerHolder.ShiftWinnerAndSetWinner(CustomWinner.Coven);
CustomWinnerHolder.WinnerIds.UnionWith(Main.EnumeratePlayerControls().Where(x => x.Is(Team.Coven)).Select(x => x.PlayerId));
}
}
+1 -1
View File
@@ -342,7 +342,7 @@ public class Dad : RoleBase
if (MilkTimer <= 0)
{
pc.TPToRandomVent();
CustomWinnerHolder.ResetAndSetWinner(CustomWinner.Crewmate);
CustomWinnerHolder.ShiftWinnerAndSetWinner(CustomWinner.Crewmate);
CustomWinnerHolder.WinnerIds.UnionWith(Main.EnumeratePlayerControls().Where(x => x.Is(Team.Crewmate)).Select(x => x.PlayerId));
}
}
+1 -1
View File
@@ -64,7 +64,7 @@ internal class Speedrunner : RoleBase
LateTask.New(() =>
{
if (!GameStates.IsEnded) CustomWinnerHolder.ResetAndSetWinner(CustomWinner.Crewmate);
if (!GameStates.IsEnded) CustomWinnerHolder.ShiftWinnerAndSetWinner(CustomWinner.Crewmate);
}, 1f, log: false);
}
else if (completedTasks >= SpeedrunnerNotifyAtXTasksLeft.GetInt() && SpeedrunnerNotifyKillers.GetBool())
+1 -1
View File
@@ -44,7 +44,7 @@ public class Hypocrite : RoleBase
{
Logger.Info($"Hypocrite ({pc.GetNameWithRole()}) finished all tasks", "Hypocrite");
pc.RPCPlayCustomSound("Congrats");
CustomWinnerHolder.ResetAndSetWinner(CustomWinner.Impostor);
CustomWinnerHolder.ShiftWinnerAndSetWinner(CustomWinner.Impostor);
}
else if (NonImpGetsNotifyWhenLowTasks.GetBool() && completedTaskCount + 1 >= totalTaskCount - NotifyAtXTasksLeft.GetInt())
{
+1 -1
View File
@@ -116,7 +116,7 @@ public class Gangster : RoleBase
private static bool CanBeMadmate(PlayerControl pc)
{
return pc != null && pc.IsCrewmate() && !pc.Is(CustomRoles.Madmate)
return pc && pc.IsCrewmate() && !pc.Is(CustomRoles.Madmate)
&& !(
(pc.Is(CustomRoles.Sheriff) && !SheriffCanBeMadmate.GetBool()) ||
(pc.Is(CustomRoles.Mayor) && !MayorCanBeMadmate.GetBool()) ||
@@ -244,7 +244,7 @@ internal class Revolutionist : RoleBase
{
if (AmongUsClient.Instance.IsGameStarted && pc.IsDrawDone())
{
CustomWinnerHolder.ResetAndSetWinner(CustomWinner.Revolutionist);
CustomWinnerHolder.SetWinnerOrAdditonalWinner(CustomWinner.Revolutionist);
Utils.GetDrawPlayerCount(pc.PlayerId, out List<PlayerControl> x);
CustomWinnerHolder.WinnerIds.Add(pc.PlayerId);
if (x != null) foreach (PlayerControl apc in x) CustomWinnerHolder.WinnerIds.Add(apc.PlayerId);
+2 -2
View File
@@ -191,13 +191,13 @@ internal class Arsonist : RoleBase
switch (apc)
{
case 1:
CustomWinnerHolder.ResetAndSetWinner(CustomWinner.Arsonist);
CustomWinnerHolder.SetWinnerOrAdditonalWinner(CustomWinner.Arsonist);
CustomWinnerHolder.WinnerIds.Add(physics.myPlayer.PlayerId);
break;
case 2:
if (Main.EnumerateAlivePlayerControls().Where(x => x.PlayerId != physics.myPlayer.PlayerId).All(x => x.GetCountTypes() == CountTypes.Crew))
{
CustomWinnerHolder.ResetAndSetWinner(CustomWinner.Arsonist);
CustomWinnerHolder.SetWinnerOrAdditonalWinner(CustomWinner.Arsonist);
CustomWinnerHolder.WinnerIds.Add(physics.myPlayer.PlayerId);
}
+1 -1
View File
@@ -89,7 +89,7 @@ public class Collector : RoleBase
{
if (check) return true;
CustomWinnerHolder.ResetAndSetWinner(CustomWinner.Collector);
CustomWinnerHolder.SetWinnerOrAdditonalWinner(CustomWinner.Collector);
foreach (PlayerControl winner in pc) CustomWinnerHolder.WinnerIds.Add(winner.PlayerId);
return true;
+1 -1
View File
@@ -125,7 +125,7 @@ public class Doomsayer : RoleBase
GuessingToWin[doomsayer.PlayerId] = DoomsayerAmountOfGuessesToWin.GetInt();
GuessesCount = DoomsayerAmountOfGuessesToWin.GetInt();
CustomWinnerHolder.ResetAndSetWinner(CustomWinner.Doomsayer);
CustomWinnerHolder.SetWinnerOrAdditonalWinner(CustomWinner.Doomsayer);
CustomWinnerHolder.WinnerIds.Add(doomsayer.PlayerId);
}
+1 -1
View File
@@ -79,7 +79,7 @@ internal class Vector : RoleBase
if (AmongUsClient.Instance.AmHost && VectorVentCount[pc.PlayerId] >= VectorVentNumWin)
{
pc.RPCPlayCustomSound("MarioCoin");
CustomWinnerHolder.ResetAndSetWinner(CustomWinner.Vector);
CustomWinnerHolder.SetWinnerOrAdditonalWinner(CustomWinner.Vector);
CustomWinnerHolder.WinnerIds.Add(pc.PlayerId);
}
}
+1 -1
View File
@@ -154,7 +154,7 @@ public class Vulture : RoleBase
if (TotalEaten >= NumberOfReportsToWin.GetInt() && GameStates.IsInTask)
{
CustomWinnerHolder.ResetAndSetWinner(CustomWinner.Vulture);
CustomWinnerHolder.SetWinnerOrAdditonalWinner(CustomWinner.Vulture);
CustomWinnerHolder.WinnerIds.Add(pc.PlayerId);
return false;
}
+1 -1
View File
@@ -80,7 +80,7 @@ internal class Workaholic : RoleBase
foreach (PlayerControl pc in Main.EnumerateAlivePlayerControls())
pc.Suicide(pc.PlayerId == player.PlayerId ? PlayerState.DeathReason.Overtired : PlayerState.DeathReason.Ashamed, player);
CustomWinnerHolder.ResetAndSetWinner(CustomWinner.Workaholic);
CustomWinnerHolder.ShiftWinnerAndSetWinner(CustomWinner.Workaholic);
CustomWinnerHolder.WinnerIds.Add(player.PlayerId);
}
}
+1 -1
View File
@@ -358,7 +358,7 @@ public class Infection : RoleBase
player.Suicide(PlayerState.DeathReason.Curse, infectionSource);
}
CustomWinnerHolder.ResetAndSetWinner(CustomWinner.Infection);
CustomWinnerHolder.SetWinnerOrAdditonalWinner(CustomWinner.Infection);
for (int index = 0; index < apc.Count; index++)
{
PlayerControl pc = apc[index];
+1 -1
View File
@@ -161,7 +161,7 @@ public class Thanos : RoleBase
{
if (CollectedStones.Count == StoneEnum.Length && CanWinAfterCollectingAllStones.GetBool())
{
CustomWinnerHolder.ResetAndSetWinner(CustomWinner.Thanos);
CustomWinnerHolder.ShiftWinnerAndSetWinner(CustomWinner.Thanos);
CustomWinnerHolder.WinnerIds.Add(pc.PlayerId);
return;
}