protected void TakeDamage(float inDamage, Character attackingCharacter) { bool dodged = false; float totalDefense = 0; float totalDamage; //Remove health based on damage taken and armor value if (equippedArmor != null) { totalDefense += equippedArmor.GetDefenseValue(); totalDamage = inDamage - equippedArmor.GetDefenseValue(); } if (offHandWeapon != null && offHandWeapon.GetWeaponType() == BaseWeapon.WEAPON_TYPE.WEAPON_SHIELD) { totalDefense += offHandWeapon.GetDefenseValue(); } if (equippedWeapon != null) { totalDefense += equippedWeapon.GetDefenseValue(); } totalDamage = inDamage - totalDefense; if (totalDamage < 0) { totalDamage = 0; } //If dodge value is higher than damage being dealt and armor isn't heavy, avoid damage all together if (equippedArmor != null) { if (GetCombatSkills().dodge > totalDamage && !equippedArmor.IsHeavyArmor()) { dodged = true; } } if (!dodged) { print("Total damage: " + totalDamage); currentHealth -= totalDamage; animator.SetTrigger("Take Damage"); } CheckHealth(); //The dude who just hit you is probably more important if he isn't your current target, switch (CHANGE TO AGGRO SYSTEM LATER) if (attackingCharacter != targetObject) { targetObject = attackingCharacter.gameObject; } }