/// <summary> /// Gets the total amount of damage done to a target. /// </summary> /// <param name="damage">The previously calculated amount of damage to deal to a target.</param> /// <param name="defender">The defending CombatEntity who will receive damage.</param> /// <returns></returns> public static DamageTypes GetTotalDamage(DamageTypes damage, CombatEntity defender) { var result = damage.Copy(); var totalArmor = defender.SecondaryStats.Armor * (defender.SecondaryStats.ArmorPercentage + 100) / 100; result -= totalArmor; if (result.Blunt < 0) { result.Blunt = 0; } if (result.Sharp < 0) { result.Sharp = 0; } if (result.Fire < 0) { result.Fire = 0; } if (result.Frost < 0) { result.Frost = 0; } if (result.Lightning < 0) { result.Lightning = 0; } if (result.Holy < 0) { result.Holy = 0; } if (result.Shadow < 0) { result.Shadow = 0; } result = result * 100 / (defender.SecondaryStats.Resistances + 100); return(result); }