From 393cd1e6d0c1096e9c451a4333a0b4e5f33d0329 Mon Sep 17 00:00:00 2001 From: hondacrx Date: Wed, 16 Feb 2022 13:17:28 -0500 Subject: [PATCH] Core/Spells: Implemented target 105 TARGET_UNIT_CASTER_AND_PASSENGERS Port From (https://github.com/TrinityCore/TrinityCore/commit/bbdb70ed57887465f5e06a131c8326b71743950c) --- .../Framework/Constants/Spells/SpellConst.cs | 2 +- Source/Game/Spells/Spell.cs | 55 +++++++------------ Source/Game/Spells/SpellInfo.cs | 2 +- 3 files changed, 23 insertions(+), 36 deletions(-) diff --git a/Source/Framework/Constants/Spells/SpellConst.cs b/Source/Framework/Constants/Spells/SpellConst.cs index f29d13650..97fd99778 100644 --- a/Source/Framework/Constants/Spells/SpellConst.cs +++ b/Source/Framework/Constants/Spells/SpellConst.cs @@ -2679,7 +2679,7 @@ namespace Framework.Constants UnitPassenger6 = 102, UnitPassenger7 = 103, UnitConeCasterToDestEnemy = 104, - UnitUnk105 = 105, // 1 Spell + UnitCasterAndPassengers = 105, DestChannelCaster = 106, UnkDestAreaUnk107 = 107, // Not Enough Info - Only Generic Spells Avalible GameobjectCone_108 = 108, diff --git a/Source/Game/Spells/Spell.cs b/Source/Game/Spells/Spell.cs index 06736ea8d..9a58c13f5 100644 --- a/Source/Game/Spells/Spell.cs +++ b/Source/Game/Spells/Spell.cs @@ -745,58 +745,45 @@ namespace Game.Spells Cypher.Assert(false, "Spell.SelectImplicitAreaTargets: received not implemented target reference type"); return; } - List targets = new(); + float radius = spellEffectInfo.CalcRadius(m_caster) * m_spellValue.RadiusMod; + List targets = new(); switch (targetType.GetTarget()) { + case Targets.UnitCasterAndPassengers: + targets.Add(m_caster); + Unit unit = m_caster.ToUnit(); + if (unit != null) + { + Vehicle vehicleKit = unit.GetVehicleKit(); + if (vehicleKit != null) + for (sbyte seat = 0; seat < SharedConst.MaxVehicleSeats; ++seat) + { + Unit passenger = vehicleKit.GetPassenger(seat); + if (passenger != null) + targets.Add(passenger); + } + } + break; case Targets.UnitTargetAllyOrRaid: Unit targetedUnit = m_targets.GetUnitTarget(); if (targetedUnit != null) { if (!m_caster.IsUnit() || !m_caster.ToUnit().IsInRaidWith(targetedUnit)) - { targets.Add(m_targets.GetUnitTarget()); - - CallScriptObjectAreaTargetSelectHandlers(targets, spellEffectInfo.EffectIndex, targetType); - - if (!targets.Empty()) - { - // Other special target selection goes here - uint maxTargets = m_spellValue.MaxAffectedTargets; - if (maxTargets != 0) - targets.RandomResize(maxTargets); - - foreach (WorldObject target in targets) - { - Unit unit = target.ToUnit(); - if (unit != null) - AddUnitTarget(unit, effMask, false, true, center); - else - { - GameObject gObjTarget = target.ToGameObject(); - if (gObjTarget != null) - AddGOTarget(gObjTarget, effMask); - } - } - } - - return; - } - - center = targetedUnit; + else + SearchAreaTargets(targets, radius, targetedUnit, referer, targetType.GetObjectType(), targetType.GetCheckType(), spellEffectInfo.ImplicitTargetConditions); } break; case Targets.UnitCasterAndSummons: targets.Add(m_caster); + SearchAreaTargets(targets, radius, center, referer, targetType.GetObjectType(), targetType.GetCheckType(), spellEffectInfo.ImplicitTargetConditions); break; default: + SearchAreaTargets(targets, radius, center, referer, targetType.GetObjectType(), targetType.GetCheckType(), spellEffectInfo.ImplicitTargetConditions); break; } - float radius = spellEffectInfo.CalcRadius(m_caster) * m_spellValue.RadiusMod; - - SearchAreaTargets(targets, radius, center, referer, targetType.GetObjectType(), targetType.GetCheckType(), spellEffectInfo.ImplicitTargetConditions); - CallScriptObjectAreaTargetSelectHandlers(targets, spellEffectInfo.EffectIndex, targetType); if (!targets.Empty()) diff --git a/Source/Game/Spells/SpellInfo.cs b/Source/Game/Spells/SpellInfo.cs index c398662ff..3cb4e1abc 100644 --- a/Source/Game/Spells/SpellInfo.cs +++ b/Source/Game/Spells/SpellInfo.cs @@ -5028,7 +5028,7 @@ namespace Game.Spells new StaticData(SpellTargetObjectTypes.Unit, SpellTargetReferenceTypes.Caster, SpellTargetSelectionCategories.Default, SpellTargetCheckTypes.Default, SpellTargetDirectionTypes.None), // 102 TARGET_UNIT_PASSENGER_6 new StaticData(SpellTargetObjectTypes.Unit, SpellTargetReferenceTypes.Caster, SpellTargetSelectionCategories.Default, SpellTargetCheckTypes.Default, SpellTargetDirectionTypes.None), // 103 TARGET_UNIT_PASSENGER_7 new StaticData(SpellTargetObjectTypes.Unit, SpellTargetReferenceTypes.Dest, SpellTargetSelectionCategories.Cone, SpellTargetCheckTypes.Enemy, SpellTargetDirectionTypes.Front), // 104 TARGET_UNIT_CONE_CASTER_TO_DEST_ENEMY - new StaticData(SpellTargetObjectTypes.Unit, SpellTargetReferenceTypes.None, SpellTargetSelectionCategories.Nyi, SpellTargetCheckTypes.Default, SpellTargetDirectionTypes.None), // 105 TARGET_UNIT_UNK_105 + new StaticData(SpellTargetObjectTypes.Unit, SpellTargetReferenceTypes.Caster, SpellTargetSelectionCategories.Area, SpellTargetCheckTypes.Default, SpellTargetDirectionTypes.None), // 105 TARGET_UNIT_CASTER_AND_PASSENGERS new StaticData(SpellTargetObjectTypes.Dest, SpellTargetReferenceTypes.Caster, SpellTargetSelectionCategories.Channel, SpellTargetCheckTypes.Default, SpellTargetDirectionTypes.None), // 106 TARGET_DEST_CHANNEL_CASTER new StaticData(SpellTargetObjectTypes.None, SpellTargetReferenceTypes.Dest, SpellTargetSelectionCategories.Nyi, SpellTargetCheckTypes.Default, SpellTargetDirectionTypes.None), // 107 TARGET_UNK_DEST_AREA_UNK_107 new StaticData(SpellTargetObjectTypes.Gobj, SpellTargetReferenceTypes.Caster, SpellTargetSelectionCategories.Cone, SpellTargetCheckTypes.Default, SpellTargetDirectionTypes.Front), // 108 TARGET_GAMEOBJECT_CONE_108