aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/server/game/Entities/Unit/Unit.cpp46
1 files changed, 11 insertions, 35 deletions
diff --git a/src/server/game/Entities/Unit/Unit.cpp b/src/server/game/Entities/Unit/Unit.cpp
index 2b9b5b52ac8..fe21ef7ea72 100644
--- a/src/server/game/Entities/Unit/Unit.cpp
+++ b/src/server/game/Entities/Unit/Unit.cpp
@@ -1649,46 +1649,22 @@ void Unit::HandleEmoteCommand(Emote emoteId, Player* target /*=nullptr*/, Trinit
if (aurEff->GetMiscValue() & SPELL_SCHOOL_MASK_NORMAL && aurEff->IsAffectingSpell(spellInfo))
armor = std::floor(AddPct(armor, -aurEff->GetAmount()));
}
-
- // Apply Player CR_ARMOR_PENETRATION rating
- if (attacker->GetTypeId() == TYPEID_PLAYER)
- {
- float arpPct = attacker->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.f, armor);
- // Figure out how much armor do we ignore
- armor -= CalculatePct(maxArmorPen, arpPct);
- }
}
- if (G3D::fuzzyLe(armor, 0.0f))
- return damage;
-
- Classes attackerClass = CLASS_WARRIOR;
- if (attacker)
- {
- attackerLevel = attacker->GetLevelForTarget(victim);
- attackerClass = Classes(attacker->GetClass());
- }
+ if (armor < 0.0f)
+ armor = 0.0f;
- // Expansion and ContentTuningID necessary? Does Player get a ContentTuningID too ?
- float armorConstant = sDB2Manager.EvaluateExpectedStat(ExpectedStatType::ArmorConstant, attackerLevel, -2, 0, attackerClass, 0);
+ float levelModifier = attacker ? attacker->GetLevel() : attackerLevel;
+ if (levelModifier > 80)
+ levelModifier = levelModifier + (4.5f * (levelModifier - 59.f)) + (20 * (levelModifier - 80));
+ else if (levelModifier > 59.f)
+ levelModifier = levelModifier + 4.5f * (levelModifier - 59.f);
- if (!(armor + armorConstant))
- return damage;
+ float damageReduction = 0.1f * armor / (8.5f * levelModifier + 40.f);
+ damageReduction /= (1.0f + damageReduction);
- float mitigation = std::min(armor / (armor + armorConstant), 0.85f);
- return uint32(std::max(damage * (1.0f - mitigation), 0.0f));
+ RoundToInterval(damageReduction, 0.f, 0.75f);
+ return uint32(std::ceil(std::max(damage * (1.0f - damageReduction), 0.0f)));
}
/*static*/ uint32 Unit::CalcSpellResistedDamage(Unit const* attacker, Unit* victim, uint32 damage, SpellSchoolMask schoolMask, SpellInfo const* spellInfo)