Jump to content

[Fix] Armor Penetration Cap


Guest Agiko

Recommended Posts

* What bug does the patch fix? What features does the patch add?

Fixes Armor penetration Cap

* For which repository revision was the patch created?

All Rev that supports 3.1.0 and greater

* Is there a thread in the bug report section or at lighthouse? If yes, please add a link to the thread.

Nope

* Who has been writing this patch? Please include either forum user names or email addresses.

Me

Armor Penetration is Incorrectly calaulated it was taking the entire armor of the victim, This is wrong.

The correct way is

If (level<60)

C=400+85*targetlevel

Else

C=400+85*targetlevel+4.5*85*(targetlevel-59);

CAP : (armor + C)/3.

From the cap we get the % of armor pen and times by the rating and that how much armor can be ignored

CAP*ArmorpenPct

Fix

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);

// Apply Player CR_ARMOR_PENETRATION rating and percent talents
   if (GetTypeId()==TYPEID_PLAYER)
+    {
+
+         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;
+
+    }
-          armor *= 1.0f - ((Player*)this)->GetArmorPenetrationPct() / 100.0f;
+        //armor *= 1.0f - ((Player*)this)->GetArmorPenetrationPct() / 100.0f;

Link to comment
Share on other sites

  • 1 month later...

1. You skip GetArmorPenetrationPct() and then skip apply SPELL_AURA_MOD_TARGET_ARMOR_PCT auras affect. I think this jusy wrong...

2. This not very good style place client used hacky formulas with raw coeffs from level explcitly in function. Better place level dependent formula itself int o Formulas.h maybe

If some formula published at well known wiki not make it 100% sure correct and include on all specific cases and details.

Link to comment
Share on other sites

This should do it..

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);

// Apply Player CR_ARMOR_PENETRATION rating and percent talents
   if (GetTypeId()==TYPEID_PLAYER)
+   {
+
+        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)->GetArmorPenetrationPct() / 100.0f;
+        // Got the value, apply it
+        armor -= armorPen;
+
+   }
-          armor *= 1.0f - ((Player*)this)->GetArmorPenetrationPct() / 100.0f;
+        //armor *= 1.0f - ((Player*)this)->GetArmorPenetrationPct() / 100.0f;

Link to comment
Share on other sites

  • 4 weeks later...
  • 8 months later...
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue. Privacy Policy Terms of Use