From 963731abc8f468fb62aca8f7f65b8dc164f6e9d8 Mon Sep 17 00:00:00 2001 From: thenecromancer Date: Sun, 24 Jan 2010 15:20:32 +0100 Subject: [PATCH] Send SMSG_SPELLORDAMAGE_IMMUNE when target is immune to periodic aura tick --HG-- branch : trunk --- src/game/SpellAuraEffects.cpp | 30 +++++++++++++++++++++++++++++- src/game/SpellAuraEffects.h | 2 ++ 2 files changed, 31 insertions(+), 1 deletion(-) diff --git a/src/game/SpellAuraEffects.cpp b/src/game/SpellAuraEffects.cpp index bb1ba5ba70..562088e209 100644 --- a/src/game/SpellAuraEffects.cpp +++ b/src/game/SpellAuraEffects.cpp @@ -1133,11 +1133,27 @@ bool AuraEffect::IsPeriodicTickCrit(Unit * target, Unit const * caster) const return false; } +void AuraEffect::SendTickImmune(Unit * target, Unit *caster) const +{ + WorldPacket data(SMSG_SPELLORDAMAGE_IMMUNE, 8+8+4+1); + data << uint64(caster ? caster->GetGUID() : target->GetGUID()); + data << uint64(target->GetGUID()); + data << uint32(m_spellProto->Id); + data << uint8(1); + target->SendMessageToSet(&data,true); +} + void AuraEffect::PeriodicTick(Unit * target, Unit * caster) const { - if(!target->isAlive() || target->hasUnitState(UNIT_STAT_ISOLATED)) + if(!target->isAlive()) return; + if (target->hasUnitState(UNIT_STAT_ISOLATED)) + { + SendTickImmune(target, caster); + return; + } + switch(GetAuraType()) { case SPELL_AURA_PERIODIC_DAMAGE: @@ -1153,7 +1169,10 @@ void AuraEffect::PeriodicTick(Unit * target, Unit * caster) const // Check for immune (not use charges) if (target->IsImmunedToDamage(GetSpellProto())) + { + SendTickImmune(target, caster); break; + } // some auras remove at specific health level or more if (GetAuraType() == SPELL_AURA_PERIODIC_DAMAGE) @@ -1276,7 +1295,10 @@ void AuraEffect::PeriodicTick(Unit * target, Unit * caster) const // Check for immune if(target->IsImmunedToDamage(GetSpellProto())) + { + SendTickImmune(target, caster); return; + } uint32 absorb=0; uint32 resist=0; @@ -1456,7 +1478,10 @@ void AuraEffect::PeriodicTick(Unit * target, Unit * caster) const // Check for immune (not use charges) if(target->IsImmunedToDamage(GetSpellProto())) + { + SendTickImmune(target, caster); break; + } // ignore non positive values (can be result apply spellmods to aura damage uint32 damage = m_amount > 0 ? m_amount : 0; @@ -1607,7 +1632,10 @@ void AuraEffect::PeriodicTick(Unit * target, Unit * caster) const // Check for immune (not use charges) if(target->IsImmunedToDamage(GetSpellProto())) + { + SendTickImmune(target, caster); return; + } int32 damage = m_amount > 0 ? m_amount : 0; diff --git a/src/game/SpellAuraEffects.h b/src/game/SpellAuraEffects.h index 3adf009e38..a74952fef5 100644 --- a/src/game/SpellAuraEffects.h +++ b/src/game/SpellAuraEffects.h @@ -67,6 +67,8 @@ class TRINITY_DLL_SPEC AuraEffect bool IsPeriodic() const { return m_isPeriodic; } bool IsAffectedOnSpell(SpellEntry const *spell) const; + void SendTickImmune(Unit * target, Unit *caster) const; + void PeriodicTick(Unit * target, Unit * caster) const; void PeriodicDummyTick(Unit * target, Unit * caster) const; Unit* GetTriggerTarget(Unit * target) const;