diff options
author | Ovahlord <dreadkiller@gmx.de> | 2023-11-24 17:27:50 +0100 |
---|---|---|
committer | Ovahlord <dreadkiller@gmx.de> | 2023-11-24 17:27:50 +0100 |
commit | cfaec0a08ae7f996ba660418229efc0ed322e3e5 (patch) | |
tree | 90ea6f661658eaffe1874bf3d4785fc14155bb23 | |
parent | 2c6a018079e66be39cf80fb13260a2e434e51969 (diff) |
Core/Units: downgraded armor damage reduction
-rw-r--r-- | src/server/game/Entities/Unit/Unit.cpp | 22 |
1 files changed, 8 insertions, 14 deletions
diff --git a/src/server/game/Entities/Unit/Unit.cpp b/src/server/game/Entities/Unit/Unit.cpp index a55a2aba0df..6b2bc3dc3f3 100644 --- a/src/server/game/Entities/Unit/Unit.cpp +++ b/src/server/game/Entities/Unit/Unit.cpp @@ -1671,23 +1671,17 @@ void Unit::HandleEmoteCommand(Emote emoteId, Player* target /*=nullptr*/, Trinit } if (G3D::fuzzyLe(armor, 0.0f)) - return damage; + armor = 0.0f; - Classes attackerClass = CLASS_WARRIOR; - if (attacker) - { - attackerLevel = attacker->GetLevelForTarget(victim); - attackerClass = Classes(attacker->GetClass()); - } - - // 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 > 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) |