Core/Auras: Defined and implemented many new interrupt flags
Port From (https://github.com/TrinityCore/TrinityCore/commit/9b5a46ca2bb3a4632cb9914e0899df611a47d935)
This commit is contained in:
@@ -919,7 +919,7 @@ namespace Game.Spells
|
||||
if (apply && mode.HasAnyFlag(AuraEffectHandleModes.Real))
|
||||
{
|
||||
// drop flag at invisibiliy in bg
|
||||
target.RemoveAurasWithInterruptFlags(SpellAuraInterruptFlags.ImmuneOrLostSelection);
|
||||
target.RemoveAurasWithInterruptFlags(SpellAuraInterruptFlags.StealthOrInvis);
|
||||
}
|
||||
target.UpdateObjectVisibility();
|
||||
}
|
||||
@@ -987,7 +987,7 @@ namespace Game.Spells
|
||||
if (apply && mode.HasAnyFlag(AuraEffectHandleModes.Real))
|
||||
{
|
||||
// drop flag at stealth in bg
|
||||
target.RemoveAurasWithInterruptFlags(SpellAuraInterruptFlags.ImmuneOrLostSelection);
|
||||
target.RemoveAurasWithInterruptFlags(SpellAuraInterruptFlags.StealthOrInvis);
|
||||
}
|
||||
target.UpdateObjectVisibility();
|
||||
}
|
||||
@@ -1113,14 +1113,7 @@ namespace Game.Spells
|
||||
Unit target = aurApp.GetTarget();
|
||||
|
||||
if (apply)
|
||||
{
|
||||
PhasingHandler.AddPhase(target, (uint)GetMiscValueB(), true);
|
||||
|
||||
// call functions which may have additional effects after chainging state of unit
|
||||
// phase auras normally not expected at BG but anyway better check
|
||||
// drop flag at invisibiliy in bg
|
||||
target.RemoveAurasWithInterruptFlags(SpellAuraInterruptFlags.ImmuneOrLostSelection);
|
||||
}
|
||||
else
|
||||
PhasingHandler.RemovePhase(target, (uint)GetMiscValueB(), true);
|
||||
}
|
||||
@@ -1134,14 +1127,7 @@ namespace Game.Spells
|
||||
Unit target = aurApp.GetTarget();
|
||||
|
||||
if (apply)
|
||||
{
|
||||
PhasingHandler.AddPhaseGroup(target, (uint)GetMiscValueB(), true);
|
||||
|
||||
// call functions which may have additional effects after chainging state of unit
|
||||
// phase auras normally not expected at BG but anyway better check
|
||||
// drop flag at invisibiliy in bg
|
||||
target.RemoveAurasWithInterruptFlags(SpellAuraInterruptFlags.ImmuneOrLostSelection);
|
||||
}
|
||||
else
|
||||
PhasingHandler.RemovePhaseGroup(target, (uint)GetMiscValueB(), true);
|
||||
}
|
||||
@@ -1226,6 +1212,9 @@ namespace Game.Spells
|
||||
if (transformSpellInfo == null || !GetSpellInfo().IsPositive())
|
||||
target.SetDisplayId(modelid);
|
||||
}
|
||||
|
||||
if (!shapeInfo.Flags.HasAnyFlag(SpellShapeshiftFormFlags.Stance))
|
||||
target.RemoveAurasWithInterruptFlags(SpellAuraInterruptFlags.Shapeshifting, GetId());
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -1602,7 +1591,6 @@ namespace Game.Spells
|
||||
}
|
||||
}
|
||||
target.CombatStop();
|
||||
target.RemoveAurasWithInterruptFlags(SpellAuraInterruptFlags.ImmuneOrLostSelection);
|
||||
|
||||
// prevent interrupt message
|
||||
if (GetCasterGUID() == target.GetGUID() && target.GetCurrentSpell(CurrentSpellTypes.Generic) != null)
|
||||
@@ -1647,10 +1635,7 @@ namespace Game.Spells
|
||||
|
||||
// call functions which may have additional effects after chainging state of unit
|
||||
if (apply && mode.HasAnyFlag(AuraEffectHandleModes.Real))
|
||||
{
|
||||
target.CombatStop();
|
||||
target.RemoveAurasWithInterruptFlags(SpellAuraInterruptFlags.ImmuneOrLostSelection);
|
||||
}
|
||||
}
|
||||
|
||||
[AuraEffectHandler(AuraType.ModDisarm)]
|
||||
@@ -2686,8 +2671,9 @@ namespace Game.Spells
|
||||
m_spellInfo.ApplyAllSpellImmunitiesTo(target, GetSpellEffectInfo(), apply);
|
||||
|
||||
// when removing flag aura, handle flag drop
|
||||
// TODO: this should be handled in aura script for flag spells using AfterEffectRemove hook
|
||||
Player player = target.ToPlayer();
|
||||
if (!apply && player != null && GetSpellInfo().HasAuraInterruptFlag(SpellAuraInterruptFlags.ImmuneOrLostSelection))
|
||||
if (!apply && player != null && GetSpellInfo().HasAuraInterruptFlag(SpellAuraInterruptFlags.StealthOrInvis))
|
||||
{
|
||||
if (player.InBattleground())
|
||||
{
|
||||
@@ -2741,13 +2727,16 @@ namespace Game.Spells
|
||||
}
|
||||
}
|
||||
|
||||
if (apply && GetMiscValue() == (int)SpellSchoolMask.Normal)
|
||||
target.RemoveAurasWithInterruptFlags(SpellAuraInterruptFlags.ImmuneOrLostSelection);
|
||||
// TODO: should be changed to a proc script on flag spell (they have "Taken positive" proc flags in db2)
|
||||
{
|
||||
if (apply && GetMiscValue() == (int)SpellSchoolMask.Normal)
|
||||
target.RemoveAurasWithInterruptFlags(SpellAuraInterruptFlags.StealthOrInvis);
|
||||
|
||||
// remove all flag auras (they are positive, but they must be removed when you are immune)
|
||||
if (GetSpellInfo().HasAttribute(SpellAttr1.DispelAurasOnImmunity)
|
||||
&& GetSpellInfo().HasAttribute(SpellAttr2.DamageReducedShield))
|
||||
target.RemoveAurasWithInterruptFlags(SpellAuraInterruptFlags.ImmuneOrLostSelection);
|
||||
// remove all flag auras (they are positive, but they must be removed when you are immune)
|
||||
if (GetSpellInfo().HasAttribute(SpellAttr1.DispelAurasOnImmunity)
|
||||
&& GetSpellInfo().HasAttribute(SpellAttr2.DamageReducedShield))
|
||||
target.RemoveAurasWithInterruptFlags(SpellAuraInterruptFlags.StealthOrInvis);
|
||||
}
|
||||
}
|
||||
|
||||
[AuraEffectHandler(AuraType.DamageImmunity)]
|
||||
|
||||
@@ -2007,7 +2007,7 @@ namespace Game.Spells
|
||||
// Failed Pickpocket, reveal rogue
|
||||
if (missInfo == SpellMissInfo.Resist && m_spellInfo.HasAttribute(SpellCustomAttributes.PickPocket) && unitTarget.IsTypeId(TypeId.Unit))
|
||||
{
|
||||
m_caster.RemoveAurasWithInterruptFlags(SpellAuraInterruptFlags.Talk);
|
||||
m_caster.RemoveAurasWithInterruptFlags(SpellAuraInterruptFlags.Interacting);
|
||||
unitTarget.ToCreature().EngageWithTarget(m_caster);
|
||||
}
|
||||
}
|
||||
@@ -2096,7 +2096,7 @@ namespace Game.Spells
|
||||
return SpellMissInfo.Evade;
|
||||
|
||||
if (m_caster._IsValidAttackTarget(unit, m_spellInfo))
|
||||
unit.RemoveAurasWithInterruptFlags(SpellAuraInterruptFlags.Hitbyspell);
|
||||
unit.RemoveAurasWithInterruptFlags(SpellAuraInterruptFlags.HostileActionReceived);
|
||||
else if (m_caster.IsFriendlyTo(unit))
|
||||
{
|
||||
// for delayed spells ignore negative spells (after duel end) for friendly targets
|
||||
@@ -2556,17 +2556,7 @@ namespace Game.Spells
|
||||
// stealth must be removed at cast starting (at show channel bar)
|
||||
// skip triggered spell (item equip spell casting and other not explicit character casts/item uses)
|
||||
if (!_triggeredCastFlags.HasAnyFlag(TriggerCastFlags.IgnoreAuraInterruptFlags) && m_spellInfo.IsBreakingStealth())
|
||||
{
|
||||
m_caster.RemoveAurasWithInterruptFlags(SpellAuraInterruptFlags.Cast);
|
||||
foreach (SpellEffectInfo effect in m_spellInfo.GetEffects())
|
||||
{
|
||||
if (effect != null && effect.GetUsedTargetObjectType() == SpellTargetObjectTypes.Unit)
|
||||
{
|
||||
m_caster.RemoveAurasWithInterruptFlags(SpellAuraInterruptFlags.SpellAttack);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
m_caster.RemoveAurasWithInterruptFlags(SpellAuraInterruptFlags.Action);
|
||||
|
||||
m_caster.SetCurrentCastSpell(this);
|
||||
|
||||
@@ -2917,6 +2907,7 @@ namespace Game.Spells
|
||||
if (!hitMask.HasAnyFlag(ProcFlagsHit.Critical))
|
||||
hitMask |= ProcFlagsHit.Normal;
|
||||
|
||||
m_originalCaster.RemoveAurasWithInterruptFlags(SpellAuraInterruptFlags.ActionDelayed);
|
||||
m_originalCaster.ProcSkillsAndAuras(null, procAttacker, ProcFlags.None, ProcFlagsSpellType.MaskAll, ProcFlagsSpellPhase.Cast, hitMask, this, null, null);
|
||||
|
||||
// Call CreatureAI hook OnSuccessfulSpellCast
|
||||
@@ -2943,13 +2934,13 @@ namespace Game.Spells
|
||||
m_caster.ModSpellDurationTime(m_spellInfo, ref duration, this);
|
||||
|
||||
m_spellState = SpellState.Casting;
|
||||
m_caster.AddInterruptMask(m_spellInfo.ChannelInterruptFlags);
|
||||
m_caster.AddInterruptMask(m_spellInfo.ChannelInterruptFlags, m_spellInfo.ChannelInterruptFlags2);
|
||||
SendChannelStart((uint)duration);
|
||||
}
|
||||
else if (duration == -1)
|
||||
{
|
||||
m_spellState = SpellState.Casting;
|
||||
m_caster.AddInterruptMask(m_spellInfo.ChannelInterruptFlags);
|
||||
m_caster.AddInterruptMask(m_spellInfo.ChannelInterruptFlags, m_spellInfo.ChannelInterruptFlags2);
|
||||
SendChannelStart((uint)duration);
|
||||
}
|
||||
}
|
||||
@@ -4591,7 +4582,7 @@ namespace Game.Spells
|
||||
// skip stuck spell to allow use it in falling case and apply spell limitations at movement
|
||||
SpellEffectInfo effect = m_spellInfo.GetEffect(0);
|
||||
if ((!m_caster.HasUnitMovementFlag(MovementFlag.FallingFar) || (effect != null && effect.Effect != SpellEffectName.Stuck)) &&
|
||||
(IsAutoRepeat() || m_spellInfo.HasAuraInterruptFlag(SpellAuraInterruptFlags.NotSeated)))
|
||||
(IsAutoRepeat() || m_spellInfo.HasAuraInterruptFlag(SpellAuraInterruptFlags.Standing)))
|
||||
return SpellCastResult.Moving;
|
||||
}
|
||||
|
||||
|
||||
@@ -2698,7 +2698,7 @@ namespace Game.Spells
|
||||
|| (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.HasChannelInterruptFlag(SpellChannelInterruptFlags.Interrupt))))
|
||||
|| (i == CurrentSpellTypes.Channeled)))
|
||||
{
|
||||
if (m_originalCaster != null)
|
||||
{
|
||||
|
||||
@@ -179,8 +179,10 @@ namespace Game.Spells
|
||||
if (_interrupt != null)
|
||||
{
|
||||
InterruptFlags = (SpellInterruptFlags)_interrupt.InterruptFlags;
|
||||
Array.Copy(_interrupt.AuraInterruptFlags, AuraInterruptFlags, 2);
|
||||
Array.Copy(_interrupt.ChannelInterruptFlags, ChannelInterruptFlags, 2);
|
||||
AuraInterruptFlags = (SpellAuraInterruptFlags)_interrupt.AuraInterruptFlags[0];
|
||||
AuraInterruptFlags2 = (SpellAuraInterruptFlags2)_interrupt.AuraInterruptFlags[1];
|
||||
ChannelInterruptFlags = (SpellAuraInterruptFlags)_interrupt.ChannelInterruptFlags[0];
|
||||
ChannelInterruptFlags2 = (SpellAuraInterruptFlags2)_interrupt.ChannelInterruptFlags[1];
|
||||
}
|
||||
|
||||
// SpellLevelsEntry
|
||||
@@ -559,7 +561,7 @@ namespace Game.Spells
|
||||
|
||||
public bool IsMoveAllowedChannel()
|
||||
{
|
||||
return IsChanneled() && (HasAttribute(SpellAttr5.CanChannelWhenMoving) || !ChannelInterruptFlags[0].HasAnyFlag((uint)(SpellAuraInterruptFlags.Move | SpellAuraInterruptFlags.Turning)));
|
||||
return IsChanneled() && (HasAttribute(SpellAttr5.CanChannelWhenMoving) || !ChannelInterruptFlags.HasAnyFlag(SpellAuraInterruptFlags.Moving | SpellAuraInterruptFlags.Turning));
|
||||
}
|
||||
|
||||
public bool NeedsComboPoints()
|
||||
@@ -1447,7 +1449,7 @@ namespace Game.Spells
|
||||
case SpellFamilyNames.Generic:
|
||||
{
|
||||
// Food / Drinks (mostly)
|
||||
if (HasAuraInterruptFlag(SpellAuraInterruptFlags.NotSeated))
|
||||
if (HasAuraInterruptFlag(SpellAuraInterruptFlags.Standing))
|
||||
{
|
||||
bool food = false;
|
||||
bool drink = false;
|
||||
@@ -2405,6 +2407,9 @@ namespace Game.Spells
|
||||
auraSpellInfo.Id != Id); // Don't remove self
|
||||
});
|
||||
}
|
||||
|
||||
if (apply && (schoolImmunity & (uint)SpellSchoolMask.Normal) != 0)
|
||||
target.RemoveAurasWithInterruptFlags(SpellAuraInterruptFlags.InvulnerabilityBuff);
|
||||
}
|
||||
|
||||
uint mechanicImmunity = immuneInfo.MechanicImmuneMask;
|
||||
@@ -2438,8 +2443,13 @@ namespace Game.Spells
|
||||
|
||||
uint damageImmunity = immuneInfo.DamageSchoolMask;
|
||||
if (damageImmunity != 0)
|
||||
{
|
||||
target.ApplySpellImmune(Id, SpellImmunity.Damage, damageImmunity, apply);
|
||||
|
||||
if (apply && (damageImmunity & (uint)SpellSchoolMask.Normal) != 0)
|
||||
target.RemoveAurasWithInterruptFlags(SpellAuraInterruptFlags.InvulnerabilityBuff);
|
||||
}
|
||||
|
||||
foreach (AuraType auraType in immuneInfo.AuraTypeImmune)
|
||||
{
|
||||
target.ApplySpellImmune(Id, SpellImmunity.State, auraType, apply);
|
||||
@@ -3599,12 +3609,13 @@ 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 HasAnyAuraInterruptFlag() { return AuraInterruptFlags.Any(flag => flag != 0); }
|
||||
public bool HasAuraInterruptFlag(SpellAuraInterruptFlags flag) { return (AuraInterruptFlags[0] & (uint)flag) != 0; }
|
||||
public bool HasAuraInterruptFlag(SpellAuraInterruptFlags2 flag) { return (AuraInterruptFlags[1] & (uint)flag) != 0; }
|
||||
|
||||
public bool HasChannelInterruptFlag(SpellChannelInterruptFlags flag) { return (ChannelInterruptFlags[0] & (uint)flag) != 0; }
|
||||
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); }
|
||||
|
||||
public bool HasChannelInterruptFlag(SpellAuraInterruptFlags flag) { return ChannelInterruptFlags.HasAnyFlag(flag); }
|
||||
public bool HasChannelInterruptFlag(SpellAuraInterruptFlags2 flag) { return ChannelInterruptFlags2.HasAnyFlag(flag); }
|
||||
|
||||
#region Fields
|
||||
public uint Id { get; set; }
|
||||
public Difficulty Difficulty { get; set; }
|
||||
@@ -3648,8 +3659,10 @@ namespace Game.Spells
|
||||
public uint StartRecoveryCategory { get; set; }
|
||||
public uint StartRecoveryTime { get; set; }
|
||||
public SpellInterruptFlags InterruptFlags { get; set; }
|
||||
public uint[] AuraInterruptFlags { get; set; } = new uint[2];
|
||||
public uint[] ChannelInterruptFlags { get; set; } = new uint[2];
|
||||
public SpellAuraInterruptFlags AuraInterruptFlags { get; set; }
|
||||
public SpellAuraInterruptFlags2 AuraInterruptFlags2 { get; set; }
|
||||
public SpellAuraInterruptFlags ChannelInterruptFlags { get; set; }
|
||||
public SpellAuraInterruptFlags2 ChannelInterruptFlags2 { get; set; }
|
||||
public ProcFlags ProcFlags { get; set; }
|
||||
public uint ProcChance { get; set; }
|
||||
public uint ProcCharges { get; set; }
|
||||
|
||||
@@ -2546,10 +2546,10 @@ namespace Game.Entities
|
||||
spellInfo.StartRecoveryCategory = spellsResult.Read<uint>(37);
|
||||
spellInfo.StartRecoveryTime = spellsResult.Read<uint>(38);
|
||||
spellInfo.InterruptFlags = (SpellInterruptFlags)spellsResult.Read<uint>(39);
|
||||
spellInfo.AuraInterruptFlags[0] = spellsResult.Read<uint>(40);
|
||||
spellInfo.AuraInterruptFlags[1] = spellsResult.Read<uint>(41);
|
||||
spellInfo.ChannelInterruptFlags[0] = spellsResult.Read<uint>(42);
|
||||
spellInfo.ChannelInterruptFlags[1] = spellsResult.Read<uint>(43);
|
||||
spellInfo.AuraInterruptFlags = (SpellAuraInterruptFlags)spellsResult.Read<uint>(40);
|
||||
spellInfo.AuraInterruptFlags2 = (SpellAuraInterruptFlags2)spellsResult.Read<uint>(41);
|
||||
spellInfo.ChannelInterruptFlags = (SpellAuraInterruptFlags)spellsResult.Read<uint>(42);
|
||||
spellInfo.ChannelInterruptFlags2 = (SpellAuraInterruptFlags2)spellsResult.Read<uint>(43);
|
||||
spellInfo.ProcFlags = (ProcFlags)spellsResult.Read<uint>(44);
|
||||
spellInfo.ProcChance = spellsResult.Read<uint>(45);
|
||||
spellInfo.ProcCharges = spellsResult.Read<uint>(46);
|
||||
@@ -3175,7 +3175,7 @@ namespace Game.Entities
|
||||
spellInfo.GetEffect(0).BasePoints = 0;// force seat 0, vehicle doesn't have the required seat flags for "no seat specified (-1)"
|
||||
break;
|
||||
case 61719: // Easter Lay Noblegarden Egg Aura - Interrupt flags copied from aura which this aura is linked with
|
||||
spellInfo.AuraInterruptFlags[0] = (uint)(SpellAuraInterruptFlags.Hitbyspell | SpellAuraInterruptFlags.TakeDamage);
|
||||
spellInfo.AuraInterruptFlags = SpellAuraInterruptFlags.HostileActionReceived | SpellAuraInterruptFlags.Damage;
|
||||
break;
|
||||
case 71838: // Drain Life - Bryntroll Normal
|
||||
case 71839: // Drain Life - Bryntroll Heroic
|
||||
@@ -3210,7 +3210,7 @@ namespace Game.Entities
|
||||
spellInfo.AttributesEx |= SpellAttr1.NoThreat;
|
||||
break;
|
||||
case 29726: // Test Ribbon Pole Channel
|
||||
spellInfo.InterruptFlags &= ~SpellInterruptFlags.Interrupt;//AURA_INTERRUPT_FLAG_CAST
|
||||
spellInfo.ChannelInterruptFlags &= ~SpellAuraInterruptFlags.Action;//AURA_INTERRUPT_FLAG_CAST
|
||||
break;
|
||||
case 42767: // Sic'em
|
||||
spellInfo.GetEffect(0).TargetA = new SpellImplicitTargetInfo(Targets.UnitNearbyEntry);
|
||||
@@ -3284,7 +3284,8 @@ namespace Game.Entities
|
||||
break;
|
||||
case 63414: // Spinning Up (Mimiron)
|
||||
spellInfo.GetEffect(0).TargetB = new SpellImplicitTargetInfo(Targets.UnitCaster);
|
||||
spellInfo.ChannelInterruptFlags.Clear();
|
||||
spellInfo.ChannelInterruptFlags = SpellAuraInterruptFlags.None;
|
||||
spellInfo.ChannelInterruptFlags2 = SpellAuraInterruptFlags2.None;
|
||||
break;
|
||||
case 63036: // Rocket Strike (Mimiron)
|
||||
spellInfo.Speed = 0;
|
||||
@@ -3508,7 +3509,7 @@ namespace Game.Entities
|
||||
spellInfo.GetEffect(0).MaxRadiusEntry = CliDB.SpellRadiusStorage.LookupByKey(EffectRadiusIndex.Yards45);
|
||||
break;
|
||||
case 24314: // Threatening Gaze
|
||||
spellInfo.AuraInterruptFlags[0] |= (uint)(SpellAuraInterruptFlags.Cast | SpellAuraInterruptFlags.Move | SpellAuraInterruptFlags.Jump);
|
||||
spellInfo.AuraInterruptFlags |= SpellAuraInterruptFlags.Action | SpellAuraInterruptFlags.Moving | SpellAuraInterruptFlags.Anim;
|
||||
break;
|
||||
case 783: // Travel Form (dummy) - cannot be cast indoors.
|
||||
spellInfo.Attributes |= SpellAttr0.OutdoorsOnly;
|
||||
@@ -3546,7 +3547,7 @@ namespace Game.Entities
|
||||
break;
|
||||
// Blaze of Glory
|
||||
case 99252:
|
||||
spellInfo.AuraInterruptFlags[0] |= (uint)SpellAuraInterruptFlags.ChangeMap;
|
||||
spellInfo.AuraInterruptFlags |= SpellAuraInterruptFlags.LeaveWorld;
|
||||
break;
|
||||
// ENDOF FIRELANDS SPELLS
|
||||
|
||||
|
||||
Reference in New Issue
Block a user