Core/Entities: Change Armor Penetration
This commit is contained in:
@@ -2599,18 +2599,21 @@ namespace Game.Entities
|
|||||||
// Apply Player CR_ARMOR_PENETRATION rating
|
// Apply Player CR_ARMOR_PENETRATION rating
|
||||||
if (IsTypeId(TypeId.Player))
|
if (IsTypeId(TypeId.Player))
|
||||||
{
|
{
|
||||||
float maxArmorPen = 0;
|
float arpPct = ToPlayer().GetRatingBonusValue(CombatRating.ArmorPenetration);
|
||||||
|
|
||||||
|
// no more than 100%
|
||||||
|
MathFunctions.RoundToInterval(ref arpPct, 0.0f, 100.0f);
|
||||||
|
|
||||||
|
float maxArmorPen = 0.0f;
|
||||||
if (victim.GetLevelForTarget(attacker) < 60)
|
if (victim.GetLevelForTarget(attacker) < 60)
|
||||||
maxArmorPen = 400 + 85 * victim.GetLevelForTarget(attacker);
|
maxArmorPen = 400 + 85 * victim.GetLevelForTarget(attacker);
|
||||||
else
|
else
|
||||||
maxArmorPen = 400 + 85 * victim.GetLevelForTarget(attacker) + 4.5f * 85 * (victim.GetLevelForTarget(attacker) - 59);
|
maxArmorPen = 400 + 85 * victim.GetLevelForTarget(attacker) + 4.5f * 85 * (victim.GetLevelForTarget(attacker) - 59);
|
||||||
|
|
||||||
// Cap armor penetration to this number
|
// Cap armor penetration to this number
|
||||||
maxArmorPen = Math.Min((armor + maxArmorPen) / 3, armor);
|
maxArmorPen = Math.Min((armor + maxArmorPen) / 3.0f, armor);
|
||||||
// Figure out how much armor do we ignore
|
// Figure out how much armor do we ignore
|
||||||
float armorPen = MathFunctions.CalculatePct(maxArmorPen, ToPlayer().GetRatingBonusValue(CombatRating.ArmorPenetration));
|
armor -= MathFunctions.CalculatePct(maxArmorPen, arpPct);
|
||||||
// Got the value, apply it
|
|
||||||
armor -= Math.Min(armorPen, maxArmorPen);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (MathFunctions.fuzzyLe(armor, 0.0f))
|
if (MathFunctions.fuzzyLe(armor, 0.0f))
|
||||||
|
|||||||
Reference in New Issue
Block a user