Core/Spells: Fixed spell target selection not being shared by multiple effects when there are targeting scripts that have the same script function

Port From (https://github.com/TrinityCore/TrinityCore/commit/b1d8061a0f848241fe70ab0d718e829836cb5601)
This commit is contained in:
Hondacrx
2024-11-10 00:09:01 -05:00
parent 336729c8d7
commit ab840142f3
2 changed files with 40 additions and 12 deletions
+17 -2
View File
@@ -392,7 +392,12 @@ namespace Game.Scripting
public Targets GetTarget() { return _targetType; }
}
public class ObjectAreaTargetSelectHandler : TargetHook
public interface ITargetFunction
{
public virtual bool HasSameTargetFunctionAs<T>(T other) { return false; }
}
public class ObjectAreaTargetSelectHandler : TargetHook, ITargetFunction
{
SpellObjectAreaTargetSelectFnType _callImpl;
@@ -405,9 +410,14 @@ namespace Game.Scripting
{
_callImpl(targets);
}
public bool HasSameTargetFunctionAs(ObjectAreaTargetSelectHandler other)
{
return _callImpl.Method == other._callImpl.Method || _callImpl.Target == other._callImpl.Target;
}
}
public class ObjectTargetSelectHandler : TargetHook
public class ObjectTargetSelectHandler : TargetHook, ITargetFunction
{
SpellObjectTargetSelectFnType _callImpl;
@@ -420,6 +430,11 @@ namespace Game.Scripting
{
_callImpl(ref target);
}
public bool HasSameTargetFunctionAs(ObjectTargetSelectHandler other)
{
return _callImpl.Method == other._callImpl.Method || _callImpl.Target == other._callImpl.Target;
}
}
public class DestinationTargetSelectHandler : TargetHook