From 19dbbb708f7ad9b4838bba0bca35d7487483d3e2 Mon Sep 17 00:00:00 2001 From: HyperAtill <150699834+HyperAtill@users.noreply.github.com> Date: Wed, 5 Jun 2024 16:35:12 +0300 Subject: [PATCH 1/2] Update DevManager.cs I'm still looking a ideal color --- Modules/DevManager.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Modules/DevManager.cs b/Modules/DevManager.cs index 9278140e4..651dd0b1f 100644 --- a/Modules/DevManager.cs +++ b/Modules/DevManager.cs @@ -83,7 +83,7 @@ public static class DevManager DevUserList.Add(new(code: "ponyholey#5532", color: "#0000FF", tag: "desenvolvedor", isUp: true, isDev: false, deBug: false, colorCmd: false, upName: "DrawingsZz")); DevUserList.Add(new(code: "akinlaptop#2206", color: "null", tag: "null", isUp: true, isDev: false, deBug: false, colorCmd: false, upName: "MR Carr")); DevUserList.Add(new(code: "fursilty#4676", color: "#0000ff", tag: "arthurzin", isUp: true, isDev: false, deBug: false, colorCmd: false, upName: "arthurzin")); - DevUserList.Add(new(code: "stonefuzzy#8673", color: "#00a6ff", tag: "Ru Translator", isUp: true, isDev: false, deBug: false, colorCmd: false, upName: "HyperAtill")); + DevUserList.Add(new(code: "stonefuzzy#8673", color: "#ff0062", tag: "Ru Translator", isUp: true, isDev: false, deBug: false, colorCmd: false, upName: "HyperAtill")); DevUserList.Add(new(code: "frizzytram#2508", color: "#1C87FF", tag: "RafaelBIT50", isUp: false, isDev: false, deBug: false, colorCmd: false, upName: "RafaelBIT50")); DevUserList.Add(new(code: "foggyzing#6238", color: "null", tag: "null", isUp: true, isDev: false, deBug: false, colorCmd: false, upName: "LdZinnn")); DevUserList.Add(new(code: "onsideblur#3929", color: "#fc3a51", tag: "YouTuber", isUp: true, isDev: false, deBug: false, colorCmd: false, upName: "Manelzin")); From 9d10c968844478efe0abc73a4f1507c697e5864d Mon Sep 17 00:00:00 2001 From: Gurge44 Date: Thu, 6 Jun 2024 09:38:15 +0200 Subject: [PATCH 2/2] Add your suggestions --- Modules/GuessManager.cs | 11 ++++--- Modules/OptionHolder.cs | 3 +- Modules/Utils.cs | 9 +++++ Patches/CheckGameEndPatch.cs | 2 +- Patches/IntroPatch.cs | 4 +-- Resources/Lang/en_US.json | 4 +++ Roles/AddOns/Common/Lovers.cs | 12 +++++++ Roles/Crewmate/Aid.cs | 60 ++++++++++++++++++++++++++-------- Roles/Impostor/Chronomancer.cs | 2 +- 9 files changed, 84 insertions(+), 23 deletions(-) diff --git a/Modules/GuessManager.cs b/Modules/GuessManager.cs index ee2f60736..2e625becb 100644 --- a/Modules/GuessManager.cs +++ b/Modules/GuessManager.cs @@ -197,6 +197,13 @@ public static class GuessManager bool forceAllowGuess = role is CustomRoles.LovingCrewmate or CustomRoles.LovingImpostor or CustomRoles.Lovers && Lovers.GuessAbility.GetValue() == 2; + if (role == CustomRoles.Lovers && Lovers.GuessAbility.GetValue() == 0) + { + if (!isUI) Utils.SendMessage(GetString("GuessLovers"), pc.PlayerId); + else pc.ShowPopUp(GetString("GuessLovers")); + return true; + } + switch (pc.GetCustomRole()) { case CustomRoles.NiceGuesser when Main.GuesserGuessed[pc.PlayerId] >= Options.GGCanGuessTime.GetInt(): @@ -279,10 +286,6 @@ public static class GuessManager if (!isUI) Utils.SendMessage(GetString("GuessVanillaCrewmate"), pc.PlayerId); else pc.ShowPopUp(GetString("GuessVanillaCrewmate")); return true; - case CustomRoles.LovingCrewmate or CustomRoles.LovingImpostor when Lovers.GuessAbility.GetValue() == 0: - if (!isUI) Utils.SendMessage(GetString("GuessLovers"), pc.PlayerId); - else pc.ShowPopUp(GetString("GuessLovers")); - return true; case CustomRoles.Workaholic when Workaholic.WorkaholicVisibleToEveryone.GetBool(): if (!isUI) Utils.SendMessage(GetString("GuessWorkaholic"), pc.PlayerId); else pc.ShowPopUp(GetString("GuessWorkaholic")); diff --git a/Modules/OptionHolder.cs b/Modules/OptionHolder.cs index b96e771dc..3165c85b9 100644 --- a/Modules/OptionHolder.cs +++ b/Modules/OptionHolder.cs @@ -1900,7 +1900,8 @@ public static class Options .SetParent(GuesserMode) .SetColor(Color.green); - GuesserDoesntDieOnMisguess = new BooleanOptionItem(19718, "GuesserDoesntDieOnMisguess", false, TabGroup.TaskSettings); + GuesserDoesntDieOnMisguess = new BooleanOptionItem(19718, "GuesserDoesntDieOnMisguess", false, TabGroup.TaskSettings) + .SetGameMode(CustomGameMode.Standard); LoadingPercentage = 92; MainLoadingText = "Building game settings"; diff --git a/Modules/Utils.cs b/Modules/Utils.cs index 63353fa9d..10b9c6620 100644 --- a/Modules/Utils.cs +++ b/Modules/Utils.cs @@ -423,6 +423,15 @@ public static class Utils var self = seerId == targetId || Main.PlayerStates[seerId].IsDead; bool isHnsAgentOverride = Options.CurrentGameMode == CustomGameMode.HideAndSeek && targetMainRole == CustomRoles.Agent && HnSManager.PlayerRoles[seerId].Interface.Team != Team.Impostor; + if (targetMainRole == CustomRoles.LovingImpostor) + { + targetMainRole = Lovers.LovingImpostorRoleForOtherImps.GetValue() switch + { + 0 => CustomRoles.ImpostorEHR, + 1 => Enum.GetValues().Where(x => x.IsEnable() && x.IsImpostor() && x != CustomRoles.LovingImpostor && !HnSManager.AllHnSRoles.Contains(x)).Shuffle()[0], + _ => CustomRoles.LovingImpostor + } + } string RoleText = GetRoleName(isHnsAgentOverride ? CustomRoles.Hider : targetMainRole); Color RoleColor = GetRoleColor(targetMainRole); diff --git a/Patches/CheckGameEndPatch.cs b/Patches/CheckGameEndPatch.cs index 03975c783..c034fabd1 100644 --- a/Patches/CheckGameEndPatch.cs +++ b/Patches/CheckGameEndPatch.cs @@ -377,7 +377,7 @@ class GameEndChecker if (CustomTeamManager.CheckCustomTeamGameEnd()) return true; - if (Main.AllAlivePlayerControls.All(p => p.Is(CustomRoles.Lovers))) + if (Main.AllAlivePlayerControls.All(p => p.Is(CustomRoles.Lovers)) && !Main.LoversPlayers.All(x => x.Is(CustomRoles.LovingCrewmate))) { ResetAndSetWinner(CustomWinner.Lovers); return true; diff --git a/Patches/IntroPatch.cs b/Patches/IntroPatch.cs index fe0b1dd8b..87e3bf074 100644 --- a/Patches/IntroPatch.cs +++ b/Patches/IntroPatch.cs @@ -247,12 +247,10 @@ class BeginCrewmatePatch } else if (role is CustomRoles.LovingCrewmate or CustomRoles.LovingImpostor) { - __instance.TeamTitle.text = GetString($"Team{role}"); - if (role == CustomRoles.LovingImpostor) __instance.TeamTitle.text = $"{__instance.TeamTitle.text}"; __instance.TeamTitle.color = __instance.BackgroundBar.material.color = Utils.GetRoleColor(role); PlayerControl.LocalPlayer.Data.Role.IntroSound = GetIntroSound(role.GetRoleTypes()); - __instance.ImpostorText.gameObject.SetActive(true); byte otherLoverId = Main.LoversPlayers.First(x => x.PlayerId != PlayerControl.LocalPlayer.PlayerId).PlayerId; + __instance.ImpostorText.gameObject.SetActive(true); __instance.ImpostorText.text = string.Format(GetString($"SubText.{role}"), Utils.ColorString(Main.PlayerColors.TryGetValue(otherLoverId, out var color) ? color : Color.white, Main.AllPlayerNames[otherLoverId])); } else diff --git a/Resources/Lang/en_US.json b/Resources/Lang/en_US.json index 7e974cde1..d2358ae90 100644 --- a/Resources/Lang/en_US.json +++ b/Resources/Lang/en_US.json @@ -1338,6 +1338,7 @@ "SniperPrecisionShooting": "Precise Shooting", "SniperAimAssist": "Aim Assist", "SniperAimAssistOneshot": "One shot Assist", + "RandomONImpRole": "Random Enabled Imp Role", "NameDisplayAddons": "Display Add-Ons next to the role name", "NoLimitAddonsNumMax": "Max Add-ons Per Player", "LoverSpawnChances": "Spawn Chance of Lovers", @@ -3427,6 +3428,9 @@ "AidInfoLong": "(Crewmates):\\nAs the Aid, you may use your kill button on someone to protect them from direct attacks temporarily. Neither you nor your target will know if someone tried to kill your target.", "AidDur": "Shield Duration", "AidCD": "Shield Cooldown", + "AidTargetKnowsAboutShield": "Targets Know They're Shielded", + "AidCounterSelf": "<#00ffa5>You're shielded for {0}s", + "AidCounterTarget": "{0} <#00ffa5>is shielded for {1}s", "GuessManagerRole": "Guess Manager", "GuessManagerRoleInfo": "Receive Additional Info About Guesses", "GuessManagerRoleInfoLong": "(Crewmates):\\nAs the Guess Manager, you know the roles of guessed players, and if someone misguesses, you'll see that.", diff --git a/Roles/AddOns/Common/Lovers.cs b/Roles/AddOns/Common/Lovers.cs index 306e13e4d..b2c806f8a 100644 --- a/Roles/AddOns/Common/Lovers.cs +++ b/Roles/AddOns/Common/Lovers.cs @@ -14,6 +14,7 @@ namespace EHR.Roles.AddOns.Common public static OptionItem NeutralCanBeInLove; public static OptionItem LegacyLovers; public static OptionItem LovingImpostorSpawnChance; + public static OptionItem LovingImpostorRoleForOtherImps; public static OptionItem PrivateChat; public static OptionItem GuessAbility; @@ -24,6 +25,13 @@ namespace EHR.Roles.AddOns.Common "RoleOn" // 2 ]; + private static readonly string[] LIRole = + [ + "Impostor", + "RandomONImpRole", + "LovingImpostor" + ] + public AddonTypes Type => AddonTypes.Mixed; public void SetupCustomOption() @@ -71,6 +79,10 @@ namespace EHR.Roles.AddOns.Common .SetParent(LegacyLovers) .SetValueFormat(OptionFormat.Percent) .SetGameMode(customGameMode); + + LovingImpostorRoleForOtherImps = new StringOptionItem(id + 12, "LIRoleForOtherImps", LIRole, 2, TabGroup.Addons) + .SetParent(LovingImpostorSpawnChance) + .SetGameMode(customGameMode); PrivateChat = new BooleanOptionItem(id + 10, "PrivateChat", false, TabGroup.Addons) .SetParent(spawnOption) diff --git a/Roles/Crewmate/Aid.cs b/Roles/Crewmate/Aid.cs index 84e276d7a..a43056978 100644 --- a/Roles/Crewmate/Aid.cs +++ b/Roles/Crewmate/Aid.cs @@ -6,11 +6,13 @@ namespace EHR.Roles.Crewmate public class Aid : RoleBase { private const int Id = 640200; - private static List playerIdList = []; public static Dictionary ShieldedPlayers = []; + public byte TargetId; + public static OptionItem AidDur; public static OptionItem AidCD; + public static OptionItem TargetKnowsShield; public static OptionItem UseLimitOpt; public static OptionItem UsePet; public override bool IsEnable => playerIdList.Count > 0; @@ -24,6 +26,8 @@ namespace EHR.Roles.Crewmate AidDur = new FloatOptionItem(Id + 11, "AidDur", new(0f, 60f, 1f), 10f, TabGroup.CrewmateRoles) .SetParent(Options.CustomRoleSpawnChances[CustomRoles.Aid]) .SetValueFormat(OptionFormat.Seconds); + TargetKnowsShield = new BooleanOptionItem(Id + 14, "AidTargetKnowsAboutShield", true, TabGroup.CrewmateRoles) + .SetParent(Options.CustomRoleSpawnChances[CustomRoles.Aid]) UseLimitOpt = new IntegerOptionItem(Id + 12, "AbilityUseLimit", new(1, 20, 1), 5, TabGroup.CrewmateRoles) .SetParent(Options.CustomRoleSpawnChances[CustomRoles.Aid]) .SetValueFormat(OptionFormat.Times); @@ -32,14 +36,13 @@ namespace EHR.Roles.Crewmate public override void Init() { - playerIdList = []; ShieldedPlayers = []; } public override void Add(byte playerId) { - playerIdList.Add(playerId); playerId.SetAbilityUseLimit(UseLimitOpt.GetInt()); + TargetId = byte.MaxValue; if (!AmongUsClient.Instance.AmHost || (Options.UsePets.GetBool() && UsePet.GetBool())) return; if (!Main.ResetCamPlayerList.Contains(playerId)) @@ -49,20 +52,15 @@ namespace EHR.Roles.Crewmate public override void SetKillCooldown(byte playerId) => Main.AllPlayerKillCooldown[playerId] = AidCD.GetInt(); public override void ApplyGameOptions(IGameOptions opt, byte playerId) => opt.SetVision(false); public override bool CanUseKillButton(PlayerControl pc) => pc.GetAbilityUseLimit() >= 1; + public override bool CanUseImpostorVentButton(PlayerControl pc) => pc.GetAbilityUseLimit() >= 1 && TargetId != byte.MaxValue; public override bool OnCheckMurder(PlayerControl killer, PlayerControl target) { if (killer == null) return false; if (target == null) return false; - if (killer.GetAbilityUseLimit() >= 1) - { - killer.RpcRemoveAbilityUse(); - ShieldedPlayers.TryAdd(target.PlayerId, Utils.TimeStamp); - Utils.NotifyRoles(SpecifySeer: killer, SpecifyTarget: target); - return false; - } - + TargetId = target.PlayerId; + Utils.NotifyRoles(SpecifySeer: killer, SpecifyTarget: target); return false; } @@ -72,9 +70,9 @@ namespace EHR.Roles.Crewmate bool change = false; - foreach (var x in ShieldedPlayers) + foreach (var x in ShieldedPlayers.ToArray()) { - if (x.Value + AidDur.GetInt() < Utils.TimeStamp || !GameStates.IsInTask) + if (x.Value + AidDur.GetInt() <= Utils.TimeStamp || !GameStates.IsInTask) { ShieldedPlayers.Remove(x.Key); change = true; @@ -86,5 +84,41 @@ namespace EHR.Roles.Crewmate Utils.NotifyRoles(SpecifySeer: pc); } } + + public override void OnCoEnterVent(PlayerPhysics physics, Vent vent) + { + var pc = physics.myPlayer; + if (pc.GetAbilityUseLimit() >= 1 && TargetId != byte.MaxValue) + { + pc.RpcRemoveAbilityUse(); + ShieldedPlayers[TargetId] = Utils.TimeStamp; + var target = Utils.GetPlayerById(TargetId); + Utils.NotifyRoles(SpecifySeer: pc, SpecifyTarget: target); + Utils.NotifyRoles(SpecifySeer: target, SpecifyTarget: target); + TargetId = byte.MaxValue; + } + + LateTask.New(() => physics.RpcBootFromVent(vent), 0.5f, log: false); + } + + public override GetSuffix(PlayerControl seer, PlayerControl target, bool hud = false, bool meeting = false) + { + if (seer.PlayerId != target.PlayerId || (seer.IsModClient() && !hud)) return string.Empty; + if (TargetKnowsShield.GetBool() && ShieldedPlayers.TryGetValue(seer.PlayerId, out var ts)) + { + var timeLeft = AidDur.GetInt() - (Utils.TimeStamp - ts); + return string.Format(Translator.GetString("AidCounterSelf"), timeLeft); + } + + if (seer.Is(CustomRoles.Aid)) + { + var duration = AidDur.GetInt(); + var now = Utils.TimeStamp; + var formatted = ShieldedPlayers.Select(x => string.Format(Translator.GetString("AidCounterTarget"), Utils.ColorString(Main.PlayerColors.GetValueOrDefault(x.Key, Color.white), Main.AllPlayerNames.GetValueOrDefault(x.Key, "Someone")), duration - (now - x.Value))); + return string.Join("\n", formatted); + } + + return string.Empty; + } } } \ No newline at end of file diff --git a/Roles/Impostor/Chronomancer.cs b/Roles/Impostor/Chronomancer.cs index 4ef33d595..8298d16f7 100644 --- a/Roles/Impostor/Chronomancer.cs +++ b/Roles/Impostor/Chronomancer.cs @@ -31,7 +31,7 @@ namespace EHR.Roles.Impostor .SetValueFormat(OptionFormat.Seconds); ChargeLossInterval = new IntegerOptionItem(Id + 13, "ChargeLossInterval", new(1, 50, 1), 25, TabGroup.ImpostorRoles) .SetParent(CustomRoleSpawnChances[CustomRoles.Chronomancer]) - .SetValueFormat(OptionFormat.Seconds); + .SetValueFormat(OptionFormat.Percent); } void SendRPC()