From 1b1214263f47f20b79d9f72088d70a0e8b521318 Mon Sep 17 00:00:00 2001 From: hondacrx Date: Thu, 17 Feb 2022 09:45:51 -0500 Subject: [PATCH] Core/Spells: Implemented target 116 TARGET_UNIT_AND_DEST_LAST_ENEMY Port From (https://github.com/TrinityCore/TrinityCore/commit/115409f353141dc8cf49a91699e9593b1bf04385) --- Source/Framework/Constants/Spells/SpellConst.cs | 2 +- Source/Game/Scripting/SpellScript.cs | 5 ++++- Source/Game/Spells/Spell.cs | 11 +++++++++++ Source/Game/Spells/SpellInfo.cs | 2 +- 4 files changed, 17 insertions(+), 3 deletions(-) diff --git a/Source/Framework/Constants/Spells/SpellConst.cs b/Source/Framework/Constants/Spells/SpellConst.cs index 191079b0b..3148c4e84 100644 --- a/Source/Framework/Constants/Spells/SpellConst.cs +++ b/Source/Framework/Constants/Spells/SpellConst.cs @@ -2690,7 +2690,7 @@ namespace Framework.Constants Unk113 = 113, Unk114 = 114, Unk115 = 115, - Unk116 = 116, + UnitAndDestLastEnemy = 116, Unk117 = 117, UnitTargetAllyOrRaid = 118, // If target is in your party or raid, all party and raid members will be affected CorpseSrcAreaRaid = 119, diff --git a/Source/Game/Scripting/SpellScript.cs b/Source/Game/Scripting/SpellScript.cs index 6b6861319..cd4f32d2d 100644 --- a/Source/Game/Scripting/SpellScript.cs +++ b/Source/Game/Scripting/SpellScript.cs @@ -287,9 +287,12 @@ namespace Game.Scripting case SpellTargetSelectionCategories.Nearby: // BOTH return true; case SpellTargetSelectionCategories.Cone: // AREA - case SpellTargetSelectionCategories.Area: // AREA case SpellTargetSelectionCategories.Line: // AREA return _area; + case SpellTargetSelectionCategories.Area: // AREA + if (targetInfo.GetObjectType() == SpellTargetObjectTypes.UnitAndDest) + return _area || _dest; + return _area; case SpellTargetSelectionCategories.Default: switch (targetInfo.GetObjectType()) { diff --git a/Source/Game/Spells/Spell.cs b/Source/Game/Spells/Spell.cs index baa4f35c1..62ad24329 100644 --- a/Source/Game/Spells/Spell.cs +++ b/Source/Game/Spells/Spell.cs @@ -720,6 +720,8 @@ namespace Game.Spells break; case SpellTargetReferenceTypes.Last: { + referer = m_caster; + // find last added target for this effect foreach (var target in m_UniqueTargetInfo) { @@ -795,6 +797,15 @@ namespace Game.Spells break; } + if (targetType.GetObjectType() == SpellTargetObjectTypes.UnitAndDest) + { + SpellDestination dest = new(referer); + + CallScriptDestinationTargetSelectHandlers(ref dest, spellEffectInfo.EffectIndex, targetType); + + m_targets.ModDst(dest); + } + CallScriptObjectAreaTargetSelectHandlers(targets, spellEffectInfo.EffectIndex, targetType); if (!targets.Empty()) diff --git a/Source/Game/Spells/SpellInfo.cs b/Source/Game/Spells/SpellInfo.cs index ec90e9162..d385c5612 100644 --- a/Source/Game/Spells/SpellInfo.cs +++ b/Source/Game/Spells/SpellInfo.cs @@ -5039,7 +5039,7 @@ namespace Game.Spells new StaticData(SpellTargetObjectTypes.None, SpellTargetReferenceTypes.None, SpellTargetSelectionCategories.Nyi, SpellTargetCheckTypes.Default, SpellTargetDirectionTypes.None), // 113 new StaticData(SpellTargetObjectTypes.None, SpellTargetReferenceTypes.None, SpellTargetSelectionCategories.Nyi, SpellTargetCheckTypes.Default, SpellTargetDirectionTypes.None), // 114 new StaticData(SpellTargetObjectTypes.None, SpellTargetReferenceTypes.None, SpellTargetSelectionCategories.Nyi, SpellTargetCheckTypes.Default, SpellTargetDirectionTypes.None), // 115 - new StaticData(SpellTargetObjectTypes.None, SpellTargetReferenceTypes.None, SpellTargetSelectionCategories.Nyi, SpellTargetCheckTypes.Default, SpellTargetDirectionTypes.None), // 116 + new StaticData(SpellTargetObjectTypes.UnitAndDest, SpellTargetReferenceTypes.Last, SpellTargetSelectionCategories.Area, SpellTargetCheckTypes.Enemy, SpellTargetDirectionTypes.None), // 116 TARGET_UNIT_AND_DEST_LAST_ENEMY new StaticData(SpellTargetObjectTypes.None, SpellTargetReferenceTypes.None, SpellTargetSelectionCategories.Nyi, SpellTargetCheckTypes.Default, SpellTargetDirectionTypes.None), // 117 new StaticData(SpellTargetObjectTypes.Unit, SpellTargetReferenceTypes.Caster, SpellTargetSelectionCategories.Area, SpellTargetCheckTypes.Raid, SpellTargetDirectionTypes.None), // 118 TARGET_UNIT_TARGET_ALLY_OR_RAID new StaticData(SpellTargetObjectTypes.Corpse, SpellTargetReferenceTypes.Caster, SpellTargetSelectionCategories.Area, SpellTargetCheckTypes.Raid, SpellTargetDirectionTypes.None), // 119 TARGET_CORPSE_SRC_AREA_RAID