Skip to content

Commit

Permalink
Core/Players: Fixed some more "issues" with resilience.
Browse files Browse the repository at this point in the history
  • Loading branch information
Warpten committed Jan 14, 2014
1 parent f9ccb6f commit b2de15e
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 11 deletions.
10 changes: 4 additions & 6 deletions src/server/game/Entities/Unit/Unit.cpp
Expand Up @@ -1016,7 +1016,7 @@ void Unit::CalculateSpellDamageTaken(SpellNonMeleeDamage* damageInfo, int32 dama
damage -= damageInfo->blocked;
}

ApplyResilience(victim, &damage, crit);
ApplyResilience(victim, &damage);
break;
}
// Magical Attacks
Expand All @@ -1030,7 +1030,7 @@ void Unit::CalculateSpellDamageTaken(SpellNonMeleeDamage* damageInfo, int32 dama
damage = SpellCriticalDamageBonus(spellInfo, damage, victim);
}

ApplyResilience(victim, &damage, crit);
ApplyResilience(victim, &damage);
break;
}
default:
Expand Down Expand Up @@ -1242,7 +1242,7 @@ void Unit::CalculateMeleeDamage(Unit* victim, uint32 damage, CalcDamageInfo* dam
damageInfo->HitInfo |= HITINFO_AFFECTS_VICTIM;

int32 resilienceReduction = damageInfo->damage;
ApplyResilience(victim, &resilienceReduction, damageInfo->hitOutCome == MELEE_HIT_CRIT);
ApplyResilience(victim, &resilienceReduction);
resilienceReduction = damageInfo->damage - resilienceReduction;
damageInfo->damage -= resilienceReduction;
damageInfo->cleanDamage += resilienceReduction;
Expand Down Expand Up @@ -14438,7 +14438,7 @@ void Unit::SendPlaySpellVisualKit(uint32 id, uint32 unkParam)
SendMessageToSet(&data, true);
}

void Unit::ApplyResilience(Unit const* victim, int32* damage, bool isCrit) const
void Unit::ApplyResilience(Unit const* victim, int32* damage) const
{
// player mounted on multi-passenger mount is also classified as vehicle
if (IsVehicle() || (victim->IsVehicle() && victim->GetTypeId() != TYPEID_PLAYER))
Expand All @@ -14457,8 +14457,6 @@ void Unit::ApplyResilience(Unit const* victim, int32* damage, bool isCrit) const
if (!target)
return;

if (isCrit)
*damage -= target->GetCritDamageReduction(*damage);
*damage -= target->GetDamageReduction(*damage);
}

Expand Down
5 changes: 2 additions & 3 deletions src/server/game/Entities/Unit/Unit.h
Expand Up @@ -1473,10 +1473,9 @@ class Unit : public WorldObject
void DealSpellDamage(SpellNonMeleeDamage* damageInfo, bool durabilityLoss);

// player or player's pet resilience (-1%)
uint32 GetCritDamageReduction(uint32 damage) const { return GetCombatRatingDamageReduction(CR_RESILIENCE_CRIT_TAKEN, 2.2f, 33.0f, damage); }
uint32 GetDamageReduction(uint32 damage) const { return GetCombatRatingDamageReduction(CR_RESILIENCE_PLAYER_DAMAGE_TAKEN, 2.0f, 100.0f, damage); }
uint32 GetDamageReduction(uint32 damage) const { return GetCombatRatingDamageReduction(CR_RESILIENCE_PLAYER_DAMAGE_TAKEN, 1.0f, 100.0f, damage); }

void ApplyResilience(Unit const* victim, int32 * damage, bool isCrit) const;
void ApplyResilience(Unit const* victim, int32* damage) const;

float MeleeSpellMissChance(Unit const* victim, WeaponAttackType attType, uint32 spellId) const;
SpellMissInfo MeleeSpellHitResult(Unit* victim, SpellInfo const* spellInfo);
Expand Down
4 changes: 2 additions & 2 deletions src/server/game/Spells/Auras/SpellAuraEffects.cpp
Expand Up @@ -5835,7 +5835,7 @@ void AuraEffect::HandlePeriodicDamageAurasTick(Unit* target, Unit* caster) const
damage = caster->SpellCriticalDamageBonus(m_spellInfo, damage, target);

int32 dmg = damage;
caster->ApplyResilience(target, &dmg, crit);
caster->ApplyResilience(target, &dmg);
damage = dmg;

caster->CalcAbsorbResist(target, GetSpellInfo()->GetSchoolMask(), DOT, damage, &absorb, &resist, GetSpellInfo());
Expand Down Expand Up @@ -5902,7 +5902,7 @@ void AuraEffect::HandlePeriodicHealthLeechAuraTick(Unit* target, Unit* caster) c
}

int32 dmg = damage;
caster->ApplyResilience(target, &dmg, crit);
caster->ApplyResilience(target, &dmg);
damage = dmg;

caster->CalcAbsorbResist(target, GetSpellInfo()->GetSchoolMask(), DOT, damage, &absorb, &resist, m_spellInfo);
Expand Down

2 comments on commit b2de15e

@Warpten
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Resilience no longer reduces further crit damage taken since Cataclysm. (Although it didnt really have an impact as all the gametables had zero as reduction rate). But doubling resilience sure did.

@Warpten
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

And yes, it was intended

Please sign in to comment.