Show move attack targets

This commit is contained in:
2026-06-19 19:51:31 +09:00
parent 6d95f13794
commit 36001c8b2f
3 changed files with 157 additions and 6 deletions

View File

@@ -384,8 +384,54 @@ func _check_scene_enemy_click_auto_attack(failures: Array[String]) -> void:
scene.free()
return
scene._refresh_ranges()
if scene._is_targeting_mode():
failures.append("move+attack marker setup should not enter formal targeting mode")
if scene.attack_cells.has(Vector2i(4, 3)):
failures.append("auto attack setup enemy should start outside current attack range")
var auto_markers := scene._target_selection_marker_entries()
var found_auto_marker := false
for marker in auto_markers:
if marker.get("cell", Vector2i.ZERO) != Vector2i(4, 3):
continue
found_auto_marker = true
if marker.get("target_id", "") != "yellow_turban_1":
failures.append("move+attack marker should keep the clicked target id: %s" % str(marker))
if marker.get("text", "") != "행공":
failures.append("move+attack marker should use compact battlefield text: %s" % str(marker))
if marker.get("origin", Vector2i.ZERO) != Vector2i(3, 3):
failures.append("move+attack marker should expose the chosen attack origin: %s" % str(marker))
if marker.get("origin", Vector2i.ZERO) == Vector2i(1, 3):
failures.append("move+attack marker origin should differ from the current cell: %s" % str(marker))
if not bool(marker.get("requires_move", false)):
failures.append("move+attack marker should flag that movement is required: %s" % str(marker))
if not found_auto_marker:
failures.append("selected unit should mark enemies reachable by move+attack: %s" % str(auto_markers))
scene.hover_cell = Vector2i(4, 3)
var auto_badge := scene._target_preview_badge()
if not str(auto_badge.get("text", "")).contains("행공"):
failures.append("hovering a move+attack target should explain the combined action: %s" % str(auto_badge))
if not ["advance", "counter", "danger"].has(str(auto_badge.get("kind", ""))):
failures.append("move+attack hover badge should use an attack-risk color kind: %s" % str(auto_badge))
cao_cao["status_effects"] = [{
"type": "action_lock",
"status": "disarm",
"action": "attack",
"remaining_phases": 2
}]
scene._refresh_ranges()
for marker in scene._target_selection_marker_entries():
if marker.get("target_id", "") == "yellow_turban_1":
failures.append("attack-locked units should not mark move+attack targets: %s" % str(marker))
scene.hover_cell = Vector2i(4, 3)
var locked_badge := scene._target_preview_badge()
if str(locked_badge.get("text", "")).contains("행공"):
failures.append("attack-locked hover badge should not offer move+attack: %s" % str(locked_badge))
scene._handle_board_click(_screen_for_cell(Vector2i(4, 3)))
if cao_cao.get("pos", Vector2i.ZERO) != Vector2i(1, 3) or int(enemy.get("hp", 0)) != 24:
failures.append("attack-locked enemy click should not auto-move or attack")
cao_cao["status_effects"] = []
scene._refresh_ranges()
scene._handle_board_click(_screen_for_cell(Vector2i(4, 3)))
cao_cao = scene.state.get_unit("cao_cao")
enemy = scene.state.get_unit("yellow_turban_1")