From a8b3677839b9a10291db7ebd7c3e0577becdbe9f Mon Sep 17 00:00:00 2001 From: xChipseq Date: Wed, 20 Aug 2025 13:56:35 +0200 Subject: [PATCH 1/9] fix adhd button triggering being global --- .../Modifiers/Effects/TokenHyperactive.cs | 21 +++++++++++-------- 1 file changed, 12 insertions(+), 9 deletions(-) diff --git a/ChaosTokens/Modifiers/Effects/TokenHyperactive.cs b/ChaosTokens/Modifiers/Effects/TokenHyperactive.cs index dc77571..ebcaa21 100644 --- a/ChaosTokens/Modifiers/Effects/TokenHyperactive.cs +++ b/ChaosTokens/Modifiers/Effects/TokenHyperactive.cs @@ -25,18 +25,21 @@ public override void FixedUpdate() { EffectActive = !EffectActive; } - - foreach (var ability in CustomButtonManager.Buttons) + + if (Player.AmOwner) { - random = Random.RandomRangeInt(1, 100); - if (random == 1) + foreach (var ability in CustomButtonManager.Buttons) { - if (!ability.Button.isActiveAndEnabled) continue; - if (ability.Location == ButtonLocation.BottomLeft) continue; // not the best solution, but stops modifier buttons from being pressed - if (!ability.CanClick()) continue; - if (ability.EffectActive) continue; + random = Random.RandomRangeInt(1, 100); + if (random == 1) + { + if (!ability.Button?.isActiveAndEnabled ?? false) continue; + if (ability.Location == ButtonLocation.BottomLeft) continue; // not the best solution, but stops modifier buttons from being pressed + if (!ability.CanClick()) continue; + if (ability.EffectActive) continue; - ability.ClickHandler(); + ability.ClickHandler(); + } } } } From 16494876e8faf4e83cb6125c08bf5faf74658a93 Mon Sep 17 00:00:00 2001 From: xChipseq Date: Wed, 20 Aug 2025 14:26:11 +0200 Subject: [PATCH 2/9] fix one time kill button appearing for everyone --- ChaosTokens/Modifiers/Effects/TokenOneTimeKill.cs | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/ChaosTokens/Modifiers/Effects/TokenOneTimeKill.cs b/ChaosTokens/Modifiers/Effects/TokenOneTimeKill.cs index 246ce87..9806f2f 100644 --- a/ChaosTokens/Modifiers/Effects/TokenOneTimeKill.cs +++ b/ChaosTokens/Modifiers/Effects/TokenOneTimeKill.cs @@ -13,12 +13,19 @@ public class TokenOneTimeKill : TokenEffect public override void OnActivate() { base.OnActivate(); - CustomButtonSingleton.Instance.SetTimer(10f); - CustomButtonSingleton.Instance.Button.gameObject.SetActive(true); + + if (Player.AmOwner) + { + CustomButtonSingleton.Instance.SetTimer(10f); + CustomButtonSingleton.Instance.Button.gameObject.SetActive(true); + } } public override void OnDeactivate() { - CustomButtonSingleton.Instance.Button.gameObject.SetActive(false); + if (Player.AmOwner) + { + CustomButtonSingleton.Instance.Button.gameObject.SetActive(false); + } } } \ No newline at end of file From 2f9577b5b963fae56ee46af86387d3f83602963f Mon Sep 17 00:00:00 2001 From: xChipseq Date: Wed, 20 Aug 2025 16:07:24 +0200 Subject: [PATCH 3/9] fix medium effect --- ChaosTokens/ChaosTokens.csproj | 2 +- ChaosTokens/Modifiers/VisibleGhost.cs | 7 ++++++- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/ChaosTokens/ChaosTokens.csproj b/ChaosTokens/ChaosTokens.csproj index cd8d561..c8aac55 100644 --- a/ChaosTokens/ChaosTokens.csproj +++ b/ChaosTokens/ChaosTokens.csproj @@ -5,7 +5,7 @@ embedded Chipseq - 1.1.1 + 1.1.2 diff --git a/ChaosTokens/Modifiers/VisibleGhost.cs b/ChaosTokens/Modifiers/VisibleGhost.cs index e8192b5..6ac08b6 100644 --- a/ChaosTokens/Modifiers/VisibleGhost.cs +++ b/ChaosTokens/Modifiers/VisibleGhost.cs @@ -6,7 +6,7 @@ public sealed class VisibleGhost : BaseModifier { public override string ModifierName => "Visible Ghost"; public override bool HideOnUi => true; - + public override void FixedUpdate() { if (!Player.Data.IsDead) @@ -17,4 +17,9 @@ public override void FixedUpdate() Player.Visible = true; } + + public override void OnDeactivate() + { + Player.Visible = false; + } } \ No newline at end of file From a997280c7a74dc49038cf035fcdbb687d908c0bd Mon Sep 17 00:00:00 2001 From: xChipseq Date: Wed, 20 Aug 2025 16:07:34 +0200 Subject: [PATCH 4/9] reveal improvements --- ChaosTokens/Modifiers/Effects/TokenReveal.cs | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/ChaosTokens/Modifiers/Effects/TokenReveal.cs b/ChaosTokens/Modifiers/Effects/TokenReveal.cs index c65b051..1956881 100644 --- a/ChaosTokens/Modifiers/Effects/TokenReveal.cs +++ b/ChaosTokens/Modifiers/Effects/TokenReveal.cs @@ -14,6 +14,7 @@ public class TokenReveal(RoleTypes role, byte source) : TokenEffect( public override bool LinkToAditional => true; public bool FakeReveal { get; protected set; } + private bool _ghostInfoUpdated = false; public override void OnActivate() { @@ -24,17 +25,17 @@ public override void OnActivate() if (Player.AmOwner && FakeReveal) { Utils.Notification("You have been revealed to everyone as a random role!"); - - AdditionalModifier.ExtraRoleText = " (fake)"; + AdditionalModifier.ExtraRoleText = " (fake)"; return; } if (Player.AmOwner) { Utils.Notification("Your role has been revealed to everyone!"); + AdditionalModifier.ExtraRoleText = " (revealed)"; return; } - + if (AdditionalModifier?.RevealSource?.AmOwner ?? false) { Utils.Notification("You revealed the role of a random person!"); @@ -47,5 +48,12 @@ public override void Update() { MeetingMenu.Instances.Do(x => x.HideSingle(Player.PlayerId)); } + + if (!_ghostInfoUpdated && FakeReveal && PlayerControl.LocalPlayer.HasDied()) + { + _ghostInfoUpdated = true; + AdditionalModifier.ExtraRoleText = $" (revealed as {AdditionalModifier.ShownRole?.NiceName})"; + AdditionalModifier.ShownRole = Player.GetRoleWhenAlive(); + } } } \ No newline at end of file From 324c2be9497749a0ebb32240afb2a7da9381398f Mon Sep 17 00:00:00 2001 From: xChipseq Date: Wed, 20 Aug 2025 16:07:56 +0200 Subject: [PATCH 5/9] notify ghosts about medium effect --- ChaosTokens/Modifiers/Effects/TokenMedium.cs | 25 +++++++++++++++++++- 1 file changed, 24 insertions(+), 1 deletion(-) diff --git a/ChaosTokens/Modifiers/Effects/TokenMedium.cs b/ChaosTokens/Modifiers/Effects/TokenMedium.cs index fe8adea..75012e8 100644 --- a/ChaosTokens/Modifiers/Effects/TokenMedium.cs +++ b/ChaosTokens/Modifiers/Effects/TokenMedium.cs @@ -1,6 +1,12 @@ -using System.Linq; +using System.Collections; +using System.Linq; using HarmonyLib; using MiraAPI.Modifiers; +using Reactor.Utilities; +using Reactor.Utilities.Extensions; +using TownOfUs; +using TownOfUs.Utilities; +using UnityEngine; namespace ChaosTokens.Modifiers.Effects; @@ -23,6 +29,12 @@ public override void OnActivate() .Where(x => !x.HasModifier()) .Do(x => x.AddModifier()); } + + if (PlayerControl.LocalPlayer.HasDied()) + { + Coroutines.Start(MiscUtils.CoFlash(ChaosTokensPlugin.MainColor, 2)); + Coroutines.Start(CoArrow(Player)); + } } public override void OnDeactivate() @@ -36,4 +48,15 @@ public override void OnDeactivate() .Do(x => x.RemoveModifier()); } } + + private static IEnumerator CoArrow(PlayerControl player) + { + var arrow = MiscUtils.CreateArrow(player.transform, TownOfUsColors.Medium); + for (float time = 0; time <= 2; time += Time.deltaTime) + { + arrow.target = player.GetTruePosition(); + yield return new WaitForEndOfFrame(); + } + arrow.gameObject.Destroy(); + } } \ No newline at end of file From 69344965616d4bdfcd538f88337feb0b44a50844 Mon Sep 17 00:00:00 2001 From: xChipseq Date: Wed, 20 Aug 2025 16:08:08 +0200 Subject: [PATCH 6/9] fix kill button appearing for everyone --- ChaosTokens/Buttons/TokenKillButton.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ChaosTokens/Buttons/TokenKillButton.cs b/ChaosTokens/Buttons/TokenKillButton.cs index 572e34b..195f71f 100644 --- a/ChaosTokens/Buttons/TokenKillButton.cs +++ b/ChaosTokens/Buttons/TokenKillButton.cs @@ -1,5 +1,4 @@ -using AmongUs.GameOptions; -using ChaosTokens.Modifiers.Effects; +using ChaosTokens.Modifiers.Effects; using MiraAPI.GameOptions; using MiraAPI.Hud; using MiraAPI.Modifiers; @@ -53,6 +52,7 @@ public override bool Enabled(RoleBehaviour role) protected override void FixedUpdate(PlayerControl playerControl) { + if (!Button) return; Button.graphic.sprite = HudManager.Instance?.KillButton?.graphic?.sprite ?? MiraAssets.Empty.LoadAsset(); Button.graphic.color = ChaosTokensPlugin.MainColor; } From b13d563889beb71659f9032421792d75e31e8ca7 Mon Sep 17 00:00:00 2001 From: xChipseq Date: Wed, 20 Aug 2025 16:08:17 +0200 Subject: [PATCH 7/9] :( --- ChaosTokens/Modifiers/Effects/TokenInvisible.cs | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/ChaosTokens/Modifiers/Effects/TokenInvisible.cs b/ChaosTokens/Modifiers/Effects/TokenInvisible.cs index 966296f..cede50a 100644 --- a/ChaosTokens/Modifiers/Effects/TokenInvisible.cs +++ b/ChaosTokens/Modifiers/Effects/TokenInvisible.cs @@ -1,5 +1,4 @@ using System; -using Reactor.Utilities; using TownOfUs.Modifiers.Game.Universal; using TownOfUs.Roles.Impostor; using TownOfUs.Utilities; @@ -11,7 +10,7 @@ public sealed class TokenInvisible : TokenEffect { public override ChaosEffects Effect => ChaosEffects.Invisible; public override string ModifierName => "Token Invisible"; - public override string Notification => "You have now become... invisible?"; + public override string Notification => "You have now become... invisible?"; // no one got the reference :cry: public override bool Negative => false; private const float InvisDelay = 1f; From d7a556672db0ddc189f79decf19a75743fd192b3 Mon Sep 17 00:00:00 2001 From: xChipseq Date: Wed, 20 Aug 2025 16:08:32 +0200 Subject: [PATCH 8/9] add all reveals to the debug menu --- ChaosTokens/DebugMenu.cs | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/ChaosTokens/DebugMenu.cs b/ChaosTokens/DebugMenu.cs index 367bca6..741db89 100644 --- a/ChaosTokens/DebugMenu.cs +++ b/ChaosTokens/DebugMenu.cs @@ -80,11 +80,25 @@ public void WindowFunction(int windowID) GUILayout.Space(5f); GUILayout.Label("Effects"); + var player = PlayerControl.LocalPlayer; foreach (var modifier in ModifierManager.Modifiers.OfType()) { if (GUILayout.Button(modifier.ModifierName.Replace("Token ", string.Empty))) { - ChaosTokensRpc.ApplyEffect(PlayerControl.LocalPlayer, modifier.Effect); + ChaosTokensRpc.ApplyEffect(player, modifier.Effect); + } + + if (modifier.ModifierName == "Token Reveal") + { + if (GUILayout.Button("Fake Reveal") && !player.HasModifier()) + { + ChaosTokensRpc.ApplyEffect(player, ChaosEffects.FakeRevealSelf); + } + + if (GUILayout.Button("Random Person Reveal")) + { + ChaosTokensRpc.ApplyEffect(player, ChaosEffects.RevealRandom); + } } } From cd2632cc9dd7db6268c2886aa2a24388865882cd Mon Sep 17 00:00:00 2001 From: xChipseq Date: Wed, 20 Aug 2025 16:09:17 +0200 Subject: [PATCH 9/9] make transparent and invisible effect reclusive or sum --- ChaosTokens/ChaosTokensRpc.cs | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/ChaosTokens/ChaosTokensRpc.cs b/ChaosTokens/ChaosTokensRpc.cs index de0f80f..c605b47 100644 --- a/ChaosTokens/ChaosTokensRpc.cs +++ b/ChaosTokens/ChaosTokensRpc.cs @@ -196,6 +196,11 @@ void Reroll() Reroll(); break; } + if (player.HasModifier()) + { + Reroll(); + break; + } player.RpcAddModifier(Random.RandomRange(0f, 0.8f)); break; @@ -256,6 +261,11 @@ void Reroll() Reroll(); break; } + if (player.HasModifier()) + { + Reroll(); + break; + } player.RpcAddModifier(); break; @@ -310,9 +320,6 @@ void Reroll() player.RpcAddModifier(); break; case ChaosEffects.FakeRevealSelf: - // The player will reveal as ANY role - // disabled, vanilla, ghost roles included - // why? because it's funny if (player.HasModifier()) { Reroll(); @@ -325,7 +332,10 @@ void Reroll() break; } - player.RpcAddModifier(RoleManager.Instance.AllRoles.Random().Role, player.Data.PlayerId); + var validRoles = CustomRoleManager.CustomMiraRoles + .Where(r => r.Team != player.GetTownOfUsRole()?.Team) + .Select(r => (r as RoleBehaviour).Role); + player.RpcAddModifier(validRoles.Random(), player.Data.PlayerId); break; case ChaosEffects.Hyperactive: if (player.HasModifier())