a few fixes

This commit is contained in:
Gurge44 committed 2025-07-30 12:25:11 +02:00
1 parent afbbf60e52
commit cc8116b3a5
8 files changed
+48 -26

No files matched your search

+2 -2
View File
@@ -42,8 +42,8 @@ public class Main : BasePlugin
private const string DebugKeyHash = "c0fd562955ba56af3ae20d7ec9e64c664f0facecef4b3e366e109306adeae29d";
private const string DebugKeySalt = "59687b";
private const string PluginGuid = "com.gurge44.endlesshostroles";
public const string PluginVersion = "6.0.0";
public const string PluginDisplayVersion = "6.0.0";
public const string PluginVersion = "6.1.0";
public const string PluginDisplayVersion = "6.1.0";
public const bool TestBuild = false;
public const string NeutralColor = "#ffab1b";
+8 -1
View File
@@ -50,7 +50,14 @@ public static class AntiBlackout
// After the ejection screen, we revert the role types to their actual values.
public static void RevertToActualRoleTypes()
{
if (CustomWinnerHolder.WinnerTeam != CustomWinner.Default || CachedRoleMap.Count == 0) return;
if (CustomWinnerHolder.WinnerTeam != CustomWinner.Default) return;
if (CachedRoleMap.Count == 0)
{
SkipTasks = false;
ExileControllerWrapUpPatch.AfterMeetingTasks();
return;
}
// Set the temporarily revived crewmate back to dead.
foreach (PlayerControl pc in Main.AllPlayerControls)
@@ -431,7 +431,10 @@ public sealed class PlayerGameOptionsSender(PlayerControl player) : GameOptionsS
if (state.SubRoles.Contains(CustomRoles.Energetic))
{
switch (roleTypes)
if (player.CanUseKillButton())
energeticDecreaseCooldown = true;
else
switch (roleTypes)
{
case RoleTypes.Impostor:
energeticDecreaseCooldown = true;
+3 -2
View File
@@ -3266,6 +3266,9 @@ public static class Utils
Camouflage.CheckCamouflage();
CopyCat.ResetRoles();
Imitator.SetRoles();
foreach (PlayerControl pc in Main.AllPlayerControls)
{
if (pc.IsAlive())
@@ -3321,8 +3324,6 @@ public static class Utils
LateTask.New(() => Main.ProcessShapeshifts = true, 1f, log: false);
CopyCat.ResetRoles();
if (Options.DiseasedCDReset.GetBool())
{
Main.KilledDiseased.SetAllValues(0);
+3 -3
View File
@@ -529,8 +529,7 @@ internal static class ChatCommands
return;
}
if (!player.IsAlive() || !Main.PlayerStates.TryGetValue(player.PlayerId, out PlayerState state) || state.Role is not Imitator imitator) return;
if (args.Length < 2 || !byte.TryParse(args[1], out byte targetId) || !Main.PlayerStates.TryGetValue(targetId, out PlayerState targetState)) return;
if (!player.IsAlive() || args.Length < 2 || !byte.TryParse(args[1], out byte targetId) || !Main.PlayerStates.TryGetValue(targetId, out PlayerState targetState)) return;
if (!player.IsLocalPlayer()) ChatManager.SendPreviousMessagesToAll();
@@ -546,7 +545,8 @@ internal static class ChatCommands
return;
}
imitator.ImitatingRole = targetState.MainRole;
Imitator.ImitatingRole[player.PlayerId] = targetState.MainRole;
Logger.Info($"{player.GetRealName()} will be imitating as {targetState.MainRole}", "Imitator");
Utils.SendMessage("\n", player.PlayerId, string.Format(GetString("Imitator.Success"), targetId.ColoredPlayerName()));
MeetingManager.SendCommandUsedMessage(args[0]);
+2
View File
@@ -1230,6 +1230,8 @@ internal static class ReportDeadBodyPatch
Divinator.DidVote.Clear();
Oracle.DidVote.Clear();
Imitator.ImitatingRole.SetAllValues(CustomRoles.Imitator);
foreach (PlayerState state in Main.PlayerStates.Values)
{
if (state.Role.IsEnable)
+23 -14
View File
@@ -1,13 +1,16 @@
namespace EHR.Crewmate;
using System.Collections.Generic;
using EHR.Modules;
namespace EHR.Crewmate;
public class Imitator : RoleBase
{
public static bool On;
private static List<byte> PlayerIdList = [];
public static Dictionary<byte, CustomRoles> ImitatingRole = [];
public override bool IsEnable => On;
private PlayerControl ImitatorPC;
public CustomRoles ImitatingRole;
public override void SetupCustomOption()
{
@@ -16,26 +19,32 @@ public class Imitator : RoleBase
public override void Init()
{
if (GameStates.InGame && !Main.HasJustStarted) return;
On = false;
PlayerIdList = [];
ImitatingRole = [];
}
public override void Add(byte playerId)
{
On = true;
ImitatorPC = playerId.GetPlayer();
ImitatingRole = CustomRoles.Imitator;
ImitatingRole[playerId] = CustomRoles.Imitator;
PlayerIdList.Add(playerId);
}
public override void OnReportDeadBody()
public static void SetRoles()
{
ImitatingRole = CustomRoles.Imitator;
}
foreach (byte id in PlayerIdList)
{
PlayerControl pc = id.GetPlayer();
public override void AfterMeetingTasks()
{
if (ImitatorPC == null || !ImitatorPC.IsAlive()) return;
ImitatorPC.RpcChangeRoleBasis(ImitatingRole);
ImitatorPC.RpcSetCustomRole(ImitatingRole);
if (pc != null && pc.IsAlive() && ImitatingRole.TryGetValue(id, out CustomRoles role) && !pc.Is(role))
{
Main.AbilityUseLimit.Remove(pc.PlayerId);
Utils.SendRPC(CustomRPC.RemoveAbilityUseLimit, pc.PlayerId);
pc.RpcChangeRoleBasis(role);
pc.RpcSetCustomRole(role);
}
}
}
}
+3 -3
View File
@@ -20,9 +20,9 @@ public class ClockBlocker : RoleBase
public override void SetupCustomOption()
{
StartSetup(653300)
.AutoSetupOption(ref KillCooldown, 30f, new FloatValueRule(0.5f, 120f, 0.5f))
.AutoSetupOption(ref EmergencyCooldownIncreasePerKill, 5, new IntegerValueRule(1, 30, 1))
.AutoSetupOption(ref MaxEmergencyCooldown, 90, new IntegerValueRule(5, 300, 5));
.AutoSetupOption(ref KillCooldown, 30f, new FloatValueRule(0.5f, 120f, 0.5f), OptionFormat.Seconds)
.AutoSetupOption(ref EmergencyCooldownIncreasePerKill, 5, new IntegerValueRule(1, 30, 1), OptionFormat.Seconds)
.AutoSetupOption(ref MaxEmergencyCooldown, 90, new IntegerValueRule(5, 300, 5), OptionFormat.Seconds);
}
public override void Init()