[8617] Update resilience affect for 3.2.x

Signed-off-by: VladimirMangos <vladimir@getmangos.com>
This commit is contained in:
Lutik 2009-10-10 14:49:31 +04:00 committed by VladimirMangos
parent f5db4fc163
commit ddb67f69ca
5 changed files with 39 additions and 18 deletions

View file

@ -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

View file

@ -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;

View file

@ -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)

View file

@ -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)
{

View file

@ -1,4 +1,4 @@
#ifndef __REVISION_NR_H__
#define __REVISION_NR_H__
#define REVISION_NR "8616"
#define REVISION_NR "8617"
#endif // __REVISION_NR_H__