aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorariel- <ariel-@users.noreply.github.com>2018-03-10 00:58:48 -0300
committerShauren <shauren.trinity@gmail.com>2021-09-05 15:19:55 +0200
commitc07b9188dfc6f76bd909eea7cb8f5a8263b0e83e (patch)
tree74a074844cf9339887d82854d97ce0efc5f26acf
parent46537c6bcb8a7405a361a6aaaa47ffe5d7721bd9 (diff)
Core/Spells: register and apply individual aura effects on hit handler
- Remove area aura processing from spell system, they're fully handled by aura owner update now Closes #21577 (cherry picked from commit 4ca9d6469da435cb818e3b56840669775627e050)
-rw-r--r--src/server/game/Spells/Spell.h1
-rw-r--r--src/server/game/Spells/SpellEffects.cpp36
2 files changed, 17 insertions, 20 deletions
diff --git a/src/server/game/Spells/Spell.h b/src/server/game/Spells/Spell.h
index b12fa5fd929..faeaa0e8101 100644
--- a/src/server/game/Spells/Spell.h
+++ b/src/server/game/Spells/Spell.h
@@ -376,7 +376,6 @@ class TC_GAME_API Spell
void EffectOpenLock();
void EffectSummonChangeItem();
void EffectProficiency();
- void EffectApplyAreaAura();
void EffectSummonType();
void EffectLearnSpell();
void EffectDispel();
diff --git a/src/server/game/Spells/SpellEffects.cpp b/src/server/game/Spells/SpellEffects.cpp
index f881bf52e15..de9e35cbd1c 100644
--- a/src/server/game/Spells/SpellEffects.cpp
+++ b/src/server/game/Spells/SpellEffects.cpp
@@ -115,7 +115,7 @@ NonDefaultConstructible<SpellEffectHandlerFn> SpellEffectHandlers[TOTAL_SPELL_EF
&Spell::EffectTriggerMissileSpell, // 32 SPELL_EFFECT_TRIGGER_MISSILE
&Spell::EffectOpenLock, // 33 SPELL_EFFECT_OPEN_LOCK
&Spell::EffectSummonChangeItem, // 34 SPELL_EFFECT_SUMMON_CHANGE_ITEM
- &Spell::EffectApplyAreaAura, // 35 SPELL_EFFECT_APPLY_AREA_AURA_PARTY
+ &Spell::EffectUnused, // 35 SPELL_EFFECT_APPLY_AREA_AURA_PARTY
&Spell::EffectLearnSpell, // 36 SPELL_EFFECT_LEARN_SPELL
&Spell::EffectUnused, // 37 SPELL_EFFECT_SPELL_DEFENSE one spell: SPELLDEFENSE (DND)
&Spell::EffectDispel, // 38 SPELL_EFFECT_DISPEL
@@ -145,7 +145,7 @@ NonDefaultConstructible<SpellEffectHandlerFn> SpellEffectHandlers[TOTAL_SPELL_EF
&Spell::EffectPowerBurn, // 62 SPELL_EFFECT_POWER_BURN
&Spell::EffectThreat, // 63 SPELL_EFFECT_THREAT
&Spell::EffectTriggerSpell, // 64 SPELL_EFFECT_TRIGGER_SPELL
- &Spell::EffectApplyAreaAura, // 65 SPELL_EFFECT_APPLY_AREA_AURA_RAID
+ &Spell::EffectUnused, // 65 SPELL_EFFECT_APPLY_AREA_AURA_RAID
&Spell::EffectRechargeItem, // 66 SPELL_EFFECT_RECHARGE_ITEM
&Spell::EffectHealMaxHealth, // 67 SPELL_EFFECT_HEAL_MAX_HEALTH
&Spell::EffectInterruptCast, // 68 SPELL_EFFECT_INTERRUPT_CAST
@@ -199,7 +199,7 @@ NonDefaultConstructible<SpellEffectHandlerFn> SpellEffectHandlers[TOTAL_SPELL_EF
&Spell::EffectSkinPlayerCorpse, //116 SPELL_EFFECT_SKIN_PLAYER_CORPSE one spell: Remove Insignia, bg usage, required special corpse flags...
&Spell::EffectSpiritHeal, //117 SPELL_EFFECT_SPIRIT_HEAL one spell: Spirit Heal
&Spell::EffectSkill, //118 SPELL_EFFECT_SKILL professions and more
- &Spell::EffectApplyAreaAura, //119 SPELL_EFFECT_APPLY_AREA_AURA_PET
+ &Spell::EffectUnused, //119 SPELL_EFFECT_APPLY_AREA_AURA_PET
&Spell::EffectNULL, //120 SPELL_EFFECT_TELEPORT_GRAVEYARD
&Spell::EffectWeaponDmg, //121 SPELL_EFFECT_NORMALIZED_WEAPON_DMG
&Spell::EffectUnused, //122 SPELL_EFFECT_122 unused
@@ -208,8 +208,8 @@ NonDefaultConstructible<SpellEffectHandlerFn> SpellEffectHandlers[TOTAL_SPELL_EF
&Spell::EffectModifyThreatPercent, //125 SPELL_EFFECT_MODIFY_THREAT_PERCENT
&Spell::EffectStealBeneficialBuff, //126 SPELL_EFFECT_STEAL_BENEFICIAL_BUFF spell steal effect?
&Spell::EffectProspecting, //127 SPELL_EFFECT_PROSPECTING Prospecting spell
- &Spell::EffectApplyAreaAura, //128 SPELL_EFFECT_APPLY_AREA_AURA_FRIEND
- &Spell::EffectApplyAreaAura, //129 SPELL_EFFECT_APPLY_AREA_AURA_ENEMY
+ &Spell::EffectUnused, //128 SPELL_EFFECT_APPLY_AREA_AURA_FRIEND
+ &Spell::EffectUnused, //129 SPELL_EFFECT_APPLY_AREA_AURA_ENEMY
&Spell::EffectRedirectThreat, //130 SPELL_EFFECT_REDIRECT_THREAT
&Spell::EffectPlaySound, //131 SPELL_EFFECT_PLAY_SOUND sound id in misc value (SoundEntries.dbc)
&Spell::EffectPlayMusic, //132 SPELL_EFFECT_PLAY_MUSIC sound id in misc value (SoundEntries.dbc)
@@ -223,7 +223,7 @@ NonDefaultConstructible<SpellEffectHandlerFn> SpellEffectHandlers[TOTAL_SPELL_EF
&Spell::EffectForceCast, //140 SPELL_EFFECT_FORCE_CAST
&Spell::EffectForceCast, //141 SPELL_EFFECT_FORCE_CAST_WITH_VALUE
&Spell::EffectTriggerSpell, //142 SPELL_EFFECT_TRIGGER_SPELL_WITH_VALUE
- &Spell::EffectApplyAreaAura, //143 SPELL_EFFECT_APPLY_AREA_AURA_OWNER
+ &Spell::EffectUnused, //143 SPELL_EFFECT_APPLY_AREA_AURA_OWNER
&Spell::EffectKnockBack, //144 SPELL_EFFECT_KNOCK_BACK_DEST
&Spell::EffectPullTowards, //145 SPELL_EFFECT_PULL_TOWARDS_DEST Black Hole Effect
&Spell::EffectNULL, //146 SPELL_EFFECT_RESTORE_GARRISON_TROOP_VITALITY
@@ -282,7 +282,7 @@ NonDefaultConstructible<SpellEffectHandlerFn> SpellEffectHandlers[TOTAL_SPELL_EF
&Spell::EffectNULL, //199 SPELL_EFFECT_DESPAWN_SUMMON
&Spell::EffectHealBattlePetPct, //200 SPELL_EFFECT_HEAL_BATTLEPET_PCT
&Spell::EffectEnableBattlePets, //201 SPELL_EFFECT_ENABLE_BATTLE_PETS
- &Spell::EffectApplyAreaAura, //202 SPELL_EFFECT_APPLY_AREA_AURA_SUMMONS
+ &Spell::EffectUnused, //202 SPELL_EFFECT_APPLY_AREA_AURA_SUMMONS
&Spell::EffectRemoveAura, //203 SPELL_EFFECT_REMOVE_AURA_2
&Spell::EffectNULL, //204 SPELL_EFFECT_CHANGE_BATTLEPET_QUALITY
&Spell::EffectLaunchQuestChoice, //205 SPELL_EFFECT_LAUNCH_QUEST_CHOICE
@@ -351,7 +351,7 @@ NonDefaultConstructible<SpellEffectHandlerFn> SpellEffectHandlers[TOTAL_SPELL_EF
&Spell::EffectNULL, //268 SPELL_EFFECT_APPLY_MOUNT_EQUIPMENT
&Spell::EffectNULL, //269 SPELL_EFFECT_INCREASE_ITEM_BONUS_LIST_GROUP_STEP
&Spell::EffectNULL, //270 SPELL_EFFECT_270
- &Spell::EffectApplyAreaAura, //271 SPELL_EFFECT_APPLY_AREA_AURA_PARTY_NONRANDOM
+ &Spell::EffectUnused, //271 SPELL_EFFECT_APPLY_AREA_AURA_PARTY_NONRANDOM
&Spell::EffectNULL, //272 SPELL_EFFECT_SET_COVENANT
&Spell::EffectNULL, //273 SPELL_EFFECT_CRAFT_RUNEFORGE_LEGENDARY
&Spell::EffectUnused, //274 SPELL_EFFECT_274
@@ -1016,18 +1016,16 @@ void Spell::EffectApplyAura()
if (!_spellAura || !unitTarget)
return;
- _spellAura->_ApplyEffectForTargets(effectInfo->EffectIndex);
-}
-
-void Spell::EffectApplyAreaAura()
-{
- if (effectHandleMode != SPELL_EFFECT_HANDLE_HIT_TARGET)
- return;
-
- if (!_spellAura || !unitTarget)
- return;
+ // register target/effect on aura
+ AuraApplication* aurApp = _spellAura->GetApplicationOfTarget(unitTarget->GetGUID());
+ if (!aurApp)
+ aurApp = unitTarget->_CreateAuraApplication(_spellAura, 1 << effectInfo->EffectIndex);
+ else
+ aurApp->UpdateApplyEffectMask(aurApp->GetEffectsToApply() | 1 << effectInfo->EffectIndex);
- _spellAura->_ApplyEffectForTargets(effectInfo->EffectIndex);
+ // apply effect on target (skip for reapply)
+ if (!aurApp->HasEffect(effectInfo->EffectIndex))
+ unitTarget->_ApplyAuraEffect(_spellAura, effectInfo->EffectIndex);
}
void Spell::EffectUnlearnSpecialization()