aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/server/game/Spells/SpellScript.cpp20
-rw-r--r--src/server/game/Spells/SpellScript.h1
2 files changed, 19 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;
diff --git a/src/server/game/Spells/SpellScript.h b/src/server/game/Spells/SpellScript.h
index 2a52b953266..5e5e5285e49 100644
--- a/src/server/game/Spells/SpellScript.h
+++ b/src/server/game/Spells/SpellScript.h
@@ -319,6 +319,7 @@ class TC_GAME_API SpellScript : public _SpellScript
bool IsInCheckCastHook() const;
bool IsAfterTargetSelectionPhase() const;
bool IsInTargetHook() const;
+ bool IsInModifiableHook() const;
bool IsInHitPhase() const;
bool IsInEffectHook() const;
private: