-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathEffectFixer.cs
53 lines (47 loc) · 2.48 KB
/
EffectFixer.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
using System.Collections;
using UnityEngine;
using Logger = Modding.Logger;
using USceneManager = UnityEngine.SceneManagement.SceneManager;
using Vasi;
namespace FuryAlwaysOn
{
internal class EffectFixer : MonoBehaviour
{
private PlayMakerFSM fsm;
private void Start() => StartCoroutine(WaitForPlayer());
private IEnumerator WaitForPlayer()
{
yield return new WaitWhile(() => HeroController.instance == null); // Waits for Hero to be loaded
yield return null;
fsm = GameObject.Find("Charm Effects").LocateMyFSM("Fury");
fsm.ChangeTransition("Check HP", "CANCEL", "Get Ref"); // Ensures the FSM does not cancel when HP is not at 1
fsm.GetState("Activate").RemoveTransition("HERO DAMAGED"); // Ensures HP is not checked when hit
fsm.GetState("Activate").RemoveTransition("HERO HEALED"); // Ensures HP is not checked when healed
fsm.GetState("Activate").RemoveTransition("HERO HEALED FULL"); // Ensures HP is not checked when at bench
fsm.GetState("Activate").RemoveTransition("ADD BLUE HEALTH"); // Ensures HP is not checked when Lifeblood is received
fsm.GetState("Activate").RemoveAction(21); // Disables Fury vignette
fsm.GetState("Activate").RemoveAction(20); // Disables Fury burst effect
fsm.GetState("Activate").RemoveAction(2); // Disables Fury particle effects
fsm.GetState("Activate").RemoveAction(1); // Required(?) to disable the rest of the effects
fsm.GetState("Activate").RemoveAction(0); // Disables Fury audio effects
// Gives Grubberfly beams their Fury color
HeroController.instance.grubberFlyBeamPrefabL = HeroController.instance.grubberFlyBeamPrefabL_fury;
HeroController.instance.grubberFlyBeamPrefabR = HeroController.instance.grubberFlyBeamPrefabR_fury;
HeroController.instance.grubberFlyBeamPrefabU = HeroController.instance.grubberFlyBeamPrefabU_fury;
HeroController.instance.grubberFlyBeamPrefabD = HeroController.instance.grubberFlyBeamPrefabD_fury;
while (true)
{
if (PlayerData.instance.equippedCharm_6 && fsm.ActiveStateName == "Idle") // Turns on Fury when equipped
{
fsm.SendEvent("HERO DAMAGED"); // Starts
}
if (!PlayerData.instance.equippedCharm_6 && fsm.ActiveStateName == "Activate") // Turns off Fury when not equipped
{
fsm.SetState("Deactivate");
}
yield return null;
}
}
public static void Log(object message) => Logger.Log("[EffectFixer] " + message);
}
}