[8454] Implement aura SPELL_AURA_MOD_TARGET_ARMOR_PCT.

This fix work stance 2457, talent 12284/13709 and ranks, partly talent 61154 and ranks.

Signed-off-by: VladimirMangos <vladimir@getmangos.com>
This commit is contained in:
Lutik 2009-09-02 18:43:25 +04:00 committed by VladimirMangos
parent 2e09244e57
commit ab9b738e54
3 changed files with 12 additions and 6 deletions

View file

@ -1565,6 +1565,7 @@ uint32 Unit::CalcArmorReducedDamage(Unit* pVictim, const uint32 damage)
{
uint32 newdamage = 0;
float armor = pVictim->GetArmor();
// Ignore enemy armor by SPELL_AURA_MOD_TARGET_RESISTANCE aura
armor += GetTotalAuraModifierByMiscMask(SPELL_AURA_MOD_TARGET_RESISTANCE, SPELL_SCHOOL_MASK_NORMAL);
@ -1572,19 +1573,24 @@ uint32 Unit::CalcArmorReducedDamage(Unit* pVictim, const uint32 damage)
if (GetTypeId()==TYPEID_PLAYER)
armor *= 1.0f - ((Player*)this)->GetRatingBonusValue(CR_ARMOR_PENETRATION) / 100.0f;
if (armor < 0.0f) armor=0.0f;
// Ignore enemy armor by SPELL_AURA_MOD_TARGET_ARMOR_PCT
armor *= 1.0f - GetTotalAuraModifier(SPELL_AURA_MOD_TARGET_ARMOR_PCT) / 100.0f;
if (armor < 0.0f)
armor = 0.0f;
float levelModifier = getLevel();
if ( levelModifier > 59 )
if (levelModifier > 59)
levelModifier = levelModifier + (4.5f * (levelModifier-59));
float tmpvalue = 0.1f * armor / (8.5f * levelModifier + 40);
tmpvalue = tmpvalue/(1.0f + tmpvalue);
if(tmpvalue < 0.0f)
if (tmpvalue < 0.0f)
tmpvalue = 0.0f;
if(tmpvalue > 0.75f)
if (tmpvalue > 0.75f)
tmpvalue = 0.75f;
newdamage = uint32(damage - (damage * tmpvalue));
return (newdamage > 1) ? newdamage : 1;