mirror of
https://github.com/Gurge44/EndlessHostRoles.git
synced 2026-10-20 01:46:25 +00:00
add settings, fixes, The Glitch to SS base, merge Door Master into Telecommunication, Message about Auto GM Rotation
This commit is contained in:
1 parent
1b3f8b9109
commit
e7fcab0897
43 files changed
+264
-338
No files matched your search
@@ -170,7 +170,6 @@ public enum CustomRoles
|
||||
Dictator,
|
||||
Doctor,
|
||||
DonutDelivery,
|
||||
Doormaster,
|
||||
DoubleAgent,
|
||||
DovesOfNeace,
|
||||
Drainer,
|
||||
|
||||
@@ -182,11 +182,9 @@ public static class CaptureTheFlag
|
||||
|
||||
public static string GetSuffixText(PlayerControl seer, PlayerControl target)
|
||||
{
|
||||
if (!ValidTag) return string.Empty;
|
||||
if (!ValidTag || seer.PlayerId != target.PlayerId) return string.Empty;
|
||||
|
||||
if (seer.PlayerId != target.PlayerId) return string.Empty;
|
||||
|
||||
string arrows = TargetArrow.GetAllArrows(seer);
|
||||
string arrows = TargetArrow.GetAllArrows(seer.PlayerId);
|
||||
arrows = arrows.Length > 0 ? $"{arrows}\n" : string.Empty;
|
||||
|
||||
var str = $"{arrows}<size=1.4>{GetStatistics(target.PlayerId).Replace(" | ", "\n")}</size>\n";
|
||||
|
||||
+18
-15
@@ -106,7 +106,10 @@ internal static class HotPotato
|
||||
public static string GetSuffixText(byte id)
|
||||
{
|
||||
if (!Main.PlayerStates.TryGetValue(id, out PlayerState state) || state.IsDead) return string.Empty;
|
||||
return $"{(HotPotatoState.HolderID == id ? $"{Translator.GetString("HotPotato_HoldingNotify")}\n" : string.Empty)}{Translator.GetString("HotPotato_TimeLeftSuffix")}{HotPotatoState.TimeLeft}s";
|
||||
string holding = HotPotatoState.HolderID == id ? $"{Translator.GetString("HotPotato_HoldingNotify")}\n" : string.Empty;
|
||||
string arrows = TargetArrow.GetAllArrows(id);
|
||||
arrows = arrows.Length > 0 ? $"\n{arrows}" : string.Empty;
|
||||
return $"{holding}{Translator.GetString("HotPotato_TimeLeftSuffix")}{HotPotatoState.TimeLeft}s{arrows}";
|
||||
}
|
||||
|
||||
public static void ReceiveRPC(MessageReader reader)
|
||||
@@ -126,9 +129,9 @@ internal static class HotPotato
|
||||
{
|
||||
if (Options.CurrentGameMode != CustomGameMode.HotPotato || !Main.IntroDestroyed || !AmongUsClient.Instance.AmHost || !GameStates.IsInTask || __instance.PlayerId >= 254 || Utils.GameStartTimeStamp + 15 > Utils.TimeStamp) return;
|
||||
|
||||
PlayerControl Holder = Utils.GetPlayerById(HotPotatoState.HolderID);
|
||||
PlayerControl holder = Utils.GetPlayerById(HotPotatoState.HolderID);
|
||||
|
||||
if (Holder == null || Holder.Data.Disconnected || !Holder.IsAlive())
|
||||
if (holder == null || holder.Data.Disconnected || !holder.IsAlive())
|
||||
{
|
||||
PassHotPotato();
|
||||
return;
|
||||
@@ -145,11 +148,11 @@ internal static class HotPotato
|
||||
|
||||
if (HotPotatoState.TimeLeft <= 0)
|
||||
{
|
||||
Holder.Suicide();
|
||||
holder.Suicide();
|
||||
SurvivalTimes[HotPotatoState.HolderID] = Time.GetInt() * (HotPotatoState.RoundNum - 1);
|
||||
PassHotPotato();
|
||||
|
||||
if (Holder.IsLocalPlayer())
|
||||
if (holder.IsLocalPlayer())
|
||||
Achievements.Type.OutOfTime.Complete();
|
||||
|
||||
return;
|
||||
@@ -158,7 +161,7 @@ internal static class HotPotato
|
||||
if (Utils.GameStartTimeStamp + 30 > now && LastPassTS == now) return;
|
||||
|
||||
PlayerControl[] aapc = Main.AllAlivePlayerControls;
|
||||
Vector2 pos = Holder.Pos();
|
||||
Vector2 pos = holder.Pos();
|
||||
if (HotPotatoState.HolderID != __instance.PlayerId || !aapc.Any(x => x.PlayerId != HotPotatoState.HolderID && (x.PlayerId != HotPotatoState.LastHolderID || aapc.Length == 2) && Vector2.Distance(x.Pos(), pos) <= Range.GetFloat())) return;
|
||||
|
||||
float wait = aapc.Length <= 2 ? 0.4f : 0f;
|
||||
@@ -167,10 +170,10 @@ internal static class HotPotato
|
||||
|
||||
UpdateDelay = 0;
|
||||
|
||||
PlayerControl Target = aapc.OrderBy(x => Vector2.Distance(x.Pos(), pos)).FirstOrDefault(x => x.PlayerId != HotPotatoState.HolderID && (x.PlayerId != HotPotatoState.LastHolderID || aapc.Length == 2));
|
||||
if (Target == null) return;
|
||||
PlayerControl target = aapc.OrderBy(x => Vector2.Distance(x.Pos(), pos)).FirstOrDefault(x => x.PlayerId != HotPotatoState.HolderID && (x.PlayerId != HotPotatoState.LastHolderID || aapc.Length == 2));
|
||||
if (target == null) return;
|
||||
|
||||
PassHotPotato(Target, false);
|
||||
PassHotPotato(target, false);
|
||||
}
|
||||
|
||||
public static void PassHotPotato(PlayerControl target = null, bool resetTime = true)
|
||||
@@ -216,19 +219,19 @@ internal static class HotPotato
|
||||
Main.AllPlayerSpeed[target.PlayerId] = HolderSpeed.GetFloat();
|
||||
target.MarkDirtySettings();
|
||||
|
||||
PlayerControl LastHolder = Utils.GetPlayerById(HotPotatoState.LastHolderID);
|
||||
PlayerControl lastHolder = Utils.GetPlayerById(HotPotatoState.LastHolderID);
|
||||
|
||||
if (LastHolder != null)
|
||||
if (lastHolder != null)
|
||||
{
|
||||
if (CanPassViaKillButton) LastHolder.RpcChangeRoleBasis(CustomRoles.Potato);
|
||||
if (CanPassViaKillButton) lastHolder.RpcChangeRoleBasis(CustomRoles.Potato);
|
||||
|
||||
TargetArrow.RemoveAllTarget(HotPotatoState.LastHolderID);
|
||||
|
||||
Main.AllPlayerSpeed[HotPotatoState.LastHolderID] = DefaultSpeed;
|
||||
LastHolder.MarkDirtySettings();
|
||||
Utils.NotifyRoles(SpecifyTarget: LastHolder);
|
||||
lastHolder.MarkDirtySettings();
|
||||
Utils.NotifyRoles(SpecifyTarget: lastHolder);
|
||||
|
||||
Logger.Info($"Hot Potato Passed: {LastHolder.GetRealName()} => {target.GetRealName()}", "HotPotato");
|
||||
Logger.Info($"Hot Potato Passed: {lastHolder.GetRealName()} => {target.GetRealName()}", "HotPotato");
|
||||
}
|
||||
}
|
||||
catch (Exception ex) { Logger.Exception(ex, "HotPotatoManager.FixedUpdatePatch.PassHotPotato"); }
|
||||
|
||||
@@ -103,7 +103,7 @@ public static class Speedrun
|
||||
int apc = Main.AllPlayerControls.Length;
|
||||
int killers = CanKill.Count;
|
||||
|
||||
string arrows = TargetArrow.GetAllArrows(pc);
|
||||
string arrows = TargetArrow.GetAllArrows(pc.PlayerId);
|
||||
arrows = arrows.Length > 0 ? $"\n{arrows}" : string.Empty;
|
||||
|
||||
// ReSharper disable once ConvertIfStatementToReturnStatement
|
||||
|
||||
@@ -424,7 +424,6 @@ public class Main : BasePlugin
|
||||
{ CustomRoles.Dealer, "#f57242" },
|
||||
{ CustomRoles.Escort, "#ff94e6" },
|
||||
{ CustomRoles.Spy, "#34495E" },
|
||||
{ CustomRoles.Doormaster, "#7FB3D5" },
|
||||
{ CustomRoles.Tether, "#138D75" },
|
||||
{ CustomRoles.Ricochet, "#EDBB99" },
|
||||
{ CustomRoles.SpeedBooster, "#00ffff" },
|
||||
|
||||
@@ -106,6 +106,7 @@ public static class AntiBlackout
|
||||
MessageWriter writer = AmongUsClient.Instance.StartRpcImmediately(pc.NetId, (byte)RpcCalls.Exiled, SendOption.Reliable);
|
||||
AmongUsClient.Instance.FinishRpcImmediately(writer);
|
||||
if (pc.HasDesyncRole()) pc.FixBlackScreen();
|
||||
if (pc.HasGhostRole()) pc.RpcResetAbilityCooldown();
|
||||
}
|
||||
}
|
||||
catch (Exception e) { Utils.ThrowException(e); }
|
||||
|
||||
@@ -105,7 +105,6 @@ internal static class CustomRoleSelector
|
||||
case CustomRoles.Battery when Main.CurrentMap == MapNames.Fungle:
|
||||
case CustomRoles.Beacon when Main.CurrentMap == MapNames.Fungle:
|
||||
case CustomRoles.DarkHide when Main.CurrentMap == MapNames.Fungle:
|
||||
case CustomRoles.Doormaster when Main.CurrentMap == MapNames.MiraHQ:
|
||||
case CustomRoles.Pelican when Roles[RoleAssignType.Impostor].Any(x => x.Role == CustomRoles.Duellist):
|
||||
case CustomRoles.Duellist when Roles[RoleAssignType.NeutralKilling].Any(x => x.Role == CustomRoles.Pelican):
|
||||
case CustomRoles.VengefulRomantic:
|
||||
|
||||
@@ -111,7 +111,7 @@ internal static class CustomRolesHelper
|
||||
CustomRoles.Sniper => UsePets ? CustomRoles.Impostor : CustomRoles.Shapeshifter,
|
||||
CustomRoles.Jester => Jester.JesterCanVent.GetBool() ? CustomRoles.Engineer : CustomRoles.Crewmate,
|
||||
CustomRoles.Mayor => Mayor.MayorHasPortableButton.GetBool() ? CustomRoles.Engineer : CustomRoles.Crewmate,
|
||||
CustomRoles.Monitor => Monitor.CanVent.GetBool() ? CustomRoles.Engineer : CustomRoles.Crewmate,
|
||||
CustomRoles.Monitor => Monitor.CanVent.GetBool() || !UsePets ? CustomRoles.Engineer : CustomRoles.Crewmate,
|
||||
CustomRoles.Vulture => Vulture.CanVent.GetBool() ? CustomRoles.Engineer : CustomRoles.Crewmate,
|
||||
CustomRoles.Opportunist => Opportunist.CanVent.GetBool() ? CustomRoles.Engineer : CustomRoles.Crewmate,
|
||||
CustomRoles.Vindicator => CustomRoles.Impostor,
|
||||
@@ -260,7 +260,6 @@ internal static class CustomRolesHelper
|
||||
CustomRoles.Spy => CustomRoles.Crewmate,
|
||||
CustomRoles.Ricochet => CustomRoles.Crewmate,
|
||||
CustomRoles.Tether => UsePets ? CustomRoles.Crewmate : CustomRoles.Engineer,
|
||||
CustomRoles.Doormaster => UsePets ? CustomRoles.Crewmate : CustomRoles.Engineer,
|
||||
CustomRoles.Aid => UsePets && Aid.UsePet.GetBool() ? CustomRoles.Crewmate : CustomRoles.Impostor,
|
||||
CustomRoles.Socialite => UsePets && Socialite.UsePet.GetBool() ? CustomRoles.Crewmate : CustomRoles.Impostor,
|
||||
CustomRoles.Escort => UsePets && Escort.UsePet.GetBool() ? CustomRoles.Crewmate : CustomRoles.Impostor,
|
||||
@@ -460,7 +459,7 @@ internal static class CustomRolesHelper
|
||||
CustomRoles.Gamer => RoleTypes.Impostor,
|
||||
CustomRoles.HexMaster => RoleTypes.Impostor,
|
||||
CustomRoles.Wraith => RoleTypes.Impostor,
|
||||
CustomRoles.Glitch => RoleTypes.Impostor,
|
||||
CustomRoles.Glitch => RoleTypes.Shapeshifter,
|
||||
CustomRoles.Jailor => UsePets && Jailor.UsePet.GetBool() ? RoleTypes.GuardianAngel : RoleTypes.Impostor,
|
||||
CustomRoles.Juggernaut => RoleTypes.Impostor,
|
||||
CustomRoles.Jinx => RoleTypes.Impostor,
|
||||
@@ -1709,7 +1708,6 @@ internal static class CustomRolesHelper
|
||||
CustomRoles.Crusader => RoleOptionType.Crewmate_Support,
|
||||
CustomRoles.Deputy => RoleOptionType.Crewmate_Support,
|
||||
CustomRoles.DonutDelivery => RoleOptionType.Crewmate_Support,
|
||||
CustomRoles.Doormaster => RoleOptionType.Crewmate_Support,
|
||||
CustomRoles.DovesOfNeace => RoleOptionType.Crewmate_Support,
|
||||
CustomRoles.Electric => RoleOptionType.Crewmate_Support,
|
||||
CustomRoles.Escort => RoleOptionType.Crewmate_Support,
|
||||
|
||||
@@ -596,8 +596,6 @@ public static class CustomRpcSenderExtensions
|
||||
if (target.Is(CustomRoles.Glitch) && Main.PlayerStates[target.PlayerId].Role is Glitch gc)
|
||||
{
|
||||
gc.LastHack = Utils.TimeStamp;
|
||||
gc.LastMimic = Utils.TimeStamp;
|
||||
gc.MimicCDTimer = 10;
|
||||
gc.HackCDTimer = 10;
|
||||
|
||||
return false;
|
||||
|
||||
@@ -661,7 +661,7 @@ internal static class ExtendedPlayerControl
|
||||
|
||||
public static void AddKCDAsAbilityCD(this PlayerControl pc)
|
||||
{
|
||||
AddAbilityCD(pc, (int)Math.Round(Main.AllPlayerKillCooldown.TryGetValue(pc.PlayerId, out float kcd) ? kcd : Options.DefaultKillCooldown));
|
||||
AddAbilityCD(pc, (int)Math.Round(Main.AllPlayerKillCooldown.TryGetValue(pc.PlayerId, out float kcd) ? kcd : Options.AdjustedDefaultKillCooldown));
|
||||
}
|
||||
|
||||
public static void AddAbilityCD(this PlayerControl pc, bool includeDuration = true)
|
||||
@@ -830,8 +830,6 @@ internal static class ExtendedPlayerControl
|
||||
if (target.Is(CustomRoles.Glitch) && Main.PlayerStates[target.PlayerId].Role is Glitch gc)
|
||||
{
|
||||
gc.LastHack = TimeStamp;
|
||||
gc.LastMimic = TimeStamp;
|
||||
gc.MimicCDTimer = 10;
|
||||
gc.HackCDTimer = 10;
|
||||
}
|
||||
else if (PlayerControl.LocalPlayer == target)
|
||||
|
||||
@@ -207,6 +207,16 @@ public static class Options
|
||||
|
||||
public static float DefaultKillCooldown = Main.NormalOptions == null ? 25f : Main.NormalOptions.KillCooldown;
|
||||
|
||||
public static float AdjustedDefaultKillCooldown => !GameStates.InGame
|
||||
? DefaultKillCooldown
|
||||
: DefaultKillCooldown + Main.CurrentMap switch
|
||||
{
|
||||
MapNames.Polus => ExtraKillCooldownOnPolus?.GetFloat() ?? 0f,
|
||||
MapNames.Airship => ExtraKillCooldownOnAirship?.GetFloat() ?? 0f,
|
||||
MapNames.Fungle => ExtraKillCooldownOnFungle?.GetFloat() ?? 0f,
|
||||
_ => 0f
|
||||
};
|
||||
|
||||
public static OptionItem ModLanguage;
|
||||
|
||||
public static readonly Dictionary<GameStateInfo, OptionItem> GameStateSettings = [];
|
||||
@@ -434,6 +444,9 @@ public static class Options
|
||||
public static OptionItem ChangeDecontaminationTime;
|
||||
public static OptionItem DecontaminationTimeOnMiraHQ;
|
||||
public static OptionItem DecontaminationTimeOnPolus;
|
||||
public static OptionItem ExtraKillCooldownOnPolus;
|
||||
public static OptionItem ExtraKillCooldownOnAirship;
|
||||
public static OptionItem ExtraKillCooldownOnFungle;
|
||||
|
||||
public static OptionItem MafiaShapeshiftCD;
|
||||
public static OptionItem MafiaShapeshiftDur;
|
||||
@@ -1786,6 +1799,18 @@ public static class Options
|
||||
.SetValueFormat(OptionFormat.Seconds)
|
||||
.SetColor(new Color32(19, 188, 233, byte.MaxValue));
|
||||
|
||||
ExtraKillCooldownOnPolus = new FloatOptionItem(60506, "ExtraKillCooldownOnPolus", new(0f, 60f, 0.5f), 0f, TabGroup.GameSettings)
|
||||
.SetValueFormat(OptionFormat.Seconds)
|
||||
.SetColor(new Color32(19, 188, 233, byte.MaxValue));
|
||||
|
||||
ExtraKillCooldownOnAirship = new FloatOptionItem(60507, "ExtraKillCooldownOnAirship", new(0f, 60f, 0.5f), 0f, TabGroup.GameSettings)
|
||||
.SetValueFormat(OptionFormat.Seconds)
|
||||
.SetColor(new Color32(19, 188, 233, byte.MaxValue));
|
||||
|
||||
ExtraKillCooldownOnFungle = new FloatOptionItem(60508, "ExtraKillCooldownOnFungle", new(0f, 60f, 0.5f), 0f, TabGroup.GameSettings)
|
||||
.SetValueFormat(OptionFormat.Seconds)
|
||||
.SetColor(new Color32(19, 188, 233, byte.MaxValue));
|
||||
|
||||
|
||||
LoadingPercentage = 70;
|
||||
|
||||
|
||||
@@ -107,9 +107,9 @@ internal static class TargetArrow
|
||||
/// </summary>
|
||||
/// <param name="seer"></param>
|
||||
/// <returns></returns>
|
||||
public static string GetAllArrows(PlayerControl seer)
|
||||
public static string GetAllArrows(byte seer)
|
||||
{
|
||||
return TargetArrows.Keys.Where(ai => ai.From == seer.PlayerId).Aggregate(string.Empty, (current, arrowInfo) => current + TargetArrows[arrowInfo]);
|
||||
return TargetArrows.Keys.Where(ai => ai.From == seer).Aggregate(string.Empty, (current, arrowInfo) => current + TargetArrows[arrowInfo]);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
||||
+6
-5
@@ -2820,7 +2820,8 @@ public static class Utils
|
||||
if (MeetingStates.FirstMeeting && Main.ShieldPlayer == target.FriendCode && !string.IsNullOrEmpty(target.FriendCode) && Options.CurrentGameMode is CustomGameMode.Standard or CustomGameMode.FFA or CustomGameMode.Speedrun)
|
||||
additionalSuffixes.Add(GetString("DiedR1Warning"));
|
||||
|
||||
additionalSuffixes.Add(AFKDetector.GetSuffix(seer, target));
|
||||
if (!forMeeting)
|
||||
additionalSuffixes.Add(AFKDetector.GetSuffix(seer, target));
|
||||
|
||||
TargetSuffix.Append(BuildSuffix(seer, target, meeting: forMeeting));
|
||||
|
||||
@@ -3082,7 +3083,7 @@ public static class Utils
|
||||
{
|
||||
if (role.UsesPetInsteadOfKill())
|
||||
{
|
||||
var kcd = (int)Math.Round(Main.AllPlayerKillCooldown.TryGetValue(playerId, out float killCd) ? killCd : Options.DefaultKillCooldown);
|
||||
var kcd = (int)Math.Round(Main.AllPlayerKillCooldown.TryGetValue(playerId, out float killCd) ? killCd : Options.AdjustedDefaultKillCooldown);
|
||||
Main.AbilityCD[playerId] = (TimeStamp, kcd);
|
||||
SendRPC(CustomRPC.SyncAbilityCD, 1, playerId, kcd);
|
||||
return;
|
||||
@@ -3091,10 +3092,10 @@ public static class Utils
|
||||
int cd = role switch
|
||||
{
|
||||
CustomRoles.Mole => Mole.CD.GetInt(),
|
||||
CustomRoles.Doormaster => Doormaster.VentCooldown.GetInt(),
|
||||
CustomRoles.Monitor => Monitor.VentCooldown.GetInt(),
|
||||
CustomRoles.Tether => Tether.VentCooldown.GetInt(),
|
||||
CustomRoles.Mayor when Mayor.MayorHasPortableButton.GetBool() => (int)Math.Round(Options.DefaultKillCooldown),
|
||||
CustomRoles.Paranoia => (int)Math.Round(Options.DefaultKillCooldown),
|
||||
CustomRoles.Mayor when Mayor.MayorHasPortableButton.GetBool() => (int)Math.Round(Options.AdjustedDefaultKillCooldown),
|
||||
CustomRoles.Paranoia => (int)Math.Round(Options.AdjustedDefaultKillCooldown),
|
||||
CustomRoles.Grenadier => Options.GrenadierSkillCooldown.GetInt() + (includeDuration ? Options.GrenadierSkillDuration.GetInt() : 0),
|
||||
CustomRoles.Lighter => Options.LighterSkillCooldown.GetInt() + (includeDuration ? Options.LighterSkillDuration.GetInt() : 0),
|
||||
CustomRoles.SecurityGuard => Options.SecurityGuardSkillCooldown.GetInt() + (includeDuration ? Options.SecurityGuardSkillDuration.GetInt() : 0),
|
||||
|
||||
@@ -1255,17 +1255,18 @@ internal static class ChatCommands
|
||||
}
|
||||
|
||||
int splitIndex = Array.IndexOf(args, args.First(x => x.Contains('?'))) + 1;
|
||||
string[] answers = args.Skip(splitIndex).ToArray();
|
||||
string[] answers = args[splitIndex..];
|
||||
|
||||
string msg = string.Join(" ", args.Take(splitIndex).Skip(1)) + "\n";
|
||||
string msg = string.Join(" ", args[1..splitIndex]) + "\n";
|
||||
bool gmPoll = msg.Contains(GetString("GameModePoll.Question"));
|
||||
|
||||
PollTimer = gmPoll ? 60f : 45f;
|
||||
Color[] gmPollColors = gmPoll ? Main.GameModeColors.Values.ToArray() : [];
|
||||
|
||||
for (var i = 0; i < Math.Max(answers.Length, 2); i++)
|
||||
{
|
||||
var choiceLetter = (char)(i + 65);
|
||||
msg += Utils.ColorString(RandomColor(), $"{char.ToUpper(choiceLetter)}) {answers[i]}\n");
|
||||
msg += Utils.ColorString(gmPoll ? gmPollColors[i] : RandomColor(), $"{char.ToUpper(choiceLetter)}) {answers[i]}\n");
|
||||
PollVotes[choiceLetter] = 0;
|
||||
PollAnswers[choiceLetter] = $"<size=70%>〖 {answers[i]} 〗</size>";
|
||||
}
|
||||
@@ -1324,7 +1325,7 @@ internal static class ChatCommands
|
||||
if (winners.Length == 1 && gmPoll && GameStates.IsLobby)
|
||||
{
|
||||
int winnerIndex = winners[0].Key - 65;
|
||||
if (winnerIndex != 0) Options.GameMode.SetValue(winnerIndex);
|
||||
Options.GameMode.SetValue(winnerIndex);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -73,7 +73,7 @@ internal static class ExileControllerWrapUpPatch
|
||||
Main.PlayerStates[exiled.PlayerId].SetDead();
|
||||
}
|
||||
|
||||
if (AmongUsClient.Instance.AmHost && Main.IsFixedCooldown) Main.RefixCooldownDelay = Options.DefaultKillCooldown - 3f;
|
||||
if (AmongUsClient.Instance.AmHost && Main.IsFixedCooldown) Main.RefixCooldownDelay = Options.AdjustedDefaultKillCooldown - 3f;
|
||||
|
||||
Witch.RemoveSpelledPlayer();
|
||||
|
||||
|
||||
+34
-26
@@ -161,32 +161,7 @@ internal static class HudManagerPatch
|
||||
AutoGMRotationStatusText.fontSize = AutoGMRotationStatusText.fontSizeMax = AutoGMRotationStatusText.fontSizeMin = 2.5f;
|
||||
}
|
||||
|
||||
bool includesRandomChoice = Options.AutoGMRotationSlots.Exists(x => x.Slot.GetValue() == 2);
|
||||
int index = Options.AutoGMRotationIndex;
|
||||
List<CustomGameMode> list = Options.AutoGMRotationCompiled;
|
||||
|
||||
CustomGameMode previousGM = index == 0 ? list[^1] : list[index - 1];
|
||||
CustomGameMode currentGM = list[index];
|
||||
CustomGameMode nextGM = index == list.Count - 1 ? list[0] : list[index + 1];
|
||||
CustomGameMode nextNextGM = index >= list.Count - 2 ? list[1] : list[index + 2];
|
||||
|
||||
var sb = new StringBuilder(GetString("AutoGMRotationStatusText"));
|
||||
sb.AppendLine();
|
||||
sb.AppendLine("....");
|
||||
if (!includesRandomChoice || index > 0) sb.AppendLine($"> {ToString(previousGM)}");
|
||||
sb.AppendLine($"<b>{GetString("AutoGMRotationStatusText.NextGM")}: {ToString(currentGM)}</b>");
|
||||
if (!includesRandomChoice || index < list.Count - 1) sb.AppendLine(ToString(nextGM));
|
||||
if (!includesRandomChoice || index < list.Count - 2) sb.AppendLine(ToString(nextNextGM));
|
||||
sb.AppendLine("....");
|
||||
|
||||
string ToString(CustomGameMode gm) => gm == CustomGameMode.All
|
||||
? GetString("AutoGMRotationStatusText.GMPoll")
|
||||
: Utils.ColorString(Main.GameModeColors[gm], GetString(gm.ToString()));
|
||||
|
||||
long timerSecondsLeft = AutoGMRotationCooldownTimerEndTS - Utils.TimeStamp;
|
||||
if (timerSecondsLeft > 0) sb.AppendLine(string.Format(GetString("AutoGMRotationStatusText.CooldownTimer"), timerSecondsLeft));
|
||||
|
||||
AutoGMRotationStatusText.text = sb.ToString().Trim();
|
||||
AutoGMRotationStatusText.text = BuildAutoGMRotationStatusText(false);
|
||||
AutoGMRotationStatusText.enabled = AutoGMRotationStatusText.text != string.Empty && GameStates.IsLobby;
|
||||
}
|
||||
else if (AutoGMRotationStatusText != null)
|
||||
@@ -432,6 +407,39 @@ internal static class HudManagerPatch
|
||||
}
|
||||
catch (Exception e) { Utils.ThrowException(e); }
|
||||
}
|
||||
|
||||
public static string BuildAutoGMRotationStatusText(bool chatMessage)
|
||||
{
|
||||
bool includesRandomChoice = Options.AutoGMRotationSlots.Exists(x => x.Slot.GetValue() == 2);
|
||||
int index = Options.AutoGMRotationIndex;
|
||||
List<CustomGameMode> list = Options.AutoGMRotationCompiled;
|
||||
|
||||
CustomGameMode previousGM = index == 0 ? list[^1] : list[index - 1];
|
||||
CustomGameMode currentGM = list[index];
|
||||
CustomGameMode nextGM = index == list.Count - 1 ? list[0] : list[index + 1];
|
||||
CustomGameMode nextNextGM = index >= list.Count - 2 ? list[1] : list[index + 2];
|
||||
|
||||
var sb = new StringBuilder();
|
||||
if (!chatMessage) sb.AppendLine(GetString("AutoGMRotationStatusText"));
|
||||
sb.AppendLine("....");
|
||||
if (!includesRandomChoice || index > 0) sb.AppendLine($"> {ToString(previousGM)}");
|
||||
sb.AppendLine($"<b>{GetString("AutoGMRotationStatusText.NextGM")}: {ToString(currentGM)}</b>");
|
||||
if (!includesRandomChoice || index < list.Count - 1) sb.AppendLine(ToString(nextGM));
|
||||
if (!includesRandomChoice || index < list.Count - 2) sb.AppendLine(ToString(nextNextGM));
|
||||
sb.AppendLine("....");
|
||||
|
||||
if (!chatMessage)
|
||||
{
|
||||
long timerSecondsLeft = AutoGMRotationCooldownTimerEndTS - Utils.TimeStamp;
|
||||
if (timerSecondsLeft > 0) sb.AppendLine(string.Format(GetString("AutoGMRotationStatusText.CooldownTimer"), timerSecondsLeft));
|
||||
}
|
||||
|
||||
return sb.ToString().Trim();
|
||||
|
||||
string ToString(CustomGameMode gm) => gm == CustomGameMode.All
|
||||
? GetString("AutoGMRotationStatusText.GMPoll")
|
||||
: Utils.ColorString(Main.GameModeColors[gm], GetString(gm.ToString()));
|
||||
}
|
||||
}
|
||||
|
||||
[HarmonyPatch(typeof(ActionButton), nameof(ActionButton.SetFillUp))]
|
||||
|
||||
@@ -331,7 +331,13 @@ internal static class ChangeRoleSettings
|
||||
|
||||
Main.PlayerStates[pc.PlayerId] = new(pc.PlayerId);
|
||||
Main.AllPlayerSpeed[pc.PlayerId] = Main.RealOptionsData.GetFloat(FloatOptionNames.PlayerSpeedMod);
|
||||
Main.AllPlayerKillCooldown[pc.PlayerId] = Options.DefaultKillCooldown;
|
||||
Main.AllPlayerKillCooldown[pc.PlayerId] = Options.DefaultKillCooldown + Main.CurrentMap switch
|
||||
{
|
||||
MapNames.Polus => Options.ExtraKillCooldownOnPolus.GetFloat(),
|
||||
MapNames.Airship => Options.ExtraKillCooldownOnAirship.GetFloat(),
|
||||
MapNames.Fungle => Options.ExtraKillCooldownOnFungle.GetFloat(),
|
||||
_ => 0f
|
||||
};
|
||||
ReportDeadBodyPatch.CanReport[pc.PlayerId] = true;
|
||||
ReportDeadBodyPatch.WaitReport[pc.PlayerId] = [];
|
||||
RoleResult[pc.PlayerId] = CustomRoles.NotAssigned;
|
||||
|
||||
@@ -1530,7 +1530,7 @@ internal static class FixedUpdatePatch
|
||||
foreach (PlayerControl pc in Main.AllPlayerControls)
|
||||
{
|
||||
if (pc.Is(CustomRoles.Vampire) || pc.Is(CustomRoles.Warlock) || pc.Is(CustomRoles.Assassin) || pc.Is(CustomRoles.Undertaker) || pc.Is(CustomRoles.Poisoner))
|
||||
Main.AllPlayerKillCooldown[pc.PlayerId] = Options.DefaultKillCooldown * 2;
|
||||
Main.AllPlayerKillCooldown[pc.PlayerId] = Options.AdjustedDefaultKillCooldown * 2;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -135,8 +135,16 @@ internal static class OnGameJoinedPatch
|
||||
|
||||
IEnumerator CoRoutine()
|
||||
{
|
||||
yield return new WaitForSeconds(10f);
|
||||
|
||||
try { Utils.SendMessage(HudManagerPatch.BuildAutoGMRotationStatusText(true), title: GetString("AutoGMRotationStatusText")); }
|
||||
catch (Exception e) { Utils.ThrowException(e); }
|
||||
|
||||
CustomGameMode nextGM = Options.AutoGMRotationCompiled[Options.AutoGMRotationIndex];
|
||||
|
||||
float timer;
|
||||
if (Options.AutoGMPollCommandAfterJoin.GetBool()) timer = Options.AutoGMPollCommandCooldown.GetInt();
|
||||
if (nextGM != CustomGameMode.All) timer = 0f;
|
||||
else if (Options.AutoGMPollCommandAfterJoin.GetBool()) timer = Options.AutoGMPollCommandCooldown.GetInt();
|
||||
else if (Main.AutoStart.Value) timer = (Options.MinWaitAutoStart.GetFloat() * 60) - 65;
|
||||
else timer = 30f;
|
||||
|
||||
@@ -153,8 +161,6 @@ internal static class OnGameJoinedPatch
|
||||
|
||||
if (Options.AutoGMRotationEnabled)
|
||||
{
|
||||
CustomGameMode nextGM = Options.AutoGMRotationCompiled[Options.AutoGMRotationIndex];
|
||||
|
||||
if (nextGM == CustomGameMode.All) ChatCommands.GameModePollCommand(PlayerControl.LocalPlayer, "/gmpoll", ["/gmpoll"]);
|
||||
else Options.GameMode.SetValue((int)nextGM - 1);
|
||||
|
||||
|
||||
@@ -3494,7 +3494,7 @@
|
||||
"DetourInfoLong": "(Crewmate):\\nAs the Detour, all kill button related actions on you will be blocked and instead happen on the closest player to you.",
|
||||
"Monitor": "Telecommunication",
|
||||
"MonitorInfo": "Track device usage",
|
||||
"MonitorInfoLong": "(Crewmates):\\nAs the Telecommunication, you are notified when anyone uses cameras, vitals, doorlogs, or admin.",
|
||||
"MonitorInfoLong": "(Crewmates):\\nAs the Telecommunication, you are notified when someone uses cameras, vitals, doorlogs, or admin (you will know who specifically). If you have ability uses left, you can vent/pet to open all closed doors on the map.",
|
||||
"Werewolf": "Werewolf",
|
||||
"WerewolfInfo": "Vent to Rampage to kill quickly",
|
||||
"WerewolfInfoLong": "(Neutrals):\\nAs the Werewolf, you can go on a rampage by entering a vent. While you're rampaging you have a very short kill cooldown. You cannot kill when you aren't rampaging. Rampaging has a cooldown and a limited duration.",
|
||||
@@ -4570,9 +4570,6 @@
|
||||
"CanKillBeforeRoleChange": "Can Kill Before Picking a Role",
|
||||
"AvailableRoles": "Available Impostor-Teamed Role List to Choose From",
|
||||
"ChangelingCurrentRole": "Selected Role: {0}",
|
||||
"Doormaster": "Door Master",
|
||||
"DoormasterInfo": "Open All Doors Anytime",
|
||||
"DoormasterInfoLong": "(Crewmates):\\nAs the Door Master, you can vent/pet to open all closed doors.",
|
||||
"Ricochet": "Ricochet",
|
||||
"RicochetInfo": "Protect yourself from someone specific",
|
||||
"RicochetInfoLong": "(Crewmates):\\nAs the Ricochet, you may vote someone in a meeting to make them your target. In the next round, your target will not be able to kill you.",
|
||||
|
||||
@@ -17,7 +17,7 @@ public class CopyCat : RoleBase
|
||||
public static OptionItem UsePet;
|
||||
|
||||
public PlayerControl CopyCatPC;
|
||||
private float CurrentKillCooldown = DefaultKillCooldown;
|
||||
private float CurrentKillCooldown = AdjustedDefaultKillCooldown;
|
||||
private float TempLimit;
|
||||
|
||||
public override bool IsEnable => Instances.Count > 0;
|
||||
@@ -49,7 +49,7 @@ public class CopyCat : RoleBase
|
||||
public override void Init()
|
||||
{
|
||||
Instances = [];
|
||||
CurrentKillCooldown = DefaultKillCooldown;
|
||||
CurrentKillCooldown = AdjustedDefaultKillCooldown;
|
||||
}
|
||||
|
||||
public override void Add(byte playerId)
|
||||
|
||||
@@ -1,93 +0,0 @@
|
||||
using System.Collections.Generic;
|
||||
using AmongUs.GameOptions;
|
||||
using EHR.Modules;
|
||||
|
||||
namespace EHR.Crewmate;
|
||||
|
||||
using static Options;
|
||||
|
||||
public class Doormaster : RoleBase
|
||||
{
|
||||
private const int Id = 640000;
|
||||
private static List<byte> PlayerIdList = [];
|
||||
|
||||
public static OptionItem VentCooldown;
|
||||
public static OptionItem UseLimitOpt;
|
||||
public static OptionItem DoormasterAbilityUseGainWithEachTaskCompleted;
|
||||
public static OptionItem AbilityChargesWhenFinishedTasks;
|
||||
|
||||
public override bool IsEnable => PlayerIdList.Count > 0;
|
||||
|
||||
public override void SetupCustomOption()
|
||||
{
|
||||
SetupRoleOptions(Id, TabGroup.CrewmateRoles, CustomRoles.Doormaster);
|
||||
|
||||
VentCooldown = new FloatOptionItem(Id + 10, "VentCooldown", new(0f, 70f, 1f), 15f, TabGroup.CrewmateRoles).SetParent(CustomRoleSpawnChances[CustomRoles.Doormaster])
|
||||
.SetValueFormat(OptionFormat.Seconds);
|
||||
|
||||
UseLimitOpt = new IntegerOptionItem(Id + 11, "AbilityUseLimit", new(0, 20, 1), 1, TabGroup.CrewmateRoles).SetParent(CustomRoleSpawnChances[CustomRoles.Doormaster])
|
||||
.SetValueFormat(OptionFormat.Times);
|
||||
|
||||
DoormasterAbilityUseGainWithEachTaskCompleted = new FloatOptionItem(Id + 12, "AbilityUseGainWithEachTaskCompleted", new(0f, 5f, 0.05f), 1f, TabGroup.CrewmateRoles)
|
||||
.SetParent(CustomRoleSpawnChances[CustomRoles.Doormaster])
|
||||
.SetValueFormat(OptionFormat.Times);
|
||||
|
||||
AbilityChargesWhenFinishedTasks = new FloatOptionItem(Id + 13, "AbilityChargesWhenFinishedTasks", new(0f, 5f, 0.05f), 0.2f, TabGroup.CrewmateRoles)
|
||||
.SetParent(CustomRoleSpawnChances[CustomRoles.Doormaster])
|
||||
.SetValueFormat(OptionFormat.Times);
|
||||
}
|
||||
|
||||
public override void Init()
|
||||
{
|
||||
PlayerIdList = [];
|
||||
}
|
||||
|
||||
public override void Add(byte playerId)
|
||||
{
|
||||
PlayerIdList.Add(playerId);
|
||||
playerId.SetAbilityUseLimit(UseLimitOpt.GetFloat());
|
||||
}
|
||||
|
||||
public override void Remove(byte playerId)
|
||||
{
|
||||
PlayerIdList.Remove(playerId);
|
||||
}
|
||||
|
||||
public override void ApplyGameOptions(IGameOptions opt, byte playerId)
|
||||
{
|
||||
if (UsePets.GetBool()) return;
|
||||
|
||||
AURoleOptions.EngineerCooldown = VentCooldown.GetFloat();
|
||||
AURoleOptions.EngineerInVentMaxTime = 1f;
|
||||
}
|
||||
|
||||
public override void OnPet(PlayerControl pc)
|
||||
{
|
||||
OpenDoors(pc);
|
||||
}
|
||||
|
||||
public override void OnEnterVent(PlayerControl pc, Vent vent)
|
||||
{
|
||||
OpenDoors(pc);
|
||||
}
|
||||
|
||||
private static void OpenDoors(PlayerControl pc)
|
||||
{
|
||||
if (pc == null) return;
|
||||
|
||||
if (!pc.Is(CustomRoles.Doormaster)) return;
|
||||
|
||||
if (pc.GetAbilityUseLimit() >= 1)
|
||||
{
|
||||
pc.RpcRemoveAbilityUse();
|
||||
DoorsReset.OpenAllDoors();
|
||||
}
|
||||
else
|
||||
pc.Notify(Translator.GetString("OutOfAbilityUsesDoMoreTasks"));
|
||||
}
|
||||
|
||||
public override bool CanUseVent(PlayerControl pc, int ventId)
|
||||
{
|
||||
return !IsThisRole(pc) || pc.Is(CustomRoles.Nimble) || pc.GetClosestVent()?.Id == ventId;
|
||||
}
|
||||
}
|
||||
@@ -6,6 +6,11 @@ internal class Monitor : RoleBase
|
||||
|
||||
public static OptionItem CanCheckCamera;
|
||||
public static OptionItem CanVent;
|
||||
public static OptionItem VentCooldown;
|
||||
public static OptionItem UseLimitOpt;
|
||||
public static OptionItem AbilityUseGainWithEachTaskCompleted;
|
||||
public static OptionItem AbilityChargesWhenFinishedTasks;
|
||||
|
||||
public static bool On;
|
||||
|
||||
public override bool IsEnable => On;
|
||||
@@ -18,6 +23,7 @@ internal class Monitor : RoleBase
|
||||
public override void Add(byte playerId)
|
||||
{
|
||||
On = true;
|
||||
playerId.SetAbilityUseLimit(UseLimitOpt.GetFloat());
|
||||
}
|
||||
|
||||
public override void SetupCustomOption()
|
||||
@@ -27,7 +33,23 @@ internal class Monitor : RoleBase
|
||||
CanCheckCamera = new BooleanOptionItem(Id + 10, "CanCheckCamera", true, TabGroup.CrewmateRoles)
|
||||
.SetParent(Options.CustomRoleSpawnChances[CustomRoles.Monitor]);
|
||||
|
||||
CanVent = new BooleanOptionItem(Id + 14, "CanVent", true, TabGroup.CrewmateRoles)
|
||||
CanVent = new BooleanOptionItem(Id + 14, "CanVent", false, TabGroup.CrewmateRoles)
|
||||
.SetParent(Options.CustomRoleSpawnChances[CustomRoles.Monitor]);
|
||||
|
||||
VentCooldown = new FloatOptionItem(Id + 15, "AbilityCooldown", new(0f, 70f, 1f), 15f, TabGroup.CrewmateRoles)
|
||||
.SetParent(Options.CustomRoleSpawnChances[CustomRoles.Monitor])
|
||||
.SetValueFormat(OptionFormat.Seconds);
|
||||
|
||||
UseLimitOpt = new IntegerOptionItem(Id + 11, "AbilityUseLimit", new(0, 20, 1), 1, TabGroup.CrewmateRoles)
|
||||
.SetParent(Options.CustomRoleSpawnChances[CustomRoles.Monitor])
|
||||
.SetValueFormat(OptionFormat.Times);
|
||||
|
||||
AbilityUseGainWithEachTaskCompleted = new FloatOptionItem(Id + 12, "AbilityUseGainWithEachTaskCompleted", new(0f, 5f, 0.05f), 1f, TabGroup.CrewmateRoles)
|
||||
.SetParent(Options.CustomRoleSpawnChances[CustomRoles.Monitor])
|
||||
.SetValueFormat(OptionFormat.Times);
|
||||
|
||||
AbilityChargesWhenFinishedTasks = new FloatOptionItem(Id + 13, "AbilityChargesWhenFinishedTasks", new(0f, 5f, 0.05f), 0.5f, TabGroup.CrewmateRoles)
|
||||
.SetParent(Options.CustomRoleSpawnChances[CustomRoles.Monitor])
|
||||
.SetValueFormat(OptionFormat.Times);
|
||||
}
|
||||
}
|
||||
@@ -343,7 +343,7 @@ internal static class EffectExtenstions
|
||||
}
|
||||
|
||||
break;
|
||||
case Effect.GhostPlayer when TimeSinceLastMeeting > Options.DefaultKillCooldown:
|
||||
case Effect.GhostPlayer when TimeSinceLastMeeting > Options.AdjustedDefaultKillCooldown:
|
||||
{
|
||||
PlayerControl killer = PickRandomPlayer();
|
||||
PlayerControl[] allPc = Main.AllAlivePlayerControls.Where(x => x.PlayerId != killer.PlayerId).ToArray();
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using AmongUs.GameOptions;
|
||||
using EHR.Modules;
|
||||
using Monitor = EHR.Crewmate.Monitor;
|
||||
|
||||
namespace EHR.Impostor;
|
||||
@@ -109,8 +110,10 @@ internal class AntiAdminer : RoleBase
|
||||
return;
|
||||
}
|
||||
|
||||
AURoleOptions.EngineerCooldown = 0f;
|
||||
AURoleOptions.EngineerInVentMaxTime = 0f;
|
||||
bool canVent = Monitor.CanVent.GetBool();
|
||||
|
||||
AURoleOptions.EngineerCooldown = canVent ? 0f : Monitor.VentCooldown.GetFloat();
|
||||
AURoleOptions.EngineerInVentMaxTime = canVent ? 0f : 1f;
|
||||
}
|
||||
|
||||
public override void OnFixedUpdate(PlayerControl player)
|
||||
@@ -146,7 +149,7 @@ internal class AntiAdminer : RoleBase
|
||||
|
||||
Dictionary<byte, HashSet<Device>> oldPlayersNearDevices = PlayersNearDevices.ToDictionary(x => x.Key, x => x.Value);
|
||||
PlayersNearDevices = [];
|
||||
bool Admin = false, Camera = false, DoorLog = false, Vital = false;
|
||||
bool admin = false, camera = false, doorLog = false, vital = false;
|
||||
float usableDistance = DisableDevice.UsableDistance;
|
||||
|
||||
foreach (PlayerControl pc in Main.AllAlivePlayerControls)
|
||||
@@ -155,108 +158,108 @@ internal class AntiAdminer : RoleBase
|
||||
|
||||
try
|
||||
{
|
||||
Vector2 PlayerPos = pc.Pos();
|
||||
Vector2 playerPos = pc.Pos();
|
||||
|
||||
switch (Main.NormalOptions.MapId)
|
||||
{
|
||||
case 0:
|
||||
if (!Options.DisableSkeldAdmin.GetBool() && Vector2.Distance(PlayerPos, DisableDevice.DevicePos["SkeldAdmin"]) <= usableDistance)
|
||||
if (!Options.DisableSkeldAdmin.GetBool() && Vector2.Distance(playerPos, DisableDevice.DevicePos["SkeldAdmin"]) <= usableDistance)
|
||||
{
|
||||
Admin = true;
|
||||
admin = true;
|
||||
AddDeviceUse(pc.PlayerId, Device.Admin);
|
||||
}
|
||||
|
||||
if (!Options.DisableSkeldCamera.GetBool() && Vector2.Distance(PlayerPos, DisableDevice.DevicePos["SkeldCamera"]) <= usableDistance)
|
||||
if (!Options.DisableSkeldCamera.GetBool() && Vector2.Distance(playerPos, DisableDevice.DevicePos["SkeldCamera"]) <= usableDistance)
|
||||
{
|
||||
Camera = true;
|
||||
camera = true;
|
||||
AddDeviceUse(pc.PlayerId, Device.Camera);
|
||||
}
|
||||
|
||||
break;
|
||||
case 1:
|
||||
if (!Options.DisableMiraHQAdmin.GetBool() && Vector2.Distance(PlayerPos, DisableDevice.DevicePos["MiraHQAdmin"]) <= usableDistance)
|
||||
if (!Options.DisableMiraHQAdmin.GetBool() && Vector2.Distance(playerPos, DisableDevice.DevicePos["MiraHQAdmin"]) <= usableDistance)
|
||||
{
|
||||
Admin = true;
|
||||
admin = true;
|
||||
AddDeviceUse(pc.PlayerId, Device.Admin);
|
||||
}
|
||||
|
||||
if (!Options.DisableMiraHQDoorLog.GetBool() && Vector2.Distance(PlayerPos, DisableDevice.DevicePos["MiraHQDoorLog"]) <= usableDistance)
|
||||
if (!Options.DisableMiraHQDoorLog.GetBool() && Vector2.Distance(playerPos, DisableDevice.DevicePos["MiraHQDoorLog"]) <= usableDistance)
|
||||
{
|
||||
DoorLog = true;
|
||||
doorLog = true;
|
||||
AddDeviceUse(pc.PlayerId, Device.DoorLog);
|
||||
}
|
||||
|
||||
break;
|
||||
case 2:
|
||||
if (!Options.DisablePolusAdmin.GetBool() && (Vector2.Distance(PlayerPos, DisableDevice.DevicePos["PolusLeftAdmin"]) <= usableDistance || Vector2.Distance(PlayerPos, DisableDevice.DevicePos["PolusRightAdmin"]) <= usableDistance))
|
||||
if (!Options.DisablePolusAdmin.GetBool() && (Vector2.Distance(playerPos, DisableDevice.DevicePos["PolusLeftAdmin"]) <= usableDistance || Vector2.Distance(playerPos, DisableDevice.DevicePos["PolusRightAdmin"]) <= usableDistance))
|
||||
{
|
||||
Admin = true;
|
||||
admin = true;
|
||||
AddDeviceUse(pc.PlayerId, Device.Admin);
|
||||
}
|
||||
|
||||
if (!Options.DisablePolusCamera.GetBool() && Vector2.Distance(PlayerPos, DisableDevice.DevicePos["PolusCamera"]) <= usableDistance)
|
||||
if (!Options.DisablePolusCamera.GetBool() && Vector2.Distance(playerPos, DisableDevice.DevicePos["PolusCamera"]) <= usableDistance)
|
||||
{
|
||||
Camera = true;
|
||||
camera = true;
|
||||
AddDeviceUse(pc.PlayerId, Device.Camera);
|
||||
}
|
||||
|
||||
if (!Options.DisablePolusVital.GetBool() && Vector2.Distance(PlayerPos, DisableDevice.DevicePos["PolusVital"]) <= usableDistance)
|
||||
if (!Options.DisablePolusVital.GetBool() && Vector2.Distance(playerPos, DisableDevice.DevicePos["PolusVital"]) <= usableDistance)
|
||||
{
|
||||
Vital = true;
|
||||
vital = true;
|
||||
AddDeviceUse(pc.PlayerId, Device.Vitals);
|
||||
}
|
||||
|
||||
break;
|
||||
case 3:
|
||||
if (!Options.DisableSkeldAdmin.GetBool() && Vector2.Distance(PlayerPos, DisableDevice.DevicePos["DleksAdmin"]) <= usableDistance)
|
||||
if (!Options.DisableSkeldAdmin.GetBool() && Vector2.Distance(playerPos, DisableDevice.DevicePos["DleksAdmin"]) <= usableDistance)
|
||||
{
|
||||
Admin = true;
|
||||
admin = true;
|
||||
AddDeviceUse(pc.PlayerId, Device.Admin);
|
||||
}
|
||||
|
||||
if (!Options.DisableSkeldCamera.GetBool() && Vector2.Distance(PlayerPos, DisableDevice.DevicePos["DleksCamera"]) <= usableDistance)
|
||||
if (!Options.DisableSkeldCamera.GetBool() && Vector2.Distance(playerPos, DisableDevice.DevicePos["DleksCamera"]) <= usableDistance)
|
||||
{
|
||||
Camera = true;
|
||||
camera = true;
|
||||
AddDeviceUse(pc.PlayerId, Device.Camera);
|
||||
}
|
||||
|
||||
break;
|
||||
case 4:
|
||||
if (!Options.DisableAirshipCockpitAdmin.GetBool() && Vector2.Distance(PlayerPos, DisableDevice.DevicePos["AirshipCockpitAdmin"]) <= usableDistance)
|
||||
if (!Options.DisableAirshipCockpitAdmin.GetBool() && Vector2.Distance(playerPos, DisableDevice.DevicePos["AirshipCockpitAdmin"]) <= usableDistance)
|
||||
{
|
||||
Admin = true;
|
||||
admin = true;
|
||||
AddDeviceUse(pc.PlayerId, Device.Admin);
|
||||
}
|
||||
|
||||
if (!Options.DisableAirshipRecordsAdmin.GetBool() && Vector2.Distance(PlayerPos, DisableDevice.DevicePos["AirshipRecordsAdmin"]) <= usableDistance)
|
||||
if (!Options.DisableAirshipRecordsAdmin.GetBool() && Vector2.Distance(playerPos, DisableDevice.DevicePos["AirshipRecordsAdmin"]) <= usableDistance)
|
||||
{
|
||||
Admin = true;
|
||||
admin = true;
|
||||
AddDeviceUse(pc.PlayerId, Device.Admin);
|
||||
}
|
||||
|
||||
if (!Options.DisableAirshipCamera.GetBool() && Vector2.Distance(PlayerPos, DisableDevice.DevicePos["AirshipCamera"]) <= usableDistance)
|
||||
if (!Options.DisableAirshipCamera.GetBool() && Vector2.Distance(playerPos, DisableDevice.DevicePos["AirshipCamera"]) <= usableDistance)
|
||||
{
|
||||
Camera = true;
|
||||
camera = true;
|
||||
AddDeviceUse(pc.PlayerId, Device.Camera);
|
||||
}
|
||||
|
||||
if (!Options.DisableAirshipVital.GetBool() && Vector2.Distance(PlayerPos, DisableDevice.DevicePos["AirshipVital"]) <= usableDistance)
|
||||
if (!Options.DisableAirshipVital.GetBool() && Vector2.Distance(playerPos, DisableDevice.DevicePos["AirshipVital"]) <= usableDistance)
|
||||
{
|
||||
Vital = true;
|
||||
vital = true;
|
||||
AddDeviceUse(pc.PlayerId, Device.Vitals);
|
||||
}
|
||||
|
||||
break;
|
||||
case 5:
|
||||
if (!Options.DisableFungleCamera.GetBool() && Vector2.Distance(PlayerPos, DisableDevice.DevicePos["FungleCamera"]) <= usableDistance)
|
||||
if (!Options.DisableFungleCamera.GetBool() && Vector2.Distance(playerPos, DisableDevice.DevicePos["FungleCamera"]) <= usableDistance)
|
||||
{
|
||||
Camera = true;
|
||||
camera = true;
|
||||
AddDeviceUse(pc.PlayerId, Device.Camera);
|
||||
}
|
||||
|
||||
if (!Options.DisableFungleVital.GetBool() && Vector2.Distance(PlayerPos, DisableDevice.DevicePos["FungleVital"]) <= usableDistance)
|
||||
if (!Options.DisableFungleVital.GetBool() && Vector2.Distance(playerPos, DisableDevice.DevicePos["FungleVital"]) <= usableDistance)
|
||||
{
|
||||
Vital = true;
|
||||
vital = true;
|
||||
AddDeviceUse(pc.PlayerId, Device.Vitals);
|
||||
}
|
||||
|
||||
@@ -268,17 +271,17 @@ internal class AntiAdminer : RoleBase
|
||||
|
||||
var change = false;
|
||||
|
||||
change |= IsAdminWatch != Admin;
|
||||
IsAdminWatch = Admin;
|
||||
change |= IsVitalWatch != Vital;
|
||||
IsVitalWatch = Vital;
|
||||
change |= IsDoorLogWatch != DoorLog;
|
||||
IsDoorLogWatch = DoorLog;
|
||||
change |= IsAdminWatch != admin;
|
||||
IsAdminWatch = admin;
|
||||
change |= IsVitalWatch != vital;
|
||||
IsVitalWatch = vital;
|
||||
change |= IsDoorLogWatch != doorLog;
|
||||
IsDoorLogWatch = doorLog;
|
||||
|
||||
if (IsMonitor ? Monitor.CanCheckCamera.GetBool() : CanCheckCamera.GetBool())
|
||||
{
|
||||
change |= IsCameraWatch != Camera;
|
||||
IsCameraWatch = Camera;
|
||||
change |= IsCameraWatch != camera;
|
||||
IsCameraWatch = camera;
|
||||
}
|
||||
|
||||
if (IsMonitor) notify |= oldPlayersNearDevices.Count != PlayersNearDevices.Count || oldPlayersNearDevices.Any(x => !PlayersNearDevices.TryGetValue(x.Key, out HashSet<Device> c) || !x.Value.SetEquals(c));
|
||||
@@ -297,6 +300,37 @@ internal class AntiAdminer : RoleBase
|
||||
}
|
||||
}
|
||||
|
||||
public override void OnPet(PlayerControl pc)
|
||||
{
|
||||
if (!IsMonitor) return;
|
||||
OpenDoors(pc);
|
||||
}
|
||||
|
||||
public override void OnEnterVent(PlayerControl pc, Vent vent)
|
||||
{
|
||||
if (!IsMonitor) return;
|
||||
OpenDoors(pc);
|
||||
}
|
||||
|
||||
private void OpenDoors(PlayerControl pc)
|
||||
{
|
||||
if (!IsMonitor) return;
|
||||
if (pc == null) return;
|
||||
|
||||
if (pc.GetAbilityUseLimit() >= 1)
|
||||
{
|
||||
pc.RpcRemoveAbilityUse();
|
||||
DoorsReset.OpenAllDoors();
|
||||
}
|
||||
else
|
||||
pc.Notify(Translator.GetString("OutOfAbilityUsesDoMoreTasks"));
|
||||
}
|
||||
|
||||
public override bool CanUseVent(PlayerControl pc, int ventId)
|
||||
{
|
||||
return !pc.Is(CustomRoles.Monitor) || pc.Is(CustomRoles.Nimble) || Monitor.CanVent.GetBool() || pc.GetClosestVent()?.Id == ventId;
|
||||
}
|
||||
|
||||
public override string GetSuffix(PlayerControl seer, PlayerControl target, bool hud = false, bool meeting = false)
|
||||
{
|
||||
if (Main.PlayerStates[seer.PlayerId].Role is AntiAdminer self && seer.PlayerId == target.PlayerId && self.AntiAdminerId == seer.PlayerId)
|
||||
|
||||
@@ -95,7 +95,7 @@ internal class Assassin : RoleBase
|
||||
|
||||
public override void SetKillCooldown(byte id)
|
||||
{
|
||||
Main.AllPlayerKillCooldown[id] = id.IsPlayerShifted() ? DefaultKillCooldown : MarkCooldown;
|
||||
Main.AllPlayerKillCooldown[id] = id.IsPlayerShifted() ? AdjustedDefaultKillCooldown : MarkCooldown;
|
||||
}
|
||||
|
||||
public override void ApplyGameOptions(IGameOptions opt, byte id)
|
||||
@@ -173,7 +173,7 @@ internal class Assassin : RoleBase
|
||||
SendRPC(pc.PlayerId);
|
||||
pc.ResetKillCooldown();
|
||||
pc.SyncSettings();
|
||||
pc.SetKillCooldown(DefaultKillCooldown);
|
||||
pc.SetKillCooldown(AdjustedDefaultKillCooldown);
|
||||
}
|
||||
else if (!tpSuccess) pc.Notify(GetString("TargetCannotBeTeleported"));
|
||||
}
|
||||
|
||||
@@ -207,7 +207,7 @@ public class BountyHunter : RoleBase
|
||||
|
||||
if (Utils.GetPlayerById(id).GetCustomRole() == CustomRoles.BountyHunter)
|
||||
{
|
||||
Main.AllPlayerKillCooldown[id] = Options.DefaultKillCooldown;
|
||||
Main.AllPlayerKillCooldown[id] = Options.AdjustedDefaultKillCooldown;
|
||||
Utils.GetPlayerById(id).SyncSettings();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -41,7 +41,7 @@ internal class CursedWolf : RoleBase
|
||||
}
|
||||
else
|
||||
{
|
||||
KillCooldown = Options.DefaultKillCooldown;
|
||||
KillCooldown = Options.AdjustedDefaultKillCooldown;
|
||||
CanVent = true;
|
||||
HasImpostorVision = true;
|
||||
KillAttacker = Options.killAttacker.GetBool();
|
||||
|
||||
@@ -60,7 +60,7 @@ public class Gangster : RoleBase
|
||||
|
||||
public override void SetKillCooldown(byte id)
|
||||
{
|
||||
Main.AllPlayerKillCooldown[id] = CanRecruit(id) ? KillCooldown.GetFloat() : Options.DefaultKillCooldown;
|
||||
Main.AllPlayerKillCooldown[id] = CanRecruit(id) ? KillCooldown.GetFloat() : Options.AdjustedDefaultKillCooldown;
|
||||
}
|
||||
|
||||
public static bool CanRecruit(byte id)
|
||||
|
||||
@@ -108,9 +108,9 @@ public class Mafioso : RoleBase
|
||||
{
|
||||
Main.AllPlayerKillCooldown[playerId] = Tier switch
|
||||
{
|
||||
0 => (float)Math.Round(DefaultKillCooldown * 1.25, 2),
|
||||
1 => DefaultKillCooldown,
|
||||
2 => (float)Math.Round(DefaultKillCooldown * 0.85, 2),
|
||||
0 => (float)Math.Round(AdjustedDefaultKillCooldown * 1.25, 2),
|
||||
1 => AdjustedDefaultKillCooldown,
|
||||
2 => (float)Math.Round(AdjustedDefaultKillCooldown * 0.85, 2),
|
||||
_ => 1f
|
||||
};
|
||||
}
|
||||
@@ -206,7 +206,7 @@ public class Mafioso : RoleBase
|
||||
|
||||
if (Pistol1CD > 0 && Pistol2CD > 0) return false;
|
||||
|
||||
int KCD = Tier >= 4 ? (int)Math.Round(DefaultKillCooldown) : (int)Math.Round(DefaultKillCooldown * 1.5);
|
||||
int KCD = Tier >= 4 ? (int)Math.Round(AdjustedDefaultKillCooldown) : (int)Math.Round(AdjustedDefaultKillCooldown * 1.5);
|
||||
KCD++;
|
||||
|
||||
if (Pistol1CD <= 0)
|
||||
@@ -241,7 +241,7 @@ public class Mafioso : RoleBase
|
||||
if (!IsEnable) return;
|
||||
|
||||
PreviouslyUsedVents.Clear();
|
||||
int KCD = Tier >= 4 ? (int)Math.Round(DefaultKillCooldown) : (int)Math.Round(DefaultKillCooldown * 1.5);
|
||||
int KCD = Tier >= 4 ? (int)Math.Round(AdjustedDefaultKillCooldown) : (int)Math.Round(AdjustedDefaultKillCooldown * 1.5);
|
||||
KCD++;
|
||||
Pistol1CD = KCD;
|
||||
Pistol2CD = KCD;
|
||||
|
||||
@@ -188,7 +188,7 @@ public class Mastermind : RoleBase
|
||||
|
||||
LateTask.New(() =>
|
||||
{
|
||||
float kcd = TempKCDs.TryGetValue(killer.PlayerId, out float cd) ? cd : Main.AllPlayerKillCooldown.GetValueOrDefault(killer.PlayerId, DefaultKillCooldown);
|
||||
float kcd = TempKCDs.TryGetValue(killer.PlayerId, out float cd) ? cd : Main.AllPlayerKillCooldown.GetValueOrDefault(killer.PlayerId, AdjustedDefaultKillCooldown);
|
||||
killer.SetKillCooldown(kcd);
|
||||
TempKCDs.Remove(killer.PlayerId);
|
||||
}, 0.1f, "Set KCD for Manipulated Kill");
|
||||
|
||||
@@ -89,7 +89,7 @@ public class Overheat : RoleBase
|
||||
|
||||
public override void SetKillCooldown(byte id)
|
||||
{
|
||||
float kcd = Options.DefaultKillCooldown;
|
||||
float kcd = Options.AdjustedDefaultKillCooldown;
|
||||
kcd -= KCDDecreasePerIncreasedTemperature.GetFloat() * (Temperature - StartingTemperature);
|
||||
Main.AllPlayerKillCooldown[id] = kcd;
|
||||
}
|
||||
|
||||
@@ -86,7 +86,7 @@ public class Penguin : RoleBase
|
||||
MeetingKill = OptionMeetingKill.GetBool();
|
||||
SpeedDuringDrag = OptionSpeedDuringDrag.GetFloat();
|
||||
VictimCanUseAbilities = OptionVictimCanUseAbilities.GetBool();
|
||||
Cooldown = Options.DefaultKillCooldown;
|
||||
Cooldown = Options.AdjustedDefaultKillCooldown;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@@ -279,7 +279,7 @@ public class Sniper : RoleBase
|
||||
public override void ApplyGameOptions(IGameOptions opt, byte playerId)
|
||||
{
|
||||
if (Options.UsePhantomBasis.GetBool())
|
||||
AURoleOptions.PhantomCooldown = bulletCount > 0 ? Options.DefaultKillCooldown : 255f;
|
||||
AURoleOptions.PhantomCooldown = bulletCount > 0 ? Options.AdjustedDefaultKillCooldown : 255f;
|
||||
else
|
||||
{
|
||||
if (Options.UsePets.GetBool()) return;
|
||||
|
||||
@@ -81,7 +81,7 @@ public class Wildling : RoleBase
|
||||
ShapeshiftCD = ShapeshiftCDOpt.GetFloat();
|
||||
ShapeshiftDur = ShapeshiftDurOpt.GetFloat();
|
||||
HasImpostorVision = true;
|
||||
KillCooldown = DefaultKillCooldown;
|
||||
KillCooldown = AdjustedDefaultKillCooldown;
|
||||
break;
|
||||
case CustomRoles.BloodKnight:
|
||||
ProtectionDuration = BloodKnight.ProtectDuration.GetFloat();
|
||||
|
||||
@@ -17,7 +17,7 @@ public class DarkHide : RoleBase
|
||||
private static OptionItem CanVent;
|
||||
public static OptionItem SnatchesWin;
|
||||
|
||||
private float CurrentKillCooldown = Options.DefaultKillCooldown;
|
||||
private float CurrentKillCooldown = Options.AdjustedDefaultKillCooldown;
|
||||
public bool IsWinKill;
|
||||
|
||||
public override bool IsEnable => PlayerIdList.Count > 0;
|
||||
|
||||
@@ -74,9 +74,9 @@ public class Gaslighter : RoleBase
|
||||
{
|
||||
Round.Kill => KillCooldown.GetFloat(),
|
||||
Round.Knight => Monarch.KnightCooldown.GetFloat(),
|
||||
Round.Curse => Options.DefaultKillCooldown,
|
||||
Round.Curse => Options.AdjustedDefaultKillCooldown,
|
||||
Round.Shield => Medic.CD.GetFloat(),
|
||||
_ => Options.DefaultKillCooldown
|
||||
_ => Options.AdjustedDefaultKillCooldown
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
+21
-95
@@ -1,6 +1,4 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using AmongUs.GameOptions;
|
||||
using EHR.Modules;
|
||||
using Hazel;
|
||||
@@ -25,15 +23,10 @@ public class Glitch : RoleBase
|
||||
private byte GlitchId;
|
||||
|
||||
public int HackCDTimer;
|
||||
private bool HasMimiced;
|
||||
private bool IsShifted;
|
||||
public int KCDTimer;
|
||||
public long LastHack;
|
||||
public long LastKill;
|
||||
public long LastMimic;
|
||||
private long LastUpdate;
|
||||
public int MimicCDTimer;
|
||||
public int MimicDurTimer;
|
||||
|
||||
public override bool IsEnable => PlayerIdList.Count > 0;
|
||||
|
||||
@@ -41,24 +34,34 @@ public class Glitch : RoleBase
|
||||
{
|
||||
SetupRoleOptions(Id, TabGroup.NeutralRoles, CustomRoles.Glitch);
|
||||
|
||||
KillCooldown = new IntegerOptionItem(Id + 10, "KillCooldown", new(0, 180, 1), 25, TabGroup.NeutralRoles).SetParent(CustomRoleSpawnChances[CustomRoles.Glitch])
|
||||
KillCooldown = new IntegerOptionItem(Id + 10, "KillCooldown", new(0, 180, 1), 25, TabGroup.NeutralRoles)
|
||||
.SetParent(CustomRoleSpawnChances[CustomRoles.Glitch])
|
||||
.SetValueFormat(OptionFormat.Seconds);
|
||||
|
||||
HackCooldown = new IntegerOptionItem(Id + 11, "HackCooldown", new(0, 180, 1), 20, TabGroup.NeutralRoles).SetParent(CustomRoleSpawnChances[CustomRoles.Glitch])
|
||||
HackCooldown = new IntegerOptionItem(Id + 11, "HackCooldown", new(0, 180, 1), 20, TabGroup.NeutralRoles)
|
||||
.SetParent(CustomRoleSpawnChances[CustomRoles.Glitch])
|
||||
.SetValueFormat(OptionFormat.Seconds);
|
||||
|
||||
HackDuration = new FloatOptionItem(Id + 14, "HackDuration", new(0f, 60f, 1f), 15f, TabGroup.NeutralRoles).SetParent(CustomRoleSpawnChances[CustomRoles.Glitch])
|
||||
HackDuration = new FloatOptionItem(Id + 14, "HackDuration", new(0f, 60f, 1f), 15f, TabGroup.NeutralRoles)
|
||||
.SetParent(CustomRoleSpawnChances[CustomRoles.Glitch])
|
||||
.SetValueFormat(OptionFormat.Seconds);
|
||||
|
||||
MimicCooldown = new IntegerOptionItem(Id + 15, "MimicCooldown", new(0, 180, 1), 30, TabGroup.NeutralRoles).SetParent(CustomRoleSpawnChances[CustomRoles.Glitch])
|
||||
MimicCooldown = new IntegerOptionItem(Id + 15, "MimicCooldown", new(0, 180, 1), 30, TabGroup.NeutralRoles)
|
||||
.SetParent(CustomRoleSpawnChances[CustomRoles.Glitch])
|
||||
.SetValueFormat(OptionFormat.Seconds);
|
||||
|
||||
MimicDuration = new FloatOptionItem(Id + 16, "MimicDuration", new(0f, 60f, 1f), 10f, TabGroup.NeutralRoles).SetParent(CustomRoleSpawnChances[CustomRoles.Glitch])
|
||||
MimicDuration = new FloatOptionItem(Id + 16, "MimicDuration", new(0f, 60f, 1f), 10f, TabGroup.NeutralRoles)
|
||||
.SetParent(CustomRoleSpawnChances[CustomRoles.Glitch])
|
||||
.SetValueFormat(OptionFormat.Seconds);
|
||||
|
||||
CanVent = new BooleanOptionItem(Id + 12, "CanVent", true, TabGroup.NeutralRoles).SetParent(CustomRoleSpawnChances[CustomRoles.Glitch]);
|
||||
CanVote = new BooleanOptionItem(Id + 17, "CanVote", true, TabGroup.NeutralRoles).SetParent(CustomRoleSpawnChances[CustomRoles.Glitch]);
|
||||
HasImpostorVision = new BooleanOptionItem(Id + 13, "ImpostorVision", true, TabGroup.NeutralRoles).SetParent(CustomRoleSpawnChances[CustomRoles.Glitch]);
|
||||
CanVent = new BooleanOptionItem(Id + 12, "CanVent", true, TabGroup.NeutralRoles)
|
||||
.SetParent(CustomRoleSpawnChances[CustomRoles.Glitch]);
|
||||
|
||||
CanVote = new BooleanOptionItem(Id + 17, "CanVote", true, TabGroup.NeutralRoles)
|
||||
.SetParent(CustomRoleSpawnChances[CustomRoles.Glitch]);
|
||||
|
||||
HasImpostorVision = new BooleanOptionItem(Id + 13, "ImpostorVision", true, TabGroup.NeutralRoles)
|
||||
.SetParent(CustomRoleSpawnChances[CustomRoles.Glitch]);
|
||||
}
|
||||
|
||||
public override void Init()
|
||||
@@ -74,20 +77,13 @@ public class Glitch : RoleBase
|
||||
|
||||
HackCDTimer = 10;
|
||||
KCDTimer = 10;
|
||||
MimicCDTimer = 10;
|
||||
MimicDurTimer = 0;
|
||||
|
||||
IsShifted = false;
|
||||
|
||||
long ts = Utils.TimeStamp;
|
||||
|
||||
LastKill = ts;
|
||||
LastHack = ts;
|
||||
LastMimic = ts;
|
||||
|
||||
LastUpdate = ts;
|
||||
|
||||
HasMimiced = false;
|
||||
}
|
||||
|
||||
public override void Remove(byte playerId)
|
||||
@@ -117,8 +113,6 @@ public class Glitch : RoleBase
|
||||
|
||||
MessageWriter writer = AmongUsClient.Instance.StartRpcImmediately(PlayerControl.LocalPlayer.NetId, (byte)CustomRPC.SyncGlitchTimers, SendOption.Reliable);
|
||||
writer.Write(GlitchId);
|
||||
writer.Write(MimicCDTimer);
|
||||
writer.Write(MimicDurTimer);
|
||||
writer.Write(HackCDTimer);
|
||||
writer.Write(KCDTimer);
|
||||
AmongUsClient.Instance.FinishRpcImmediately(writer);
|
||||
@@ -129,8 +123,6 @@ public class Glitch : RoleBase
|
||||
byte id = reader.ReadByte();
|
||||
if (Main.PlayerStates[id].Role is not Glitch gc) return;
|
||||
|
||||
gc.MimicCDTimer = reader.ReadInt32();
|
||||
gc.MimicDurTimer = reader.ReadInt32();
|
||||
gc.HackCDTimer = reader.ReadInt32();
|
||||
gc.KCDTimer = reader.ReadInt32();
|
||||
}
|
||||
@@ -143,37 +135,9 @@ public class Glitch : RoleBase
|
||||
public override void ApplyGameOptions(IGameOptions opt, byte id)
|
||||
{
|
||||
opt.SetVision(HasImpostorVision.GetBool());
|
||||
}
|
||||
|
||||
private void Mimic(PlayerControl pc)
|
||||
{
|
||||
if (pc == null || !pc.Is(CustomRoles.Glitch) || !pc.IsAlive() || MimicCDTimer > 0 || IsShifted) return;
|
||||
|
||||
PlayerControl[] playerlist = Main.AllAlivePlayerControls.Where(a => a.PlayerId != pc.PlayerId).ToArray();
|
||||
|
||||
try
|
||||
{
|
||||
pc.RpcShapeshift(playerlist.RandomElement(), false);
|
||||
|
||||
IsShifted = true;
|
||||
HasMimiced = true;
|
||||
LastMimic = Utils.TimeStamp;
|
||||
MimicCDTimer = MimicCooldown.GetInt();
|
||||
MimicDurTimer = MimicDuration.GetInt();
|
||||
SendRPCSyncTimers();
|
||||
}
|
||||
catch (Exception ex) { Logger.Error(ex.ToString(), "Glitch.Mimic.RpcShapeshift"); }
|
||||
}
|
||||
|
||||
public override void OnPet(PlayerControl pc)
|
||||
{
|
||||
Mimic(pc);
|
||||
}
|
||||
|
||||
public override bool OnSabotage(PlayerControl pc)
|
||||
{
|
||||
Mimic(pc);
|
||||
return false;
|
||||
AURoleOptions.ShapeshifterCooldown = MimicCooldown.GetInt();
|
||||
AURoleOptions.ShapeshifterDuration = MimicDuration.GetInt();
|
||||
}
|
||||
|
||||
public override bool OnCheckMurder(PlayerControl killer, PlayerControl target)
|
||||
@@ -211,8 +175,6 @@ public class Glitch : RoleBase
|
||||
|
||||
if (HackCDTimer is > 180 or < 0) HackCDTimer = 0;
|
||||
if (KCDTimer is > 180 or < 0) KCDTimer = 0;
|
||||
if (MimicCDTimer is > 180 or < 0) MimicCDTimer = 0;
|
||||
if (MimicDurTimer is > 180 or < 0) MimicDurTimer = 0;
|
||||
|
||||
if (player == null) return;
|
||||
|
||||
@@ -220,32 +182,10 @@ public class Glitch : RoleBase
|
||||
{
|
||||
HackCDTimer = 0;
|
||||
KCDTimer = 0;
|
||||
MimicCDTimer = 0;
|
||||
MimicDurTimer = 0;
|
||||
return;
|
||||
}
|
||||
|
||||
if (MimicDurTimer > 0)
|
||||
{
|
||||
try { MimicDurTimer = (int)(MimicDuration.GetInt() - (now - LastMimic)); }
|
||||
catch { MimicDurTimer = 0; }
|
||||
|
||||
if (MimicDurTimer > 180) MimicDurTimer = 0;
|
||||
}
|
||||
|
||||
if ((MimicDurTimer <= 0 || !GameStates.IsInTask) && IsShifted)
|
||||
{
|
||||
try
|
||||
{
|
||||
player.RpcShapeshift(player, false);
|
||||
IsShifted = false;
|
||||
}
|
||||
catch (Exception ex) { Logger.Error(ex.ToString(), "Glitch.Mimic.RpcRevertShapeshift"); }
|
||||
|
||||
if (!GameStates.IsInTask) MimicDurTimer = 0;
|
||||
}
|
||||
|
||||
if (HackCDTimer <= 0 && KCDTimer <= 0 && MimicCDTimer <= 0 && MimicDurTimer <= 0) return;
|
||||
if (HackCDTimer <= 0 && KCDTimer <= 0) return;
|
||||
|
||||
try { HackCDTimer = (int)(HackCooldown.GetInt() - (now - LastHack)); }
|
||||
catch { HackCDTimer = 0; }
|
||||
@@ -257,11 +197,6 @@ public class Glitch : RoleBase
|
||||
|
||||
if (KCDTimer is > 180 or < 0) KCDTimer = 0;
|
||||
|
||||
try { MimicCDTimer = (int)(MimicCooldown.GetInt() + (HasMimiced ? MimicDuration.GetInt() : 0) - (now - LastMimic)); }
|
||||
catch { MimicCDTimer = 0; }
|
||||
|
||||
if (MimicCDTimer is > 180 or < 0) MimicCDTimer = 0;
|
||||
|
||||
if (player.IsNonHostModdedClient())
|
||||
SendRPCSyncTimers();
|
||||
|
||||
@@ -276,8 +211,6 @@ public class Glitch : RoleBase
|
||||
|
||||
if (!hud) sb.Append("<size=70%>");
|
||||
|
||||
if (MimicDurTimer > 0) sb.Append($"{string.Format(Translator.GetString("MimicDur"), MimicDurTimer)}\n");
|
||||
if (MimicCDTimer > 0 && MimicDurTimer <= 0) sb.Append($"{string.Format(Translator.GetString("MimicCD"), MimicCDTimer)}\n");
|
||||
if (HackCDTimer > 0) sb.Append($"{string.Format(Translator.GetString("HackCD"), HackCDTimer)}\n");
|
||||
if (KCDTimer > 0) sb.Append($"{string.Format(Translator.GetString("KCD"), KCDTimer)}\n");
|
||||
|
||||
@@ -293,15 +226,8 @@ public class Glitch : RoleBase
|
||||
long timestamp = Utils.TimeStamp;
|
||||
LastKill = timestamp;
|
||||
LastHack = timestamp;
|
||||
LastMimic = timestamp;
|
||||
KCDTimer = 10;
|
||||
HackCDTimer = 10;
|
||||
MimicCDTimer = 10;
|
||||
SendRPCSyncTimers();
|
||||
}
|
||||
|
||||
public override void OnReportDeadBody()
|
||||
{
|
||||
HasMimiced = false;
|
||||
}
|
||||
}
|
||||
@@ -22,7 +22,7 @@ public class HeadHunter : RoleBase
|
||||
private static OptionItem MinKCD;
|
||||
private static OptionItem MaxKCD;
|
||||
private byte HeadHunterId;
|
||||
public float KCD = DefaultKillCooldown;
|
||||
public float KCD = AdjustedDefaultKillCooldown;
|
||||
|
||||
public List<byte> Targets = [];
|
||||
|
||||
|
||||
@@ -99,7 +99,7 @@ public class PlagueDoctor : RoleBase
|
||||
|
||||
public override void SetKillCooldown(byte id)
|
||||
{
|
||||
Main.AllPlayerKillCooldown[id] = Options.DefaultKillCooldown;
|
||||
Main.AllPlayerKillCooldown[id] = Options.AdjustedDefaultKillCooldown;
|
||||
}
|
||||
|
||||
public override bool CanUseKillButton(PlayerControl pc)
|
||||
|
||||
@@ -42,7 +42,7 @@ internal class Provocateur : RoleBase
|
||||
|
||||
public override void SetKillCooldown(byte id)
|
||||
{
|
||||
Main.AllPlayerKillCooldown[id] = Options.DefaultKillCooldown;
|
||||
Main.AllPlayerKillCooldown[id] = Options.AdjustedDefaultKillCooldown;
|
||||
}
|
||||
|
||||
public override void ApplyGameOptions(IGameOptions opt, byte playerId)
|
||||
|
||||
@@ -95,7 +95,7 @@ public class Rogue : RoleBase
|
||||
{
|
||||
if (GotRewards.Contains(Reward.Morph) && MorphCooldown <= 0)
|
||||
{
|
||||
MorphCooldown = 15 + (int)Options.DefaultKillCooldown;
|
||||
MorphCooldown = 15 + (int)Options.AdjustedDefaultKillCooldown;
|
||||
Utils.SendRPC(CustomRPC.SyncRoleData, pc.PlayerId, 2, MorphCooldown);
|
||||
PlayerControl target = Main.AllAlivePlayerControls.Except([pc]).RandomElement();
|
||||
pc.RpcShapeshift(target, !Options.DisableAllShapeshiftAnimations.GetBool());
|
||||
@@ -167,7 +167,7 @@ public class Rogue : RoleBase
|
||||
Utils.SendRPC(CustomRPC.SyncRoleData, pc.PlayerId, 2, MorphCooldown);
|
||||
Utils.NotifyRoles(SpecifySeer: pc, SpecifyTarget: pc);
|
||||
|
||||
if (pc.IsShifted() && MorphCooldown <= Options.DefaultKillCooldown)
|
||||
if (pc.IsShifted() && MorphCooldown <= Options.AdjustedDefaultKillCooldown)
|
||||
pc.RpcShapeshift(pc, !Options.DisableAllShapeshiftAnimations.GetBool());
|
||||
}
|
||||
}
|
||||
@@ -319,7 +319,7 @@ public class Rogue : RoleBase
|
||||
|
||||
if (CurrentTask.IsCompleted) return Translator.GetString("Rogue.TaskCompleted");
|
||||
|
||||
float d = Options.DefaultKillCooldown;
|
||||
float d = Options.AdjustedDefaultKillCooldown;
|
||||
|
||||
string c = GotRewards.Contains(Reward.Morph) && MorphCooldown > 0
|
||||
? MorphCooldown <= d
|
||||
|
||||
+1
-1
@@ -46,7 +46,7 @@ public abstract class RoleBase : IComparable<RoleBase>
|
||||
// Some virtual methods that trigger actions, like venting, petting, CheckMurder, etc. These are not abstract because they have a default implementation. These should also have the same name as the methods in the derived classes.
|
||||
public virtual void SetKillCooldown(byte id)
|
||||
{
|
||||
Main.AllPlayerKillCooldown[id] = Options.DefaultKillCooldown;
|
||||
Main.AllPlayerKillCooldown[id] = Options.AdjustedDefaultKillCooldown;
|
||||
}
|
||||
|
||||
public virtual bool CanUseKillButton(PlayerControl pc)
|
||||
|
||||
Reference in new issue
Block a user