Core/Auras: Don't cache aura object fields in periodic damage aura handler, as it's not needed.

This commit is contained in:
QAston
2011-06-30 00:00:20 +02:00
parent 6f0af070c0
commit d31f53c16a
@@ -6065,26 +6065,21 @@ void AuraEffect::HandlePeriodicDamageAurasTick(Unit* target, Unit* caster) const
return; return;
} }
// We use it to fight with invalid data that appears later sometimes.
SpellEntry const*spellProto = GetSpellProto();
const uint32 effIndex = GetEffIndex();
uint64 casterGuid = GetCasterGUID();
// Consecrate ticks can miss and will not show up in the combat log // Consecrate ticks can miss and will not show up in the combat log
if (spellProto->Effect[effIndex] == SPELL_EFFECT_PERSISTENT_AREA_AURA && if (GetSpellProto()->Effect[GetEffIndex()] == SPELL_EFFECT_PERSISTENT_AREA_AURA &&
caster->SpellHitResult(target, spellProto, false) != SPELL_MISS_NONE) caster->SpellHitResult(target, GetSpellProto(), false) != SPELL_MISS_NONE)
return; return;
// some auras remove at specific health level or more // some auras remove at specific health level or more
if (GetAuraType() == SPELL_AURA_PERIODIC_DAMAGE) if (GetAuraType() == SPELL_AURA_PERIODIC_DAMAGE)
{ {
switch (spellProto->Id) switch (GetSpellProto()->Id)
{ {
case 43093: case 31956: case 38801: // Grievous Wound case 43093: case 31956: case 38801: // Grievous Wound
case 35321: case 38363: case 39215: // Gushing Wound case 35321: case 38363: case 39215: // Gushing Wound
if (target->IsFullHealth()) if (target->IsFullHealth())
{ {
target->RemoveAurasDueToSpell(spellProto->Id); target->RemoveAurasDueToSpell(GetSpellProto()->Id);
return; return;
} }
break; break;
@@ -6093,7 +6088,7 @@ void AuraEffect::HandlePeriodicDamageAurasTick(Unit* target, Unit* caster) const
uint32 percent = SpellMgr::CalculateSpellEffectAmount(GetSpellProto(), 1, caster); uint32 percent = SpellMgr::CalculateSpellEffectAmount(GetSpellProto(), 1, caster);
if (!target->HealthBelowPct(percent)) if (!target->HealthBelowPct(percent))
{ {
target->RemoveAurasDueToSpell(spellProto->Id); target->RemoveAurasDueToSpell(GetSpellProto()->Id);
return; return;
} }
break; break;
@@ -6110,18 +6105,18 @@ void AuraEffect::HandlePeriodicDamageAurasTick(Unit* target, Unit* caster) const
if (GetAuraType() == SPELL_AURA_PERIODIC_DAMAGE) if (GetAuraType() == SPELL_AURA_PERIODIC_DAMAGE)
{ {
damage = caster->SpellDamageBonus(target, spellProto, damage, DOT, GetBase()->GetStackAmount()); damage = caster->SpellDamageBonus(target, GetSpellProto(), damage, DOT, GetBase()->GetStackAmount());
// Calculate armor mitigation // Calculate armor mitigation
if (Unit::IsDamageReducedByArmor(GetSpellSchoolMask(spellProto), spellProto, effIndex)) if (Unit::IsDamageReducedByArmor(GetSpellSchoolMask(GetSpellProto()), GetSpellProto(), GetEffIndex()))
{ {
uint32 damageReductedArmor = caster->CalcArmorReducedDamage(target, damage, spellProto); uint32 damageReductedArmor = caster->CalcArmorReducedDamage(target, damage, GetSpellProto());
cleanDamage.mitigated_damage += damage - damageReductedArmor; cleanDamage.mitigated_damage += damage - damageReductedArmor;
damage = damageReductedArmor; damage = damageReductedArmor;
} }
// Curse of Agony damage-per-tick calculation // Curse of Agony damage-per-tick calculation
if (spellProto->SpellFamilyName == SPELLFAMILY_WARLOCK && (spellProto->SpellFamilyFlags[0] & 0x400) && spellProto->SpellIconID == 544) if (GetSpellProto()->SpellFamilyName == SPELLFAMILY_WARLOCK && (GetSpellProto()->SpellFamilyFlags[0] & 0x400) && GetSpellProto()->SpellIconID == 544)
{ {
uint32 totalTick = GetTotalTicks(); uint32 totalTick = GetTotalTicks();
// 1..4 ticks, 1/2 from normal tick damage // 1..4 ticks, 1/2 from normal tick damage
@@ -6133,7 +6128,7 @@ void AuraEffect::HandlePeriodicDamageAurasTick(Unit* target, Unit* caster) const
// 5..8 ticks have normal tick damage // 5..8 ticks have normal tick damage
} }
// There is a Chance to make a Soul Shard when Drain soul does damage // There is a Chance to make a Soul Shard when Drain soul does damage
if (spellProto->SpellFamilyName == SPELLFAMILY_WARLOCK && (spellProto->SpellFamilyFlags[0] & 0x00004000)) if (GetSpellProto()->SpellFamilyName == SPELLFAMILY_WARLOCK && (GetSpellProto()->SpellFamilyFlags[0] & 0x00004000))
{ {
if (caster->GetTypeId() == TYPEID_PLAYER && caster->ToPlayer()->isHonorOrXPTarget(target)) if (caster->GetTypeId() == TYPEID_PLAYER && caster->ToPlayer()->isHonorOrXPTarget(target))
{ {
@@ -6147,7 +6142,7 @@ void AuraEffect::HandlePeriodicDamageAurasTick(Unit* target, Unit* caster) const
} }
} }
} }
if (spellProto->SpellFamilyName == SPELLFAMILY_GENERIC) if (GetSpellProto()->SpellFamilyName == SPELLFAMILY_GENERIC)
{ {
switch (GetId()) switch (GetId())
{ {
@@ -6173,7 +6168,7 @@ void AuraEffect::HandlePeriodicDamageAurasTick(Unit* target, Unit* caster) const
caster->ApplyResilience(target, NULL, &dmg, crit, CR_CRIT_TAKEN_SPELL); caster->ApplyResilience(target, NULL, &dmg, crit, CR_CRIT_TAKEN_SPELL);
damage = dmg; damage = dmg;
caster->CalcAbsorbResist(target, GetSpellSchoolMask(spellProto), DOT, damage, &absorb, &resist, spellProto); caster->CalcAbsorbResist(target, GetSpellSchoolMask(GetSpellProto()), DOT, damage, &absorb, &resist, GetSpellProto());
sLog->outDetail("PeriodicTick: %u (TypeId: %u) attacked %u (TypeId: %u) for %u dmg inflicted by %u abs is %u", sLog->outDetail("PeriodicTick: %u (TypeId: %u) attacked %u (TypeId: %u) for %u dmg inflicted by %u abs is %u",
GUID_LOPART(GetCasterGUID()), GuidHigh2TypeId(GUID_HIPART(GetCasterGUID())), target->GetGUIDLow(), target->GetTypeId(), damage, GetId(), absorb); GUID_LOPART(GetCasterGUID()), GuidHigh2TypeId(GUID_HIPART(GetCasterGUID())), target->GetGUIDLow(), target->GetTypeId(), damage, GetId(), absorb);
@@ -6195,9 +6190,9 @@ void AuraEffect::HandlePeriodicDamageAurasTick(Unit* target, Unit* caster) const
SpellPeriodicAuraLogInfo pInfo(this, damage, overkill, absorb, resist, 0.0f, crit); SpellPeriodicAuraLogInfo pInfo(this, damage, overkill, absorb, resist, 0.0f, crit);
target->SendPeriodicAuraLog(&pInfo); target->SendPeriodicAuraLog(&pInfo);
caster->ProcDamageAndSpell(target, procAttacker, procVictim, procEx, damage, BASE_ATTACK, spellProto); caster->ProcDamageAndSpell(target, procAttacker, procVictim, procEx, damage, BASE_ATTACK, GetSpellProto());
caster->DealDamage(target, damage, &cleanDamage, DOT, GetSpellSchoolMask(spellProto), spellProto, true); caster->DealDamage(target, damage, &cleanDamage, DOT, GetSpellSchoolMask(GetSpellProto()), GetSpellProto(), true);
} }
void AuraEffect::HandlePeriodicHealthLeechAuraTick(Unit* target, Unit* caster) const void AuraEffect::HandlePeriodicHealthLeechAuraTick(Unit* target, Unit* caster) const