diff --git a/src/game/Player.cpp b/src/game/Player.cpp index 88541ba6c..14ac2c082 100644 --- a/src/game/Player.cpp +++ b/src/game/Player.cpp @@ -4823,6 +4823,15 @@ uint32 Player::GetMeleeCritDamageReduction(uint32 damage) const return uint32 (melee * damage /100.0f); } +uint32 Player::GetMeleeDamageReduction(uint32 damage) const +{ + float rate = GetRatingBonusValue(CR_CRIT_TAKEN_MELEE); + // Resilience not limited (limit it by 100%) + if (rate > 100.0f) + rate = 100.0f; + return uint32 (rate * damage / 100.0f); +} + uint32 Player::GetRangedCritDamageReduction(uint32 damage) const { float ranged = GetRatingBonusValue(CR_CRIT_TAKEN_RANGED)*2.2f; @@ -4830,6 +4839,15 @@ uint32 Player::GetRangedCritDamageReduction(uint32 damage) const return uint32 (ranged * damage /100.0f); } +uint32 Player::GetRangedDamageReduction(uint32 damage) const +{ + float rate = GetRatingBonusValue(CR_CRIT_TAKEN_RANGED); + // Resilience not limited (limit it by 100%) + if (rate > 100.0f) + rate = 100.0f; + return uint32 (rate * damage / 100.0f); +} + uint32 Player::GetSpellCritDamageReduction(uint32 damage) const { float spell = GetRatingBonusValue(CR_CRIT_TAKEN_SPELL)*2.2f; @@ -4839,13 +4857,13 @@ uint32 Player::GetSpellCritDamageReduction(uint32 damage) const return uint32 (spell * damage / 100.0f); } -uint32 Player::GetDotDamageReduction(uint32 damage) const +uint32 Player::GetSpellDamageReduction(uint32 damage) const { - float spellDot = GetRatingBonusValue(CR_CRIT_TAKEN_SPELL); - // Dot resilience not limited (limit it by 100%) - if (spellDot > 100.0f) - spellDot = 100.0f; - return uint32 (spellDot * damage / 100.0f); + float rate = GetRatingBonusValue(CR_CRIT_TAKEN_SPELL); + // Resilience not limited (limit it by 100%) + if (rate > 100.0f) + rate = 100.0f; + return uint32 (rate * damage / 100.0f); } float Player::GetExpertiseDodgeOrParryReduction(WeaponAttackType attType) const diff --git a/src/game/Player.h b/src/game/Player.h index 5d0a4fbcf..39a25e8f0 100644 --- a/src/game/Player.h +++ b/src/game/Player.h @@ -1723,9 +1723,11 @@ class MANGOS_DLL_SPEC Player : public Unit float GetRatingCoefficient(CombatRating cr) const; float GetRatingBonusValue(CombatRating cr) const; uint32 GetMeleeCritDamageReduction(uint32 damage) const; + uint32 GetMeleeDamageReduction(uint32 damage) const; uint32 GetRangedCritDamageReduction(uint32 damage) const; + uint32 GetRangedDamageReduction(uint32 damage) const; uint32 GetSpellCritDamageReduction(uint32 damage) const; - uint32 GetDotDamageReduction(uint32 damage) const; + uint32 GetSpellDamageReduction(uint32 damage) const; uint32 GetBaseSpellPowerBonus() { return m_baseSpellPower; } float GetExpertiseDodgeOrParryReduction(WeaponAttackType attType) const; diff --git a/src/game/SpellAuras.cpp b/src/game/SpellAuras.cpp index 6948cbd00..c1723f711 100644 --- a/src/game/SpellAuras.cpp +++ b/src/game/SpellAuras.cpp @@ -6355,11 +6355,6 @@ void Aura::PeriodicTick() // This method can modify pdamage bool isCrit = IsCritFromAbilityAura(pCaster, pdamage); - // As of 2.2 resilience reduces damage from DoT ticks as much as the chance to not be critically hit - // Reduce dot damage from resilience for players - if (m_target->GetTypeId() == TYPEID_PLAYER) - pdamage-=((Player*)m_target)->GetDotDamageReduction(pdamage); - pCaster->CalcAbsorbResist(m_target, GetSpellSchoolMask(GetSpellProto()), DOT, pdamage, &absorb, &resist); sLog.outDetail("PeriodicTick: %u (TypeId: %u) attacked %u (TypeId: %u) for %u dmg inflicted by %u abs is %u", @@ -6415,11 +6410,6 @@ void Aura::PeriodicTick() pdamage = pCaster->SpellDamageBonus(m_target, GetSpellProto(), pdamage, DOT, GetStackAmount()); - // As of 2.2 resilience reduces damage from DoT ticks as much as the chance to not be critically hit - // Reduce dot damage from resilience for players - if (m_target->GetTypeId()==TYPEID_PLAYER) - pdamage-=((Player*)m_target)->GetDotDamageReduction(pdamage); - pCaster->CalcAbsorbResist(m_target, GetSpellSchoolMask(GetSpellProto()), DOT, pdamage, &absorb, &resist); if(m_target->GetHealth() < pdamage) diff --git a/src/game/Unit.cpp b/src/game/Unit.cpp index 3b19f33d9..e0d330cb8 100644 --- a/src/game/Unit.cpp +++ b/src/game/Unit.cpp @@ -1120,6 +1120,9 @@ void Unit::CalculateSpellDamage(SpellNonMeleeDamage *damageInfo, int32 damage, S break; } + if (GetTypeId() == TYPEID_PLAYER && pVictim->GetTypeId() == TYPEID_PLAYER) + damage -= ((Player*)pVictim)->GetSpellDamageReduction(damage); + // Calculate absorb resist if(damage > 0) { @@ -1408,6 +1411,14 @@ void Unit::CalculateMeleeDamage(Unit *pVictim, uint32 damage, CalcDamageInfo *da break; } + if (GetTypeId() == TYPEID_PLAYER && pVictim->GetTypeId() == TYPEID_PLAYER) + { + if (attackType != RANGED_ATTACK) + damage-=((Player*)pVictim)->GetMeleeDamageReduction(damage); + else + damage-=((Player*)pVictim)->GetRangedDamageReduction(damage); + } + // Calculate absorb resist if(int32(damageInfo->damage) > 0) { diff --git a/src/shared/revision_nr.h b/src/shared/revision_nr.h index ea33176bb..eb7705dbc 100644 --- a/src/shared/revision_nr.h +++ b/src/shared/revision_nr.h @@ -1,4 +1,4 @@ #ifndef __REVISION_NR_H__ #define __REVISION_NR_H__ - #define REVISION_NR "8616" + #define REVISION_NR "8617" #endif // __REVISION_NR_H__