mirror of
https://github.com/araxiaonline/TrinityCore.git
synced 2026-06-18 14:10:18 -04:00
Core/Entities: Adapted changes from 584abe107e
This commit is contained in:
@@ -1599,18 +1599,21 @@ uint32 Unit::CalcArmorReducedDamage(Unit* attacker, Unit* victim, const uint32 d
|
||||
// Apply Player CR_ARMOR_PENETRATION rating
|
||||
if (GetTypeId() == TYPEID_PLAYER)
|
||||
{
|
||||
float maxArmorPen = 0;
|
||||
float arpPct = ToPlayer()->GetRatingBonusValue(CR_ARMOR_PENETRATION);
|
||||
|
||||
// no more than 100%
|
||||
RoundToInterval(arpPct, 0.f, 100.f);
|
||||
|
||||
float maxArmorPen = 0.f;
|
||||
if (victim->GetLevelForTarget(attacker) < 60)
|
||||
maxArmorPen = float(400 + 85 * victim->GetLevelForTarget(attacker));
|
||||
else
|
||||
maxArmorPen = 400 + 85 * victim->GetLevelForTarget(attacker) + 4.5f * 85 * (victim->GetLevelForTarget(attacker) - 59);
|
||||
|
||||
// Cap armor penetration to this number
|
||||
maxArmorPen = std::min((armor + maxArmorPen) / 3, armor);
|
||||
maxArmorPen = std::min((armor + maxArmorPen) / 3.f, armor);
|
||||
// Figure out how much armor do we ignore
|
||||
float armorPen = CalculatePct(maxArmorPen, ToPlayer()->GetRatingBonusValue(CR_ARMOR_PENETRATION));
|
||||
// Got the value, apply it
|
||||
armor -= std::min(armorPen, maxArmorPen);
|
||||
armor -= CalculatePct(maxArmorPen, arpPct);
|
||||
}
|
||||
|
||||
if (G3D::fuzzyLe(armor, 0.0f))
|
||||
|
||||
Reference in New Issue
Block a user