[8458] Re-implement SPELL_AURA_MOD_TARGET_ARMOR_PCT in more porper way for weapon dependent cases.

(cherry picked from commit 7efab7fd38c3a753e967648ca8ef1f2cdfbac76c)

Signed-off-by: VladimirMangos <vladimir@getmangos.com>

With some fixes and rewrites.
This commit is contained in:
sixsixnine 2009-09-04 02:14:37 +04:00 committed by VladimirMangos
parent 57158e9185
commit 63e7c092f1
7 changed files with 61 additions and 8 deletions

View file

@ -132,6 +132,7 @@ bool Player::UpdateAllStats()
UpdateAllSpellCritChances();
UpdateDefenseBonusesMod();
UpdateShieldBlockValue();
UpdateArmorPenetration();
UpdateSpellDamageAndHealingBonus();
UpdateManaRegen();
UpdateExpertise(BASE_ATTACK);
@ -648,6 +649,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;