Core/Spells: Use dbc flag to check if channeled spell can be interrupted

Closes #2292
This commit is contained in:
tobmaps
2011-11-05 05:21:37 +07:00
parent dc81555740
commit 935527eebe
2 changed files with 9 additions and 5 deletions
+3 -2
View File
@@ -53,6 +53,7 @@ enum SpellInterruptFlags
// See SpellAuraInterruptFlags for other values definitions // See SpellAuraInterruptFlags for other values definitions
enum SpellChannelInterruptFlags enum SpellChannelInterruptFlags
{ {
CHANNEL_INTERRUPT_FLAG_INTERRUPT = 0x08, // interrupt
CHANNEL_FLAG_DELAY = 0x4000 CHANNEL_FLAG_DELAY = 0x4000
}; };
@@ -1007,8 +1008,8 @@ enum CurrentSpellTypes
{ {
CURRENT_MELEE_SPELL = 0, CURRENT_MELEE_SPELL = 0,
CURRENT_GENERIC_SPELL = 1, CURRENT_GENERIC_SPELL = 1,
CURRENT_AUTOREPEAT_SPELL = 2, CURRENT_CHANNELED_SPELL = 2,
CURRENT_CHANNELED_SPELL = 3 CURRENT_AUTOREPEAT_SPELL = 3
}; };
#define CURRENT_FIRST_NON_MELEE_SPELL 1 #define CURRENT_FIRST_NON_MELEE_SPELL 1
+5 -2
View File
@@ -4333,7 +4333,8 @@ void Spell::EffectInterruptCast(SpellEffIndex effIndex)
// TODO: not all spells that used this effect apply cooldown at school spells // 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 // 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) // there is no CURRENT_AUTOREPEAT_SPELL spells that can be interrupted
for (uint32 i = CURRENT_FIRST_NON_MELEE_SPELL; i < CURRENT_AUTOREPEAT_SPELL; ++i)
{ {
if (Spell* spell = unitTarget->GetCurrentSpell(CurrentSpellTypes(i))) if (Spell* spell = unitTarget->GetCurrentSpell(CurrentSpellTypes(i)))
{ {
@@ -4341,7 +4342,9 @@ void Spell::EffectInterruptCast(SpellEffIndex effIndex)
// check if we can interrupt spell // check if we can interrupt spell
if ((spell->getState() == SPELL_STATE_CASTING if ((spell->getState() == SPELL_STATE_CASTING
|| (spell->getState() == SPELL_STATE_PREPARING && spell->CalcCastTime() > 0.0f)) || (spell->getState() == SPELL_STATE_PREPARING && spell->CalcCastTime() > 0.0f))
&& curSpellInfo->InterruptFlags & SPELL_INTERRUPT_FLAG_INTERRUPT && curSpellInfo->PreventionType == SPELL_PREVENTION_TYPE_SILENCE) && curSpellInfo->PreventionType == SPELL_PREVENTION_TYPE_SILENCE
&& ((i == CURRENT_GENERIC_SPELL && curSpellInfo->InterruptFlags & SPELL_INTERRUPT_FLAG_INTERRUPT)
|| (i == CURRENT_CHANNELED_SPELL && curSpellInfo->ChannelInterruptFlags & CHANNEL_INTERRUPT_FLAG_INTERRUPT)))
{ {
if (m_originalCaster) if (m_originalCaster)
{ {