Core/Entities: Adapted changes from 584abe107e

This commit is contained in:
joschiwald
2018-04-21 16:15:21 +02:00
parent 15d2126828
commit 6faec45f8d
+8 -5
View File
@@ -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))