Core/Spells: Implement AURA_REMOVE_BY_INTERRUPT to provide aura scripts with more information when removing by Unit::RemoveAurasWithInterruptFlags

This commit is contained in:
hondacrx
2018-07-25 12:25:53 -04:00
parent 75619e833f
commit 943e858ccf
5 changed files with 12 additions and 8 deletions
+3 -3
View File
@@ -2563,7 +2563,7 @@ namespace Game.Entities
Aura aura = app.Value.GetBase(); Aura aura = app.Value.GetBase();
if (!aura.IsPassive() && !aura.IsDeathPersistent()) if (!aura.IsPassive() && !aura.IsDeathPersistent())
_UnapplyAura(app, AuraRemoveMode.ByDeath); _UnapplyAura(app, AuraRemoveMode.Death);
} }
foreach (var pair in GetOwnedAuras()) foreach (var pair in GetOwnedAuras())
@@ -2573,7 +2573,7 @@ namespace Game.Entities
continue; continue;
if (!aura.IsPassive() && !aura.IsDeathPersistent()) if (!aura.IsPassive() && !aura.IsDeathPersistent())
RemoveOwnedAura(pair, AuraRemoveMode.ByDeath); RemoveOwnedAura(pair, AuraRemoveMode.Death);
} }
} }
public void RemoveMovementImpairingAuras() public void RemoveMovementImpairingAuras()
@@ -3193,7 +3193,7 @@ namespace Game.Entities
&& !(Convert.ToBoolean(flag & (uint)SpellAuraInterruptFlags.Move) && HasAuraTypeWithAffectMask(AuraType.CastWhileWalking, aura.GetSpellInfo()))) && !(Convert.ToBoolean(flag & (uint)SpellAuraInterruptFlags.Move) && HasAuraTypeWithAffectMask(AuraType.CastWhileWalking, aura.GetSpellInfo())))
{ {
uint removedAuras = m_removedAurasCount; uint removedAuras = m_removedAurasCount;
RemoveAura(aura); RemoveAura(aura, AuraRemoveMode.Interrupt);
if (m_removedAurasCount > removedAuras + 1) if (m_removedAurasCount > removedAuras + 1)
i = 0; i = 0;
} }
+3 -2
View File
@@ -37,10 +37,11 @@ namespace Game.Spells
{ {
None = 0, None = 0,
Default = 1, // scripted remove, remove by stack with aura with different ids and sc aura remove Default = 1, // scripted remove, remove by stack with aura with different ids and sc aura remove
Interrupt,
Cancel, Cancel,
EnemySpell, // dispel and absorb aura destroy EnemySpell, // dispel and absorb aura destroy
Expire, // aura duration has ended Expire, // aura duration has ended
ByDeath Death
} }
public enum AuraFlags public enum AuraFlags
{ {
@@ -1162,7 +1163,7 @@ namespace Game.Spells
{ {
if (spell < 0) if (spell < 0)
target.RemoveAurasDueToSpell((uint)-spell); target.RemoveAurasDueToSpell((uint)-spell);
else if (removeMode != AuraRemoveMode.ByDeath) else if (removeMode != AuraRemoveMode.Death)
target.CastSpell(target, (uint)spell, true, null, null, GetCasterGUID()); target.CastSpell(target, (uint)spell, true, null, null, GetCasterGUID());
} }
} }
+1 -1
View File
@@ -4468,7 +4468,7 @@ namespace Game.Spells
if (!mode.HasAnyFlag(AuraEffectHandleModes.Real)) if (!mode.HasAnyFlag(AuraEffectHandleModes.Real))
return; return;
if (apply || aurApp.GetRemoveMode() != AuraRemoveMode.ByDeath) if (apply || aurApp.GetRemoveMode() != AuraRemoveMode.Death)
return; return;
Unit caster = GetCaster(); Unit caster = GetCaster();
+4 -1
View File
@@ -298,7 +298,10 @@ namespace Scripts.Spells.Hunter
void OnRemove(AuraEffect aurEff, AuraEffectHandleModes mode) 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(); GetTarget().ResetRedirectThreat();
} }
+1 -1
View File
@@ -192,7 +192,7 @@ namespace Scripts.Spells.Warlock
return; return;
AuraRemoveMode removeMode = GetTargetApplication().GetRemoveMode(); AuraRemoveMode removeMode = GetTargetApplication().GetRemoveMode();
if (removeMode != AuraRemoveMode.ByDeath || !IsExpired()) if (removeMode != AuraRemoveMode.Death || !IsExpired())
return; return;
if (GetCaster().ToPlayer().isHonorOrXPTarget(GetTarget())) if (GetCaster().ToPlayer().isHonorOrXPTarget(GetTarget()))