debug: log nearby enemies in _try_attack_adjacent
This commit is contained in:
parent
962c9ea857
commit
dd966bea93
1 changed files with 11 additions and 0 deletions
|
|
@ -387,6 +387,17 @@ func _try_attack_adjacent(unit: Variant, game_map: RefCounted) -> void:
|
|||
return
|
||||
var primary: Dictionary = GameState.get_primary_layer()
|
||||
var all_units: Array = primary.get("units", [])
|
||||
# Debug: count nearby enemies
|
||||
if _turn_count % 50 == 0:
|
||||
var nearby_enemies: int = 0
|
||||
for e: Variant in all_units:
|
||||
if e.get("owner") != player.index and e.is_alive():
|
||||
var dist: int = HexUtilsScript.hex_distance(unit.position, e.position)
|
||||
if dist <= 2:
|
||||
nearby_enemies += 1
|
||||
print(" enemy at %s (dist=%d from %s)" % [e.position, dist, unit.position])
|
||||
if nearby_enemies == 0:
|
||||
print(" no enemies within 2 hexes of %s" % unit.position)
|
||||
|
||||
# Check adjacent hexes for enemies
|
||||
var neighbors: Array[Vector2i] = HexUtilsScript.get_neighbors(unit.position)
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue