From 1ef8ea1161d5ef36b645e3667c11c30a9a1c9b50 Mon Sep 17 00:00:00 2001 From: Lynx3d Date: Sat, 20 Nov 2010 04:18:29 +0100 Subject: [PATCH] [10756] Implement armor penetration limitations The tool-tip says "up to X%" for a reason... --- src/game/Unit.cpp | 12 +++++++++++- src/shared/revision_nr.h | 2 +- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/src/game/Unit.cpp b/src/game/Unit.cpp index 2f6c78816..f0dfc3395 100644 --- a/src/game/Unit.cpp +++ b/src/game/Unit.cpp @@ -1841,7 +1841,17 @@ uint32 Unit::CalcArmorReducedDamage(Unit* pVictim, const uint32 damage) // Apply Player CR_ARMOR_PENETRATION rating and percent talents if (GetTypeId()==TYPEID_PLAYER) - armor *= 1.0f - ((Player*)this)->GetArmorPenetrationPct() / 100.0f; + { + float maxArmorPen = 400 + 85 * pVictim->getLevel(); + if (getLevel() > 59) + maxArmorPen += 4.5f * 85 * (pVictim->getLevel()-59); + // Cap ignored armor to this value + maxArmorPen = std::min(((armor+maxArmorPen)/3), armor); + // Also, armor penetration is limited to 100% since 3.1.2, before greater values did + // continue to give benefit for targets with more armor than the above cap + float armorPenPct = std::min(100.f, ((Player*)this)->GetArmorPenetrationPct()); + armor -= maxArmorPen * armorPenPct / 100.0f; + } if (armor < 0.0f) armor = 0.0f; diff --git a/src/shared/revision_nr.h b/src/shared/revision_nr.h index 16879572b..5cc0539c6 100644 --- a/src/shared/revision_nr.h +++ b/src/shared/revision_nr.h @@ -1,4 +1,4 @@ #ifndef __REVISION_NR_H__ #define __REVISION_NR_H__ - #define REVISION_NR "10755" + #define REVISION_NR "10756" #endif // __REVISION_NR_H__