Core/Spells: Defined and implemented new spell interrupt flags

Port From (https://github.com/TrinityCore/TrinityCore/commit/07a47947e2e189649e48a093b66c8c3de8872ac0)
This commit is contained in:
hondacrx
2021-03-29 13:09:27 -04:00
parent 9bbc1b49f3
commit e3994d9636
5 changed files with 76 additions and 32 deletions
+1 -2
View File
@@ -6688,8 +6688,7 @@ namespace Game.Spells
bool IsAutoActionResetSpell()
{
// @todo changed SPELL_INTERRUPT_FLAG_AUTOATTACK . SPELL_INTERRUPT_FLAG_INTERRUPT to fix compile - is this check correct at all?
if (IsTriggered() || !m_spellInfo.InterruptFlags.HasAnyFlag(SpellInterruptFlags.Interrupt))
if (IsTriggered())
return false;
if (m_casttime == 0 && m_spellInfo.HasAttribute(SpellAttr6.NotResetSwingIfInstant))
+1 -3
View File
@@ -2696,9 +2696,7 @@ namespace Game.Spells
// check if we can interrupt spell
if ((spell.GetState() == SpellState.Casting
|| (spell.GetState() == SpellState.Preparing && spell.GetCastTime() > 0.0f))
&& (curSpellInfo.PreventionType.HasAnyFlag(SpellPreventionType.Silence))
&& ((i == CurrentSpellTypes.Generic && curSpellInfo.InterruptFlags.HasAnyFlag(SpellInterruptFlags.Interrupt))
|| (i == CurrentSpellTypes.Channeled)))
&& curSpellInfo.CanBeInterrupted(m_caster, unitTarget))
{
if (m_originalCaster != null)
{
+12
View File
@@ -3609,6 +3609,18 @@ namespace Game.Spells
public bool HasAttribute(SpellAttr14 attribute) { return Convert.ToBoolean(AttributesEx14 & attribute); }
public bool HasAttribute(SpellCustomAttributes attribute) { return Convert.ToBoolean(AttributesCu & attribute); }
public bool CanBeInterrupted(Unit interruptCaster, Unit interruptTarget)
{
return HasAttribute(SpellAttr7.CanAlwaysBeInterrupted)
|| HasChannelInterruptFlag(SpellAuraInterruptFlags.Damage | SpellAuraInterruptFlags.EnteringCombat)
|| (interruptTarget.IsPlayer() && InterruptFlags.HasFlag(SpellInterruptFlags.DamageCancelsPlayerOnly))
|| InterruptFlags.HasFlag(SpellInterruptFlags.DamageCancels)
|| interruptCaster.HasAuraTypeWithMiscvalue(AuraType.AllowInterruptSpell, (int)Id)
|| ((interruptTarget.GetMechanicImmunityMask() & (1 << (int)Mechanics.Interrupt)) == 0
&& !interruptTarget.HasAuraTypeWithAffectMask(AuraType.PreventInterrupt, this)
&& PreventionType.HasAnyFlag(SpellPreventionType.Silence));
}
public bool HasAnyAuraInterruptFlag() { return AuraInterruptFlags != SpellAuraInterruptFlags.None || AuraInterruptFlags2 != SpellAuraInterruptFlags2.None; }
public bool HasAuraInterruptFlag(SpellAuraInterruptFlags flag) { return AuraInterruptFlags.HasAnyFlag(flag); }
public bool HasAuraInterruptFlag(SpellAuraInterruptFlags2 flag) { return AuraInterruptFlags2.HasAnyFlag(flag); }