From: Eisbison Date: Wed, 7 Apr 2021 13:36:10 +0000 (+0200) Subject: Update source code X-Git-Url: https://git.deb.at/?a=commitdiff_plain;h=9b013b496b0f35542c7091d7933291893c37bd4d;p=rhonda%2Ftheotherroles.git Update source code --- diff --git a/Source Code/Buttons.cs b/Source Code/Buttons.cs index c442615..a435c39 100644 --- a/Source Code/Buttons.cs +++ b/Source Code/Buttons.cs @@ -243,11 +243,11 @@ namespace TheOtherRoles AmongUsClient.Instance.FinishRpcImmediately(writer); RPCProcedure.morphlingMorph(Morphling.sampledTarget.PlayerId); Morphling.sampledTarget = null; - morphlingButton.HasEffect = true; // Trigger effect on this click + morphlingButton.EffectDuration = 10f; } else if (Morphling.currentTarget != null) { Morphling.sampledTarget = Morphling.currentTarget; morphlingButton.Sprite = Morphling.getMorphSprite(); - morphlingButton.HasEffect = false; // Block effect on this click + morphlingButton.EffectDuration = 1f; } }, () => { return Morphling.morphling != null && Morphling.morphling == PlayerControl.LocalPlayer && !PlayerControl.LocalPlayer.IDOFAMCIJKE.FGNJJFABIHJ; }, @@ -265,8 +265,10 @@ namespace TheOtherRoles true, 10f, () => { - morphlingButton.Timer = morphlingButton.MaxTimer; - morphlingButton.Sprite = Morphling.getSampleSprite(); + if (Morphling.sampledTarget == null) { + morphlingButton.Timer = morphlingButton.MaxTimer; + morphlingButton.Sprite = Morphling.getSampleSprite(); + } } ); @@ -512,6 +514,8 @@ namespace TheOtherRoles __instance ); + // Set the default (or settings from the previous game) timers/durations when spawning the buttons + setCustomButtonCooldowns(); } } } \ No newline at end of file diff --git a/Source Code/CredentialsPatch.cs b/Source Code/CredentialsPatch.cs index 1cb48b2..3c24d59 100644 --- a/Source Code/CredentialsPatch.cs +++ b/Source Code/CredentialsPatch.cs @@ -15,7 +15,7 @@ namespace TheOtherRoles { static void Postfix(VersionShower __instance) { string spacer = new String('\n', 21); - string fullCredentials = "[FCCE03FF]TheOtherRoles[] v2.0.0 beta:\n- Modded by [FCCE03FF]Eisbison[] and [FFEB91FF]Thunderstorm584[]\n- Balanced with [FFEB91FF]Dhalucard[]\n- Button design by [FFEB91FF]Bavari[]"; + string fullCredentials = "[FCCE03FF]TheOtherRoles[] v2.0.1 beta:\n- Modded by [FCCE03FF]Eisbison[] and [FFEB91FF]Thunderstorm584[]\n- Balanced with [FFEB91FF]Dhalucard[]\n- Button design by [FFEB91FF]Bavari[]"; if (__instance.text.Text.Contains(spacer)) __instance.text.Text += "\n" + fullCredentials; else diff --git a/Source Code/EndGamePatch.cs b/Source Code/EndGamePatch.cs index 897e4aa..e51fa58 100644 --- a/Source Code/EndGamePatch.cs +++ b/Source Code/EndGamePatch.cs @@ -24,7 +24,8 @@ namespace TheOtherRoles { enum CustomGameOverReason { LoversWin = 10, TeamJackalWin = 11, - ChildLose = 12 + ChildLose = 12, + JesterWin = 13 } enum WinCondition { @@ -32,8 +33,6 @@ namespace TheOtherRoles { LoversTeamWin, LoversSoloWin, JesterWin, - BountyHunterWin, - JesterAndBountyHunterWin, JackalWin, ChildLose } @@ -89,10 +88,9 @@ namespace TheOtherRoles { } bool childLose = Child.child != null && gameOverReason == (GameOverReason)CustomGameOverReason.ChildLose; - bool jesterWin = Jester.jester != null && Jester.jester.IDOFAMCIJKE.CIDDOFDJHJH; - bool bountyHunterWin = BountyHunter.bountyHunter != null && BountyHunter.bountyHunter.IDOFAMCIJKE.CIDDOFDJHJH; + bool jesterWin = Jester.jester != null && gameOverReason == (GameOverReason)CustomGameOverReason.JesterWin; - // Child lose condition (should be implemented using a proper GameOverReason in the future) + // Child lose if (childLose) { TempData.BDGOKPKHCNB = new Il2CppSystem.Collections.Generic.List(); WinningPlayerData wpd = new WinningPlayerData(Child.child.IDOFAMCIJKE); @@ -101,27 +99,15 @@ namespace TheOtherRoles { AdditionalTempData.winCondition = WinCondition.ChildLose; } - // Jester and Bounty Hunter win condition (should be implemented using a proper GameOverReason in the future) - else if (jesterWin || bountyHunterWin) { + // Jester win + else if (jesterWin) { TempData.BDGOKPKHCNB = new Il2CppSystem.Collections.Generic.List(); - if (jesterWin) { - WinningPlayerData wpd = new WinningPlayerData(Jester.jester.IDOFAMCIJKE); - wpd.CIDDOFDJHJH = false; - TempData.BDGOKPKHCNB.Add(wpd); - AdditionalTempData.winCondition = WinCondition.JesterWin; - } - if (bountyHunterWin) { - WinningPlayerData wpd = new WinningPlayerData(BountyHunter.bountyHunter.IDOFAMCIJKE); - wpd.CIDDOFDJHJH = false; - TempData.BDGOKPKHCNB.Add(wpd); - if (AdditionalTempData.winCondition == WinCondition.JesterWin) - AdditionalTempData.winCondition = WinCondition.JesterAndBountyHunterWin; - else - AdditionalTempData.winCondition = WinCondition.BountyHunterWin; - } + WinningPlayerData wpd = new WinningPlayerData(Jester.jester.IDOFAMCIJKE); + TempData.BDGOKPKHCNB.Add(wpd); + AdditionalTempData.winCondition = WinCondition.JesterWin; } - // Lovers win conditions (should be implemented using a proper GameOverReason in the future) + // Lovers win conditions else if (Lovers.existingAndAlive() && gameOverReason == (GameOverReason)CustomGameOverReason.LoversWin) { AdditionalTempData.localIsLover = (PlayerControl.LocalPlayer == Lovers.lover1 || PlayerControl.LocalPlayer == Lovers.lover2); // Double win for lovers, crewmates also win @@ -184,14 +170,6 @@ namespace TheOtherRoles { textRenderer.Text = "Jester Wins"; textRenderer.Color = Jester.color; } - else if (AdditionalTempData.winCondition == WinCondition.BountyHunterWin) { - textRenderer.Text = "Bounty Hunter Wins"; - textRenderer.Color = BountyHunter.color; - } - else if (AdditionalTempData.winCondition == WinCondition.JesterAndBountyHunterWin) { - textRenderer.Text = "[AD653BFF]Bounty Hunter[FFFFFFFF] and [FF54A7FF]Jester[FFFFFFFF] Win"; - textRenderer.Color = Color.white; - } else if (AdditionalTempData.winCondition == WinCondition.LoversTeamWin) { if (AdditionalTempData.localIsLover) { __instance.WinText.Text = "Double Victory"; @@ -225,12 +203,13 @@ namespace TheOtherRoles { if (!GameData.Instance) return false; var statistics = new PlayerStatistics(__instance); if (CheckAndEndGameForChildLose(__instance)) return false; - if(CheckAndEndGameForSabotageWin(__instance)) return false; - if(CheckAndEndGameForTaskWin(__instance)) return false; - if(CheckAndEndGameForLoverWin(__instance, statistics)) return false; - if(CheckAndEndGameForJackalWin(__instance, statistics)) return false; - if(CheckAndEndGameForImpostorWin(__instance, statistics)) return false; - if(CheckAndEndGameForCrewmateWin(__instance, statistics)) return false; + if (CheckAndEndGameForJesterWin(__instance)) return false; + if (CheckAndEndGameForSabotageWin(__instance)) return false; + if (CheckAndEndGameForTaskWin(__instance)) return false; + if (CheckAndEndGameForLoverWin(__instance, statistics)) return false; + if (CheckAndEndGameForJackalWin(__instance, statistics)) return false; + if (CheckAndEndGameForImpostorWin(__instance, statistics)) return false; + if (CheckAndEndGameForCrewmateWin(__instance, statistics)) return false; return false; } @@ -248,6 +227,19 @@ namespace TheOtherRoles { return false; } + private static bool CheckAndEndGameForJesterWin(ShipStatus __instance) { + if (Jester.triggerJesterWin) { + if (!DestroyableSingleton.JECNDKBIOFO) + { + __instance.enabled = false; + ShipStatus.PBKIGLMJEDH((GameOverReason)CustomGameOverReason.JesterWin, false); + } + DestroyableSingleton.CMJOLNCMAPD.ShowPopUp(DestroyableSingleton.CMJOLNCMAPD.GetString(StringNames.GameOverImpostorDead, new Il2CppReferenceArray(0))); + ReviveEveryone(); + return true; + } + return false; + } private static bool CheckAndEndGameForSabotageWin(ShipStatus __instance) { if (__instance.Systems == null) return false; diff --git a/Source Code/IntroPatch.cs b/Source Code/IntroPatch.cs index 62581c5..26cb872 100644 --- a/Source Code/IntroPatch.cs +++ b/Source Code/IntroPatch.cs @@ -40,13 +40,6 @@ namespace TheOtherRoles __instance.__4__this.ImpostorText.gameObject.SetActive(true); __instance.__4__this.BackgroundBar.material.color = Lovers.color; } - else if (PlayerControl.LocalPlayer == BountyHunter.bountyHunter) - { - __instance.__4__this.Title.Text = "Bounty Hunter"; - __instance.__4__this.Title.Color = BountyHunter.color; - __instance.__4__this.ImpostorText.Text = "Hunt [ED653BFF]" + BountyHunter.target?.IDOFAMCIJKE?.HGGCLJHCDBM + "[FFFFFFFF] down"; - __instance.__4__this.BackgroundBar.material.color = BountyHunter.color; - } else if (roleInfo.name == "Crewmate" || roleInfo.name == "Impostor") {} else { __instance.__4__this.Title.Text = roleInfo.name; diff --git a/Source Code/Main.cs b/Source Code/Main.cs index b9109bd..ea3310a 100644 --- a/Source Code/Main.cs +++ b/Source Code/Main.cs @@ -15,7 +15,7 @@ using static TheOtherRoles.TheOtherRoles; namespace TheOtherRoles { - [BepInPlugin(Id, "The Other Roles", "2.0.0")] + [BepInPlugin(Id, "The Other Roles", "2.0.1")] [BepInProcess("Among Us.exe")] public class TheOtherRolesPlugin : BasePlugin { diff --git a/Source Code/MeetingPatch.cs b/Source Code/MeetingPatch.cs index 3d079bd..fad5f2e 100644 --- a/Source Code/MeetingPatch.cs +++ b/Source Code/MeetingPatch.cs @@ -361,24 +361,6 @@ namespace TheOtherRoles Child.child.SetKillTimer(PlayerControl.GameOptions.ELBDIKIOHHH * multiplier); } - if (ExileController.Instance.KLHCDCKJHKC != null) { - byte exiledId = ExileController.Instance.KLHCDCKJHKC.GMBAIPNOKLP; - - // Child lose condition - if (Child.child != null && Child.child.PlayerId == exiledId && !Child.isGrownUp() && !Child.child.IDOFAMCIJKE.CIDDOFDJHJH) { - MessageWriter writer = AmongUsClient.Instance.StartRpcImmediately(PlayerControl.LocalPlayer.NetId, (byte)CustomRPC.ChildLose, Hazel.SendOption.Reliable, -1); - AmongUsClient.Instance.FinishRpcImmediately(writer); - RPCProcedure.childLose(); - } - // Jester and Bounty Hunter win condition - else if ((Jester.jester != null && Jester.jester.PlayerId == exiledId) || (BountyHunter.bountyHunter != null && !BountyHunter.bountyHunter.IDOFAMCIJKE.FGNJJFABIHJ && BountyHunter.target != null && BountyHunter.target.PlayerId == exiledId)) { - MessageWriter writer = AmongUsClient.Instance.StartRpcImmediately(PlayerControl.LocalPlayer.NetId, (byte)CustomRPC.JesterBountyHunterWin, Hazel.SendOption.Reliable, -1); - writer.Write(exiledId); - AmongUsClient.Instance.FinishRpcImmediately(writer); - RPCProcedure.jesterBountyHunterWin(exiledId); - } - } - // Seer spawn souls if (Seer.deadBodyPositions != null && Seer.seer != null && PlayerControl.LocalPlayer == Seer.seer && (Seer.mode == 0 || Seer.mode == 2)) { foreach (Vector3 pos in Seer.deadBodyPositions) { @@ -443,8 +425,6 @@ namespace TheOtherRoles __result = ExileController.Instance.KLHCDCKJHKC.HGGCLJHCDBM + " was The Hacker."; else if(Child.child != null && ExileController.Instance.KLHCDCKJHKC.GPBBCHGPABL.PlayerId == Child.child.PlayerId) __result = ExileController.Instance.KLHCDCKJHKC.HGGCLJHCDBM + " was The Child."; - else if(BountyHunter.bountyHunter != null && ExileController.Instance.KLHCDCKJHKC.GPBBCHGPABL.PlayerId == BountyHunter.bountyHunter.PlayerId) - __result = ExileController.Instance.KLHCDCKJHKC.HGGCLJHCDBM + " was The Bounty Hunter."; else if(Tracker.tracker != null && ExileController.Instance.KLHCDCKJHKC.GPBBCHGPABL.PlayerId == Tracker.tracker.PlayerId) __result = ExileController.Instance.KLHCDCKJHKC.HGGCLJHCDBM + " was The Tracker."; else if(Snitch.snitch != null && ExileController.Instance.KLHCDCKJHKC.GPBBCHGPABL.PlayerId == Snitch.snitch.PlayerId) diff --git a/Source Code/PlayerControlPatch.cs b/Source Code/PlayerControlPatch.cs index c1cc418..4c20f0c 100644 --- a/Source Code/PlayerControlPatch.cs +++ b/Source Code/PlayerControlPatch.cs @@ -201,11 +201,32 @@ namespace TheOtherRoles { } } + public static void playerSizeUpdate(PlayerControl p) { + if (Child.child == null) return; + + float growingProgress = Child.growingProgress(); + float scale = growingProgress * 0.35f + 0.35f; + + if (p == Child.child) + Child.child.transform.localScale = new Vector3(scale, scale, 1f); + if (Morphling.morphling != null && p == Morphling.morphling && Morphling.morphTarget == Child.child && Morphling.morphTimer > 0f) + p.transform.localScale = new Vector3(scale, scale, 1f); + } + + public static void Prefix(PlayerControl __instance) { + if (AmongUsClient.Instance.GameState != InnerNet.InnerNetClient.CJDCOJJNIGL.Started) return; + + // Reset player sizes + __instance.transform.localScale = new Vector3(0.7f, 0.7f, 1f); + } + public static void Postfix(PlayerControl __instance) { if (AmongUsClient.Instance.GameState != InnerNet.InnerNetClient.CJDCOJJNIGL.Started) return; // Update Role Description Helpers.refreshRoleDescription(__instance); + // Child and Morphling shrink + playerSizeUpdate(__instance); if (PlayerControl.LocalPlayer == __instance) { // Time Master @@ -297,7 +318,7 @@ namespace TheOtherRoles { if (timeSinceDeath < Detective.reportNameDuration * 1000) { msg = $"Body Report: The killer appears to be {deadPlayer.killerIfExisting.name}!"; } else if (timeSinceDeath < Detective.reportColorDuration * 1000) { - var typeOfColor = Helpers.isLighterColor(deadPlayer.killerIfExisting.IDOFAMCIJKE.JFHFMIKFHGG) ? "darker" : "lighter"; + var typeOfColor = Helpers.isLighterColor(deadPlayer.killerIfExisting.IDOFAMCIJKE.JFHFMIKFHGG) ? "lighter" : "darker"; msg = $"Body Report: The killer appears to be a {typeOfColor} color!"; } else { msg = $"Body Report: The corpse is too old to gain information from!"; @@ -399,6 +420,17 @@ namespace TheOtherRoles { [HarmonyPatch(typeof(PlayerControl), nameof(PlayerControl.Exiled))] public static class ExilePlayerPatch { + public static void Prefix(PlayerControl __instance) { + // Child exile lose condition + if (Child.child != null && Child.child == __instance && !Child.isGrownUp() && !Child.child.IDOFAMCIJKE.CIDDOFDJHJH) { + Child.triggerChildLose = true; + } + // Jester win condition + else if (Jester.jester != null && Jester.jester == __instance) { + Jester.triggerJesterWin = true; + } + } + public static void Postfix(PlayerControl __instance) { // Collect dead player info diff --git a/Source Code/RPC.cs b/Source Code/RPC.cs index 7cd28cb..fb5bf85 100644 --- a/Source Code/RPC.cs +++ b/Source Code/RPC.cs @@ -39,7 +39,6 @@ namespace TheOtherRoles Camouflager, Hacker, Child, - BountyHunter, Tracker, Vampire, Snitch, @@ -59,8 +58,7 @@ namespace TheOtherRoles // Role functionality - JesterBountyHunterWin = 80, - EngineerFixLights, + EngineerFixLights = 81, EngineerUsedRepair, JanitorClean, SheriffKill, @@ -74,7 +72,6 @@ namespace TheOtherRoles CamouflagerCamouflage, TrackerUsedTracker, LoverSuicide, - SetBountyHunterTarget, VampireSetBitten, VampireTryKill, PlaceGarlic, @@ -82,7 +79,6 @@ namespace TheOtherRoles SidekickKill, JackalCreatesSidekick, SidekickPromotes, - ChildLose, ErasePlayerRole, SetFutureErased, SetFutureShifted @@ -181,9 +177,6 @@ namespace TheOtherRoles case RoleId.Child: Child.child = player; break; - case RoleId.BountyHunter: - BountyHunter.bountyHunter = player; - break; case RoleId.Tracker: Tracker.tracker = player; break; @@ -208,47 +201,6 @@ namespace TheOtherRoles // Role functionality - public static void jesterBountyHunterWin(byte exiledId) { - PlayerControl exiled = Helpers.playerById(exiledId); - if (exiled == null) return; - - bool jesterWin = false; - bool bountyHunterWin = false; - - if (Jester.jester != null && exiled == Jester.jester) { - Jester.jester.Revive(); - Jester.jester.IDOFAMCIJKE.FGNJJFABIHJ = false; - Jester.jester.IDOFAMCIJKE.CIDDOFDJHJH = true; - jesterWin = true; - } - if (BountyHunter.bountyHunter != null && !BountyHunter.bountyHunter.IDOFAMCIJKE.FGNJJFABIHJ && BountyHunter.target == exiled) { - BountyHunter.bountyHunter.IDOFAMCIJKE.CIDDOFDJHJH = true; - bountyHunterWin = true; - } - - foreach (PlayerControl player in PlayerControl.AllPlayerControls) - { - if (player != null && player != Jester.jester && player != BountyHunter.bountyHunter) - { - player.RemoveInfected(); - player.Die(DeathReason.Exile); - player.IDOFAMCIJKE.FGNJJFABIHJ = true; - player.IDOFAMCIJKE.CIDDOFDJHJH = false; - } - } - if (jesterWin && !bountyHunterWin && BountyHunter.bountyHunter != null) { - BountyHunter.bountyHunter.RemoveInfected(); - BountyHunter.bountyHunter.Die(DeathReason.Exile); - BountyHunter.bountyHunter.IDOFAMCIJKE.FGNJJFABIHJ = true; - BountyHunter.bountyHunter.IDOFAMCIJKE.CIDDOFDJHJH = false; - } else if (bountyHunterWin && !jesterWin && Jester.jester != null) { - Jester.jester.RemoveInfected(); - Jester.jester.Die(DeathReason.Exile); - Jester.jester.IDOFAMCIJKE.FGNJJFABIHJ = true; - Jester.jester.IDOFAMCIJKE.CIDDOFDJHJH = false; - } - } - public static void engineerFixLights() { SwitchSystem switchSystem = ShipStatus.Instance.Systems[SystemTypes.Electrical].Cast(); switchSystem.GNPBPJHLPAO = switchSystem.KNFBDAFFMGF; @@ -396,8 +348,6 @@ namespace TheOtherRoles Hacker.hacker = oldShifter; } else if (Child.child != null && Child.child == player) { Child.child = oldShifter; - } else if (BountyHunter.bountyHunter != null && BountyHunter.bountyHunter == player) { - BountyHunter.bountyHunter = oldShifter; } else if (Tracker.tracker != null && Tracker.tracker == player) { Tracker.tracker = oldShifter; } else if (Snitch.snitch != null && Snitch.snitch == player) { @@ -439,12 +389,6 @@ namespace TheOtherRoles } } - public static void setBountyHunterTarget(byte targetId) { - foreach (PlayerControl player in PlayerControl.AllPlayerControls) - if (player.PlayerId == targetId) - BountyHunter.target = player; - } - public static void vampireSetBitten(byte targetId, byte reset) { if (reset != 0) { Vampire.bitten = null; @@ -531,10 +475,6 @@ namespace TheOtherRoles Sidekick.clearAndReload(); return; } - - public static void childLose() { - Child.triggerChildLose = true; - } public static void erasePlayerRole(byte playerId) { PlayerControl player = Helpers.playerById(playerId); @@ -553,7 +493,6 @@ namespace TheOtherRoles if (player == Hacker.hacker) Hacker.clearAndReload(); if (player == Child.child) Child.clearAndReload(); if (player == Tracker.tracker) Tracker.clearAndReload(); - if (player == BountyHunter.bountyHunter) BountyHunter.clearAndReload(); if (player == Snitch.snitch) Snitch.clearAndReload(); if (player == Swapper.swapper) Swapper.clearAndReload(); @@ -623,9 +562,6 @@ namespace TheOtherRoles // Role functionality - case (byte)CustomRPC.JesterBountyHunterWin: - RPCProcedure.jesterBountyHunterWin(DOOILGKLBBF.ReadByte()); - break; case (byte)CustomRPC.EngineerFixLights: RPCProcedure.engineerFixLights(); break; @@ -667,9 +603,6 @@ namespace TheOtherRoles case (byte)CustomRPC.LoverSuicide: RPCProcedure.loverSuicide(DOOILGKLBBF.ReadByte()); break; - case (byte)CustomRPC.SetBountyHunterTarget: - RPCProcedure.setBountyHunterTarget(DOOILGKLBBF.ReadByte()); - break; case (byte)CustomRPC.VampireSetBitten: byte bittenId = DOOILGKLBBF.ReadByte(); byte reset = DOOILGKLBBF.ReadByte(); @@ -696,9 +629,6 @@ namespace TheOtherRoles case (byte)CustomRPC.SidekickPromotes: RPCProcedure.sidekickPromotes(); break; - case (byte)CustomRPC.ChildLose: - RPCProcedure.childLose(); - break; case (byte)CustomRPC.ErasePlayerRole: RPCProcedure.erasePlayerRole(DOOILGKLBBF.ReadByte()); break; diff --git a/Source Code/RoleAssignmentPatch.cs b/Source Code/RoleAssignmentPatch.cs index da0a3d2..04bb8b3 100644 --- a/Source Code/RoleAssignmentPatch.cs +++ b/Source Code/RoleAssignmentPatch.cs @@ -72,7 +72,6 @@ namespace TheOtherRoles crewSettings.Add((byte)RoleId.Tracker, CustomOptionHolder.trackerSpawnRate.getSelection()); crewSettings.Add((byte)RoleId.Snitch, CustomOptionHolder.snitchSpawnRate.getSelection()); crewSettings.Add((byte)RoleId.Jackal, CustomOptionHolder.jackalSpawnRate.getSelection()); - // crewSettings.Add((byte)RoleId.BountyHunter, CustomOptionHolder.bountyHunterSpawnRate.getSelection()); BOUNTY HUNTER // Set special roles if (impostors.Count >= 3 && maxImpostorRoles >= 3 && (rnd.Next(1, 101) <= CustomOptionHolder.mafiaSpawnRate.getSelection() * 10)) { @@ -153,24 +152,6 @@ namespace TheOtherRoles setRoleToRandomPlayer(roleId, impostors); } } - - // if (crewmates.Count > 0 && (rnd.Next(1, 101) <= CustomOptionHolder.bountyHunterSpawnRate.getSelection())) { - // List availableTargets = PlayerControl.AllPlayerControls.ToArray().ToList(); - // var bountyHunterIndex = rnd.Next(0, crewmates.Count); - // byte bountyHunterId = crewmates[bountyHunterIndex].PlayerId; - - // availableTargets.RemoveAll(x => x.IDOFAMCIJKE.CIDDOFDJHJH || x.PlayerId == bountyHunterId); - - // if (availableTargets.Count > 0) { - // byte targetId = availableTargets[rnd.Next(0, availableTargets.Count)].PlayerId; - // crewmates.RemoveAt(bountyHunterIndex); - // setRoleToPlayer((byte)RoleId.BountyHunter, bountyHunterId); - // writer = AmongUsClient.Instance.StartRpcImmediately(PlayerControl.LocalPlayer.NetId, (byte)CustomRPC.SetBountyHunterTarget, Hazel.SendOption.Reliable, -1); - // writer.Write(targetId); - // AmongUsClient.Instance.FinishRpcImmediately(writer); - // RPCProcedure.setBountyHunterTarget(targetId); - // } - // } } } } diff --git a/Source Code/RoleInfo.cs b/Source Code/RoleInfo.cs index 7d1682d..0fee9f8 100644 --- a/Source Code/RoleInfo.cs +++ b/Source Code/RoleInfo.cs @@ -154,13 +154,6 @@ namespace TheOtherRoles "No one will harm you until you grow up", "No one will harm you")); } - if (BountyHunter.bountyHunter != null && p == BountyHunter.bountyHunter) { - infos.Add(new RoleInfo("Bounty Hunter", - BountyHunter.color, - "Hunt your bounty down", - "Hunt your bounty")); - ; - } if (Tracker.tracker != null && p == Tracker.tracker) { infos.Add(new RoleInfo("Tracker", Tracker.color, diff --git a/Source Code/TheOtherRoles.cs b/Source Code/TheOtherRoles.cs index 801de9c..fe2f649 100644 --- a/Source Code/TheOtherRoles.cs +++ b/Source Code/TheOtherRoles.cs @@ -40,7 +40,6 @@ namespace TheOtherRoles Camouflager.clearAndReload(); Hacker.clearAndReload(); Child.clearAndReload(); - BountyHunter.clearAndReload(); Tracker.clearAndReload(); Vampire.clearAndReload(); Snitch.clearAndReload(); @@ -53,8 +52,11 @@ namespace TheOtherRoles public static PlayerControl jester; public static Color color = new Color(255f / 255f, 84f / 255f, 167f / 255f, 1); + public static bool triggerJesterWin = false; + public static void clearAndReload() { jester = null; + triggerJesterWin = false; } } @@ -108,7 +110,7 @@ namespace TheOtherRoles public static PlayerControl janitor; public static Color color = Palette.LDCHDOFJPGH; - public static float cooldown = float.MaxValue; + public static float cooldown = 30f; private static Sprite buttonSprite; public static Sprite getButtonSprite() { @@ -127,7 +129,7 @@ namespace TheOtherRoles public static PlayerControl sheriff; public static Color color = new Color(255f / 255f, 204f / 255f, 0f / 255f, 1); - public static float cooldown = float.MaxValue; + public static float cooldown = 30f; public static bool jesterCanDieToSheriff = false; public static PlayerControl currentTarget; @@ -147,7 +149,7 @@ namespace TheOtherRoles public static float lighterModeLightsOnVision = 2f; public static float lighterModeLightsOffVision = 0.75f; - public static float cooldown = float.MaxValue; + public static float cooldown = 30f; public static float duration = 5f; public static float lighterTimer = 0f; @@ -178,8 +180,7 @@ namespace TheOtherRoles public static bool anonymousFootprints = false; public static float reportNameDuration = 0f; public static float reportColorDuration = 20f; - - public static float timer = 1f; + public static float timer = 6.2f; public static void clearAndReload() { detective = null; @@ -188,7 +189,7 @@ namespace TheOtherRoles footprintDuration = CustomOptionHolder.detectiveFootprintDuration.getFloat(); reportNameDuration = CustomOptionHolder.detectiveReportNameDuration.getFloat(); reportColorDuration = CustomOptionHolder.detectiveReportColorDuration.getFloat(); - timer = footprintIntervall; + timer = 6.2f; } } } @@ -200,7 +201,7 @@ namespace TheOtherRoles public static bool reviveDuringRewind = false; public static float rewindTime = 3f; public static float shieldDuration = 3f; // Constant - public static float cooldown = float.MaxValue; + public static float cooldown = 30f; public static bool shieldActive = false; public static bool isRewinding = false; @@ -348,7 +349,7 @@ namespace TheOtherRoles private static Sprite sampleSprite; private static Sprite morphSprite; - public static float cooldown = float.MaxValue; + public static float cooldown = 30f; public static PlayerControl currentTarget; public static PlayerControl sampledTarget; @@ -395,7 +396,7 @@ namespace TheOtherRoles public static PlayerControl camouflager; public static Color color = Palette.LDCHDOFJPGH; - public static float cooldown = float.MaxValue; + public static float cooldown = 30f; public static float camouflageTimer = 0f; private static Sprite buttonSprite; @@ -433,7 +434,7 @@ namespace TheOtherRoles private static Sprite adminTableIcon; public static Color color = new Color(252f / 255f, 90f / 255f, 30f / 255f, 1); - public static float cooldown = float.MaxValue; + public static float cooldown = 30f; public static float duration = 10f; public static bool onlyColorType = false; @@ -465,7 +466,7 @@ namespace TheOtherRoles public static PlayerControl child; public static Color color = Color.white; - public static float growingUpDuration = float.MaxValue; + public static float growingUpDuration = 400f; public static DateTime timeOfGrowthStart = DateTime.UtcNow; public static bool triggerChildLose = false; @@ -488,20 +489,6 @@ namespace TheOtherRoles } } - public static class BountyHunter { - public static PlayerControl bountyHunter; - public static Color color = new Color(237f / 255f, 101f / 255f, 59f / 255f, 1); - - public static bool notifyBounty = true; - public static PlayerControl target; - - public static void clearAndReload() { - bountyHunter = null; - target = null; - // notifyBounty = CustomOptionHolder.bountyHunterNotifyBounty.getBool(); - } - } - public static class Tracker { public static PlayerControl tracker; public static Color color = new Color(117f / 255f, 209f / 255f, 255f / 255f, 1); @@ -539,7 +526,7 @@ namespace TheOtherRoles public static Color color = Palette.LDCHDOFJPGH; public static float delay = 10f; - public static float cooldown = float.MaxValue; + public static float cooldown = 30f; public static bool canKillNearGarlics = true; public static bool localPlacedGarlic = false; public static bool garlicsActive = true; @@ -602,8 +589,8 @@ namespace TheOtherRoles public static PlayerControl currentTarget; public static List formerJackals = new List(); - public static float cooldown = float.MaxValue; - public static float createSidekickCooldown = float.MaxValue; + public static float cooldown = 30f; + public static float createSidekickCooldown = 30f; public static bool canUseVents = true; public static bool canCreateSidekick = true; public static Sprite buttonSprite; @@ -646,7 +633,7 @@ namespace TheOtherRoles public static PlayerControl currentTarget; - public static float cooldown = float.MaxValue; + public static float cooldown = 30f; public static bool canUseVents = true; public static bool canKill = true; public static bool promotesToJackal = true; @@ -667,7 +654,7 @@ namespace TheOtherRoles public static List futureErased = new List(); public static PlayerControl currentTarget; - public static float cooldown = float.MaxValue; + public static float cooldown = 30f; private static Sprite buttonSprite; public static Sprite getButtonSprite() { diff --git a/Source Code/UpdatePatch.cs b/Source Code/UpdatePatch.cs index 3cdcd80..c928765 100644 --- a/Source Code/UpdatePatch.cs +++ b/Source Code/UpdatePatch.cs @@ -90,10 +90,6 @@ namespace TheOtherRoles setPlayerNameColor(Seer.seer, Seer.color); else if (Hacker.hacker != null && Hacker.hacker == PlayerControl.LocalPlayer) setPlayerNameColor(Hacker.hacker, Hacker.color); - else if (BountyHunter.bountyHunter != null && BountyHunter.target != null && BountyHunter.bountyHunter == PlayerControl.LocalPlayer) { - setPlayerNameColor(BountyHunter.bountyHunter, BountyHunter.color); - setPlayerNameColor(BountyHunter.target, BountyHunter.color); - } else if (Tracker.tracker != null && Tracker.tracker == PlayerControl.LocalPlayer) setPlayerNameColor(Tracker.tracker, Tracker.color); else if (Snitch.snitch != null && Snitch.snitch == PlayerControl.LocalPlayer) @@ -243,7 +239,18 @@ namespace TheOtherRoles p.LNMJKMLHMIM.material.SetFloat("_Outline", 0f); p.HatRenderer.SetHat(0, 0); Helpers.setSkinWithAnim(p.MyPhysics, 0); - if (p.CurrentPet) UnityEngine.Object.Destroy(p.CurrentPet.gameObject); + bool spawnPet = false; + if (p.CurrentPet == null) spawnPet = true; + else if (p.CurrentPet.EKONGILOOPE != DestroyableSingleton.CMJOLNCMAPD.AllPets[0].EKONGILOOPE) { + UnityEngine.Object.Destroy(p.CurrentPet.gameObject); + spawnPet = true; + } + + if (spawnPet) { + p.CurrentPet = UnityEngine.Object.Instantiate(DestroyableSingleton.CMJOLNCMAPD.AllPets[0]); + p.CurrentPet.transform.position = p.transform.position; + p.CurrentPet.Source = p; + } } } @@ -259,45 +266,23 @@ namespace TheOtherRoles } public static void childUpdate() { - foreach (PlayerControl p in PlayerControl.AllPlayerControls) { - if (p == null) continue; - p.transform.localScale = new Vector3(0.7f, 0.7f, 1f); - if (Child.child == null) continue; + if (Child.child == null) return; - float growingProgress = Child.growingProgress(); - float scale = growingProgress * 0.35f + 0.35f; - string suffix = ""; - if (growingProgress != 1f) - suffix = " [FAD934FF](" + Mathf.FloorToInt(growingProgress * 18) + ")"; - - if (Child.child == p) { - p.transform.localScale = new Vector3(scale, scale, 1f); - p.nameText.Text += suffix; - if (MeetingHud.Instance != null) - foreach (PlayerVoteArea player in MeetingHud.Instance.DHCOPOOJCLN) - if (player.NameText != null && p.PlayerId == player.HMPHKKGPLAG) - player.NameText.Text += suffix; - } - else if (Morphling.morphling != null && Morphling.morphling == p && Morphling.morphTarget != null && Morphling.morphTarget == Child.child && Morphling.morphTimer > 0f) { - p.transform.localScale = new Vector3(scale, scale, 1f); - p.nameText.Text += suffix; - } - else - p.transform.localScale = new Vector3(0.7f, 0.7f, 1f); - } - } - - public static void bountyHunterUpdate() { - if (BountyHunter.bountyHunter == null || BountyHunter.target == null) return; + float growingProgress = Child.growingProgress(); + float scale = growingProgress * 0.35f + 0.35f; + string suffix = ""; + if (growingProgress != 1f) + suffix = " [FAD934FF](" + Mathf.FloorToInt(growingProgress * 18) + ")"; - if (BountyHunter.notifyBounty && PlayerControl.LocalPlayer == BountyHunter.target) { - string suffix = "[AD653BFF] (Bounty)[FFFFFFFF]"; - PlayerControl.LocalPlayer.nameText.Text += suffix; - if (MeetingHud.Instance != null) - foreach (PlayerVoteArea player in MeetingHud.Instance.DHCOPOOJCLN) - if (player.NameText != null && PlayerControl.LocalPlayer.PlayerId == player.HMPHKKGPLAG) - player.NameText.Text += suffix; + Child.child.nameText.Text += suffix; + if (MeetingHud.Instance != null) { + foreach (PlayerVoteArea player in MeetingHud.Instance.DHCOPOOJCLN) + if (player.NameText != null && Child.child.PlayerId == player.HMPHKKGPLAG) + player.NameText.Text += suffix; } + + if (Morphling.morphling != null && Morphling.morphTarget == Child.child && Morphling.morphTimer > 0f) + Morphling.morphling.nameText.Text += suffix; } static void vampireDeactivateKillButton(HudManager __instance) { @@ -369,8 +354,6 @@ namespace TheOtherRoles camouflageAndMorphActions(); // Child childUpdate(); - // Bounty Hunter - bountyHunterUpdate(); // Vampire vampireDeactivateKillButton(__instance); // Snitch