Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System.Reflection;
- using GlobalEnums;
- using Modding;
- using UnityEngine;
- using ModCommon;
- using On;
- namespace money_is_hp
- {
- public class money_is_hp : Mod,ITogglableMod
- {
- internal static money_is_hp Instance;
- public override void Initialize()
- {
- Instance = this;
- ModHooks.Instance.TakeHealthHook += TakeDamage;
- ModHooks.Instance.HeroUpdateHook += OnHeroUpdate;
- On.PlayerData.SetupNewPlayerData += NewSave;
- }
- public void NewSave(On.PlayerData.orig_SetupNewPlayerData orig, PlayerData self)
- {
- orig(self);
- PlayerData.instance.geo += 5;
- }
- public void Unload()
- {
- Instance = null;
- ModHooks.Instance.TakeHealthHook -= TakeDamage;
- ModHooks.Instance.HeroUpdateHook -= OnHeroUpdate;
- On.PlayerData.SetupNewPlayerData -= NewSave;
- }
- public void OnHeroUpdate()
- {
- PlayerData.instance.health = PlayerData.instance.geo;
- }
- public int TakeDamage(int damage)
- {
- if (PlayerData.instance.geo >= 25)
- {
- PlayerData.instance.geo -= 25;
- }
- else
- {
- if(PlayerData.instance.geo > 5)
- {
- PlayerData.instance.geo -= 1;
- }
- else
- {
- PlayerData.instance.geo -= 5;
- }
- }
- return damage * 0;
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment