From 943e858ccfeb421da083f64914806df17cbe9b60 Mon Sep 17 00:00:00 2001 From: hondacrx Date: Wed, 25 Jul 2018 12:25:53 -0400 Subject: [PATCH] Core/Spells: Implement AURA_REMOVE_BY_INTERRUPT to provide aura scripts with more information when removing by Unit::RemoveAurasWithInterruptFlags --- Source/Game/Entities/Unit/Unit.Spells.cs | 6 +++--- Source/Game/Spells/Auras/Aura.cs | 5 +++-- Source/Game/Spells/Auras/AuraEffect.cs | 2 +- Source/Scripts/Spells/Hunter.cs | 5 ++++- Source/Scripts/Spells/Warlock.cs | 2 +- 5 files changed, 12 insertions(+), 8 deletions(-) diff --git a/Source/Game/Entities/Unit/Unit.Spells.cs b/Source/Game/Entities/Unit/Unit.Spells.cs index 197d156df..f16aca044 100644 --- a/Source/Game/Entities/Unit/Unit.Spells.cs +++ b/Source/Game/Entities/Unit/Unit.Spells.cs @@ -2563,7 +2563,7 @@ namespace Game.Entities Aura aura = app.Value.GetBase(); if (!aura.IsPassive() && !aura.IsDeathPersistent()) - _UnapplyAura(app, AuraRemoveMode.ByDeath); + _UnapplyAura(app, AuraRemoveMode.Death); } foreach (var pair in GetOwnedAuras()) @@ -2573,7 +2573,7 @@ namespace Game.Entities continue; if (!aura.IsPassive() && !aura.IsDeathPersistent()) - RemoveOwnedAura(pair, AuraRemoveMode.ByDeath); + RemoveOwnedAura(pair, AuraRemoveMode.Death); } } public void RemoveMovementImpairingAuras() @@ -3193,7 +3193,7 @@ namespace Game.Entities && !(Convert.ToBoolean(flag & (uint)SpellAuraInterruptFlags.Move) && HasAuraTypeWithAffectMask(AuraType.CastWhileWalking, aura.GetSpellInfo()))) { uint removedAuras = m_removedAurasCount; - RemoveAura(aura); + RemoveAura(aura, AuraRemoveMode.Interrupt); if (m_removedAurasCount > removedAuras + 1) i = 0; } diff --git a/Source/Game/Spells/Auras/Aura.cs b/Source/Game/Spells/Auras/Aura.cs index 90739507a..976f3d55c 100644 --- a/Source/Game/Spells/Auras/Aura.cs +++ b/Source/Game/Spells/Auras/Aura.cs @@ -37,10 +37,11 @@ namespace Game.Spells { None = 0, Default = 1, // scripted remove, remove by stack with aura with different ids and sc aura remove + Interrupt, Cancel, EnemySpell, // dispel and absorb aura destroy Expire, // aura duration has ended - ByDeath + Death } public enum AuraFlags { @@ -1162,7 +1163,7 @@ namespace Game.Spells { if (spell < 0) target.RemoveAurasDueToSpell((uint)-spell); - else if (removeMode != AuraRemoveMode.ByDeath) + else if (removeMode != AuraRemoveMode.Death) target.CastSpell(target, (uint)spell, true, null, null, GetCasterGUID()); } } diff --git a/Source/Game/Spells/Auras/AuraEffect.cs b/Source/Game/Spells/Auras/AuraEffect.cs index 4eb7eff59..6a31628b7 100644 --- a/Source/Game/Spells/Auras/AuraEffect.cs +++ b/Source/Game/Spells/Auras/AuraEffect.cs @@ -4468,7 +4468,7 @@ namespace Game.Spells if (!mode.HasAnyFlag(AuraEffectHandleModes.Real)) return; - if (apply || aurApp.GetRemoveMode() != AuraRemoveMode.ByDeath) + if (apply || aurApp.GetRemoveMode() != AuraRemoveMode.Death) return; Unit caster = GetCaster(); diff --git a/Source/Scripts/Spells/Hunter.cs b/Source/Scripts/Spells/Hunter.cs index 0ebd13be6..c659d02e7 100644 --- a/Source/Scripts/Spells/Hunter.cs +++ b/Source/Scripts/Spells/Hunter.cs @@ -298,7 +298,10 @@ namespace Scripts.Spells.Hunter void OnRemove(AuraEffect aurEff, AuraEffectHandleModes mode) { - if (GetTargetApplication().GetRemoveMode() != AuraRemoveMode.Default || !GetTarget().HasAura(SpellIds.MisdirectionProc)) + if (GetTargetApplication().GetRemoveMode() = AuraRemoveMode.Default || GetTargetApplication().GetRemoveMode() == AuraRemoveMode.Interrupt) + return; + + if (!GetTarget().HasAura(SpellIds.MisdirectionProc)) GetTarget().ResetRedirectThreat(); } diff --git a/Source/Scripts/Spells/Warlock.cs b/Source/Scripts/Spells/Warlock.cs index 867781d23..b15f88239 100644 --- a/Source/Scripts/Spells/Warlock.cs +++ b/Source/Scripts/Spells/Warlock.cs @@ -192,7 +192,7 @@ namespace Scripts.Spells.Warlock return; AuraRemoveMode removeMode = GetTargetApplication().GetRemoveMode(); - if (removeMode != AuraRemoveMode.ByDeath || !IsExpired()) + if (removeMode != AuraRemoveMode.Death || !IsExpired()) return; if (GetCaster().ToPlayer().isHonorOrXPTarget(GetTarget()))