diff options
author | maximius <none@none> | 2009-09-14 16:02:13 -0700 |
---|---|---|
committer | maximius <none@none> | 2009-09-14 16:02:13 -0700 |
commit | b37f9b1e55bd4b80597b8b8c3f461aad70ccc5c1 (patch) | |
tree | c637055aab5d8f0e733fc611fada42c43ad04d83 /src/game/StatSystem.cpp | |
parent | 7b664c8c9fdda2b963f7883684a2f31d0f79551b (diff) |
*Merged MaNGOS [8458], [8475], [8476] by ogeraisi, thanks to all authors :)
--HG--
branch : trunk
Diffstat (limited to 'src/game/StatSystem.cpp')
-rw-r--r-- | src/game/StatSystem.cpp | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/src/game/StatSystem.cpp b/src/game/StatSystem.cpp index d991a96ebe6..a55f0bb47c3 100644 --- a/src/game/StatSystem.cpp +++ b/src/game/StatSystem.cpp @@ -151,6 +151,7 @@ bool Player::UpdateAllStats() UpdateAllSpellCritChances(); UpdateDefenseBonusesMod(); UpdateShieldBlockValue(); + UpdateArmorPenetration(); UpdateSpellDamageAndHealingBonus(); UpdateManaRegen(); UpdateExpertise(BASE_ATTACK); @@ -686,6 +687,30 @@ void Player::UpdateExpertise(WeaponAttackType attack) } } +void Player::UpdateArmorPenetration() +{ + m_armorPenetrationPct = GetRatingBonusValue(CR_ARMOR_PENETRATION); + + AuraList const& armorAuras = GetAurasByType(SPELL_AURA_MOD_TARGET_ARMOR_PCT); + for(AuraList::const_iterator itr = armorAuras.begin(); itr != armorAuras.end(); ++itr) + { + // affects all weapons + if((*itr)->GetSpellProto()->EquippedItemClass == -1) + { + m_armorPenetrationPct += (*itr)->GetModifier()->m_amount; + continue; + } + + // dependent on weapon class + for(uint8 i = 0; i < MAX_ATTACK; ++i) + { + Item *weapon = GetWeaponForAttack(WeaponAttackType(i)); + if(weapon && weapon->IsFitToSpellRequirements((*itr)->GetSpellProto())) + m_armorPenetrationPct += (*itr)->GetModifier()->m_amount; + } + } +} + void Player::ApplyManaRegenBonus(int32 amount, bool apply) { m_baseManaRegen+= apply ? amount : -amount; |