diff options
| author | Aqua Deus <95978183+aquadeus@users.noreply.github.com> | 2024-11-08 12:15:27 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2024-11-08 12:15:27 +0100 |
| commit | 11f6576f04688fb89d97e2bbe7ae97a8b6585415 (patch) | |
| tree | 64360dc1830aae247f32b20ee951e2bc104fd568 /src/server/game/Entities/Unit | |
| parent | c00dde7e2c8101813344ed9e475978988b7d4092 (diff) | |
Core/Auras: Reimplement SPELL_AURA_MOD_ARMOR_PENETRATION_PCT, it is back from the dead (#30410)
Diffstat (limited to 'src/server/game/Entities/Unit')
| -rw-r--r-- | src/server/game/Entities/Unit/Unit.cpp | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/src/server/game/Entities/Unit/Unit.cpp b/src/server/game/Entities/Unit/Unit.cpp index 7c3d7514ffc..03376801b3e 100644 --- a/src/server/game/Entities/Unit/Unit.cpp +++ b/src/server/game/Entities/Unit/Unit.cpp @@ -1661,7 +1661,7 @@ void Unit::HandleEmoteCommand(Emote emoteId, Player* target /*=nullptr*/, Trinit return !spellInfo || !spellInfo->HasAttribute(SPELL_ATTR0_CU_IGNORE_ARMOR); } -/*static*/ uint32 Unit::CalcArmorReducedDamage(Unit const* attacker, Unit* victim, uint32 damage, SpellInfo const* spellInfo, WeaponAttackType /*attackType*/ /*= MAX_ATTACK*/, uint8 attackerLevel /*= 0*/) +/*static*/ uint32 Unit::CalcArmorReducedDamage(Unit const* attacker, Unit* victim, uint32 damage, SpellInfo const* spellInfo, WeaponAttackType attackType /*= MAX_ATTACK*/, uint8 attackerLevel /*= 0*/) { float armor = float(victim->GetArmor()); @@ -1691,11 +1691,17 @@ void Unit::HandleEmoteCommand(Emote emoteId, Player* target /*=nullptr*/, Trinit armor = std::floor(AddPct(armor, -aurEff->GetAmount())); } - // Apply Player CR_ARMOR_PENETRATION rating + // Apply Player CR_ARMOR_PENETRATION rating and buffs from stances\specializations etc. if (attacker->GetTypeId() == TYPEID_PLAYER) { float arpPct = attacker->ToPlayer()->GetRatingBonusValue(CR_ARMOR_PENETRATION); + Item const* weapon = attacker->ToPlayer()->GetWeaponForAttack(attackType, true); + arpPct += attacker->GetTotalAuraModifier(SPELL_AURA_MOD_ARMOR_PENETRATION_PCT, [weapon](AuraEffect const* aurEff) -> bool + { + return aurEff->GetSpellInfo()->IsItemFitToSpellRequirements(weapon); + }); + // no more than 100% RoundToInterval(arpPct, 0.f, 100.f); |
