Core/Spells: use DamageInfo struct to calc spell absorbs and resists, and use calculated proc hitMask on aura ticks

This commit is contained in:
ariel- authored and roc13x committed 2017-05-04 01:07:05 +01:00
1 parent 8bf21ad927
commit 3d9c4fd3fc
6 files changed
+114 -109

No files matched your search

+10 -9
View File
@@ -2335,19 +2335,20 @@ public:
// melee damage by specific school
if (!spellStr)
{
uint32 absorb = 0;
uint32 resist = 0;
Player* attacker = handler->GetSession()->GetPlayer();
DamageInfo dmgInfo(attacker, target, damage, nullptr, schoolmask, SPELL_DIRECT_DAMAGE, BASE_ATTACK);
attacker->CalcAbsorbResist(dmgInfo);
handler->GetSession()->GetPlayer()->CalcAbsorbResist(target, schoolmask, SPELL_DIRECT_DAMAGE, damage, &absorb, &resist);
if (damage <= absorb + resist)
if (!dmgInfo.GetDamage())
return true;
damage -= absorb + resist;
damage = dmgInfo.GetDamage();
handler->GetSession()->GetPlayer()->DealDamageMods(target, damage, &absorb);
handler->GetSession()->GetPlayer()->DealDamage(target, damage, NULL, DIRECT_DAMAGE, schoolmask, NULL, false);
handler->GetSession()->GetPlayer()->SendAttackStateUpdate (HITINFO_AFFECTS_VICTIM, target, 1, schoolmask, damage, absorb, resist, VICTIMSTATE_HIT, 0);
uint32 absorb = dmgInfo.GetAbsorb();
uint32 resist = dmgInfo.GetResist();
attacker->DealDamageMods(target, damage, &absorb);
attacker->DealDamage(target, damage, nullptr, DIRECT_DAMAGE, schoolmask, nullptr, false);
attacker->SendAttackStateUpdate(HITINFO_AFFECTS_VICTIM, target, 0, schoolmask, damage, absorb, resist, VICTIMSTATE_HIT, 0);
return true;
}