Skip to content

Instantly share code, notes, and snippets.

@tobmaps
Created November 4, 2011 21:17
Show Gist options
  • Save tobmaps/1340506 to your computer and use it in GitHub Desktop.
Save tobmaps/1340506 to your computer and use it in GitHub Desktop.
Evocation, Army of the Dead and etc interruption fix
diff --git a/src/server/game/Entities/Unit/Unit.h b/src/server/game/Entities/Unit/Unit.h
index 4523397..877bf11 100755
--- a/src/server/game/Entities/Unit/Unit.h
+++ b/src/server/game/Entities/Unit/Unit.h
@@ -53,7 +53,8 @@ enum SpellInterruptFlags
// See SpellAuraInterruptFlags for other values definitions
enum SpellChannelInterruptFlags
{
- CHANNEL_FLAG_DELAY = 0x4000
+ CHANNEL_INTERRUPT_FLAG_INTERRUPT = 0x08, // interrupt
+ CHANNEL_FLAG_DELAY = 0x4000
};
enum SpellAuraInterruptFlags
@@ -1007,8 +1008,8 @@ enum CurrentSpellTypes
{
CURRENT_MELEE_SPELL = 0,
CURRENT_GENERIC_SPELL = 1,
- CURRENT_AUTOREPEAT_SPELL = 2,
- CURRENT_CHANNELED_SPELL = 3
+ CURRENT_CHANNELED_SPELL = 2,
+ CURRENT_AUTOREPEAT_SPELL = 3
};
#define CURRENT_FIRST_NON_MELEE_SPELL 1
diff --git a/src/server/game/Spells/SpellEffects.cpp b/src/server/game/Spells/SpellEffects.cpp
index 1c8ce35..c17b334 100755
--- a/src/server/game/Spells/SpellEffects.cpp
+++ b/src/server/game/Spells/SpellEffects.cpp
@@ -4333,7 +4333,8 @@ void Spell::EffectInterruptCast(SpellEffIndex effIndex)
// 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)
+ // 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)))
{
@@ -4341,7 +4342,9 @@ void Spell::EffectInterruptCast(SpellEffIndex effIndex)
// check if we can interrupt spell
if ((spell->getState() == SPELL_STATE_CASTING
|| (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)
{
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment