diff options
author | QAston <none@none> | 2009-06-16 15:29:07 +0200 |
---|---|---|
committer | QAston <none@none> | 2009-06-16 15:29:07 +0200 |
commit | 2e6db5421eb0132fc84d26b6f0c28c76a6b89a67 (patch) | |
tree | c0da76853de39de1e4c8b8c8c0792e04ce4890e9 /src/game/StatSystem.cpp | |
parent | 56408648456b8b78d0bfed4aec8d74473ab6b62e (diff) |
*Fix aura type 280.
--HG--
branch : trunk
Diffstat (limited to 'src/game/StatSystem.cpp')
-rw-r--r-- | src/game/StatSystem.cpp | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/src/game/StatSystem.cpp b/src/game/StatSystem.cpp index b3f1ae585fc..896a6e98a4a 100644 --- a/src/game/StatSystem.cpp +++ b/src/game/StatSystem.cpp @@ -160,6 +160,7 @@ bool Player::UpdateAllStats() UpdateManaRegen(); UpdateExpertise(BASE_ATTACK); UpdateExpertise(OFF_ATTACK); + RecalculateRating(CR_ARMOR_PENETRATION); for (int i = SPELL_SCHOOL_NORMAL; i < MAX_SPELL_SCHOOL; ++i) UpdateResistances(i); @@ -618,6 +619,35 @@ void Player::UpdateSpellCritChance(uint32 school) SetFloatValue(PLAYER_SPELL_CRIT_PERCENTAGE1 + school, crit); } +void Player::UpdateArmorPenetration(int32 amount) +{ + AuraEffectList const& expAuras = GetAurasByType(SPELL_AURA_MOD_ARMOR_PENETRATION_PCT); + for(AuraEffectList::const_iterator itr = expAuras.begin(); itr != expAuras.end(); ++itr) + { + // item neutral spell + if((*itr)->GetSpellProto()->EquippedItemClass == -1) + { + amount *= ((*itr)->GetAmount() + 100.0f) / 100.0f; + continue; + } + + // item dependent spell - check curent weapons + for(int i = 0; i < MAX_ATTACK; ++i) + { + Item *weapon = GetWeaponForAttack(WeaponAttackType(i)); + + if(weapon && weapon->IsFitToSpellRequirements((*itr)->GetSpellProto())) + { + amount *= ((*itr)->GetAmount() + 100.0f) / 100.0f; + break; + } + } + } + + // Store Rating Value + SetUInt32Value(PLAYER_FIELD_COMBAT_RATING_1 + CR_ARMOR_PENETRATION, amount); +} + void Player::UpdateMeleeHitChances() { m_modMeleeHitChance = GetTotalAuraModifier(SPELL_AURA_MOD_HIT_CHANCE); |