summaryrefslogtreecommitdiff
path: root/Thronefall_v1.0/Decompile/PerkHpModifyer.cs
blob: 3c7186c02ee32485110d410e19e9fd58e174e74c (plain)
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
using UnityEngine;

public class PerkHpModifyer : MonoBehaviour
{
	public Equippable requiredPerk;

	public float hpMultiplyer;

	public Hp hp;

	private void Start()
	{
		if (PerkManager.IsEquipped(requiredPerk))
		{
			BuildSlot componentInParent = GetComponentInParent<BuildSlot>();
			if ((bool)componentInParent)
			{
				foreach (BuildSlot.Upgrade upgrade in componentInParent.Upgrades)
				{
					foreach (BuildSlot.UpgradeBranch upgradeBranch in upgrade.upgradeBranches)
					{
						upgradeBranch.hpChange = Mathf.RoundToInt((float)upgradeBranch.hpChange * hpMultiplyer);
					}
				}
			}
			hp.maxHp *= hpMultiplyer;
			hp.Heal(float.MaxValue);
		}
		Object.Destroy(this);
	}
}