to be squashed with standground commit

This commit is contained in:
Atrik 2026-05-18 14:54:26 +02:00
parent 2447d8d01c
commit cabf1b6d76
2 changed files with 13 additions and 1 deletions

View file

@ -271,6 +271,15 @@ Attack.prototype.CanAttack = function(target, wantedTypes)
if (!cmpTargetPlayer || !cmpEntityPlayer)
return false;
// Must be visible or miraged / with retainInFog flag, not completely hidden
const cmpRangeManager = Engine.QueryInterface(SYSTEM_ENTITY, IID_RangeManager);
if (cmpRangeManager)
{
const visibility = cmpRangeManager.GetLosVisibility(target, cmpEntityPlayer.GetPlayerID());
if (visibility == "hidden")
return false;
}
const types = this.GetAttackTypes(wantedTypes);
const entityOwner = cmpEntityPlayer.GetPlayerID();
const targetOwner = cmpTargetPlayer.GetPlayerID();

View file

@ -6386,7 +6386,10 @@ UnitAI.prototype.GetQueryRange = function(iid)
if (!range)
return ret;
ret.min = range.min;
ret.max = Math.min(range.max, visionRange);
// Use full attack range (not capped by vision) for StandGround.
// Enemies visible through allied vision or as mirages are valid targets;
// completely hidden enemies are filtered out by Attack.CanAttack's visibility check.
ret.max = range.max;
// For StandGround, the 'parabolic' flag is set so that the caller can create a
// parabolic query instead of a flat one. This ensures elevation bonuses are
// properly accounted for when detecting enemies.