mirror of
https://github.com/Gurge44/EndlessHostRoles.git
synced 2026-10-20 01:46:25 +00:00
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
This commit is contained in:
1 parent
32e44209e0
commit
c609450ec3
21 files changed
+99
-140
No files matched your search
@@ -1971,7 +1971,6 @@ public enum CountTypes
|
||||
Glitch,
|
||||
Arsonist,
|
||||
Cherokious,
|
||||
Sheriff,
|
||||
|
||||
Coven
|
||||
}
|
||||
@@ -400,12 +400,12 @@ public sealed class PlayerGameOptionsSender(PlayerControl player) : GameOptionsS
|
||||
}
|
||||
|
||||
break;
|
||||
case CustomRoles.Bewilder:
|
||||
case CustomRoles.Bewilder when !Utils.IsActive(SystemTypes.Electrical):
|
||||
opt.SetVision(false);
|
||||
opt.SetFloat(FloatOptionNames.CrewLightMod, Options.BewilderVision.GetFloat());
|
||||
opt.SetFloat(FloatOptionNames.ImpostorLightMod, Options.BewilderVision.GetFloat());
|
||||
break;
|
||||
case CustomRoles.Sunglasses:
|
||||
case CustomRoles.Sunglasses when !Utils.IsActive(SystemTypes.Electrical):
|
||||
opt.SetVision(false);
|
||||
opt.SetFloat(FloatOptionNames.CrewLightMod, Options.SunglassesVision.GetFloat());
|
||||
opt.SetFloat(FloatOptionNames.ImpostorLightMod, Options.SunglassesVision.GetFloat());
|
||||
|
||||
@@ -474,18 +474,14 @@ public class TaskState
|
||||
{
|
||||
switch (player.GetCustomRole())
|
||||
{
|
||||
case CustomRoles.Mechanic:
|
||||
if (Main.PlayerStates[player.PlayerId].Role is not Mechanic sm) break;
|
||||
|
||||
sm.UsedSkillCount -= Mechanic.MechanicAbilityUseGainWithEachTaskCompleted.GetFloat();
|
||||
sm.SendRPC();
|
||||
break;
|
||||
case CustomRoles.Hacker:
|
||||
if (!player.IsModdedClient() && Hacker.UseLimit.ContainsKey(player.PlayerId))
|
||||
Hacker.UseLimit[player.PlayerId] += Hacker.HackerAbilityUseGainWithEachTaskCompleted.GetFloat();
|
||||
else if (Hacker.UseLimitSeconds.ContainsKey(player.PlayerId)) Hacker.UseLimitSeconds[player.PlayerId] += Hacker.HackerAbilityUseGainWithEachTaskCompleted.GetInt() * Hacker.ModdedClientAbilityUseSecondsMultiplier.GetInt();
|
||||
else if (Hacker.UseLimitSeconds.ContainsKey(player.PlayerId))
|
||||
Hacker.UseLimitSeconds[player.PlayerId] += Hacker.HackerAbilityUseGainWithEachTaskCompleted.GetInt() * Hacker.ModdedClientAbilityUseSecondsMultiplier.GetInt();
|
||||
|
||||
if (Hacker.UseLimitSeconds.ContainsKey(player.PlayerId)) Hacker.SendRPC(player.PlayerId, Hacker.UseLimitSeconds[player.PlayerId]);
|
||||
if (Hacker.UseLimitSeconds.ContainsKey(player.PlayerId))
|
||||
Hacker.SendRPC(player.PlayerId, Hacker.UseLimitSeconds[player.PlayerId]);
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -134,17 +134,18 @@ public static class GuessManager
|
||||
ShowMessage(error);
|
||||
return true;
|
||||
}
|
||||
|
||||
if ((pc.IsCrewmate() && role.IsCrewmate() && !Options.CrewCanGuessCrew.GetBool()) ||
|
||||
(pc.IsImpostor() && role.IsImpostor() && !Options.ImpCanGuessImp.GetBool()))
|
||||
{
|
||||
ShowMessage("GuessTeamMate");
|
||||
return true;
|
||||
}
|
||||
|
||||
PlayerControl target = Utils.GetPlayerById(targetId);
|
||||
|
||||
if (target != null)
|
||||
{
|
||||
if ((pc.IsCrewmate() && target.IsCrewmate() && !Options.CrewCanGuessCrew.GetBool()) ||
|
||||
(pc.IsImpostor() && target.IsImpostor() && !Options.ImpCanGuessImp.GetBool()))
|
||||
{
|
||||
ShowMessage("GuessTeamMate");
|
||||
return true;
|
||||
}
|
||||
|
||||
Main.GuesserGuessed.TryAdd(pc.PlayerId, 0);
|
||||
Main.GuesserGuessedMeeting.TryAdd(pc.PlayerId, 0);
|
||||
|
||||
+3
-9
@@ -102,7 +102,6 @@ public enum CustomRPC
|
||||
SetWeaponMasterMode,
|
||||
SyncGlitchTimers,
|
||||
SyncSpy,
|
||||
SetMechanicLimit,
|
||||
SetHackerLimit,
|
||||
SetCurrentDrawTarget,
|
||||
SetCpTasksDone,
|
||||
@@ -136,7 +135,8 @@ public enum CustomRPC
|
||||
SyncRomanticTarget,
|
||||
SyncVengefulRomanticTarget,
|
||||
SetRevealedPlayer,
|
||||
SetCurrentRevealTarget = 209,
|
||||
SetCurrentRevealTarget,
|
||||
SetDoomsayerProgress = 209,
|
||||
|
||||
/*
|
||||
* SUBMERGED RPCs
|
||||
@@ -147,8 +147,7 @@ public enum CustomRPC
|
||||
* 214 - OxygenDeath
|
||||
*/
|
||||
|
||||
SetDoomsayerProgress = 215,
|
||||
SetTrackerTarget,
|
||||
SetTrackerTarget = 215,
|
||||
RpcPassBomb,
|
||||
SetAlchemistTimer,
|
||||
SyncPostman,
|
||||
@@ -863,11 +862,6 @@ internal static class RPCHandlerPatch
|
||||
Druid.ReceiveRPCAddTrigger(reader);
|
||||
break;
|
||||
}
|
||||
case CustomRPC.SetMechanicLimit:
|
||||
{
|
||||
Mechanic.ReceiveRPC(reader);
|
||||
break;
|
||||
}
|
||||
case CustomRPC.SetHackerLimit:
|
||||
{
|
||||
Hacker.ReceiveRPC(reader);
|
||||
|
||||
+2
-2
@@ -388,7 +388,7 @@ public static class Utils
|
||||
|
||||
if (!seer.IsAlive() || killer == seer || target == seer) return false;
|
||||
|
||||
return seer.Is(CustomRoles.EvilTracker) && EvilTracker.KillFlashCheck(killer, target);
|
||||
return false;
|
||||
}
|
||||
|
||||
public static void BlackOut(this IGameOptions opt, bool blackOut)
|
||||
@@ -1150,7 +1150,7 @@ public static class Utils
|
||||
try
|
||||
{
|
||||
float limit = playerId.GetAbilityUseLimit();
|
||||
if (float.IsNaN(limit) /* || limit is > 100 or < 0*/) return string.Empty;
|
||||
if (float.IsNaN(limit) || limit >= 10) return string.Empty;
|
||||
|
||||
Color textColor;
|
||||
|
||||
|
||||
@@ -593,7 +593,7 @@ internal static class GameEndChecker
|
||||
|
||||
foreach (PlayerState playerState in statesCoutingAsCrew)
|
||||
{
|
||||
if (playerState.Player == null || !playerState.Player.IsAlive() || !Options.CrewAdvancedGameEndCheckingSettings[playerState.MainRole].GetBool()) continue;
|
||||
if (playerState.Player == null || !playerState.Player.IsAlive() || !Options.CrewAdvancedGameEndCheckingSettings.TryGetValue(playerState.MainRole, out var option) || !option.GetBool()) continue;
|
||||
playerState.Role.ManipulateGameEndCheckCrew(out bool keepGameGoing, out int countsAs);
|
||||
crewKeepsGameGoing |= keepGameGoing;
|
||||
crew += countsAs - 1;
|
||||
|
||||
@@ -1061,11 +1061,7 @@ internal static class IntroCutsceneDestroyPatch
|
||||
|
||||
if (Options.CurrentGameMode == CustomGameMode.Standard)
|
||||
{
|
||||
int kcd = Options.StartingKillCooldown.GetInt();
|
||||
|
||||
if (kcd is not 10 and > 0)
|
||||
LateTask.New(() => aapc.Do(x => x.SetKillCooldown(kcd - 2)), 2f, "FixKillCooldownTask");
|
||||
else if (Options.FixFirstKillCooldown.GetBool())
|
||||
if (Options.FixFirstKillCooldown.GetBool())
|
||||
{
|
||||
LateTask.New(() =>
|
||||
{
|
||||
@@ -1073,11 +1069,16 @@ internal static class IntroCutsceneDestroyPatch
|
||||
{
|
||||
x.ResetKillCooldown(false);
|
||||
|
||||
if (Main.AllPlayerKillCooldown.TryGetValue(x.PlayerId, out float kc) && kc - 2f > 0f)
|
||||
x.SetKillCooldown(kc - 2f);
|
||||
if (Main.AllPlayerKillCooldown.TryGetValue(x.PlayerId, out float kcd) && kcd - 2f > 0f)
|
||||
x.SetKillCooldown(kcd - 2f);
|
||||
});
|
||||
}, 2f, "FixKillCooldownTask");
|
||||
}
|
||||
else
|
||||
{
|
||||
int kcd = Options.StartingKillCooldown.GetInt();
|
||||
LateTask.New(() => aapc.Do(x => x.SetKillCooldown(kcd - 2)), 2f, "FixKillCooldownTask");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -252,6 +252,7 @@ internal static class ChangeRoleSettings
|
||||
Express.SpeedUp = [];
|
||||
Messenger.Sent = [];
|
||||
Lazy.BeforeMeetingPositions = [];
|
||||
Introvert.TeleportAwayDelays = [];
|
||||
|
||||
ReportDeadBodyPatch.CanReport = [];
|
||||
SabotageMapPatch.TimerTexts = [];
|
||||
@@ -735,7 +736,9 @@ internal static class StartGameHostPatch
|
||||
if (!physicistBanned) physicistList.Add(player.PlayerId);
|
||||
if (!finderBanned) finderList.Add(player.PlayerId);
|
||||
if (!noisyBanned) noisyList.Add(player.PlayerId);
|
||||
if (!examinerBanned) examinerList.Add(player.PlayerId);
|
||||
|
||||
if (!examinerBanned && !kp.Value.UsesMeetingShapeshift())
|
||||
examinerList.Add(player.PlayerId);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -748,10 +751,10 @@ internal static class StartGameHostPatch
|
||||
{
|
||||
{ CustomRoles.Bloodlust, (bloodlustSpawn, bloodlustList) },
|
||||
{ CustomRoles.Nimble, (nimbleSpawn, nimbleList) },
|
||||
{ CustomRoles.Physicist, (physicistSpawn, physicistList) },
|
||||
{ CustomRoles.Finder, (finderSpawn, finderList) },
|
||||
{ CustomRoles.Noisy, (noisySpawn, noisyList) },
|
||||
{ CustomRoles.Examiner, (examinerSpawn, examinerList) },
|
||||
{ CustomRoles.Finder, (finderSpawn, finderList) },
|
||||
{ CustomRoles.Physicist, (physicistSpawn, physicistList) },
|
||||
{ CustomRoles.Noisy, (noisySpawn, noisyList) },
|
||||
{ CustomRoles.Venom, (venomSpawn, venomList) }
|
||||
};
|
||||
|
||||
|
||||
@@ -746,6 +746,8 @@ internal static class MurderPlayerPatch
|
||||
Main.PlayerStates[killer.PlayerId].Role.OnMurder(killer, target);
|
||||
|
||||
Chef.SpitOutFood(killer);
|
||||
|
||||
EvilTracker.OnAnyoneMurder(killer, target);
|
||||
|
||||
if (Options.CurrentGameMode == CustomGameMode.Speedrun)
|
||||
Speedrun.ResetTimer(killer);
|
||||
@@ -2076,21 +2078,13 @@ internal static class FixedUpdatePatch
|
||||
{
|
||||
if (Main.HasJustStarted || !player.IsAlive()) return;
|
||||
|
||||
if (Main.PlayerStates[player.PlayerId].Role is Mechanic sm)
|
||||
{
|
||||
sm.UsedSkillCount -= Mechanic.AbilityChargesWhenFinishedTasks.GetFloat();
|
||||
sm.SendRPC();
|
||||
}
|
||||
else
|
||||
{
|
||||
float add = GetSettingNameAndValueForRole(player.GetCustomRole(), "AbilityChargesWhenFinishedTasks");
|
||||
float add = GetSettingNameAndValueForRole(player.GetCustomRole(), "AbilityChargesWhenFinishedTasks");
|
||||
|
||||
if (Math.Abs(add - float.MaxValue) > 0.5f && add > 0)
|
||||
{
|
||||
if (player.Is(CustomRoles.Bloodlust)) add *= 5;
|
||||
if (Math.Abs(add - float.MaxValue) > 0.5f && add > 0)
|
||||
{
|
||||
if (player.Is(CustomRoles.Bloodlust)) add *= 5;
|
||||
|
||||
player.RpcIncreaseAbilityUseLimitBy(add);
|
||||
}
|
||||
player.RpcIncreaseAbilityUseLimitBy(add);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -9860,7 +9860,7 @@
|
||||
"WinnerRoleText.Magician": "Magician Wins!",
|
||||
"WinnerRoleText.Reckless": "Reckless Wins!",
|
||||
"WinnerRoleText.WeaponMaster": "Weapon Master Wins!",
|
||||
"WinnerRoleText.PlagueDoctor": "Curse Wins!",
|
||||
"WinnerRoleText.PlagueDoctor": "Infection Wins!",
|
||||
"WinnerRoleText.Enderman": "Enderman Wins!",
|
||||
"WinnerRoleText.Mycologist": "Mycologist Wins!",
|
||||
"WinnerRoleText.Bubble": "Bubble Wins!",
|
||||
|
||||
@@ -10,7 +10,7 @@ public class Introvert : IAddon
|
||||
private static OptionItem Radius;
|
||||
private static OptionItem Time;
|
||||
|
||||
private static readonly Dictionary<byte, long> TeleportAwayDelays = [];
|
||||
public static Dictionary<byte, long> TeleportAwayDelays = [];
|
||||
public AddonTypes Type => AddonTypes.Mixed;
|
||||
|
||||
public void SetupCustomOption()
|
||||
@@ -28,7 +28,11 @@ public class Introvert : IAddon
|
||||
|
||||
public static void OnFixedUpdate(PlayerControl pc)
|
||||
{
|
||||
if (Main.HasJustStarted || ExileController.Instance) return;
|
||||
if (Main.HasJustStarted || !Main.IntroDestroyed || AntiBlackout.SkipTasks || ExileController.Instance)
|
||||
{
|
||||
TeleportAwayDelays = [];
|
||||
return;
|
||||
}
|
||||
|
||||
Vector2 pos = pc.Pos();
|
||||
float radius = Radius.GetFloat();
|
||||
@@ -95,7 +99,6 @@ public class Introvert : IAddon
|
||||
public static string GetSelfSuffix(PlayerControl seer)
|
||||
{
|
||||
if (!seer.IsAlive() || !TeleportAwayDelays.TryGetValue(seer.PlayerId, out long endTS)) return string.Empty;
|
||||
|
||||
return string.Format(Translator.GetString("Introvert.Suffix"), endTS - Utils.TimeStamp);
|
||||
}
|
||||
}
|
||||
+24
-62
@@ -19,7 +19,7 @@ public class Mechanic : RoleBase
|
||||
private static OptionItem FixesOxygens;
|
||||
private static OptionItem FixesComms;
|
||||
private static OptionItem FixesElectrical;
|
||||
public static OptionItem MechanicAbilityUseGainWithEachTaskCompleted;
|
||||
public static OptionItem AbilityUseGainWithEachTaskCompleted;
|
||||
public static OptionItem AbilityChargesWhenFinishedTasks;
|
||||
private static OptionItem UsesUsedWhenFixingReactorOrO2;
|
||||
private static OptionItem UsesUsedWhenFixingLightsOrComms;
|
||||
@@ -32,9 +32,6 @@ public class Mechanic : RoleBase
|
||||
private static bool DoorsProgressing;
|
||||
private bool fixedSabotage;
|
||||
private int PetLimit;
|
||||
private byte MechanicId;
|
||||
|
||||
public float UsedSkillCount;
|
||||
|
||||
public override bool IsEnable => PlayerIdList.Count > 0;
|
||||
|
||||
@@ -61,7 +58,7 @@ public class Mechanic : RoleBase
|
||||
FixesElectrical = new BooleanOptionItem(Id + 15, "MechanicFixesElectrical", true, TabGroup.CrewmateRoles)
|
||||
.SetParent(Options.CustomRoleSpawnChances[CustomRoles.Mechanic]);
|
||||
|
||||
MechanicAbilityUseGainWithEachTaskCompleted = new FloatOptionItem(Id + 16, "AbilityUseGainWithEachTaskCompleted", new(0f, 5f, 0.05f), 3f, TabGroup.CrewmateRoles)
|
||||
AbilityUseGainWithEachTaskCompleted = new FloatOptionItem(Id + 16, "AbilityUseGainWithEachTaskCompleted", new(0f, 5f, 0.05f), 3f, TabGroup.CrewmateRoles)
|
||||
.SetParent(Options.CustomRoleSpawnChances[CustomRoles.Mechanic])
|
||||
.SetValueFormat(OptionFormat.Times);
|
||||
|
||||
@@ -98,16 +95,13 @@ public class Mechanic : RoleBase
|
||||
public override void Init()
|
||||
{
|
||||
PlayerIdList = [];
|
||||
UsedSkillCount = 0;
|
||||
MechanicId = byte.MaxValue;
|
||||
}
|
||||
|
||||
public override void Add(byte playerId)
|
||||
{
|
||||
PlayerIdList.Add(playerId);
|
||||
PetLimit = MaxFixedViaPet.GetInt();
|
||||
UsedSkillCount = 0;
|
||||
MechanicId = playerId;
|
||||
playerId.SetAbilityUseLimit(SkillLimit.GetFloat());
|
||||
}
|
||||
|
||||
public override void Remove(byte playerId)
|
||||
@@ -122,13 +116,6 @@ public class Mechanic : RoleBase
|
||||
AURoleOptions.EngineerInVentMaxTime = MaxInVentTime.GetFloat();
|
||||
}
|
||||
|
||||
public override string GetProgressText(byte playerId, bool comms)
|
||||
{
|
||||
double limit = Math.Round(SkillLimit.GetInt() - UsedSkillCount, 1);
|
||||
string colored = Utils.ColorString(Utils.GetRoleColor(CustomRoles.Mechanic).ShadeColor(0.25f), limit.ToString(CultureInfo.CurrentCulture));
|
||||
return $"({colored}){base.GetProgressText(playerId, comms)}";
|
||||
}
|
||||
|
||||
public override void OnPet(PlayerControl pc)
|
||||
{
|
||||
SystemTypes[] systemTypes = [SystemTypes.Electrical, SystemTypes.Reactor, SystemTypes.Laboratory, SystemTypes.LifeSupp, SystemTypes.HeliSabotage, SystemTypes.Comms];
|
||||
@@ -156,51 +143,31 @@ public class Mechanic : RoleBase
|
||||
}
|
||||
}
|
||||
|
||||
public void SendRPC()
|
||||
{
|
||||
if (!IsEnable || !Utils.DoRPC) return;
|
||||
|
||||
MessageWriter writer = AmongUsClient.Instance.StartRpcImmediately(PlayerControl.LocalPlayer.NetId, (byte)CustomRPC.SetMechanicLimit, SendOption.Reliable);
|
||||
writer.Write(MechanicId);
|
||||
writer.Write(UsedSkillCount);
|
||||
AmongUsClient.Instance.FinishRpcImmediately(writer);
|
||||
}
|
||||
|
||||
public static void ReceiveRPC(MessageReader reader)
|
||||
{
|
||||
byte id = reader.ReadByte();
|
||||
if (Main.PlayerStates[id].Role is not Mechanic m) return;
|
||||
|
||||
m.UsedSkillCount = reader.ReadSingle();
|
||||
}
|
||||
|
||||
public static void RepairSystem(byte playerId, SystemTypes systemType, byte amount)
|
||||
{
|
||||
if (Main.PlayerStates[playerId].Role is not Mechanic m) return;
|
||||
|
||||
float limit = playerId.GetAbilityUseLimit();
|
||||
float usesForReactorO2 = UsesUsedWhenFixingReactorOrO2.GetFloat();
|
||||
|
||||
switch (systemType)
|
||||
{
|
||||
case SystemTypes.Reactor:
|
||||
case SystemTypes.Laboratory:
|
||||
{
|
||||
if (!FixesReactors.GetBool()) break;
|
||||
|
||||
if (SkillLimit.GetFloat() > 0 && m.UsedSkillCount + UsesUsedWhenFixingReactorOrO2.GetFloat() - 1 >= SkillLimit.GetFloat()) break;
|
||||
if (!FixesReactors.GetBool() || limit - usesForReactorO2 < 0) break;
|
||||
|
||||
if (amount.HasAnyBit(ReactorSystemType.AddUserOp))
|
||||
{
|
||||
ShipStatus.Instance.UpdateSystem(Main.CurrentMap == MapNames.Polus ? SystemTypes.Laboratory : SystemTypes.Reactor, playerId.GetPlayer(), ReactorSystemType.ClearCountdown);
|
||||
m.UsedSkillCount += UsesUsedWhenFixingReactorOrO2.GetFloat();
|
||||
m.SendRPC();
|
||||
playerId.SetAbilityUseLimit(limit - usesForReactorO2);
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
case SystemTypes.HeliSabotage:
|
||||
{
|
||||
if (!FixesReactors.GetBool()) break;
|
||||
|
||||
if (SkillLimit.GetFloat() > 0 && m.UsedSkillCount + UsesUsedWhenFixingReactorOrO2.GetFloat() - 1 >= SkillLimit.GetFloat()) break;
|
||||
if (!FixesReactors.GetBool() || limit - usesForReactorO2 < 0) break;
|
||||
|
||||
var tags = (HeliSabotageSystem.Tags)(amount & HeliSabotageSystem.TagMask);
|
||||
if (tags == HeliSabotageSystem.Tags.ActiveBit) m.fixedSabotage = false;
|
||||
@@ -211,32 +178,27 @@ public class Mechanic : RoleBase
|
||||
int consoleId = amount & HeliSabotageSystem.IdMask;
|
||||
int otherConsoleId = (consoleId + 1) % 2;
|
||||
ShipStatus.Instance.UpdateSystem(SystemTypes.HeliSabotage, playerId.GetPlayer(), (byte)(otherConsoleId | (int)HeliSabotageSystem.Tags.FixBit));
|
||||
m.UsedSkillCount += UsesUsedWhenFixingReactorOrO2.GetFloat();
|
||||
m.SendRPC();
|
||||
playerId.SetAbilityUseLimit(limit - usesForReactorO2);
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
case SystemTypes.LifeSupp:
|
||||
{
|
||||
if (!FixesOxygens.GetBool()) break;
|
||||
|
||||
if (SkillLimit.GetFloat() > 0 && m.UsedSkillCount + UsesUsedWhenFixingReactorOrO2.GetFloat() - 1 >= SkillLimit.GetFloat()) break;
|
||||
if (!FixesOxygens.GetBool() || limit - usesForReactorO2 < 0) break;
|
||||
|
||||
if (amount.HasAnyBit(LifeSuppSystemType.AddUserOp))
|
||||
{
|
||||
ShipStatus.Instance.UpdateSystem(SystemTypes.LifeSupp, playerId.GetPlayer(), LifeSuppSystemType.ClearCountdown);
|
||||
m.UsedSkillCount += UsesUsedWhenFixingReactorOrO2.GetFloat();
|
||||
m.SendRPC();
|
||||
playerId.SetAbilityUseLimit(limit - usesForReactorO2);
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
case SystemTypes.Comms when Main.CurrentMap == MapNames.MiraHQ:
|
||||
{
|
||||
if (!FixesComms.GetBool()) break;
|
||||
|
||||
if (SkillLimit.GetFloat() > 0 && m.UsedSkillCount + UsesUsedWhenFixingLightsOrComms.GetFloat() - 1 >= SkillLimit.GetFloat()) break;
|
||||
float usesForComms = UsesUsedWhenFixingLightsOrComms.GetFloat();
|
||||
if (!FixesComms.GetBool() || limit - usesForComms < 0) break;
|
||||
|
||||
var tags = (HqHudSystemType.Tags)(amount & HqHudSystemType.TagMask);
|
||||
if (tags == HqHudSystemType.Tags.ActiveBit) m.fixedSabotage = false;
|
||||
@@ -247,20 +209,19 @@ public class Mechanic : RoleBase
|
||||
int consoleId = amount & HqHudSystemType.IdMask;
|
||||
int otherConsoleId = (consoleId + 1) % 2;
|
||||
ShipStatus.Instance.UpdateSystem(SystemTypes.Comms, playerId.GetPlayer(), (byte)(otherConsoleId | (int)HqHudSystemType.Tags.FixBit));
|
||||
m.UsedSkillCount += UsesUsedWhenFixingLightsOrComms.GetFloat();
|
||||
m.SendRPC();
|
||||
playerId.SetAbilityUseLimit(limit - usesForComms);
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
case SystemTypes.Doors:
|
||||
{
|
||||
if (!FixesDoors.GetBool()) break;
|
||||
|
||||
if (DoorsProgressing) break;
|
||||
if (!FixesDoors.GetBool() || DoorsProgressing) break;
|
||||
|
||||
int mapId = Main.NormalOptions.MapId;
|
||||
if (AmongUsClient.Instance.NetworkMode == NetworkModes.FreePlay) mapId = AmongUsClient.Instance.TutorialMapId;
|
||||
|
||||
if (AmongUsClient.Instance.NetworkMode == NetworkModes.FreePlay)
|
||||
mapId = AmongUsClient.Instance.TutorialMapId;
|
||||
|
||||
var shipStatus = ShipStatus.Instance;
|
||||
|
||||
@@ -316,17 +277,18 @@ public class Mechanic : RoleBase
|
||||
|
||||
public static void SwitchSystemRepair(byte playerId, SwitchSystem switchSystem, byte amount)
|
||||
{
|
||||
if (!FixesElectrical.GetBool() || Main.PlayerStates[playerId].Role is not Mechanic m) return;
|
||||
if (!FixesElectrical.GetBool() || Main.PlayerStates[playerId].Role is not Mechanic) return;
|
||||
|
||||
if (SkillLimit.GetFloat() > 0 && m.UsedSkillCount + UsesUsedWhenFixingLightsOrComms.GetFloat() - 1 >= SkillLimit.GetFloat()) return;
|
||||
float usesForLightsOrComms = UsesUsedWhenFixingLightsOrComms.GetFloat();
|
||||
float limit = playerId.GetAbilityUseLimit();
|
||||
if (limit - usesForLightsOrComms < 0) return;
|
||||
|
||||
if (amount.HasBit(SwitchSystem.DamageSystem)) return;
|
||||
|
||||
int fixbit = 1 << amount;
|
||||
switchSystem.ActualSwitches = (byte)(switchSystem.ExpectedSwitches ^ fixbit);
|
||||
|
||||
m.UsedSkillCount += UsesUsedWhenFixingLightsOrComms.GetFloat();
|
||||
m.SendRPC();
|
||||
playerId.SetAbilityUseLimit(limit - usesForLightsOrComms);
|
||||
}
|
||||
|
||||
public override bool CanUseVent(PlayerControl pc, int ventId)
|
||||
|
||||
@@ -160,6 +160,11 @@ public class Medic : RoleBase
|
||||
opt.SetVision(false);
|
||||
}
|
||||
|
||||
public override string GetProgressText(byte playerId, bool comms)
|
||||
{
|
||||
return playerId.GetAbilityUseLimit() > 0 ? base.GetProgressText(playerId, comms) : Utils.GetTaskCount(playerId, comms);
|
||||
}
|
||||
|
||||
public override bool OnCheckMurder(PlayerControl killer, PlayerControl target)
|
||||
{
|
||||
if (killer == null || target == null) return false;
|
||||
@@ -310,8 +315,6 @@ public class Medic : RoleBase
|
||||
|
||||
if (!ShieldDeactivatesWhenMedicDies.GetBool()) return;
|
||||
|
||||
Utils.NotifyRoles(SpecifySeer: target);
|
||||
|
||||
ProtectList.Clear();
|
||||
SendRPCForProtectList();
|
||||
Logger.Info($"{target.GetNameWithRole().RemoveHtmlTags()} : Medic is dead", "Medic");
|
||||
|
||||
@@ -187,9 +187,6 @@ public class President : RoleBase
|
||||
|
||||
switch (Main.PlayerStates[player.PlayerId].Role)
|
||||
{
|
||||
case Mechanic sm:
|
||||
sm.UsedSkillCount--;
|
||||
break;
|
||||
case Hacker when Hacker.UseLimit.ContainsKey(player.PlayerId):
|
||||
Hacker.UseLimit[player.PlayerId]++;
|
||||
break;
|
||||
|
||||
@@ -3,6 +3,7 @@ using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using AmongUs.GameOptions;
|
||||
using EHR.Modules;
|
||||
using Hazel;
|
||||
using UnityEngine;
|
||||
using static EHR.Options;
|
||||
@@ -91,6 +92,9 @@ internal class TimeMaster : RoleBase
|
||||
pc.RpcRemoveAbilityUse();
|
||||
|
||||
Main.Instance.StartCoroutine(Rewind());
|
||||
|
||||
if (pc.IsLocalPlayer())
|
||||
Achievements.Type.APerfectTimeToRewindIt.Complete();
|
||||
}
|
||||
|
||||
public override void OnEnterVent(PlayerControl pc, Vent vent)
|
||||
@@ -100,6 +104,9 @@ internal class TimeMaster : RoleBase
|
||||
pc.RpcRemoveAbilityUse();
|
||||
|
||||
Main.Instance.StartCoroutine(Rewind());
|
||||
|
||||
if (pc.IsLocalPlayer())
|
||||
Achievements.Type.APerfectTimeToRewindIt.Complete();
|
||||
}
|
||||
|
||||
private static IEnumerator Rewind()
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using AmongUs.GameOptions;
|
||||
using UnityEngine;
|
||||
using static EHR.Options;
|
||||
@@ -74,6 +75,7 @@ public class Tracefinder : RoleBase
|
||||
{
|
||||
if (!On || !GameStates.IsInTask || target == null || target.Data.Disconnected) return;
|
||||
|
||||
Vector2 pos = target.Pos();
|
||||
float delay;
|
||||
|
||||
if (ArrowDelayMax.GetFloat() < ArrowDelayMin.GetFloat())
|
||||
@@ -92,7 +94,7 @@ public class Tracefinder : RoleBase
|
||||
PlayerControl pc = Utils.GetPlayerById(id);
|
||||
if (pc == null || !pc.IsAlive()) continue;
|
||||
|
||||
LocateArrow.Add(id, target.Pos());
|
||||
LocateArrow.Add(id, pos);
|
||||
Utils.NotifyRoles(SpecifySeer: pc, SpecifyTarget: pc);
|
||||
}
|
||||
}
|
||||
@@ -101,7 +103,7 @@ public class Tracefinder : RoleBase
|
||||
|
||||
public override string GetSuffix(PlayerControl seer, PlayerControl target, bool hud = false, bool meeting = false)
|
||||
{
|
||||
if (seer.PlayerId != TracefinderId || (target != null && seer.PlayerId != target.PlayerId)) return string.Empty;
|
||||
if (seer.PlayerId != TracefinderId || (target != null && seer.PlayerId != target.PlayerId) || hud || meeting) return string.Empty;
|
||||
return Utils.ColorString(Color.white, LocateArrow.GetArrows(seer));
|
||||
}
|
||||
}
|
||||
@@ -42,8 +42,9 @@ internal class Transporter : RoleBase
|
||||
try
|
||||
{
|
||||
opt.SetVision(false);
|
||||
opt.SetFloat(FloatOptionNames.CrewLightMod, Main.DefaultCrewmateVision);
|
||||
opt.SetFloat(FloatOptionNames.ImpostorLightMod, Main.DefaultCrewmateVision);
|
||||
float crewVision = Main.RealOptionsData.GetFloat(FloatOptionNames.CrewLightMod);
|
||||
opt.SetFloat(FloatOptionNames.CrewLightMod, crewVision);
|
||||
opt.SetFloat(FloatOptionNames.ImpostorLightMod, crewVision);
|
||||
AURoleOptions.ShapeshifterCooldown = AbilityCooldown.GetFloat();
|
||||
AURoleOptions.ShapeshifterDuration = 1f;
|
||||
}
|
||||
|
||||
@@ -113,13 +113,10 @@ public class EvilTracker : RoleBase
|
||||
&& (target.Is(CustomRoleTypes.Impostor) || et.Target == target.PlayerId);
|
||||
}
|
||||
|
||||
public static bool KillFlashCheck(PlayerControl killer, PlayerControl target)
|
||||
public static void OnAnyoneMurder(PlayerControl killer, PlayerControl target)
|
||||
{
|
||||
if (!CanSeeKillFlash) return false;
|
||||
|
||||
PlayerControl realKiller = target.GetRealKiller() ?? killer;
|
||||
if (realKiller == null) return false;
|
||||
return realKiller.Is(CustomRoleTypes.Impostor) && realKiller != target;
|
||||
if (CanSeeKillFlash && killer != null && killer.Is(CustomRoleTypes.Impostor) && killer != target)
|
||||
PlayerIdList.ToValidPlayers().ForEach(x => x.KillFlash());
|
||||
}
|
||||
|
||||
public override bool OnShapeshift(PlayerControl shapeshifter, PlayerControl target, bool shapeshifting)
|
||||
|
||||
@@ -80,12 +80,6 @@ internal class Nullifier : RoleBase
|
||||
else
|
||||
Hacker.UseLimit[target.PlayerId]--;
|
||||
|
||||
break;
|
||||
case CustomRoles.Mechanic:
|
||||
if (Main.PlayerStates[target.PlayerId].Role is not Mechanic { IsEnable: true } m) return;
|
||||
|
||||
m.UsedSkillCount++;
|
||||
m.SendRPC();
|
||||
break;
|
||||
case CustomRoles.SwordsMan:
|
||||
SwordsMan.Killed.Add(target.PlayerId);
|
||||
|
||||
@@ -137,6 +137,11 @@ public class PlagueBearer : RoleBase
|
||||
{
|
||||
hud.KillButton?.OverrideText(GetString("InfectiousKillButtonText"));
|
||||
}
|
||||
|
||||
public override void ApplyGameOptions(IGameOptions opt, byte playerId)
|
||||
{
|
||||
opt.SetVision(false);
|
||||
}
|
||||
}
|
||||
|
||||
public class Pestilence : RoleBase
|
||||
|
||||
Reference in new issue
Block a user