mirror of
https://github.com/Gurge44/EndlessHostRoles.git
synced 2026-10-20 01:46:25 +00:00
Fix bugs
This commit is contained in:
1 parent
db37189e2a
commit
7b7076e51e
10 files changed
+41
-34
No files matched your search
@@ -55,8 +55,17 @@ namespace EHR.Modules
|
||||
{
|
||||
if (AssignedGhostRoles.Count >= GhostRoles.Count) return false;
|
||||
if (pc.IsAlive() || pc.GetCountTypes() is CountTypes.None or CountTypes.OutOfGame || pc.Is(CustomRoles.EvilSpirit)) return false;
|
||||
|
||||
var suitableRole = GetSuitableGhostRole(pc);
|
||||
if (suitableRole == CustomRoles.Specter && IsPartnerPickedRole()) return false;
|
||||
switch (suitableRole)
|
||||
{
|
||||
case CustomRoles.Specter when IsPartnerPickedRole():
|
||||
return false;
|
||||
case CustomRoles.Haunter:
|
||||
GhostRoles.Remove(CustomRoles.Haunter);
|
||||
break;
|
||||
}
|
||||
|
||||
return suitableRole.IsGhostRole() && !AssignedGhostRoles.Any(x => x.Key == pc.PlayerId || x.Value.Role == suitableRole);
|
||||
|
||||
bool IsPartnerPickedRole() => Main.PlayerStates[pc.PlayerId].Role switch
|
||||
|
||||
@@ -2520,6 +2520,9 @@ public static class Utils
|
||||
case CustomRoles.Markseeker:
|
||||
Markseeker.OnDeath(target);
|
||||
break;
|
||||
case CustomRoles.Medic:
|
||||
Medic.IsDead(target);
|
||||
break;
|
||||
}
|
||||
|
||||
if (target == null) return;
|
||||
|
||||
@@ -362,6 +362,8 @@ class CheckForEndVotingPatch
|
||||
int impnum = 0;
|
||||
int neutralnum = 0;
|
||||
|
||||
var DecidedWinner = false;
|
||||
|
||||
if (CustomRoles.Bard.RoleExist())
|
||||
{
|
||||
Bard.OnMeetingHudDestroy(ref name);
|
||||
@@ -417,8 +419,6 @@ class CheckForEndVotingPatch
|
||||
name += $" ({Utils.ColorString(Utils.GetRoleColor(CustomRoles.Brakar), GetString("Brakar"))})";
|
||||
}
|
||||
|
||||
var DecidedWinner = false;
|
||||
|
||||
if (crole == CustomRoles.Jester)
|
||||
{
|
||||
name = string.Format(GetString("ExiledJester"), realName, coloredRole);
|
||||
@@ -486,7 +486,7 @@ class CheckForEndVotingPatch
|
||||
|
||||
|
||||
name = name.Replace("color=", string.Empty) + "<size=0>";
|
||||
EjectionText = name.Split('\n')[0];
|
||||
EjectionText = name.Split('\n')[DecidedWinner ? 1 : 0];
|
||||
|
||||
_ = new LateTask(() =>
|
||||
{
|
||||
@@ -745,6 +745,11 @@ class MeetingHudStartPatch
|
||||
AddMsg(MimicMsg, ipc.PlayerId, Utils.ColorString(Utils.GetRoleColor(CustomRoles.Mimic), GetString("MimicMsgTitle")));
|
||||
}
|
||||
|
||||
if (msgToSend.Count > 0)
|
||||
{
|
||||
_ = new LateTask(() => { msgToSend.Do(x => Utils.SendMessage(x.MESSAGE, x.TARGET_ID, x.TITLE)); }, 6f, "Meeting Start Notify");
|
||||
}
|
||||
|
||||
Main.CyberStarDead.Clear();
|
||||
Express.SpeedNormal.Clear();
|
||||
Express.SpeedUp.Clear();
|
||||
|
||||
@@ -123,6 +123,8 @@ internal class ChangeRoleSettings
|
||||
|
||||
Main.LastNotifyNames = [];
|
||||
|
||||
CheckForEndVotingPatch.EjectionText = string.Empty;
|
||||
|
||||
Arsonist.CurrentDousingTarget = byte.MaxValue;
|
||||
Revolutionist.CurrentDrawTarget = byte.MaxValue;
|
||||
Main.PlayerColors = [];
|
||||
|
||||
@@ -1828,22 +1828,8 @@ class CoEnterVentPatch
|
||||
{
|
||||
try
|
||||
{
|
||||
MessageWriter writer = AmongUsClient.Instance.StartRpcImmediately(__instance.NetId, (byte)RpcCalls.BootFromVent, SendOption.Reliable);
|
||||
writer.WritePacked(127);
|
||||
AmongUsClient.Instance.FinishRpcImmediately(writer);
|
||||
_ = new LateTask(() =>
|
||||
{
|
||||
try
|
||||
{
|
||||
int clientId = __instance.myPlayer.GetClientId();
|
||||
MessageWriter writer2 = AmongUsClient.Instance.StartRpcImmediately(__instance.NetId, (byte)RpcCalls.BootFromVent, SendOption.Reliable, clientId);
|
||||
writer2.Write(id);
|
||||
AmongUsClient.Instance.FinishRpcImmediately(writer2);
|
||||
}
|
||||
catch
|
||||
{
|
||||
}
|
||||
}, 0.5f, "Fix DesyncImpostor Stuck");
|
||||
__instance.RpcBootFromVent(id);
|
||||
return false;
|
||||
}
|
||||
catch
|
||||
{
|
||||
|
||||
@@ -16,6 +16,8 @@ namespace EHR.Roles.AddOns.GhostRoles
|
||||
private static OptionItem NumberOfReveals;
|
||||
|
||||
private List<byte> WarnedImps = [];
|
||||
|
||||
private long WarnTimeStamp = 0;
|
||||
public Team Team => Team.Crewmate | Team.Neutral;
|
||||
public int Cooldown => 900;
|
||||
|
||||
@@ -76,6 +78,8 @@ namespace EHR.Roles.AddOns.GhostRoles
|
||||
imp.Notify(Translator.GetString("Haunter1TaskLeft"), 300f);
|
||||
WarnedImps.Add(imp.PlayerId);
|
||||
}
|
||||
|
||||
WarnTimeStamp = Utils.TimeStamp;
|
||||
}
|
||||
|
||||
public void OnFinishedTasks(PlayerControl pc)
|
||||
@@ -103,7 +107,7 @@ namespace EHR.Roles.AddOns.GhostRoles
|
||||
|
||||
public void Update(PlayerControl pc)
|
||||
{
|
||||
if (WarnedImps.Count == 0) return;
|
||||
if (WarnedImps.Count == 0 || WarnTimeStamp == Utils.TimeStamp) return;
|
||||
|
||||
if (WarnedImps.Any(imp => TargetArrow.GetArrows(Utils.GetPlayerById(imp), pc.PlayerId) == "・"))
|
||||
{
|
||||
|
||||
+8
-10
@@ -42,12 +42,7 @@ public class Medic : RoleBase
|
||||
"DeactivationIsVisibleOFF",
|
||||
];
|
||||
|
||||
enum Visible
|
||||
{
|
||||
Immediately,
|
||||
AfterMeeting,
|
||||
OFF,
|
||||
}
|
||||
public override bool IsEnable => playerIdList.Count > 0;
|
||||
|
||||
public static void SetupCustomOption()
|
||||
{
|
||||
@@ -95,8 +90,6 @@ public class Medic : RoleBase
|
||||
Main.ResetCamPlayerList.Add(playerId);
|
||||
}
|
||||
|
||||
public override bool IsEnable => playerIdList.Count > 0;
|
||||
|
||||
private static void SendRPCForProtectList()
|
||||
{
|
||||
if (!Utils.DoRPC) return;
|
||||
@@ -247,8 +240,6 @@ public class Medic : RoleBase
|
||||
if (!target.Is(CustomRoles.Medic)) return;
|
||||
if (!ShieldDeactivatesWhenMedicDies.GetBool()) return;
|
||||
|
||||
if (playerIdList.Any(x => Utils.GetPlayerById(x).IsAlive())) return; // If not all Medic-s are dead, return
|
||||
|
||||
Utils.NotifyRoles(SpecifySeer: target);
|
||||
|
||||
ProtectList.Clear();
|
||||
@@ -293,4 +284,11 @@ public class Medic : RoleBase
|
||||
|
||||
return string.Empty;
|
||||
}
|
||||
|
||||
enum Visible
|
||||
{
|
||||
Immediately,
|
||||
AfterMeeting,
|
||||
OFF,
|
||||
}
|
||||
}
|
||||
@@ -64,7 +64,7 @@ public class Tracefinder : RoleBase
|
||||
|
||||
public static void OnPlayerDead(PlayerControl target)
|
||||
{
|
||||
if (!On || !GameStates.IsInTask || target == null) return;
|
||||
if (!On || !GameStates.IsInTask || target == null || target.Data.Disconnected) return;
|
||||
|
||||
float delay;
|
||||
if (ArrowDelayMax.GetFloat() < ArrowDelayMin.GetFloat()) delay = 0f;
|
||||
|
||||
@@ -103,7 +103,7 @@ namespace EHR.Roles.Crewmate
|
||||
if (!TrackerTarget.ContainsKey(seer.PlayerId)) return string.Empty;
|
||||
if (GameStates.IsMeeting) return string.Empty;
|
||||
|
||||
return TrackerTarget[seer.PlayerId].Aggregate(string.Empty, (current, trackTarget) => current + Utils.ColorString(CanGetColoredArrow.GetBool() ? Main.PlayerColors[trackTarget] : Color.white, TargetArrow.GetArrows(seer, trackTarget) + LocateArrow.GetArrows(seer)));
|
||||
return TrackerTarget[seer.PlayerId].Aggregate(string.Empty, (current, trackTarget) => current + Utils.ColorString(CanGetColoredArrow.GetBool() ? Main.PlayerColors[trackTarget] : Color.white, TargetArrow.GetArrows(seer, trackTarget))) + LocateArrow.GetArrows(seer);
|
||||
}
|
||||
|
||||
public static bool IsTrackTarget(PlayerControl seer, PlayerControl target)
|
||||
|
||||
@@ -122,7 +122,7 @@ public class Vulture : RoleBase
|
||||
|
||||
public static void OnPlayerDead(PlayerControl target)
|
||||
{
|
||||
if (!ArrowsPointingToDeadBody.GetBool()) return;
|
||||
if (!ArrowsPointingToDeadBody.GetBool() || target.Data.Disconnected) return;
|
||||
|
||||
foreach (byte pc in playerIdList)
|
||||
{
|
||||
|
||||
Reference in new issue
Block a user