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;
}
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/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())
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);
+ }
}
}
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();
+ }
}
}
}
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;
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
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
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
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