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()));
|
armor = floor(AddPctN(armor, -(*j)->GetAmount()));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Apply Player CR_ARMOR_PENETRATION rating and buffs from stances\specializations etc.
|
||||||
if (GetTypeId() == TYPEID_PLAYER)
|
if (GetTypeId() == TYPEID_PLAYER)
|
||||||
{
|
{
|
||||||
AuraEffectList const& ArPenAuras = GetAuraEffectsByType(SPELL_AURA_MOD_ARMOR_PENETRATION_PCT);
|
float bonusPct = 0;
|
||||||
for (AuraEffectList::const_iterator itr = ArPenAuras.begin(); itr != ArPenAuras.end(); ++itr)
|
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)
|
if ((*itr)->GetSpellInfo()->EquippedItemClass == -1)
|
||||||
{
|
{
|
||||||
armor = floor(AddPctN(armor, -(*itr)->GetAmount()));
|
if (!spellInfo || (*itr)->IsAffectedOnSpell(spellInfo) || (*itr)->GetMiscValue() & spellInfo->GetSchoolMask())
|
||||||
continue;
|
bonusPct += (*itr)->GetAmount();
|
||||||
|
else if (!(*itr)->GetMiscValue() && !(*itr)->HasSpellClassMask())
|
||||||
|
bonusPct += (*itr)->GetAmount();
|
||||||
}
|
}
|
||||||
|
else
|
||||||
// item dependent spell - check current weapons
|
|
||||||
for (int i = 0; i < MAX_ATTACK; ++i)
|
|
||||||
{
|
{
|
||||||
Item* weapon = ToPlayer()->GetWeaponForAttack(WeaponAttackType(i), true);
|
if (ToPlayer() && ToPlayer()->HasItemFitToSpellRequirements((*itr)->GetSpellInfo()))
|
||||||
|
bonusPct += (*itr)->GetAmount();
|
||||||
if (weapon && weapon->IsFitToSpellRequirements((*itr)->GetSpellInfo()))
|
|
||||||
{
|
|
||||||
armor = floor(AddPctN(armor, -(*itr)->GetAmount()));
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Apply Player CR_ARMOR_PENETRATION rating
|
|
||||||
if (GetTypeId() == TYPEID_PLAYER)
|
|
||||||
{
|
|
||||||
float maxArmorPen = 0;
|
float maxArmorPen = 0;
|
||||||
if (getLevel() < 60)
|
if (victim->getLevel() < 60)
|
||||||
maxArmorPen = float(400 + 85 * victim->getLevel());
|
maxArmorPen = float(400 + 85 * victim->getLevel());
|
||||||
else
|
else
|
||||||
maxArmorPen = 400 + 85 * victim->getLevel() + 4.5f * 85 * (victim->getLevel() - 59);
|
maxArmorPen = 400 + 85 * victim->getLevel() + 4.5f * 85 * (victim->getLevel() - 59);
|
||||||
// Cap armor penetration to this number
|
// Cap armor penetration to this number
|
||||||
maxArmorPen = std::min((armor + maxArmorPen) / 3, armor);
|
maxArmorPen = std::min((armor + maxArmorPen) / 3, armor);
|
||||||
// Figure out how much armor do we ignore
|
// 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
|
// Got the value, apply it
|
||||||
armor -= std::min(armorPen, maxArmorPen);
|
armor -= std::min(armorPen, maxArmorPen);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -80,6 +80,7 @@ class AuraEffect
|
|||||||
bool IsPeriodic() const { return m_isPeriodic; }
|
bool IsPeriodic() const { return m_isPeriodic; }
|
||||||
void SetPeriodic(bool isPeriodic) { m_isPeriodic = isPeriodic; }
|
void SetPeriodic(bool isPeriodic) { m_isPeriodic = isPeriodic; }
|
||||||
bool IsAffectedOnSpell(SpellInfo const* spell) const;
|
bool IsAffectedOnSpell(SpellInfo const* spell) const;
|
||||||
|
bool HasSpellClassMask() const { return m_spellInfo->Effects[m_effIndex].SpellClassMask; }
|
||||||
|
|
||||||
void SendTickImmune(Unit* target, Unit* caster) const;
|
void SendTickImmune(Unit* target, Unit* caster) const;
|
||||||
void PeriodicTick(AuraApplication * aurApp, Unit* caster) const;
|
void PeriodicTick(AuraApplication * aurApp, Unit* caster) const;
|
||||||
|
|||||||
Reference in New Issue
Block a user