public override void Hit(int damage, bool ignoreArmor, DamageType type) { var hitEventContext = new COTFEvents.GotHitParams(damage, ignoreArmor); COTFEvents.Instance.OnGetHit.Invoke(hitEventContext); if (type == DamageType.Physical) { COTFEvents.Instance.OnGetHitPhysical.Invoke(hitEventContext); if (UnityEngine.Random.value > ModdedPlayer.Stats.getHitChance) { COTFEvents.Instance.OnDodge.Invoke(); if (ModdedPlayer.Stats.i_isWindArmor) { //grant buffs; BuffDB.AddBuff(5, 84, 1.2f, 30); BuffDB.AddBuff(9, 85, 1.35f, 10); BuffDB.AddBuff(15, 86, 2000, 10); HealthTarget += ModdedPlayer.Stats.TotalMaxHealth * 0.05f; } Sfx.PlayWhoosh(); return; } } else { COTFEvents.Instance.OnGetHitNonPhysical.Invoke(hitEventContext); } float f = damage * ModdedPlayer.Stats.allDamageTaken; if (!ignoreArmor) { f *= 1 - ModReferences.DamageReduction(Mathf.Max(0, ModdedPlayer.Stats.armor - (int)ModdedPlayer.instance.lostArmor)); } if (type == DamageType.Fire) { f *= 0.01f * ModdedPlayer.Stats.TotalMaxHealth; f *= UnityEngine.Random.Range(0.9f, 1.4f); //f *= 1-ModdedPlayer.Stats.magicDamageTaken; f *= ModdedPlayer.Stats.fireDamageTaken; } if (ModdedPlayer.Stats.i_KingQruiesSword) { BuffDB.AddBuff(22, 80, f, 1); } CotfUtils.Log("Tanked damage: " + f, true); base.Hit(damage, ignoreArmor, type); }
public override void Hit(int damage, bool ignoreArmor, DamageType type) { if (type == DamageType.Physical) { if (UnityEngine.Random.value > ModdedPlayer.Stats.getHitChance) { if (ModdedPlayer.Stats.i_isWindArmor) { //grant buffs; BuffDB.AddBuff(5, 84, 1.2f, 30); BuffDB.AddBuff(9, 85, 1.35f, 10); BuffDB.AddBuff(15, 86, 2000, 10); HealthTarget += ModdedPlayer.Stats.TotalMaxHealth * 0.05f; } Sfx.PlayWhoosh(); return; } } float f = damage * ModdedPlayer.Stats.allDamageTaken; if (!ignoreArmor) { f *= 1 - ModReferences.DamageReduction(Mathf.Max(0, ModdedPlayer.Stats.armor - (int)ModdedPlayer.instance.lostArmor)); } if (type == DamageType.Fire) { f *= 0.01f * ModdedPlayer.Stats.TotalMaxHealth; f *= UnityEngine.Random.Range(0.9f, 1.4f); //f *= 1-ModdedPlayer.Stats.magicDamageTaken; f *= ModdedPlayer.Stats.fireDamageTaken; } if (ModdedPlayer.Stats.i_KingQruiesSword) { BuffDB.AddBuff(22, 80, f, 1); } base.Hit(damage, ignoreArmor, type); }