*change SPELL_AURA_MOD_ARMOR_PENETRATION_PCT to reduce armor on target and add cap amount of armor reduced by armor penetration rating By thenecromancer

--HG--
branch : trunk
This commit is contained in:
megamage
2009-08-10 15:32:08 -05:00
parent 0ed719c558
commit feba13e650
4 changed files with 40 additions and 34 deletions
+1 -9
View File
@@ -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
-1
View File
@@ -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);
-23
View File
@@ -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);
}
+39 -1
View File
@@ -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;