From dd966bea93a5ccae4fb809544404f9c106bfacc5 Mon Sep 17 00:00:00 2001 From: Natalie Date: Sun, 12 Apr 2026 16:13:42 -0700 Subject: [PATCH] debug: log nearby enemies in _try_attack_adjacent --- src/game/engine/scenes/tests/auto_play.gd | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/src/game/engine/scenes/tests/auto_play.gd b/src/game/engine/scenes/tests/auto_play.gd index c2767457..0fb14c15 100644 --- a/src/game/engine/scenes/tests/auto_play.gd +++ b/src/game/engine/scenes/tests/auto_play.gd @@ -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)