diff options
author | ariel- <ariel-@users.noreply.github.com> | 2018-02-05 14:43:11 -0300 |
---|---|---|
committer | Shauren <shauren.trinity@gmail.com> | 2021-06-19 23:33:24 +0200 |
commit | 8c379e920ca184d520c81ada26c42c5dfeac770d (patch) | |
tree | 01b139320b29e7f917018133187ce96fdefbec61 /src/server/game/Spells/SpellScript.cpp | |
parent | f9b14ca795de932746ce404dfe56c5cded3bde2b (diff) |
Core/Spells: fix logic error causing near teleports to drop combat for players
Closes #21362
(cherry picked from commit 65709e1c3081c97442792695cbc0f0826015d625)
Diffstat (limited to 'src/server/game/Spells/SpellScript.cpp')
-rw-r--r-- | src/server/game/Spells/SpellScript.cpp | 20 |
1 files changed, 18 insertions, 2 deletions
diff --git a/src/server/game/Spells/SpellScript.cpp b/src/server/game/Spells/SpellScript.cpp index d437790b48b..29d559cf0be 100644 --- a/src/server/game/Spells/SpellScript.cpp +++ b/src/server/game/Spells/SpellScript.cpp @@ -436,6 +436,22 @@ bool SpellScript::IsInTargetHook() const } return false; } + +bool SpellScript::IsInModifiableHook() const +{ + // after hit hook executed after damage/healing is already done + // modifying it at this point has no effect + switch (m_currentScriptState) + { + case SPELL_SCRIPT_HOOK_EFFECT_LAUNCH_TARGET: + case SPELL_SCRIPT_HOOK_EFFECT_HIT_TARGET: + case SPELL_SCRIPT_HOOK_BEFORE_HIT: + case SPELL_SCRIPT_HOOK_HIT: + return true; + } + return false; +} + bool SpellScript::IsInHitPhase() const { return (m_currentScriptState >= HOOK_SPELL_HIT_START && m_currentScriptState < HOOK_SPELL_HIT_END); @@ -603,7 +619,7 @@ int32 SpellScript::GetHitDamage() const void SpellScript::SetHitDamage(int32 damage) { - if (!IsInTargetHook()) + if (!IsInModifiableHook()) { TC_LOG_ERROR("scripts", "Script: `%s` Spell: `%u`: function SpellScript::SetHitDamage was called, but function has no effect in current hook!", m_scriptName->c_str(), m_scriptSpellId); return; @@ -623,7 +639,7 @@ int32 SpellScript::GetHitHeal() const void SpellScript::SetHitHeal(int32 heal) { - if (!IsInTargetHook()) + if (!IsInModifiableHook()) { TC_LOG_ERROR("scripts", "Script: `%s` Spell: `%u`: function SpellScript::SetHitHeal was called, but function has no effect in current hook!", m_scriptName->c_str(), m_scriptSpellId); return; |