Core/Objects: Allow more specific checks to include or exclude feign death units in CreatureWithOptionsInObjectRangeCheck::IsAlive check (#30361)
* this also extends SMART_TARGET_CLOSEST_CREATURE dead param Port From (https://github.com/TrinityCore/TrinityCore/commit/92efc2523b75e4ca01be7d0894ed8bc979cb3049)
This commit is contained in:
@@ -497,7 +497,11 @@ namespace Game.AI
|
||||
TC_SAI_IS_BOOLEAN_VALID(e, e.Target.farthest.isInLos);
|
||||
break;
|
||||
case SmartTargets.ClosestCreature:
|
||||
TC_SAI_IS_BOOLEAN_VALID(e, e.Target.unitClosest.dead);
|
||||
if (e.Target.unitClosest.findCreatureAliveState < (uint)FindCreatureAliveState.Alive || e.Target.unitClosest.findCreatureAliveState >= (uint)FindCreatureAliveState.Max)
|
||||
{
|
||||
Log.outError(LogFilter.Sql, $"SmartAIMgr: {e} has invalid alive state {e.Target.unitClosest.findCreatureAliveState}");
|
||||
return false;
|
||||
}
|
||||
break;
|
||||
case SmartTargets.ClosestEnemy:
|
||||
TC_SAI_IS_BOOLEAN_VALID(e, e.Target.closestAttackable.playerOnly);
|
||||
@@ -3969,7 +3973,7 @@ namespace Game.AI
|
||||
{
|
||||
public uint entry;
|
||||
public uint dist;
|
||||
public uint dead;
|
||||
public uint findCreatureAliveState;
|
||||
}
|
||||
public struct GoClosest
|
||||
{
|
||||
|
||||
@@ -2918,7 +2918,7 @@ namespace Game.AI
|
||||
}
|
||||
|
||||
Creature target = refObj.FindNearestCreatureWithOptions(e.Target.unitClosest.dist != 0 ? e.Target.unitClosest.dist : 100,
|
||||
new FindCreatureOptions() { CreatureId = e.Target.unitClosest.entry, StringId = !e.Target.param_string.IsEmpty() ? e.Target.param_string : null, IsAlive = e.Target.unitClosest.dead == 0 });
|
||||
new FindCreatureOptions() { CreatureId = e.Target.unitClosest.entry, StringId = !e.Target.param_string.IsEmpty() ? e.Target.param_string : null, IsAlive = (FindCreatureAliveState)e.Target.unitClosest.findCreatureAliveState });
|
||||
|
||||
if (target != null)
|
||||
targets.Add(target);
|
||||
|
||||
Reference in New Issue
Block a user