aboutsummaryrefslogtreecommitdiff
path: root/src/server/game/Spells/SpellScript.cpp
diff options
context:
space:
mode:
authorariel- <ariel-@users.noreply.github.com>2018-01-27 03:45:40 -0300
committerAriel Silva <ariel-@users.noreply.github.com>2018-03-09 14:41:28 -0300
commite8d5aa56cc48572d81e1898b7b4ff10cfa6d1957 (patch)
treeb21b5dff1cdb693074e23eb57906f6a2a2182a76 /src/server/game/Spells/SpellScript.cpp
parent9b38a6352c0fe2499de54fd769aa1c721a410bda (diff)
Core/Spells: rework part 3: spells only handle at most one UnitAura and one DynObjAura during its lifetime
Closes #15088
Diffstat (limited to 'src/server/game/Spells/SpellScript.cpp')
-rw-r--r--src/server/game/Spells/SpellScript.cpp20
1 files changed, 13 insertions, 7 deletions
diff --git a/src/server/game/Spells/SpellScript.cpp b/src/server/game/Spells/SpellScript.cpp
index 909ae8c9131..a7f852eb884 100644
--- a/src/server/game/Spells/SpellScript.cpp
+++ b/src/server/game/Spells/SpellScript.cpp
@@ -576,18 +576,22 @@ void SpellScript::SetHitHeal(int32 heal)
m_spell->m_healing = heal;
}
-Aura* SpellScript::GetHitAura() const
+Aura* SpellScript::GetHitAura(bool dynObjAura /*= false*/) const
{
if (!IsInTargetHook())
{
TC_LOG_ERROR("scripts", "Script: `%s` Spell: `%u`: function SpellScript::GetHitAura was called, but function has no effect in current hook!", m_scriptName->c_str(), m_scriptSpellId);
return nullptr;
}
- if (!m_spell->m_spellAura)
- return nullptr;
- if (m_spell->m_spellAura->IsRemoved())
+
+ Aura* aura = m_spell->_spellAura;
+ if (dynObjAura)
+ aura = m_spell->_dynObjAura;
+
+ if (!aura || aura->IsRemoved())
return nullptr;
- return m_spell->m_spellAura;
+
+ return aura;
}
void SpellScript::PreventHitAura()
@@ -597,8 +601,10 @@ void SpellScript::PreventHitAura()
TC_LOG_ERROR("scripts", "Script: `%s` Spell: `%u`: function SpellScript::PreventHitAura was called, but function has no effect in current hook!", m_scriptName->c_str(), m_scriptSpellId);
return;
}
- if (m_spell->m_spellAura)
- m_spell->m_spellAura->Remove();
+ if (UnitAura* aura = m_spell->_spellAura)
+ aura->Remove();
+ if (DynObjAura* aura = m_spell->_dynObjAura)
+ aura->Remove();
}
void SpellScript::PreventHitEffect(SpellEffIndex effIndex)