aboutsummaryrefslogtreecommitdiff
path: root/src/game/SpellEffects.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/game/SpellEffects.cpp')
-rw-r--r--src/game/SpellEffects.cpp19
1 files changed, 11 insertions, 8 deletions
diff --git a/src/game/SpellEffects.cpp b/src/game/SpellEffects.cpp
index 05944606063..911c75ca6b4 100644
--- a/src/game/SpellEffects.cpp
+++ b/src/game/SpellEffects.cpp
@@ -4542,19 +4542,22 @@ void Spell::EffectInterruptCast(uint32 i)
// TODO: not all spells that used this effect apply cooldown at school spells
// also exist case: apply cooldown to interrupted cast only and to all spells
- for (uint32 i = CURRENT_FIRST_NON_MELEE_SPELL; i < CURRENT_MAX_SPELL; i++)
+ for (uint32 i = CURRENT_FIRST_NON_MELEE_SPELL; i < CURRENT_MAX_SPELL; ++i)
{
- if (unitTarget->m_currentSpells[i])
+ if (Spell* spell = unitTarget->GetCurrentSpell(CurrentSpellTypes(i)))
{
+ SpellEntry const* curSpellInfo = spell->m_spellInfo;
// check if we can interrupt spell
- if ( (unitTarget->m_currentSpells[i]->getState() == SPELL_STATE_CASTING || (unitTarget->m_currentSpells[i]->getState() == SPELL_STATE_PREPARING && unitTarget->m_currentSpells[i]->GetCastTime() > 0.0f)) && unitTarget->m_currentSpells[i]->m_spellInfo->InterruptFlags & SPELL_INTERRUPT_FLAG_INTERRUPT && unitTarget->m_currentSpells[i]->m_spellInfo->PreventionType == SPELL_PREVENTION_TYPE_SILENCE )
+ if ((spell->getState() == SPELL_STATE_CASTING
+ || spell->getState() == SPELL_STATE_PREPARING && spell->GetCastTime() > 0.0f)
+ && curSpellInfo->InterruptFlags & SPELL_INTERRUPT_FLAG_INTERRUPT && curSpellInfo->PreventionType == SPELL_PREVENTION_TYPE_SILENCE )
{
if(m_originalCaster)
{
int32 duration = m_originalCaster->ModSpellDuration(m_spellInfo, unitTarget, m_originalCaster->CalcSpellDuration(m_spellInfo), false);
- unitTarget->ProhibitSpellScholl(GetSpellSchoolMask(unitTarget->m_currentSpells[i]->m_spellInfo), duration/*GetSpellDuration(m_spellInfo)*/);
+ unitTarget->ProhibitSpellScholl(GetSpellSchoolMask(curSpellInfo), duration/*GetSpellDuration(m_spellInfo)*/);
}
- unitTarget->InterruptSpell(i,false);
+ unitTarget->InterruptSpell(CurrentSpellTypes(i), false);
}
}
}
@@ -5585,10 +5588,10 @@ void Spell::EffectSanctuary(uint32 /*i*/)
for(uint32 i = CURRENT_FIRST_NON_MELEE_SPELL; i < CURRENT_MAX_SPELL; i++)
{
- if((*iter)->m_currentSpells[i]
- && (*iter)->m_currentSpells[i]->m_targets.getUnitTargetGUID() == unitTarget->GetGUID())
+ if((*iter)->GetCurrentSpell(i)
+ && (*iter)->GetCurrentSpell(i)->m_targets.getUnitTargetGUID() == unitTarget->GetGUID())
{
- (*iter)->InterruptSpell(i, false);
+ (*iter)->InterruptSpell(CurrentSpellTypes(i), false);
}
}
}