more fixes

This commit is contained in:
Gurge44 committed 2025-10-13 09:07:48 +02:00
1 parent 7df3773b74
commit 53f422ed34
8 files changed
+58 -19

No files matched your search

+29 -8
View File
@@ -73,7 +73,7 @@ public static class Mingle
public static string GetSuffix(PlayerControl seer)
{
return seer.IsModdedClient() ? string.Empty : GetRoomsInfo(seer);
return seer.IsModdedClient() ? string.Empty : GetRoomsInfo(seer, false);
}
public static int GetSurvivalTime(byte id)
@@ -90,15 +90,32 @@ public static class Mingle
public static bool CheckGameEnd(out GameOverReason reason)
{
reason = GameOverReason.ImpostorsByKill;
return false;
if (GameStates.IsEnded || !GameGoing) return false;
PlayerControl[] aapc = Main.AllAlivePlayerControls;
switch (aapc.Length)
{
case 1:
PlayerControl winner = aapc[0];
Logger.Info($"Winner: {winner.GetRealName().RemoveHtmlTags()}", "Mingle");
CustomWinnerHolder.WinnerIds = [winner.PlayerId];
Main.DoBlockNameChange = true;
return true;
case 0:
CustomWinnerHolder.ResetAndSetWinner(CustomWinner.Error);
Logger.Warn("No players alive. Force ending the game", "Mingle");
return true;
default:
return false;
}
}
public static string GetTaskBarText()
{
return GetRoomsInfo(PlayerControl.LocalPlayer);
return GetRoomsInfo(PlayerControl.LocalPlayer, true);
}
private static string GetRoomsInfo(PlayerControl pc)
private static string GetRoomsInfo(PlayerControl pc, bool hud)
{
StringBuilder sb = new("<#ffffff><size=90%>");
PlainShipRoom plainShipRoom = pc.GetPlainShipRoom();
@@ -108,7 +125,7 @@ public static class Mingle
int count = GetNumPlayersInRoom(room);
if (plainShipRoom != null && plainShipRoom.RoomId == room)
sb.Append("<u>");
sb.Append(hud ? "➡ " : "<u>");
if (DisplayCurrentPlayerCountInEachRoom)
{
@@ -130,11 +147,12 @@ public static class Mingle
if (DisplayCurrentPlayerCountInEachRoom)
{
sb.Append(' ');
sb.Append(count > required ? "+ <#ff0000>╳</color>" : count == required ? "= <#00ff00>✓</color>" : "- <#ff0000>╳</color>");
sb.Append("</color>");
}
if (plainShipRoom != null && plainShipRoom.RoomId == room)
if (plainShipRoom != null && plainShipRoom.RoomId == room && !hud)
sb.Append("</u>");
sb.Append('\n');
@@ -147,7 +165,9 @@ public static class Mingle
if (timeLeft >= 0)
{
sb.Append('\n');
if (hud) sb.Append("<b><size=200%>");
sb.Append(timeLeft);
if (hud) sb.Append("</size></b>");
}
if (plainShipRoom == null || !RequiredPlayerCount.ContainsKey(plainShipRoom.RoomId))
@@ -218,9 +238,9 @@ public static class Mingle
}
NameNotifyManager.Reset();
StartNewRound();
GameGoing = true;
GameStartDateTime = DateTime.Now;
StartNewRound();
}
private static void StartNewRound()
@@ -272,6 +292,7 @@ public static class Mingle
Time = Math.Clamp(Time - TimeDecreaseOnNoDeath, MinTime, TimeLimit);
break;
case var x when x == aapc.Length:
Main.AllPlayerSpeed.SetAllValues(Main.RealOptionsData.GetFloat(FloatOptionNames.PlayerSpeedMod));
CustomWinnerHolder.ResetAndSetWinner(CustomWinner.None);
GameGoing = false;
break;
@@ -281,7 +302,7 @@ public static class Mingle
}
}
private static int GetNumPlayersInRoom(SystemTypes room) => Main.AllAlivePlayerControls.Select(x => x.GetPlainShipRoom()).Count(x => x != null && x.RoomId == room);
private static int GetNumPlayersInRoom(SystemTypes room) => Main.AllAlivePlayerControls.Where(x => !x.inMovingPlat).Select(x => x.GetPlainShipRoom()).Count(x => x != null && x.RoomId == room);
public static void HandleDisconnect()
{
+1 -1
View File
@@ -1163,7 +1163,7 @@ public static class GameSettingMenuPatch
CustomGameMode[] gms = Enum.GetValues<CustomGameMode>()[..^1];
if (SubmergedCompatibility.Loaded && Main.NormalOptions.MapId == 6) gms = gms.Where(SubmergedCompatibility.IsSupported).ToArray();
int totalCols = Mathf.Max(1, Mathf.CeilToInt(gms.Length / 5f));
int totalCols = Mathf.Max(1, Mathf.CeilToInt(gms.Length / 7f));
GMButtons = [];
+7 -3
View File
@@ -373,7 +373,7 @@ internal static class HudManagerPatch
button = __instance.ImpostorVentButton;
else if ((role.IsCrewmate() && role.IsDesyncRole() && !usesPetInsteadOfKill) || role is CustomRoles.Dreamweaver or CustomRoles.Enchanter or CustomRoles.VoodooMaster or CustomRoles.Blackmailer or CustomRoles.Cantankerous or CustomRoles.Consort or CustomRoles.EvilDiviner or CustomRoles.Framer or CustomRoles.Gangster or CustomRoles.Kamikaze or CustomRoles.Auditor or CustomRoles.Backstabber or CustomRoles.Cherokious or CustomRoles.Cultist or CustomRoles.Curser or CustomRoles.Gaslighter or CustomRoles.Investor or CustomRoles.Jackal or CustomRoles.PlagueDoctor or CustomRoles.Pursuer or CustomRoles.Spiritcaller or CustomRoles.Starspawn)
button = __instance.KillButton;
else if ((Options.UsePhantomBasis.GetBool() && (!role.IsNK() || Options.UsePhantomBasisForNKs.GetBool()) && role.SimpleAbilityTrigger()) || (player.GetRoleTypes() is RoleTypes.Engineer or RoleTypes.Shapeshifter or RoleTypes.Phantom && !player.Is(CustomRoles.Nimble)))
else if ((Options.UsePhantomBasis.GetBool() && (!role.IsNK() || Options.UsePhantomBasisForNKs.GetBool()) && role.SimpleAbilityTrigger()) || (player.GetRoleTypes() is RoleTypes.Engineer or RoleTypes.Shapeshifter or RoleTypes.Phantom && !player.Is(CustomRoles.Nimble) && player.GetCustomRole() is not (CustomRoles.Mechanic or CustomRoles.Monitor)))
button = __instance.AbilityButton;
else if ((Options.UsePets.GetBool() && role.PetActivatedAbility()) || usesPetInsteadOfKill)
button = __instance.PetButton;
@@ -514,8 +514,12 @@ public static class ButtonCooldownPatch
if (!__instance.isActiveAndEnabled) return;
if (!Main.ButtonCooldownInDecimalUnder10s.Value) return;
if (__instance.isCoolingDown && timer < 10f)
__instance.cooldownTimerText.text = timer.ToString("0.0", NumberFormatInfo.CurrentInfo);
if (__instance.isCoolingDown)
{
__instance.cooldownTimerText.text = timer < 10f
? timer.ToString("0.0", NumberFormatInfo.CurrentInfo)
: ((int)timer).ToString();
}
}
}
+5 -2
View File
@@ -1176,7 +1176,7 @@ internal static class IntroCutsceneDestroyPatch
Main.ProcessShapeshifts = false;
LateTask.New(GrantPetForEveryone, 0.7f, "Grant Pet For Everyone");
LateTask.New(GrantPetForEveryone, 3f, "Grant Pet For Everyone");
LateTask.New(() =>
{
@@ -1204,7 +1204,7 @@ internal static class IntroCutsceneDestroyPatch
}
catch (Exception ex) { Logger.Fatal(ex.ToString(), "IntroPatch.RpcShapeshift"); }
}
}, 1.4f, "Show Pet For Everyone");
}, 4f, "Show Pet For Everyone");
LateTask.New(() => Main.ProcessShapeshifts = true, 2f, "Enable SS Processing");
}
@@ -1328,6 +1328,9 @@ internal static class IntroCutsceneDestroyPatch
];
hud.SetRolePanelOpen(true);
if (Options.CurrentGameMode == CustomGameMode.Standard && !Utils.HasTasks(PlayerControl.LocalPlayer.Data, forRecompute: false))
hud.TaskPanel.open = false;
}, 1f, log: false);
LateTask.New(() =>
+11
View File
@@ -51,6 +51,17 @@ public static class PhantomRolePatch
return false;
}
[HarmonyPatch(nameof(PlayerControl.CheckVanish))]
[HarmonyPrefix]
private static bool CheckVanish_Prefix(PlayerControl __instance)
{
if (!AmongUsClient.Instance.AmHost || !__instance.AmOwner) return true;
Logger.Info($" {__instance.GetNameWithRole()}", "CheckVanish");
return CheckTrigger(__instance);
}
// Called when Phantom press vanish button when visible
/*[HarmonyPatch(nameof(PlayerControl.CheckVanish))]
[HarmonyPrefix]
+1 -1
View File
@@ -355,7 +355,7 @@ internal static class CheckMurderPatch
return false;
}
bool CheckMurder() => Main.PlayerStates[killer.PlayerId].Role.OnCheckMurder(killer, target) || target.Is(CustomRoles.Fragile) || Ambusher.FragilePlayers.ContainsKey(target.PlayerId);
bool CheckMurder() => target.Is(CustomRoles.Fragile) || Ambusher.FragilePlayers.ContainsKey(target.PlayerId) || Main.PlayerStates[killer.PlayerId].Role.OnCheckMurder(killer, target);
}
if (!killer.RpcCheckAndMurder(target, true)) return false;
+3 -3
View File
@@ -692,13 +692,13 @@
"MercenaryInfoLong": "(Impostors):\\nAs the Mercenary, you have a lower kill cooldown than other impostors, but you also have a timer. You must kill someone to reset it. If it gets to 0, you suicide. You can see the timer above your name if it gets below 20 seconds.",
"MareInfoLong": "(Add-ons):\\nAs the Mare, you have a low kill cooldown but can only kill during lights. Additionally, your name will appear in red during lights. Only assigned to Impostors and cannot be guessed.",
"VampireInfoLong": "(Impostors):\\nVampire bites delay death. Meeting kills bitten. Biting Bait = normal kill, self-report.",
"WarlockInfoLong": "(Impostors):\\nWarlock can curse a player while not Shapeshifted. If they vanish/pet after cursing, the closest player to the cursed one is killed, regardless of distance. Only one player can be cursed at a time.\\n\\nKilling, shapeshifting/petting, and cursing all have separate cooldowns. The Warlock may freeze in place for a few seconds after killing via cursed player.",
"WarlockInfoLong": "(Impostors):\\nWarlock can curse a player while not Shapeshifted. If they vanish/pet after cursing, the closest player to the cursed one is killed, regardless of distance. Only one player can be cursed at a time.\\n\\nKilling, vanishing/petting, and cursing all have separate cooldowns. The Warlock may freeze in place for a few seconds after killing via cursed player.",
"ZombieInfoLong": "(Impostors):\\nZombie has a short kill cooldown but moves very slowly and has very little vision. Zombie will not be voted out by anyone other than the Dictator, and the movement speed of Zombie will gradually slow down as they make kills or time passes.",
"NinjaInfoLong": "(Impostors):\\nNinja can use the kill button to mark a target, and if the mark is successful, a shield animation will show as a reminder. The Ninja can then use the vanish/pet to teleport to the marked person and kill the marked person. Ninja cannot kill regularly, but may be able to kill regularly after assassination according to the host's settings.",
"AnonymousInfoLong": "(Impostors):\\nAnonymous can use Shapeshift to hack into a target. The hacked target will report the body killed by Anonymous or its own if there is none. Hacking ignores whether a body can be reported. Hacking Lazy Guy is a waste of time.",
"MinerInfoLong": "(Impostors):\\nMiner can vanish/pet to teleport back to the last vent they were in.",
"KillingMachineInfoLong": "(Impostors):\\nThe Killing Machine has a very short kill cooldown, but cannot vent, has lower vision, cannot sabotage, cannot report, and cannot call emergency meetings.",
"EscapeeInfoLong": "(Impostors):\\nEscapist can mark a location by shapeshifting/petting, and they will be teleported to the marked location when they vanish/pet again (not when unshifting).",
"EscapeeInfoLong": "(Impostors):\\nEscapist can mark a location by vanishing/petting, and they will be teleported to the marked location when they vanish/pet again (not when unshifting).",
"WitchInfoLong": "(Impostors):\\nThe Witch can kill players directly or cast spells by tapping the kill button once or twice, respectively. Spelled players will have a 「†」 mark next to their name in the next meeting. If the Witch survives until the meeting's end, all spelled players die.",
"MafiaInfoLong": "(Impostors):\\nNemesis can't kill while there are other Impostors alive in the game, but can use /rv [player id] after death to kill the specified player.",
"GodfatherInfoLong": "(Impostors):\\nAs a Godfather, you vote for someone to make them your target. In the next round if someone kills the target, the killer will turn into a refugee",
@@ -738,7 +738,7 @@
"DeathpactInfoLong": "(Impostors):\\nAs the Deathpact, the targets of your shapeshifting are marked for a deathpact. When enough players are marked for a death pact, the marked players must meet within a defined period; if they fail to do so, they die.\\n\\nIf a marked player dies before the death pact is completed, the pact is withdrawn.",
"DevourerInfoLong": "(Impostors):\\nAs the Devourer, you use your shapeshift to change the appearance of the target of the shapeshift permanently. Additionally, when each player's appearance changes, your kill cooldown is reduced by a defined number of seconds. If the Devourer dies or gets voted out during a meeting, the player's appearance will change back to their normal appearance.",
"MorphlingInfoLong": "(Impostors):\\nAs the Morphling, you are a Shapeshifter but cannot kill while not shapeshifted.",
"TwisterInfoLong": "(Impostors):\\nAs the Twister, you can use shapeshifting/petting to swap the position of all players randomly.\\n\\nThe Twister itself will not swap places with anyone, and players who are in vents cannot be teleported.",
"TwisterInfoLong": "(Impostors):\\nAs the Twister, you can use vanishing/petting to swap the position of all players randomly.\\n\\nThe Twister itself will not swap places with anyone, and players who are in vents cannot be teleported.",
"LurkerInfoLong": "(Impostors):\\nAs the Lurker, you can jump into a vent to reduce your cooldown by a certain number of seconds. After you kill, your cooldown is reset to its original value.",
"ConvictInfoLong": "(Madmates):\\nAs the Convict, you now work for the Impostors.",
"VisionaryInfoLong": "(Impostors):\\nAs the Visionary, you see the teams of players you revealed. You can reveal a player's alignment by selecting them as your shapeshifting target; if you have at least one ability, use left. You gain one ability to use after each kill you make.\\nThe name color of a revealed player will indicate their team (<#8cffff>Crewmate</color>/<#ff1919>Impostor</color>/<#ffab1b>Neutral</color>/<#7b3fbb>Coven</color>).",
+1 -1
View File
@@ -129,7 +129,7 @@ public class Pelican : RoleBase
if (!pc.Is(CustomRoles.Pelican) || GameStates.IsMeeting) return false;
PlayerControl target = Utils.GetPlayerById(id);
return target != null && target.IsAlive() && !target.inVent && !Medic.ProtectList.Contains(target.PlayerId) && !target.Is(CustomRoles.GM) && !target.Is(CustomRoles.Pestilence) && !target.Is(CustomRoles.Fragile) && !IsEaten(pc, id) && !IsEaten(id);
return target != null && target.IsAlive() && !target.inVent && !Medic.ProtectList.Contains(target.PlayerId) && !target.Is(CustomRoles.GM) && !target.Is(CustomRoles.Pestilence) && !IsEaten(pc, id) && !IsEaten(id);
}
public static Vector2 GetBlackRoomPS()