Core/Mechanics: Armor penetration improvement. Revamp calculation of SPELL_AURA_MOD_TARGET_ARMOR_PCT
This commit is contained in:
@@ -1512,44 +1512,36 @@ uint32 Unit::CalcArmorReducedDamage(Unit* victim, const uint32 damage, SpellInfo
|
||||
armor = floor(AddPctN(armor, -(*j)->GetAmount()));
|
||||
}
|
||||
|
||||
// Apply Player CR_ARMOR_PENETRATION rating and buffs from stances\specializations etc.
|
||||
if (GetTypeId() == TYPEID_PLAYER)
|
||||
{
|
||||
AuraEffectList const& ArPenAuras = GetAuraEffectsByType(SPELL_AURA_MOD_ARMOR_PENETRATION_PCT);
|
||||
for (AuraEffectList::const_iterator itr = ArPenAuras.begin(); itr != ArPenAuras.end(); ++itr)
|
||||
float bonusPct = 0;
|
||||
AuraEffectList const& ResIgnoreAuras = GetAuraEffectsByType(SPELL_AURA_MOD_ARMOR_PENETRATION_PCT);
|
||||
for (AuraEffectList::const_iterator itr = ResIgnoreAuras.begin(); itr != ResIgnoreAuras.end(); ++itr)
|
||||
{
|
||||
// item neutral spell
|
||||
if ((*itr)->GetSpellInfo()->EquippedItemClass == -1)
|
||||
{
|
||||
armor = floor(AddPctN(armor, -(*itr)->GetAmount()));
|
||||
continue;
|
||||
if (!spellInfo || (*itr)->IsAffectedOnSpell(spellInfo) || (*itr)->GetMiscValue() & spellInfo->GetSchoolMask())
|
||||
bonusPct += (*itr)->GetAmount();
|
||||
else if (!(*itr)->GetMiscValue() && !(*itr)->HasSpellClassMask())
|
||||
bonusPct += (*itr)->GetAmount();
|
||||
}
|
||||
|
||||
// item dependent spell - check current weapons
|
||||
for (int i = 0; i < MAX_ATTACK; ++i)
|
||||
else
|
||||
{
|
||||
Item* weapon = ToPlayer()->GetWeaponForAttack(WeaponAttackType(i), true);
|
||||
|
||||
if (weapon && weapon->IsFitToSpellRequirements((*itr)->GetSpellInfo()))
|
||||
{
|
||||
armor = floor(AddPctN(armor, -(*itr)->GetAmount()));
|
||||
break;
|
||||
}
|
||||
if (ToPlayer() && ToPlayer()->HasItemFitToSpellRequirements((*itr)->GetSpellInfo()))
|
||||
bonusPct += (*itr)->GetAmount();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Apply Player CR_ARMOR_PENETRATION rating
|
||||
if (GetTypeId() == TYPEID_PLAYER)
|
||||
{
|
||||
float maxArmorPen = 0;
|
||||
if (getLevel() < 60)
|
||||
if (victim->getLevel() < 60)
|
||||
maxArmorPen = float(400 + 85 * victim->getLevel());
|
||||
else
|
||||
maxArmorPen = 400 + 85 * victim->getLevel() + 4.5f * 85 * (victim->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 = CalculatePctF(maxArmorPen, ToPlayer()->GetRatingBonusValue(CR_ARMOR_PENETRATION));
|
||||
float armorPen = CalculatePctF(maxArmorPen, bonusPct + ToPlayer()->GetRatingBonusValue(CR_ARMOR_PENETRATION));
|
||||
// Got the value, apply it
|
||||
armor -= std::min(armorPen, maxArmorPen);
|
||||
}
|
||||
|
||||
@@ -80,6 +80,7 @@ class AuraEffect
|
||||
bool IsPeriodic() const { return m_isPeriodic; }
|
||||
void SetPeriodic(bool isPeriodic) { m_isPeriodic = isPeriodic; }
|
||||
bool IsAffectedOnSpell(SpellInfo const* spell) const;
|
||||
bool HasSpellClassMask() const { return m_spellInfo->Effects[m_effIndex].SpellClassMask; }
|
||||
|
||||
void SendTickImmune(Unit* target, Unit* caster) const;
|
||||
void PeriodicTick(AuraApplication * aurApp, Unit* caster) const;
|
||||
|
||||
Reference in New Issue
Block a user