-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathInvulnerability.cs
64 lines (58 loc) · 1.87 KB
/
Invulnerability.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
using BepInEx;
using HarmonyLib;
namespace MonsterTrainInvulnerableMod
{
[BepInPlugin(GUID, NAME, VERSION)]
[BepInProcess("MonsterTrain.exe")]
[BepInProcess("MtLinkHandler.exe")]
public class Invulnerability : BaseUnityPlugin
{
public const string GUID = "com.github.cdietschrun.MonsterTrainInvulnerableMod";
public const string NAME = "Invulnerable Pyre Mod";
public const string VERSION = "1.0.0";
private void Awake()
{
var harmony = new Harmony(GUID);
harmony.PatchAll();
}
}
[HarmonyPatch(typeof(CombatManager), "HandleTowerHPChanged")]
public static class CombatManagerHandleTowerHPChangedOverride
{
static bool Prefix(ref SaveManager.PyreHPChangedSignalData data, ref SaveManager ___saveManager)
{
data.newHP = ___saveManager.GetTowerHP();
data.prevHP = ___saveManager.GetTowerHP();
return false;
}
}
[HarmonyPatch(typeof(PyreRoomState), "SynchronizeHP")]
public static class PyreRoomStateSynchronizeHPOverride
{
static bool Prefix(ref SaveManager.PyreHPChangedSignalData data, ref SaveManager ___saveManager)
{
data.newHP = ___saveManager.GetTowerHP();
data.prevHP = ___saveManager.GetTowerHP();
return false;
}
}
[HarmonyPatch(typeof(CharacterState), "ApplyDamage")]
public static class CharacterStateApplyDamagerOverride
{
static void Prefix(ref CharacterState __instance, ref int damage)
{
if (__instance.IsPyreHeart())
{
damage = 0;
}
}
}
[HarmonyPatch(typeof(PlayerManager), "AdjustTowerHP")]
public static class PlayerManagerAdjustTowerHPOverride
{
static void Prefix(ref int addHP)
{
addHP = 0;
}
}
}