diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/game/SpellAuras.cpp | 10 | ||||
-rw-r--r-- | src/game/SpellAuras.h | 1 | ||||
-rw-r--r-- | src/game/StatSystem.cpp | 23 | ||||
-rw-r--r-- | src/game/Unit.cpp | 40 |
4 files changed, 40 insertions, 34 deletions
diff --git a/src/game/SpellAuras.cpp b/src/game/SpellAuras.cpp index 6db5315ae5b..244b85d38dc 100644 --- a/src/game/SpellAuras.cpp +++ b/src/game/SpellAuras.cpp @@ -333,7 +333,7 @@ pAuraHandler AuraHandler[TOTAL_AURAS]= &Aura::HandleNoImmediateEffect, //277 SPELL_AURA_MOD_ABILITY_AFFECTED_TARGETS implemented in spell::settargetmap &Aura::HandleAuraModDisarm, //278 SPELL_AURA_MOD_DISARM_RANGED disarm ranged weapon &Aura::HandleAuraInitializeImages, //279 SPELL_AURA_INITIALIZE_IMAGES - &Aura::HandleModArmorPenetrationPct, //280 SPELL_AURA_MOD_ARMOR_PENETRATION_PCT + &Aura::HandleNoImmediateEffect, //280 SPELL_AURA_MOD_ARMOR_PENETRATION_PCT &Aura::HandleNoImmediateEffect, //281 SPELL_AURA_MOD_HONOR_GAIN_PCT implemented in Player::RewardHonor &Aura::HandleAuraIncreaseBaseHealthPercent, //282 SPELL_AURA_INCREASE_BASE_HEALTH_PERCENT &Aura::HandleNoImmediateEffect, //283 SPELL_AURA_MOD_HEALING_RECEIVED implemented in Unit::SpellHealingBonus @@ -7038,14 +7038,6 @@ void AuraEffect::HandleAuraSafeFall( bool Apply, bool Real , bool /*changeAmount ((Player*)m_target)->ActivateTaxiPathTo(506,GetId()); } -void AuraEffect::HandleModArmorPenetrationPct(bool apply, bool Real, bool changeAmount) -{ - if(m_target->GetTypeId() != TYPEID_PLAYER) - return; - - ((Player*)m_target)->RecalculateRating(CR_ARMOR_PENETRATION); -} - void AuraEffect::HandleReflectSpells( bool Apply, bool Real , bool /*changeAmount*/) { // implemented in Unit::SpellHitResult diff --git a/src/game/SpellAuras.h b/src/game/SpellAuras.h index 6a1c11e49c9..e05e255b412 100644 --- a/src/game/SpellAuras.h +++ b/src/game/SpellAuras.h @@ -331,7 +331,6 @@ class TRINITY_DLL_SPEC AuraEffect void HandleAuraAllowOnlyAbility(bool apply, bool Real, bool changeAmount); void HandleCharmConvert(bool apply, bool Real, bool changeAmount); void HandleReflectSpells( bool Apply, bool Real , bool changeAmount); - void HandleModArmorPenetrationPct(bool Apply, bool Real, bool changeAmount); void HandleAuraInitializeImages(bool Apply, bool Real, bool changeAmount); void HandleAuraCloneCaster(bool Apply, bool Real, bool changeAmount); diff --git a/src/game/StatSystem.cpp b/src/game/StatSystem.cpp index 36d88e065a6..d6a0d737d7b 100644 --- a/src/game/StatSystem.cpp +++ b/src/game/StatSystem.cpp @@ -630,29 +630,6 @@ void Player::UpdateSpellCritChance(uint32 school) 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); } diff --git a/src/game/Unit.cpp b/src/game/Unit.cpp index 1533c6cd565..cf6b8a577c3 100644 --- a/src/game/Unit.cpp +++ b/src/game/Unit.cpp @@ -1803,9 +1803,47 @@ uint32 Unit::CalcArmorReducedDamage(Unit* pVictim, const uint32 damage, SpellEnt armor= int32(float(armor) * (float(100-(*j)->GetAmount())/100.0f)); } + if ( GetTypeId() == TYPEID_PLAYER ) + { + AuraEffectList const& ResIgnoreAuras = GetAurasByType(SPELL_AURA_MOD_ARMOR_PENETRATION_PCT); + for(AuraEffectList::const_iterator itr = ResIgnoreAuras.begin();itr != ResIgnoreAuras.end(); ++itr) + { + // item neutral spell + if((*itr)->GetSpellProto()->EquippedItemClass == -1) + { + armor= int32(float(armor) * (float(100-(*itr)->GetAmount())/100.0f)); + continue; + } + + // item dependent spell - check curent weapons + for(int i = 0; i < MAX_ATTACK; ++i) + { + Item *weapon = ((Player *)this)->GetWeaponForAttack(WeaponAttackType(i)); + + if(weapon && weapon->IsFitToSpellRequirements((*itr)->GetSpellProto())) + { + armor= int32(float(armor) * (float(100-(*itr)->GetAmount())/100.0f)); + break; + } + } + } + } + // Apply Player CR_ARMOR_PENETRATION rating if (GetTypeId()==TYPEID_PLAYER) - armor *= 1.0f - (((Player*)this)->GetRatingBonusValue(CR_ARMOR_PENETRATION) / 100.0f); + { + float maxArmorPen=0; + if (getLevel()<60) + maxArmorPen=400+85*pVictim->getLevel(); + else + maxArmorPen=400+85*pVictim->getLevel()+4.5*85*(pVictim->getLevel()-59); + // Cap armor penetration to this number + maxArmorPen = std::min(((armor+maxArmorPen)/3),armor); + // Figure out how much armor do we ignore + float armorPen = maxArmorPen*((Player*)this)->GetRatingBonusValue(CR_ARMOR_PENETRATION) / 100.0f; + // Got the value, apply it + armor -= armorPen; + } if (armor < 0.0f) armor=0.0f; |