Fix resilience update for 3.3.x. Thanks dr.tenma.
Fixes issue #198. --HG-- branch : trunk
This commit is contained in:
@@ -1295,9 +1295,15 @@ void AuraEffect::PeriodicTick(Unit * target, Unit * caster) const
|
|||||||
damage -= target->GetSpellCritDamageReduction(damage);
|
damage -= target->GetSpellCritDamageReduction(damage);
|
||||||
}
|
}
|
||||||
|
|
||||||
// only from players
|
// Reduce damage from resilience for players and pets only.
|
||||||
if (IS_PLAYER_GUID(GetCasterGUID()))
|
// As of patch 3.3 pets inherit 100% of master resilience.
|
||||||
damage -= target->GetSpellDamageReduction(damage);
|
if (caster->GetSpellModOwner())
|
||||||
|
if (Player* modOwner = target->GetSpellModOwner())
|
||||||
|
{
|
||||||
|
if (crit)
|
||||||
|
damage -= modOwner->GetSpellCritDamageReduction(damage);
|
||||||
|
damage -= modOwner->GetSpellDamageReduction(damage);
|
||||||
|
}
|
||||||
|
|
||||||
caster->CalcAbsorbResist(target, GetSpellSchoolMask(GetSpellProto()), DOT, damage, &absorb, &resist, m_spellProto);
|
caster->CalcAbsorbResist(target, GetSpellSchoolMask(GetSpellProto()), DOT, damage, &absorb, &resist, m_spellProto);
|
||||||
|
|
||||||
@@ -1368,9 +1374,15 @@ void AuraEffect::PeriodicTick(Unit * target, Unit * caster) const
|
|||||||
damage = damageReductedArmor;
|
damage = damageReductedArmor;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Reduce dot damage from resilience for players.
|
// Reduce damage from resilience for players and pets only.
|
||||||
if (target->GetTypeId() == TYPEID_PLAYER)
|
// As of patch 3.3 pets inherit 100% of master resilience.
|
||||||
damage-=target->GetSpellDamageReduction(damage);
|
if (caster->GetSpellModOwner())
|
||||||
|
if (Player* modOwner = target->GetSpellModOwner())
|
||||||
|
{
|
||||||
|
if (crit)
|
||||||
|
damage -= modOwner->GetSpellCritDamageReduction(damage);
|
||||||
|
damage -= modOwner->GetSpellDamageReduction(damage);
|
||||||
|
}
|
||||||
|
|
||||||
caster->CalcAbsorbResist(target, GetSpellSchoolMask(GetSpellProto()), DOT, damage, &absorb, &resist, m_spellProto);
|
caster->CalcAbsorbResist(target, GetSpellSchoolMask(GetSpellProto()), DOT, damage, &absorb, &resist, m_spellProto);
|
||||||
|
|
||||||
|
|||||||
+74
-28
@@ -1083,13 +1083,8 @@ void Unit::CalculateSpellDamageTaken(SpellNonMeleeDamage *damageInfo, int32 dama
|
|||||||
|
|
||||||
if (critPctDamageMod != 0)
|
if (critPctDamageMod != 0)
|
||||||
damage = int32(damage * float((100.0f + critPctDamageMod)/100.0f));
|
damage = int32(damage * float((100.0f + critPctDamageMod)/100.0f));
|
||||||
|
|
||||||
// Resilience - reduce crit damage
|
|
||||||
if (attackType != RANGED_ATTACK)
|
|
||||||
damage -= pVictim->GetMeleeCritDamageReduction(damage);
|
|
||||||
else
|
|
||||||
damage -= pVictim->GetRangedCritDamageReduction(damage);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Spell weapon based damage CAN BE crit & blocked at same time
|
// Spell weapon based damage CAN BE crit & blocked at same time
|
||||||
if (blocked)
|
if (blocked)
|
||||||
{
|
{
|
||||||
@@ -1101,6 +1096,24 @@ void Unit::CalculateSpellDamageTaken(SpellNonMeleeDamage *damageInfo, int32 dama
|
|||||||
damageInfo->blocked = damage;
|
damageInfo->blocked = damage;
|
||||||
damage -= damageInfo->blocked;
|
damage -= damageInfo->blocked;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Reduce damage from resilience for players and pets only.
|
||||||
|
// As of patch 3.3 pets inherit 100% of master resilience.
|
||||||
|
if (GetSpellModOwner())
|
||||||
|
if (Player* modOwner = pVictim->GetSpellModOwner())
|
||||||
|
{
|
||||||
|
if (crit)
|
||||||
|
{
|
||||||
|
if (attackType != RANGED_ATTACK)
|
||||||
|
damage -= modOwner->GetMeleeCritDamageReduction(damage);
|
||||||
|
else
|
||||||
|
damage -= modOwner->GetRangedCritDamageReduction(damage);
|
||||||
|
}
|
||||||
|
if (attackType != RANGED_ATTACK)
|
||||||
|
damage -= modOwner->GetMeleeDamageReduction(damage);
|
||||||
|
else
|
||||||
|
damage -= modOwner->GetRangedDamageReduction(damage);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
// Magical Attacks
|
// Magical Attacks
|
||||||
@@ -1110,19 +1123,23 @@ void Unit::CalculateSpellDamageTaken(SpellNonMeleeDamage *damageInfo, int32 dama
|
|||||||
// If crit add critical bonus
|
// If crit add critical bonus
|
||||||
if (crit)
|
if (crit)
|
||||||
{
|
{
|
||||||
damageInfo->HitInfo|= SPELL_HIT_TYPE_CRIT;
|
damageInfo->HitInfo |= SPELL_HIT_TYPE_CRIT;
|
||||||
damage = SpellCriticalDamageBonus(spellInfo, damage, pVictim);
|
damage = SpellCriticalDamageBonus(spellInfo, damage, pVictim);
|
||||||
// Resilience - reduce crit damage
|
|
||||||
damage -= pVictim->GetSpellCritDamageReduction(damage);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Reduce damage from resilience for players and pets only.
|
||||||
|
// As of patch 3.3 pets inherit 100% of master resilience.
|
||||||
|
if (GetSpellModOwner())
|
||||||
|
if (Player* modOwner = pVictim->GetSpellModOwner())
|
||||||
|
{
|
||||||
|
if (crit)
|
||||||
|
damage -= modOwner->GetSpellCritDamageReduction(damage);
|
||||||
|
damage -= modOwner->GetSpellDamageReduction(damage);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
// only from players
|
|
||||||
if (GetTypeId() == TYPEID_PLAYER)
|
|
||||||
damage -= pVictim->GetSpellDamageReduction(damage);
|
|
||||||
|
|
||||||
// Calculate absorb resist
|
// Calculate absorb resist
|
||||||
if (damage > 0)
|
if (damage > 0)
|
||||||
{
|
{
|
||||||
@@ -1295,10 +1312,20 @@ void Unit::CalculateMeleeDamage(Unit *pVictim, uint32 damage, CalcDamageInfo *da
|
|||||||
if (mod != 0)
|
if (mod != 0)
|
||||||
damageInfo->damage = int32((damageInfo->damage) * float((100.0f + mod)/100.0f));
|
damageInfo->damage = int32((damageInfo->damage) * float((100.0f + mod)/100.0f));
|
||||||
|
|
||||||
// Resilience - reduce crit damage
|
// Reduce damage from resilience for players and pets only.
|
||||||
uint32 resilienceReduction = pVictim->GetMeleeCritDamageReduction(damageInfo->damage);
|
// As of patch 3.3 pets inherit 100% of master resilience.
|
||||||
damageInfo->damage -= resilienceReduction;
|
if (GetSpellModOwner())
|
||||||
damageInfo->cleanDamage += resilienceReduction;
|
if (Player* modOwner = pVictim->GetSpellModOwner())
|
||||||
|
{
|
||||||
|
uint32 resilienceReduction;
|
||||||
|
if (attackType != RANGED_ATTACK)
|
||||||
|
resilienceReduction = modOwner->GetMeleeCritDamageReduction(damageInfo->damage);
|
||||||
|
else
|
||||||
|
resilienceReduction = modOwner->GetRangedCritDamageReduction(damageInfo->damage);
|
||||||
|
|
||||||
|
damageInfo->damage -= resilienceReduction;
|
||||||
|
damageInfo->cleanDamage += resilienceReduction;
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case MELEE_HIT_PARRY:
|
case MELEE_HIT_PARRY:
|
||||||
@@ -1360,9 +1387,20 @@ void Unit::CalculateMeleeDamage(Unit *pVictim, uint32 damage, CalcDamageInfo *da
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
// only from players
|
// Reduce damage from resilience for players and pets only.
|
||||||
if (GetTypeId() == TYPEID_PLAYER)
|
// As of patch 3.3 pets inherit 100% of master resilience.
|
||||||
damage -= pVictim->GetMeleeDamageReduction(damage);
|
if (GetSpellModOwner())
|
||||||
|
if (Player* modOwner = pVictim->GetSpellModOwner())
|
||||||
|
{
|
||||||
|
uint32 resilienceReduction;
|
||||||
|
if (attackType != RANGED_ATTACK)
|
||||||
|
resilienceReduction = modOwner->GetMeleeDamageReduction(damageInfo->damage);
|
||||||
|
else
|
||||||
|
resilienceReduction = modOwner->GetRangedDamageReduction(damageInfo->damage);
|
||||||
|
|
||||||
|
damageInfo->damage -= resilienceReduction;
|
||||||
|
damageInfo->cleanDamage += resilienceReduction;
|
||||||
|
}
|
||||||
|
|
||||||
// Calculate absorb resist
|
// Calculate absorb resist
|
||||||
if (int32(damageInfo->damage) > 0)
|
if (int32(damageInfo->damage) > 0)
|
||||||
@@ -3101,13 +3139,18 @@ float Unit::GetUnitCriticalChance(WeaponAttackType attackType, const Unit *pVict
|
|||||||
// reduce crit chance from Rating for players
|
// reduce crit chance from Rating for players
|
||||||
if (attackType != RANGED_ATTACK)
|
if (attackType != RANGED_ATTACK)
|
||||||
{
|
{
|
||||||
crit -= pVictim->GetMeleeCritChanceReduction();
|
// Reduce crit chance from resilience for players and pets only.
|
||||||
// Glyph of barkskin
|
// As of patch 3.3 pets inherit 100% of master resilience.
|
||||||
if (pVictim->HasAura(63057) && pVictim->HasAura(22812))
|
if (GetSpellModOwner())
|
||||||
crit-=25.0f;
|
if (Player* modOwner = pVictim->GetSpellModOwner())
|
||||||
|
crit -= modOwner->GetMeleeCritChanceReduction();
|
||||||
|
// Glyph of barkskin
|
||||||
|
if (pVictim->HasAura(63057) && pVictim->HasAura(22812))
|
||||||
|
crit -= 25.0f;
|
||||||
}
|
}
|
||||||
else
|
else if (GetSpellModOwner())
|
||||||
crit -= pVictim->GetRangedCritChanceReduction();
|
if (Player* modOwner = pVictim->GetSpellModOwner())
|
||||||
|
crit -= modOwner->GetRangedCritChanceReduction();
|
||||||
|
|
||||||
// Apply crit chance from defence skill
|
// Apply crit chance from defence skill
|
||||||
crit += (int32(GetMaxSkillValueForLevel(pVictim)) - int32(pVictim->GetDefenseSkillValue(this))) * 0.04f;
|
crit += (int32(GetMaxSkillValueForLevel(pVictim)) - int32(pVictim->GetDefenseSkillValue(this))) * 0.04f;
|
||||||
@@ -10216,8 +10259,11 @@ bool Unit::isSpellCrit(Unit *pVictim, SpellEntry const *spellProto, SpellSchoolM
|
|||||||
crit_chance += pVictim->GetTotalAuraModifierByMiscMask(SPELL_AURA_MOD_ATTACKER_SPELL_CRIT_CHANCE, schoolMask);
|
crit_chance += pVictim->GetTotalAuraModifierByMiscMask(SPELL_AURA_MOD_ATTACKER_SPELL_CRIT_CHANCE, schoolMask);
|
||||||
// Modify critical chance by victim SPELL_AURA_MOD_ATTACKER_SPELL_AND_WEAPON_CRIT_CHANCE
|
// Modify critical chance by victim SPELL_AURA_MOD_ATTACKER_SPELL_AND_WEAPON_CRIT_CHANCE
|
||||||
crit_chance += pVictim->GetTotalAuraModifier(SPELL_AURA_MOD_ATTACKER_SPELL_AND_WEAPON_CRIT_CHANCE);
|
crit_chance += pVictim->GetTotalAuraModifier(SPELL_AURA_MOD_ATTACKER_SPELL_AND_WEAPON_CRIT_CHANCE);
|
||||||
// Modify by player victim resilience
|
// Reduce crit chance from resilience for players and pets only.
|
||||||
crit_chance -= pVictim->GetSpellCritChanceReduction();
|
// As of patch 3.3 pets inherit 100% of master resilience.
|
||||||
|
if (GetSpellModOwner())
|
||||||
|
if (Player* modOwner = pVictim->GetSpellModOwner())
|
||||||
|
crit_chance -= modOwner->GetSpellCritChanceReduction();
|
||||||
}
|
}
|
||||||
// scripted (increase crit chance ... against ... target by x%
|
// scripted (increase crit chance ... against ... target by x%
|
||||||
AuraEffectList const& mOverrideClassScript = GetAuraEffectsByType(SPELL_AURA_OVERRIDE_CLASS_SCRIPTS);
|
AuraEffectList const& mOverrideClassScript = GetAuraEffectsByType(SPELL_AURA_OVERRIDE_CLASS_SCRIPTS);
|
||||||
|
|||||||
+2
-2
@@ -1309,8 +1309,8 @@ class Unit : public WorldObject
|
|||||||
|
|
||||||
// player or player's pet resilience (-1%), cap 100%
|
// player or player's pet resilience (-1%), cap 100%
|
||||||
uint32 GetMeleeDamageReduction(uint32 damage) const { return GetCombatRatingDamageReduction(CR_CRIT_TAKEN_MELEE, 2.0f, 100.0f, damage); }
|
uint32 GetMeleeDamageReduction(uint32 damage) const { return GetCombatRatingDamageReduction(CR_CRIT_TAKEN_MELEE, 2.0f, 100.0f, damage); }
|
||||||
uint32 GetRangedDamageReduction(uint32 damage) const { return GetCombatRatingDamageReduction(CR_CRIT_TAKEN_MELEE, 2.0f, 100.0f, damage); }
|
uint32 GetRangedDamageReduction(uint32 damage) const { return GetCombatRatingDamageReduction(CR_CRIT_TAKEN_RANGED, 2.0f, 100.0f, damage); }
|
||||||
uint32 GetSpellDamageReduction(uint32 damage) const { return GetCombatRatingDamageReduction(CR_CRIT_TAKEN_MELEE, 2.0f, 100.0f, damage); }
|
uint32 GetSpellDamageReduction(uint32 damage) const { return GetCombatRatingDamageReduction(CR_CRIT_TAKEN_SPELL, 2.0f, 100.0f, damage); }
|
||||||
|
|
||||||
float MeleeSpellMissChance(const Unit *pVictim, WeaponAttackType attType, int32 skillDiff, uint32 spellId) const;
|
float MeleeSpellMissChance(const Unit *pVictim, WeaponAttackType attType, int32 skillDiff, uint32 spellId) const;
|
||||||
SpellMissInfo MeleeSpellHitResult(Unit *pVictim, SpellEntry const *spell);
|
SpellMissInfo MeleeSpellHitResult(Unit *pVictim, SpellEntry const *spell);
|
||||||
|
|||||||
Reference in New Issue
Block a user