diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/server/game/Spells/Spell.cpp | 4 | ||||
-rw-r--r-- | src/server/game/Spells/SpellInfo.cpp | 23 | ||||
-rw-r--r-- | src/server/game/Spells/SpellInfo.h | 4 |
3 files changed, 25 insertions, 6 deletions
diff --git a/src/server/game/Spells/Spell.cpp b/src/server/game/Spells/Spell.cpp index 39eb1867b65..6adbfa28086 100644 --- a/src/server/game/Spells/Spell.cpp +++ b/src/server/game/Spells/Spell.cpp @@ -4469,8 +4469,8 @@ void Spell::SendSpellStart() uint32 mechanicImmunityMask = 0; if (Unit* unitCaster = m_caster->ToUnit()) { - schoolImmunityMask = unitCaster->GetSchoolImmunityMask(); - mechanicImmunityMask = unitCaster->GetMechanicImmunityMask(); + schoolImmunityMask = m_timer!= 0 ? unitCaster->GetSchoolImmunityMask() : 0; + mechanicImmunityMask = m_timer != 0 ? m_spellInfo->GetMechanicImmunityMask(unitCaster) : 0; } if (schoolImmunityMask || mechanicImmunityMask) diff --git a/src/server/game/Spells/SpellInfo.cpp b/src/server/game/Spells/SpellInfo.cpp index 8f799d9422a..9c089aacd74 100644 --- a/src/server/game/Spells/SpellInfo.cpp +++ b/src/server/game/Spells/SpellInfo.cpp @@ -1376,14 +1376,14 @@ bool SpellInfo::HasTargetType(::Targets target) const return false; } -bool SpellInfo::CanBeInterrupted(WorldObject const* interruptCaster, Unit const* interruptTarget) const +bool SpellInfo::CanBeInterrupted(WorldObject const* interruptCaster, Unit const* interruptTarget, bool ignoreImmunity /*= false*/) 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->IsUnit() && interruptCaster->ToUnit()->HasAuraTypeWithMiscvalue(SPELL_AURA_ALLOW_INTERRUPT_SPELL, Id)) - || (!(interruptTarget->GetMechanicImmunityMask() & (1 << MECHANIC_INTERRUPT)) + || (interruptCaster && interruptCaster->IsUnit() && interruptCaster->ToUnit()->HasAuraTypeWithMiscvalue(SPELL_AURA_ALLOW_INTERRUPT_SPELL, Id)) + || ((!(interruptTarget->GetMechanicImmunityMask() & (1 << MECHANIC_INTERRUPT)) || ignoreImmunity) && !interruptTarget->HasAuraTypeWithAffectMask(SPELL_AURA_PREVENT_INTERRUPT, this) && PreventionType & SPELL_PREVENTION_TYPE_SILENCE); } @@ -3729,6 +3729,23 @@ uint32 SpellInfo::GetAllowedMechanicMask() const return _allowedMechanicMask; } +uint32 SpellInfo::GetMechanicImmunityMask(Unit const* caster) const +{ + uint32 casterMechanicImmunityMask = caster->GetMechanicImmunityMask(); + uint32 mechanicImmunityMask = 0; + + if (CanBeInterrupted(nullptr, caster, true)) + { + if (casterMechanicImmunityMask & (1 << MECHANIC_SILENCE)) + mechanicImmunityMask |= (1 << MECHANIC_SILENCE); + + if (casterMechanicImmunityMask & (1 << MECHANIC_INTERRUPT)) + mechanicImmunityMask |= (1 << MECHANIC_INTERRUPT); + } + + return mechanicImmunityMask; +} + float SpellInfo::GetMinRange(bool positive /*= false*/) const { if (!RangeEntry) diff --git a/src/server/game/Spells/SpellInfo.h b/src/server/game/Spells/SpellInfo.h index 21425d1b595..bb4c11871f4 100644 --- a/src/server/game/Spells/SpellInfo.h +++ b/src/server/game/Spells/SpellInfo.h @@ -476,7 +476,7 @@ class TC_GAME_API SpellInfo bool HasAttribute(SpellAttr14 attribute) const { return !!(AttributesEx14 & attribute); } bool HasAttribute(SpellCustomAttributes customAttribute) const { return !!(AttributesCu & customAttribute); } - bool CanBeInterrupted(WorldObject const* interruptCaster, Unit const* interruptTarget) const; + bool CanBeInterrupted(WorldObject const* interruptCaster, Unit const* interruptTarget, bool ignoreImmunity = false) const; bool HasAnyAuraInterruptFlag() const; bool HasAuraInterruptFlag(SpellAuraInterruptFlags flag) const { return AuraInterruptFlags.HasFlag(flag); } @@ -605,6 +605,8 @@ class TC_GAME_API SpellInfo uint32 GetAllowedMechanicMask() const; + uint32 GetMechanicImmunityMask(Unit const* caster) const; + // Player Condition bool MeetsFutureSpellPlayerCondition(Player const* player) const; |