diff options
author | ariel- <ariel-@users.noreply.github.com> | 2018-01-27 03:45:40 -0300 |
---|---|---|
committer | Shauren <shauren.trinity@gmail.com> | 2021-08-28 15:59:11 +0200 |
commit | f3548d45d0a74203ef6f5c7282c31ba794ddf7a1 (patch) | |
tree | 94a7c69af30d4b13018457cf40c06366ebc11ba9 /src/server/game/Spells/SpellScript.cpp | |
parent | 52ae3c89d1d4dbcff309d940fd41c7212edc77b7 (diff) |
Core/Spells: rework part 3: spells only handle at most one UnitAura and one DynObjAura during its lifetime
Closes #15088
(cherry picked from commit e8d5aa56cc48572d81e1898b7b4ff10cfa6d1957)
Diffstat (limited to 'src/server/game/Spells/SpellScript.cpp')
-rw-r--r-- | src/server/game/Spells/SpellScript.cpp | 21 |
1 files changed, 14 insertions, 7 deletions
diff --git a/src/server/game/Spells/SpellScript.cpp b/src/server/game/Spells/SpellScript.cpp index 7213776011f..577273d4ff7 100644 --- a/src/server/game/Spells/SpellScript.cpp +++ b/src/server/game/Spells/SpellScript.cpp @@ -21,6 +21,7 @@ #include "ScriptMgr.h" #include "SpellAuras.h" #include "SpellMgr.h" +#include "Unit.h" #include <sstream> #include <string> @@ -648,18 +649,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() @@ -669,8 +674,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) |