-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathFCLogic.cs
67 lines (59 loc) · 1.97 KB
/
FCLogic.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
54
55
56
57
58
59
60
61
62
63
64
65
66
67
using HarmonyLib;
namespace ForceCombo
{
public class FCLogic
{
private static bool isRestarting = false;
[HarmonyPatch(typeof(Track), "LateUpdate")]
[HarmonyPostfix]
private static void ForceComboMainLogic()
{
if (isRestarting || !(Main.InCustoms || Main.InArcade) || Track.IsEditing || Track.IsPaused || Track.Instance.playStateFirst.isInPracticeMode) return;
PlayState playState = Track.Instance.playStateFirst;
switch (Main.ForceComboState)
{
case ForceComboMode.NoHit:
if (playState.health < playState.MaxHealth)
Restart();
break;
case ForceComboMode.FC:
if (playState.fullComboState == FullComboState.None)
Restart();
break;
case ForceComboMode.PFC:
if (playState.fullComboState != FullComboState.PerfectFullCombo)
Restart();
break;
}
}
private static void Restart()
{
isRestarting = true;
if (Main.InstantRestart)
{
Track.Instance.RestartTrack();
return;
}
Track.Instance.playStateFirst.health = -50;
}
[HarmonyPatch(typeof(Track), nameof(Track.PlayTrack))]
[HarmonyPostfix]
private static void ForceComboResetValues()
{
isRestarting = false;
}
[HarmonyPatch(typeof(Track), nameof(Track.FailSong))]
[HarmonyPostfix]
private static void FailSong()
{
if (Main.InstantRestart)
Track.Instance.RestartTrack();
}
[HarmonyPatch(typeof(Track), nameof(Track.ReturnToPickTrack))]
[HarmonyPrefix]
private static void PreventRestart()
{
isRestarting = true;
}
}
}