diff --git a/Modules/CustomRolesHelper.cs b/Modules/CustomRolesHelper.cs index bab7cce05..7f316dd8f 100644 --- a/Modules/CustomRolesHelper.cs +++ b/Modules/CustomRolesHelper.cs @@ -1971,7 +1971,6 @@ public enum CountTypes Glitch, Arsonist, Cherokious, - Sheriff, Coven } diff --git a/Modules/GameOptionsSender/PlayerGameOptionsSender.cs b/Modules/GameOptionsSender/PlayerGameOptionsSender.cs index 2fe0aebcd..000f08f98 100644 --- a/Modules/GameOptionsSender/PlayerGameOptionsSender.cs +++ b/Modules/GameOptionsSender/PlayerGameOptionsSender.cs @@ -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()); diff --git a/Modules/GameState.cs b/Modules/GameState.cs index e25e08cc4..ce9b04858 100644 --- a/Modules/GameState.cs +++ b/Modules/GameState.cs @@ -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; } diff --git a/Modules/GuessManager.cs b/Modules/GuessManager.cs index 1876bd1c7..968ba0baf 100644 --- a/Modules/GuessManager.cs +++ b/Modules/GuessManager.cs @@ -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); diff --git a/Modules/RPC.cs b/Modules/RPC.cs index 865ad75fd..7dc84054a 100644 --- a/Modules/RPC.cs +++ b/Modules/RPC.cs @@ -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); diff --git a/Modules/Utils.cs b/Modules/Utils.cs index 998730788..9b81a84fb 100644 --- a/Modules/Utils.cs +++ b/Modules/Utils.cs @@ -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; diff --git a/Patches/CheckGameEndPatch.cs b/Patches/CheckGameEndPatch.cs index c00e68177..1436ae1f1 100644 --- a/Patches/CheckGameEndPatch.cs +++ b/Patches/CheckGameEndPatch.cs @@ -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; diff --git a/Patches/IntroPatch.cs b/Patches/IntroPatch.cs index 194dd38ea..e06c8777e 100644 --- a/Patches/IntroPatch.cs +++ b/Patches/IntroPatch.cs @@ -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"); + } } } diff --git a/Patches/OnGameStartedPatch.cs b/Patches/OnGameStartedPatch.cs index aae3358ef..81ba42c8e 100644 --- a/Patches/OnGameStartedPatch.cs +++ b/Patches/OnGameStartedPatch.cs @@ -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) } }; diff --git a/Patches/PlayerControlPatch.cs b/Patches/PlayerControlPatch.cs index a9dbb81bf..1e8318fb3 100644 --- a/Patches/PlayerControlPatch.cs +++ b/Patches/PlayerControlPatch.cs @@ -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); } } diff --git a/Resources/Lang/en_US.json b/Resources/Lang/en_US.json index c97bd2518..d4bf9eb69 100644 --- a/Resources/Lang/en_US.json +++ b/Resources/Lang/en_US.json @@ -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!", diff --git a/Roles/AddOns/Common/Introvert.cs b/Roles/AddOns/Common/Introvert.cs index 9d3482336..52e4b67a3 100644 --- a/Roles/AddOns/Common/Introvert.cs +++ b/Roles/AddOns/Common/Introvert.cs @@ -10,7 +10,7 @@ public class Introvert : IAddon private static OptionItem Radius; private static OptionItem Time; - private static readonly Dictionary TeleportAwayDelays = []; + public static Dictionary 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); } } diff --git a/Roles/Crewmate/Mechanic.cs b/Roles/Crewmate/Mechanic.cs index 1babbdebf..3d87a4e50 100644 --- a/Roles/Crewmate/Mechanic.cs +++ b/Roles/Crewmate/Mechanic.cs @@ -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) diff --git a/Roles/Crewmate/Medic.cs b/Roles/Crewmate/Medic.cs index eb8036948..c36387f3d 100644 --- a/Roles/Crewmate/Medic.cs +++ b/Roles/Crewmate/Medic.cs @@ -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"); diff --git a/Roles/Crewmate/President.cs b/Roles/Crewmate/President.cs index 7f69c0e97..255200dc3 100644 --- a/Roles/Crewmate/President.cs +++ b/Roles/Crewmate/President.cs @@ -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; diff --git a/Roles/Crewmate/TimeMaster.cs b/Roles/Crewmate/TimeMaster.cs index a005d442a..e2df68052 100644 --- a/Roles/Crewmate/TimeMaster.cs +++ b/Roles/Crewmate/TimeMaster.cs @@ -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() diff --git a/Roles/Crewmate/Tracefinder.cs b/Roles/Crewmate/Tracefinder.cs index e6559ee43..959d4ee38 100644 --- a/Roles/Crewmate/Tracefinder.cs +++ b/Roles/Crewmate/Tracefinder.cs @@ -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)); } } \ No newline at end of file diff --git a/Roles/Crewmate/Transporter.cs b/Roles/Crewmate/Transporter.cs index d5122b55e..62fcbc4cf 100644 --- a/Roles/Crewmate/Transporter.cs +++ b/Roles/Crewmate/Transporter.cs @@ -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; } diff --git a/Roles/Impostor/EvilTracker.cs b/Roles/Impostor/EvilTracker.cs index 1948f64f6..bcab69944 100644 --- a/Roles/Impostor/EvilTracker.cs +++ b/Roles/Impostor/EvilTracker.cs @@ -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) diff --git a/Roles/Impostor/Nullifier.cs b/Roles/Impostor/Nullifier.cs index 8bd0edae7..67d6de0a3 100644 --- a/Roles/Impostor/Nullifier.cs +++ b/Roles/Impostor/Nullifier.cs @@ -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); diff --git a/Roles/Neutral/PlagueBearer.cs b/Roles/Neutral/PlagueBearer.cs index 7f4edf530..dcfc52e95 100644 --- a/Roles/Neutral/PlagueBearer.cs +++ b/Roles/Neutral/PlagueBearer.cs @@ -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