fix(combat): synchronize auto-target presentation

Make the retained toolbar consume retail's payload-free selection notice from canonical live state so a reentrant Auto Target replacement cannot be erased by the outer clear. Restrict automatic acquisition to the requested hostile non-player monster policy and record the intentional PK edge divergence.

Co-Authored-By: Codex <codex@openai.com>
This commit is contained in:
Erik 2026-07-12 20:26:00 +02:00
parent 8be933fc94
commit 0f2d98c501
11 changed files with 225 additions and 7 deletions

View file

@ -11964,7 +11964,7 @@ public sealed class GameWindow : IDisposable
private uint? GetSelectedOrClosestCombatTarget()
{
if (_selection.SelectedObjectId is { } selected && IsLiveCreatureTarget(selected))
if (_selection.SelectedObjectId is { } selected && IsLiveHostileMonsterTarget(selected))
return selected;
if (!_persistedGameplay.AutoTarget)
@ -11984,7 +11984,7 @@ public sealed class GameWindow : IDisposable
if (!_persistedGameplay.ViewCombatTarget
|| !AcDream.Core.Combat.CombatInputPlanner.SupportsTargetedAttack(Combat.CurrentMode)
|| _selection.SelectedObjectId is not uint selected
|| !IsLiveCreatureTarget(selected)
|| !IsLiveHostileMonsterTarget(selected)
|| !_entitiesByServerGuid.TryGetValue(selected, out var target))
return null;
@ -12496,7 +12496,7 @@ public sealed class GameWindow : IDisposable
float bestDistanceSq = float.PositiveInfinity;
foreach (var (guid, entity) in _entitiesByServerGuid)
{
if (!IsLiveCreatureTarget(guid))
if (!IsLiveHostileMonsterTarget(guid))
continue;
float distanceSq = System.Numerics.Vector3.DistanceSquared(
@ -12545,6 +12545,17 @@ public sealed class GameWindow : IDisposable
return (LiveItemType(guid) & AcDream.Core.Items.ItemType.Creature) != 0;
}
private bool IsLiveHostileMonsterTarget(uint guid)
{
if (!IsLiveCreatureTarget(guid))
return false;
return AcDream.Core.Combat.CombatTargetPolicy.IsHostileMonster(
_playerServerGuid,
Objects.Get(_playerServerGuid),
Objects.Get(guid));
}
/// <summary>
/// True if the selected-object strip should show a Health meter for <paramref name="guid"/>.
/// Exact projection of retail's <c>IsPlayer() || pet_owner ||