From 42f411119a437abbe21f2ba0fe1025d7ca6d60c7 Mon Sep 17 00:00:00 2001 From: hondacrx Date: Thu, 4 Mar 2021 14:21:45 -0500 Subject: [PATCH] Core/Spells: Implemented spell effect 202 SPELL_EFFECT_APPLY_AREA_AURA_SUMMONS Port From (https://github.com/TrinityCore/TrinityCore/commit/ad479e8fa0de6659815e956ee5f2b594957a7d1d) --- Source/Framework/Constants/Spells/SpellConst.cs | 2 +- Source/Game/Spells/Auras/Aura.cs | 10 +++++++++- Source/Game/Spells/SpellEffects.cs | 5 ++++- Source/Game/Spells/SpellInfo.cs | 5 +++-- Source/Game/Spells/SpellManager.cs | 2 +- 5 files changed, 18 insertions(+), 6 deletions(-) diff --git a/Source/Framework/Constants/Spells/SpellConst.cs b/Source/Framework/Constants/Spells/SpellConst.cs index 2b121356c..ee8f05e7b 100644 --- a/Source/Framework/Constants/Spells/SpellConst.cs +++ b/Source/Framework/Constants/Spells/SpellConst.cs @@ -2209,7 +2209,7 @@ namespace Framework.Constants Unk199 = 199, HealBattlepetPct = 200, // NYI EnableBattlePets = 201, // NYI - Unk202 = 202, + ApplyAreaAuraSummons = 202, Unk203 = 203, ChangeBattlepetQuality = 204, LaunchQuestChoice = 205, diff --git a/Source/Game/Spells/Auras/Aura.cs b/Source/Game/Spells/Auras/Aura.cs index f75fc366b..3791d1254 100644 --- a/Source/Game/Spells/Auras/Aura.cs +++ b/Source/Game/Spells/Auras/Aura.cs @@ -2602,7 +2602,7 @@ namespace Game.Spells List targetList = new List(); // non-area aura - if (effect.Effect == SpellEffectName.ApplyAura || effect.Effect == SpellEffectName.Unk202) + if (effect.Effect == SpellEffectName.ApplyAura) { targetList.Add(GetUnitOwner()); } @@ -2657,6 +2657,14 @@ namespace Game.Spells targetList.Add(pet); break; } + case SpellEffectName.ApplyAreaAuraSummons: + { + targetList.Add(GetUnitOwner()); + WorldObjectSpellAreaTargetCheck check = new(radius, GetUnitOwner(), caster, GetUnitOwner(), GetSpellInfo(), SpellTargetCheckTypes.Summoned, null, SpellTargetObjectTypes.Unit); + UnitListSearcher searcher = new(GetUnitOwner(), targetList, check); + Cell.VisitAllObjects(GetUnitOwner(), searcher, radius); + break; + } } } } diff --git a/Source/Game/Spells/SpellEffects.cs b/Source/Game/Spells/SpellEffects.cs index c4885332b..b25c1862c 100644 --- a/Source/Game/Spells/SpellEffects.cs +++ b/Source/Game/Spells/SpellEffects.cs @@ -716,7 +716,6 @@ namespace Game.Spells [SpellEffectHandler(SpellEffectName.ApplyAura)] [SpellEffectHandler(SpellEffectName.ApplyAuraOnPet)] - [SpellEffectHandler(SpellEffectName.Unk202)] void EffectApplyAura(uint effIndex) { if (effectHandleMode != SpellEffectHandleMode.HitTarget) @@ -736,6 +735,7 @@ namespace Game.Spells [SpellEffectHandler(SpellEffectName.ApplyAreaAuraPet)] [SpellEffectHandler(SpellEffectName.ApplyAreaAuraRaid)] [SpellEffectHandler(SpellEffectName.ApplyAreaAuraPartyNonrandom)] + [SpellEffectHandler(SpellEffectName.ApplyAreaAuraSummons)] void EffectApplyAreaAura(uint effIndex) { if (effectHandleMode != SpellEffectHandleMode.HitTarget) @@ -2179,6 +2179,9 @@ namespace Game.Spells if (effectHandleMode != SpellEffectHandleMode.HitTarget) return; + if (itemTarget == null) + return; + Player player = m_caster.ToPlayer(); if (player == null) return; diff --git a/Source/Game/Spells/SpellInfo.cs b/Source/Game/Spells/SpellInfo.cs index 7fbfa972f..50d0bf39d 100644 --- a/Source/Game/Spells/SpellInfo.cs +++ b/Source/Game/Spells/SpellInfo.cs @@ -3721,6 +3721,7 @@ namespace Game.Spells Effect == SpellEffectName.ApplyAreaAuraEnemy || Effect == SpellEffectName.ApplyAreaAuraPet || Effect == SpellEffectName.ApplyAreaAuraOwner || + Effect == SpellEffectName.ApplyAreaAuraSummons || Effect == SpellEffectName.ApplyAreaAuraPartyNonrandom) return true; return false; @@ -3740,7 +3741,7 @@ namespace Game.Spells public bool IsUnitOwnedAuraEffect() { - return IsAreaAuraEffect() || Effect == SpellEffectName.ApplyAura || Effect == SpellEffectName.ApplyAuraOnPet || Effect == SpellEffectName.Unk202; + return IsAreaAuraEffect() || Effect == SpellEffectName.ApplyAura || Effect == SpellEffectName.ApplyAuraOnPet; } public int CalcValue(Unit caster = null, int? bp = null, Unit target = null, uint castItemId = 0, int itemLevel = -1) @@ -4034,7 +4035,7 @@ namespace Game.Spells case SpellEffectName.ApplyAreaAuraEnemy: case SpellEffectName.ApplyAreaAuraOwner: case SpellEffectName.ApplyAuraOnPet: - case SpellEffectName.Unk202: + case SpellEffectName.ApplyAreaAuraSummons: case SpellEffectName.ApplyAreaAuraPartyNonrandom: switch (ApplyAuraName) { diff --git a/Source/Game/Spells/SpellManager.cs b/Source/Game/Spells/SpellManager.cs index a78043db5..4da6dad83 100644 --- a/Source/Game/Spells/SpellManager.cs +++ b/Source/Game/Spells/SpellManager.cs @@ -2534,7 +2534,7 @@ namespace Game.Entities case SpellEffectName.ApplyAreaAuraPet: case SpellEffectName.ApplyAreaAuraOwner: case SpellEffectName.ApplyAuraOnPet: - case SpellEffectName.Unk202: + case SpellEffectName.ApplyAreaAuraSummons: case SpellEffectName.ApplyAreaAuraPartyNonrandom: { if (effect.ApplyAuraName == AuraType.PeriodicDamage ||