diff options
Diffstat (limited to 'src/game/Spell.cpp')
-rw-r--r-- | src/game/Spell.cpp | 34 |
1 files changed, 21 insertions, 13 deletions
diff --git a/src/game/Spell.cpp b/src/game/Spell.cpp index 3eada04fe42..64758d62f94 100644 --- a/src/game/Spell.cpp +++ b/src/game/Spell.cpp @@ -2814,6 +2814,7 @@ void Spell::cast(bool skipCheck) if (m_caster->GetTypeId()==TYPEID_PLAYER) { // Set spell which will drop charges for triggered cast spells + // if not successfully casted, will be remove in finish(false) ((Player*)m_caster)->SetSpellModTakingSpell(this, true); } @@ -2825,6 +2826,14 @@ void Spell::cast(bool skipCheck) { SendCastResult(castResult); SendInterrupted(0); + //restore spell mods + if (m_caster->GetTypeId() == TYPEID_PLAYER) + { + ((Player*)m_caster)->RestoreSpellMods(this); + // cleanup after mod system + // triggered spell pointer can be not removed in some cases + ((Player*)m_caster)->SetSpellModTakingSpell(this, false); + } finish(false); SetExecutedCurrently(false); return; @@ -2837,6 +2846,15 @@ void Spell::cast(bool skipCheck) if(m_spellState == SPELL_STATE_FINISHED) { SendInterrupted(0); + //restore spell mods + if (m_caster->GetTypeId() == TYPEID_PLAYER) + { + ((Player*)m_caster)->RestoreSpellMods(this); + // cleanup after mod system + // triggered spell pointer can be not removed in some cases + ((Player*)m_caster)->SetSpellModTakingSpell(this, false); + } + finish(false); SetExecutedCurrently(false); return; } @@ -3046,6 +3064,9 @@ uint64 Spell::handle_delayed(uint64 t_offset) } } + if (m_caster->GetTypeId()==TYPEID_PLAYER) + ((Player*)m_caster)->SetSpellModTakingSpell(this, false); + // All targets passed - need finish phase if (next_time == 0) { @@ -3059,9 +3080,6 @@ uint64 Spell::handle_delayed(uint64 t_offset) } else { - if (m_caster->GetTypeId()==TYPEID_PLAYER) - ((Player*)m_caster)->SetSpellModTakingSpell(this, false); - // spell is unfinished, return next execution time return next_time; } @@ -3315,17 +3333,7 @@ void Spell::finish(bool ok) } if(!ok) - { - //restore spell mods - if (m_caster->GetTypeId() == TYPEID_PLAYER) - { - ((Player*)m_caster)->RestoreSpellMods(this); - // cleanup after mod system - // triggered spell pointer can be not removed in some cases - ((Player*)m_caster)->SetSpellModTakingSpell(this, false); - } return; - } if (m_caster->GetTypeId()==TYPEID_UNIT && ((Creature*)m_caster)->isSummon()) { |