aboutsummaryrefslogtreecommitdiff
path: root/src/server/game/Spells/SpellInfo.cpp
diff options
context:
space:
mode:
authorShauren <shauren.trinity@gmail.com>2021-03-24 23:36:53 +0100
committerShauren <shauren.trinity@gmail.com>2021-03-24 23:36:53 +0100
commit07a47947e2e189649e48a093b66c8c3de8872ac0 (patch)
treeb9aea76dbb04b26ed97b0a45df436a4f997eb4f6 /src/server/game/Spells/SpellInfo.cpp
parentabaeb12ba3993a636d8385fe06b3a5ceb0f66f63 (diff)
Core/Spells: Defined and implemented new spell interrupt flags
Diffstat (limited to 'src/server/game/Spells/SpellInfo.cpp')
-rw-r--r--src/server/game/Spells/SpellInfo.cpp14
1 files changed, 13 insertions, 1 deletions
diff --git a/src/server/game/Spells/SpellInfo.cpp b/src/server/game/Spells/SpellInfo.cpp
index f8cabac4d00..0a73ed4ad1f 100644
--- a/src/server/game/Spells/SpellInfo.cpp
+++ b/src/server/game/Spells/SpellInfo.cpp
@@ -1212,7 +1212,7 @@ SpellInfo::SpellInfo(SpellNameEntry const* spellName, ::Difficulty difficulty, S
// SpellInterruptsEntry
if (SpellInterruptsEntry const* _interrupt = data.Interrupts)
{
- InterruptFlags = _interrupt->InterruptFlags;
+ InterruptFlags = SpellInterruptFlags(_interrupt->InterruptFlags);
AuraInterruptFlags = SpellAuraInterruptFlags(_interrupt->AuraInterruptFlags[0]);
AuraInterruptFlags2 = SpellAuraInterruptFlags2(_interrupt->AuraInterruptFlags[1]);
ChannelInterruptFlags = SpellAuraInterruptFlags(_interrupt->ChannelInterruptFlags[0]);
@@ -1360,6 +1360,18 @@ bool SpellInfo::HasTargetType(::Targets target) const
return false;
}
+bool SpellInfo::CanBeInterrupted(Unit* interruptCaster, Unit* interruptTarget) const
+{
+ return HasAttribute(SPELL_ATTR7_CAN_ALWAYS_BE_INTERRUPTED)
+ || HasChannelInterruptFlag(SpellAuraInterruptFlags::Damage | SpellAuraInterruptFlags::EnteringCombat)
+ || (interruptTarget->IsPlayer() && InterruptFlags.HasFlag(SpellInterruptFlags::DamageCancelsPlayerOnly))
+ || InterruptFlags.HasFlag(SpellInterruptFlags::DamageCancels)
+ || interruptCaster->HasAuraTypeWithMiscvalue(SPELL_AURA_ALLOW_INTERRUPT_SPELL, Id)
+ || (!(interruptTarget->GetMechanicImmunityMask() & (1 << MECHANIC_INTERRUPT))
+ && !interruptTarget->HasAuraTypeWithAffectMask(SPELL_AURA_PREVENT_INTERRUPT, this)
+ && PreventionType & SPELL_PREVENTION_TYPE_SILENCE);
+}
+
bool SpellInfo::HasAnyAuraInterruptFlag() const
{
return AuraInterruptFlags != SpellAuraInterruptFlags::None || AuraInterruptFlags2 != SpellAuraInterruptFlags2::None;