some fixes

This commit is contained in:
Gurge44 committed 2024-11-25 17:53:09 +01:00
1 parent c82a9d492e
commit 0fb1bcd6a5
10 files changed
+68 -44

No files matched your search

+2 -1
View File
@@ -131,8 +131,9 @@ namespace EHR
new("strangeant#6543", isUp: true), // after.edits
new("ninjanice#3990", isUp: true), // void_daora
new("magicmill#4146", isUp: true), // Sr.Angel
new("grassyprey#9593", isUp: true), // LucasCarr
new("grassyprey#9593", "#ff0000", "YouTuber", true), // LucasCarr
new("blessedtea#6684", "#ff0000", "YouTuber", true), // Rvimpostor
new("seriouslug#1532", "#FF2400", "ZEN", true), // Zypherus
// Sponsor
new("recentduct#6068", "#FF00FF", "高冷男模法师", false, true),
+9
View File
@@ -97,6 +97,15 @@ namespace EHR
public void SetMainRole(CustomRoles role)
{
try
{
Utils.RemovePlayerFromPreviousRoleData(Player);
}
catch (Exception e)
{
Utils.ThrowException(e);
}
countTypes = role.GetCountTypes();
if (SubRoles.Contains(CustomRoles.Recruit))
+3 -4
View File
@@ -74,15 +74,14 @@ namespace EHR
// Impostors and Madmates
if (seer.Is(CustomRoleTypes.Impostor) && target.Is(CustomRoleTypes.Impostor)) color = target.Is(CustomRoles.Egoist) && Options.ImpEgoistVisibalToAllies.GetBool() && seer != target ? Main.RoleColors[CustomRoles.Egoist] : Main.ImpostorColor;
if (seer.Is(CustomRoles.Madmate) && target.Is(CustomRoleTypes.Impostor) && Options.MadmateKnowWhosImp.GetBool()) color = Main.ImpostorColor;
if (seer.Is(CustomRoleTypes.Impostor) && target.Is(CustomRoles.Madmate) && Options.ImpKnowWhosMadmate.GetBool()) color = Main.RoleColors[CustomRoles.Madmate];
if (seer.Is(CustomRoles.Madmate) && target.Is(CustomRoles.Madmate) && Options.MadmateKnowWhosMadmate.GetBool()) color = Main.RoleColors[CustomRoles.Madmate];
if (seer.IsMadmate() && target.Is(CustomRoleTypes.Impostor) && Options.MadmateKnowWhosImp.GetBool()) color = Main.ImpostorColor;
if (seer.Is(CustomRoleTypes.Impostor) && target.IsMadmate() && Options.ImpKnowWhosMadmate.GetBool()) color = Main.RoleColors[CustomRoles.Madmate];
if (seer.IsMadmate() && target.IsMadmate() && Options.MadmateKnowWhosMadmate.GetBool()) color = Main.RoleColors[CustomRoles.Madmate];
if (Blackmailer.On && seerRoleClass is Blackmailer { IsEnable: true } bm && bm.BlackmailedPlayerIds.Contains(target.PlayerId)) color = Main.RoleColors[CustomRoles.BloodKnight];
if (Commander.On && seer.Is(Team.Impostor))
{
if (Commander.PlayerList.Any(x => x.MarkedPlayer == target.PlayerId)) color = Main.RoleColors[CustomRoles.Sprayer];
if (Commander.PlayerList.Any(x => x.DontKillMarks.Contains(target.PlayerId))) color = "#0daeff";
}
+8 -7
View File
@@ -8,6 +8,7 @@ namespace EHR.Modules
{
public static class Statistics
{
private const int MinPlayers = 3;
private static bool OnlyVotingForKillersAsCrew = true;
private static bool VotedBySomeone;
public static int VentTimes;
@@ -15,7 +16,7 @@ namespace EHR.Modules
public static void OnGameEnd()
{
if (CustomWinnerHolder.WinnerTeam is CustomWinner.None or CustomWinner.Draw or CustomWinner.Error || Main.AllPlayerControls.Length <= 2) return;
if (CustomWinnerHolder.WinnerTeam is CustomWinner.None or CustomWinner.Draw or CustomWinner.Error || Main.AllPlayerControls.Length <= 3) return;
var lp = PlayerControl.LocalPlayer;
var role = lp.GetCustomRole();
@@ -81,7 +82,7 @@ namespace EHR.Modules
if (Utils.GameStartTimeStamp + 90 > Utils.TimeStamp)
Achievements.Type.Speedrun.CompleteAfterGameEnd();
if (won && lp.IsMadmate() && !Main.AllAlivePlayerControls.Any(x => x.IsImpostor()))
if (won && CustomWinnerHolder.WinnerTeam == CustomWinner.Impostor && lp.IsMadmate() && !Main.AllAlivePlayerControls.Any(x => x.IsImpostor()))
Achievements.Type.Carried.CompleteAfterGameEnd();
if (won && lp.IsNeutralKiller())
@@ -140,7 +141,7 @@ namespace EHR.Modules
break;
}
int correctGuesses = Main.PlayerStates.Values.Count(x => x.GetRealKiller() == lp.PlayerId && x.deathReason == PlayerState.DeathReason.Gambled);
int correctGuesses = Main.PlayerStates.Values.Count(x => !x.Player.IsLocalPlayer() && x.GetRealKiller() == lp.PlayerId && x.deathReason == PlayerState.DeathReason.Gambled);
if (correctGuesses >= 1) Achievements.Type.LuckOrObservation.CompleteAfterGameEnd();
if (correctGuesses >= 2) Achievements.Type.BeginnerGuesser.CompleteAfterGameEnd();
@@ -174,7 +175,7 @@ namespace EHR.Modules
{
try
{
if (Options.CurrentGameMode != CustomGameMode.Standard || Main.AllPlayerControls.Length <= 2) return;
if (Options.CurrentGameMode != CustomGameMode.Standard || Main.AllPlayerControls.Length <= MinPlayers) return;
PlayerControl lp = PlayerControl.LocalPlayer;
@@ -232,7 +233,7 @@ namespace EHR.Modules
{
try
{
if (!CustomRoleSelector.RoleResult.TryGetValue(PlayerControl.LocalPlayer.PlayerId, out CustomRoles role) || Main.AllPlayerControls.Length <= 2) return;
if (!CustomRoleSelector.RoleResult.TryGetValue(PlayerControl.LocalPlayer.PlayerId, out CustomRoles role) || Main.AllPlayerControls.Length <= MinPlayers) return;
const float delay = 15f;
@@ -257,7 +258,7 @@ namespace EHR.Modules
{
try
{
if (Options.CurrentGameMode != CustomGameMode.Standard || killer.PlayerId == target.PlayerId || Main.AllPlayerControls.Length <= 2) return;
if (Options.CurrentGameMode != CustomGameMode.Standard || killer.PlayerId == target.PlayerId || Main.AllPlayerControls.Length <= MinPlayers) return;
if (killer.IsLocalPlayer())
{
@@ -315,7 +316,7 @@ namespace EHR.Modules
{
try
{
if (Options.CurrentGameMode != CustomGameMode.Standard || Main.AllPlayerControls.Length <= 2) return;
if (Options.CurrentGameMode != CustomGameMode.Standard || Main.AllPlayerControls.Length <= MinPlayers) return;
if (shapeshifter.IsLocalPlayer() && shapeshifting && animated)
{
+26 -7
View File
@@ -427,6 +427,25 @@ other: ∟ ⌠ ⌡ ╬ ╨ ▓ ▒ ░ « » █ ▄ ▌▀▐│ ┤ ╡ ╢
}
}
public static void RemovePlayerFromPreviousRoleData(PlayerControl target)
{
switch (target.GetCustomRole())
{
case CustomRoles.Enigma:
Enigma.PlayerIdList.Remove(target.PlayerId);
break;
case CustomRoles.Mediumshiper:
Mediumshiper.PlayerIdList.Remove(target.PlayerId);
break;
case CustomRoles.Mortician:
Mortician.PlayerIdList.Remove(target.PlayerId);
break;
case CustomRoles.Spiritualist:
Spiritualist.PlayerIdList.Remove(target.PlayerId);
break;
}
}
public static string GetDisplayRoleName(byte playerId, bool pure = false, bool seeTargetBetrayalAddons = false)
{
(string, Color) TextData = GetRoleText(playerId, playerId, pure, seeTargetBetrayalAddons);
@@ -984,12 +1003,12 @@ other: ∟ ⌠ ⌡ ╬ ╨ ▓ ▒ ░ « » █ ▄ ▌▀▐│ ┤ ╡ ╢
return true;
}
return (__instance.Is(CustomRoles.Madmate) && PlayerControl.LocalPlayer.Is(CustomRoles.Madmate) && Options.MadmateKnowWhosMadmate.GetBool()) ||
return (__instance.IsMadmate() && PlayerControl.LocalPlayer.IsMadmate() && Options.MadmateKnowWhosMadmate.GetBool()) ||
(__instance.IsMadmate() && PlayerControl.LocalPlayer.Is(CustomRoleTypes.Impostor) && Options.ImpKnowWhosMadmate.GetBool()) ||
(__instance.Is(CustomRoleTypes.Impostor) && PlayerControl.LocalPlayer.IsMadmate() && Options.MadmateKnowWhosImp.GetBool()) ||
(__instance.Is(CustomRoles.Mimic) && Main.VisibleTasksCount && __instance.Data.IsDead) ||
(__instance.Is(CustomRoles.Madmate) && PlayerControl.LocalPlayer.Is(CustomRoleTypes.Impostor) && Options.ImpKnowWhosMadmate.GetBool()) ||
(__instance.Is(CustomRoleTypes.Impostor) && PlayerControl.LocalPlayer.Is(CustomRoles.Crewpostor) && Options.AlliesKnowCrewpostor.GetBool()) ||
(__instance.Is(CustomRoleTypes.Impostor) && PlayerControl.LocalPlayer.Is(CustomRoleTypes.Impostor) && Options.ImpKnowAlliesRole.GetBool()) ||
(__instance.Is(CustomRoleTypes.Impostor) && PlayerControl.LocalPlayer.Is(CustomRoles.Madmate) && Options.MadmateKnowWhosImp.GetBool()) ||
(Main.LoversPlayers.TrueForAll(x => x.PlayerId == __instance.PlayerId || x.IsLocalPlayer()) && Main.LoversPlayers.Count == 2 && Lovers.LoverKnowRoles.GetBool()) ||
(CustomTeamManager.AreInSameCustomTeam(__instance.PlayerId, PlayerControl.LocalPlayer.PlayerId) && CustomTeamManager.IsSettingEnabledForPlayerTeam(__instance.PlayerId, CTAOption.KnowRoles)) ||
Main.PlayerStates.Values.Any(x => x.Role.KnowRole(PlayerControl.LocalPlayer, __instance)) ||
@@ -2062,7 +2081,7 @@ other: ∟ ⌠ ⌡ ╬ ╨ ▓ ▒ ░ « » █ ▄ ▌▀▐│ ┤ ╡ ╢
if (!GameStates.IsLobby)
{
if (AntiBlackout.SkipTasks) SelfSuffix.AppendLine(GetString("AntiBlackoutSkipTasks"));
if (Options.CurrentGameMode != CustomGameMode.Standard) goto GameMode0;
SelfMark.Append(Snitch.GetWarningArrow(seer));
@@ -2347,11 +2366,11 @@ other: ∟ ⌠ ⌡ ╬ ╨ ▓ ▒ ░ « » █ ▄ ▌▀▐│ ┤ ╡ ╢
(target.Is(CustomRoles.Gravestone) && target.Data.IsDead) ||
(Main.LoversPlayers.TrueForAll(x => x.PlayerId == seer.PlayerId || x.PlayerId == target.PlayerId) && Main.LoversPlayers.Count == 2 && Lovers.LoverKnowRoles.GetBool()) ||
(seer.Is(CustomRoleTypes.Impostor) && target.Is(CustomRoleTypes.Impostor) && Options.ImpKnowAlliesRole.GetBool()) ||
(seer.Is(CustomRoles.Madmate) && target.Is(CustomRoleTypes.Impostor) && Options.MadmateKnowWhosImp.GetBool()) ||
(seer.Is(CustomRoleTypes.Impostor) && target.Is(CustomRoles.Madmate) && Options.ImpKnowWhosMadmate.GetBool()) ||
(seer.IsMadmate() && target.Is(CustomRoleTypes.Impostor) && Options.MadmateKnowWhosImp.GetBool()) ||
(seer.Is(CustomRoleTypes.Impostor) && target.IsMadmate() && Options.ImpKnowWhosMadmate.GetBool()) ||
(seer.Is(CustomRoles.Crewpostor) && target.Is(CustomRoleTypes.Impostor) && Options.CrewpostorKnowsAllies.GetBool()) ||
(seer.Is(CustomRoleTypes.Impostor) && target.Is(CustomRoles.Crewpostor) && Options.AlliesKnowCrewpostor.GetBool()) ||
(seer.Is(CustomRoles.Madmate) && target.Is(CustomRoles.Madmate) && Options.MadmateKnowWhosMadmate.GetBool()) ||
(seer.IsMadmate() && target.IsMadmate() && Options.MadmateKnowWhosMadmate.GetBool()) ||
((seer.Is(CustomRoles.Sidekick) || seer.Is(CustomRoles.Recruit) || seer.Is(CustomRoles.Jackal)) && (target.Is(CustomRoles.Sidekick) || target.Is(CustomRoles.Recruit) || target.Is(CustomRoles.Jackal))) ||
(target.Is(CustomRoles.Workaholic) && Workaholic.WorkaholicVisibleToEveryone.GetBool()) ||
(target.Is(CustomRoles.Doctor) && !target.HasEvilAddon() && Options.DoctorVisibleToEveryone.GetBool()) ||
+3 -3
View File
@@ -864,11 +864,11 @@ namespace EHR.Patches
(target.Is(CustomRoles.Gravestone) && Main.VisibleTasksCount && target.Data.IsDead) ||
(Main.LoversPlayers.TrueForAll(x => x.PlayerId == target.PlayerId || x.PlayerId == seer.PlayerId) && Main.LoversPlayers.Count == 2 && Lovers.LoverKnowRoles.GetBool()) ||
(target.Is(CustomRoleTypes.Impostor) && seer.Is(CustomRoleTypes.Impostor) && Options.ImpKnowAlliesRole.GetBool()) ||
(target.Is(CustomRoleTypes.Impostor) && seer.Is(CustomRoles.Madmate) && Options.MadmateKnowWhosImp.GetBool()) ||
(target.Is(CustomRoles.Madmate) && seer.Is(CustomRoleTypes.Impostor) && Options.ImpKnowWhosMadmate.GetBool()) ||
(target.Is(CustomRoleTypes.Impostor) && seer.IsMadmate() && Options.MadmateKnowWhosImp.GetBool()) ||
(target.IsMadmate() && seer.Is(CustomRoleTypes.Impostor) && Options.ImpKnowWhosMadmate.GetBool()) ||
(target.Is(CustomRoleTypes.Impostor) && seer.Is(CustomRoles.Crewpostor) && Options.AlliesKnowCrewpostor.GetBool()) ||
(target.Is(CustomRoles.Crewpostor) && seer.Is(CustomRoleTypes.Impostor) && Options.CrewpostorKnowsAllies.GetBool()) ||
(target.Is(CustomRoles.Madmate) && seer.Is(CustomRoles.Madmate) && Options.MadmateKnowWhosMadmate.GetBool()) ||
(target.IsMadmate() && seer.IsMadmate() && Options.MadmateKnowWhosMadmate.GetBool()) ||
((target.Is(CustomRoles.Jackal) || target.Is(CustomRoles.Sidekick) || target.Is(CustomRoles.Recruit)) && (seer.Is(CustomRoles.Sidekick) || seer.Is(CustomRoles.Recruit) || seer.Is(CustomRoles.Jackal))) ||
(target.Is(CustomRoles.Workaholic) && Workaholic.WorkaholicVisibleToEveryone.GetBool()) ||
(target.Is(CustomRoles.Doctor) && !target.HasEvilAddon() && Options.DoctorVisibleToEveryone.GetBool()) ||
+4 -3
View File
@@ -151,7 +151,7 @@ namespace EHR
target = Main.AllAlivePlayerControls.Where(x => x.PlayerId != target.PlayerId && x.PlayerId != killer.PlayerId).MinBy(x => Vector2.Distance(x.Pos(), target.Pos()));
Logger.Info($"Target was {tempTarget.GetNameWithRole()}, new target is {target.GetNameWithRole()}", "Detour");
if (target.IsLocalPlayer())
if (tempTarget.IsLocalPlayer())
{
Detour.TotalRedirections++;
if (Detour.TotalRedirections >= 3) Achievements.Type.CantTouchThis.CompleteAfterGameEnd();
@@ -1161,9 +1161,10 @@ namespace EHR
foreach (PlayerControl pc in Main.AllAlivePlayerControls)
{
CustomRoles role = pc.GetCustomRole();
if (role.AlwaysUsesUnshift() || (role.SimpleAbilityTrigger() && Options.UseUnshiftTrigger.GetBool() && (!pc.IsNeutralKiller() || Options.UseUnshiftTriggerForNKs.GetBool())))
pc.RpcShapeshift(pc, false);
if (Camouflage.IsCamouflage) Camouflage.RpcSetSkin(pc, RevertToDefault: true, ForceRevert: true);
}
@@ -1557,7 +1558,7 @@ namespace EHR
Mark.Clear();
Suffix.Clear();
if (AntiBlackout.SkipTasks) Suffix.AppendLine(GetString("AntiBlackoutSkipTasks"));
string RealName = target.GetRealName();
+6 -1
View File
@@ -29,6 +29,8 @@ namespace EHR
Logger.Info($"{__instance.GameId} joined lobby", "OnGameJoined");
SetUpRoleTextPatch.IsInIntro = false;
Main.PlayerVersion = [];
RPC.RpcVersionCheck();
SoundManager.Instance?.ChangeAmbienceVolume(DataManager.Settings.Audio.AmbienceVolume);
@@ -200,7 +202,7 @@ namespace EHR
{
if (data != null && data.Character != null) StartGameHostPatch.DataDisconnected[data.Character.PlayerId] = true;
if (GameStates.IsInGame)
if (GameStates.IsInGame && data != null && data.Character != null)
{
if (Options.CurrentGameMode == CustomGameMode.HideAndSeek) HnSManager.PlayerRoles.Remove(data.Character.PlayerId);
@@ -223,6 +225,9 @@ namespace EHR
case CustomRoles.Markseeker:
Markseeker.OnDeath(data.Character);
break;
case CustomRoles.Jackal:
Jackal.Instances.Do(x => x.PromoteSidekick());
break;
}
if (Executioner.Target.ContainsValue(data.Character.PlayerId)) Executioner.ChangeRoleByTarget(data.Character);
+6 -2
View File
@@ -63,7 +63,7 @@ namespace EHR.Impostor
void SwitchAction()
{
InRevivingMode = !InRevivingMode;
InRevivingMode = Main.AllAlivePlayerControls.Length >= 4 && !InRevivingMode;
Utils.SendRPC(CustomRPC.SyncRoleData, OccultistPC.PlayerId, 1, InRevivingMode);
Utils.NotifyRoles(SpecifySeer: OccultistPC, SpecifyTarget: OccultistPC);
}
@@ -139,6 +139,8 @@ namespace EHR.Impostor
data.Done = true;
}
}
if (Main.AllAlivePlayerControls.Length < 4) SwitchAction();
}
public static void OnAnyoneDied(PlayerControl target)
@@ -156,7 +158,9 @@ namespace EHR.Impostor
public override string GetSuffix(PlayerControl seer, PlayerControl target, bool hud = false, bool meeting = false)
{
if (seer.PlayerId != OccultistPC.PlayerId || seer.PlayerId != target.PlayerId || meeting || (seer.IsModClient() && !hud)) return string.Empty;
return string.Format(Translator.GetString("OccultistSuffix"), Translator.GetString(InRevivingMode ? "OccultistMode.Revive" : "OccultistMode.Report"), Translator.GetString($"OccultistActionSwitchMode.{ActionSwitchMode}"));
var str = string.Format(Translator.GetString("OccultistSuffix"), Translator.GetString(InRevivingMode ? "OccultistMode.Revive" : "OccultistMode.Report"), Translator.GetString($"OccultistActionSwitchMode.{ActionSwitchMode}"));
if (Main.AllAlivePlayerControls.Length < 4) str = str.Split('(')[0].TrimEnd(' ');
return str;
}
enum ActionSwitchModes
+1 -16
View File
@@ -1,6 +1,5 @@
using System.Collections.Generic;
using AmongUs.GameOptions;
using EHR.Crewmate;
using EHR.Modules;
using EHR.Patches;
@@ -85,21 +84,7 @@ namespace EHR.Neutral
CustomRoles targetRole = target.GetCustomRole();
switch (targetRole)
{
case CustomRoles.Enigma:
Enigma.PlayerIdList.Remove(target.PlayerId);
break;
case CustomRoles.Mediumshiper:
Mediumshiper.PlayerIdList.Remove(target.PlayerId);
break;
case CustomRoles.Mortician:
Mortician.PlayerIdList.Remove(target.PlayerId);
break;
case CustomRoles.Spiritualist:
Spiritualist.PlayerIdList.Remove(target.PlayerId);
break;
}
Utils.RemovePlayerFromPreviousRoleData(target);
killer.RpcSetCustomRole(targetRole);
killer.RpcChangeRoleBasis(targetRole);