aboutsummaryrefslogtreecommitdiff
path: root/src/server/game/Spells/SpellEffects.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/server/game/Spells/SpellEffects.cpp')
-rw-r--r--src/server/game/Spells/SpellEffects.cpp64
1 files changed, 37 insertions, 27 deletions
diff --git a/src/server/game/Spells/SpellEffects.cpp b/src/server/game/Spells/SpellEffects.cpp
index 286e6b8c1fe..2695c741874 100644
--- a/src/server/game/Spells/SpellEffects.cpp
+++ b/src/server/game/Spells/SpellEffects.cpp
@@ -1150,10 +1150,10 @@ void Spell::EffectApplyAura(SpellEffIndex effIndex)
if (effectHandleMode != SPELL_EFFECT_HANDLE_HIT_TARGET)
return;
- if (!m_spellAura || !unitTarget)
+ if (!_spellAura || !unitTarget)
return;
- ASSERT(unitTarget == m_spellAura->GetOwner());
- m_spellAura->_ApplyEffectForTargets(effIndex);
+
+ _spellAura->_ApplyEffectForTargets(effIndex);
}
void Spell::EffectApplyAreaAura(SpellEffIndex effIndex)
@@ -1161,10 +1161,10 @@ void Spell::EffectApplyAreaAura(SpellEffIndex effIndex)
if (effectHandleMode != SPELL_EFFECT_HANDLE_HIT_TARGET)
return;
- if (!m_spellAura || !unitTarget)
+ if (!_spellAura || !unitTarget)
return;
- ASSERT (unitTarget == m_spellAura->GetOwner());
- m_spellAura->_ApplyEffectForTargets(effIndex);
+
+ _spellAura->_ApplyEffectForTargets(effIndex);
}
void Spell::EffectUnlearnSpecialization(SpellEffIndex effIndex)
@@ -1671,32 +1671,42 @@ void Spell::EffectPersistentAA(SpellEffIndex effIndex)
if (effectHandleMode != SPELL_EFFECT_HANDLE_HIT)
return;
- if (!m_spellAura)
+ // only handle at last effect
+ for (uint8 i = effIndex + 1; i < MAX_SPELL_EFFECTS; ++i)
+ if (m_spellInfo->Effects[i].Effect == SPELL_EFFECT_PERSISTENT_AREA_AURA)
+ return;
+
+ ASSERT(!_dynObjAura);
+
+ Unit* caster = m_caster->GetEntry() == WORLD_TRIGGER ? m_originalCaster : m_caster;
+ float radius = m_spellInfo->Effects[effIndex].CalcRadius(caster);
+
+ // Caster not in world, might be spell triggered from aura removal
+ if (!caster->IsInWorld())
+ return;
+
+ DynamicObject* dynObj = new DynamicObject(false);
+ if (!dynObj->CreateDynamicObject(caster->GetMap()->GenerateLowGuid<HighGuid::DynamicObject>(), caster, m_spellInfo->Id, *destTarget, radius, DYNAMIC_OBJECT_AREA_SPELL))
{
- Unit* caster = m_caster->GetEntry() == WORLD_TRIGGER ? m_originalCaster : m_caster;
- float radius = m_spellInfo->Effects[effIndex].CalcRadius(caster);
+ delete dynObj;
+ return;
+ }
- // Caster not in world, might be spell triggered from aura removal
- if (!caster->IsInWorld())
- return;
- DynamicObject* dynObj = new DynamicObject(false);
- if (!dynObj->CreateDynamicObject(caster->GetMap()->GenerateLowGuid<HighGuid::DynamicObject>(), caster, m_spellInfo->Id, *destTarget, radius, DYNAMIC_OBJECT_AREA_SPELL))
- {
- delete dynObj;
- return;
- }
+ AuraCreateInfo createInfo(m_spellInfo, MAX_EFFECT_MASK, dynObj);
+ createInfo
+ .SetCaster(caster)
+ .SetBaseAmount(m_spellValue->EffectBasePoints);
- if (Aura* aura = Aura::TryCreate(m_spellInfo, MAX_EFFECT_MASK, dynObj, caster, &m_spellValue->EffectBasePoints[0]))
- {
- m_spellAura = aura;
- m_spellAura->_RegisterForTargets();
- }
- else
- return;
+ if (Aura* aura = Aura::TryCreate(createInfo))
+ {
+ _dynObjAura = aura->ToDynObjAura();
+ _dynObjAura->_RegisterForTargets();
}
+ else
+ return;
- ASSERT(m_spellAura->GetDynobjOwner());
- m_spellAura->_ApplyEffectForTargets(effIndex);
+ ASSERT(_dynObjAura->GetDynobjOwner());
+ _dynObjAura->_ApplyEffectForTargets(effIndex);
}
void Spell::EffectEnergize(SpellEffIndex effIndex)