From 0b3177fc1fecddd79e401135b3949cd6bf7b1eb1 Mon Sep 17 00:00:00 2001 From: hondacrx Date: Wed, 8 Sep 2021 22:55:23 -0400 Subject: [PATCH] Core/Spells: register and apply individual aura effects on hit handler Port From (https://github.com/TrinityCore/TrinityCore/commit/c07b9188dfc6f76bd909eea7cb8f5a8263b0e83e) --- Source/Game/Spells/SpellEffects.cs | 28 +++++++++------------------- 1 file changed, 9 insertions(+), 19 deletions(-) diff --git a/Source/Game/Spells/SpellEffects.cs b/Source/Game/Spells/SpellEffects.cs index 6b1a9290e..302979586 100644 --- a/Source/Game/Spells/SpellEffects.cs +++ b/Source/Game/Spells/SpellEffects.cs @@ -705,26 +705,16 @@ namespace Game.Spells if (spellAura == null || unitTarget == null) return; - spellAura._ApplyEffectForTargets(effectInfo.EffectIndex); - } + // register target/effect on aura + AuraApplication aurApp = spellAura.GetApplicationOfTarget(unitTarget.GetGUID()); + if (aurApp == null) + aurApp = unitTarget._CreateAuraApplication(spellAura, 1u << (int)effectInfo.EffectIndex); + else + aurApp.UpdateApplyEffectMask(aurApp.GetEffectsToApply() | 1u << (int)effectInfo.EffectIndex); - [SpellEffectHandler(SpellEffectName.ApplyAreaAuraEnemy)] - [SpellEffectHandler(SpellEffectName.ApplyAreaAuraFriend)] - [SpellEffectHandler(SpellEffectName.ApplyAreaAuraOwner)] - [SpellEffectHandler(SpellEffectName.ApplyAreaAuraParty)] - [SpellEffectHandler(SpellEffectName.ApplyAreaAuraPet)] - [SpellEffectHandler(SpellEffectName.ApplyAreaAuraRaid)] - [SpellEffectHandler(SpellEffectName.ApplyAreaAuraPartyNonrandom)] - [SpellEffectHandler(SpellEffectName.ApplyAreaAuraSummons)] - void EffectApplyAreaAura() - { - if (effectHandleMode != SpellEffectHandleMode.HitTarget) - return; - - if (spellAura == null || unitTarget == null) - return; - - spellAura._ApplyEffectForTargets(effectInfo.EffectIndex); + // apply effect on target (skip for reapply) + if (!aurApp.HasEffect(effectInfo.EffectIndex)) + unitTarget._ApplyAuraEffect(spellAura, effectInfo.EffectIndex); } [SpellEffectHandler(SpellEffectName.UnlearnSpecialization)]