Add hover intent action badges

This commit is contained in:
2026-06-18 21:03:37 +09:00
parent 1ee3859636
commit 1e75b50bcd
2 changed files with 66 additions and 1 deletions

View File

@@ -43,6 +43,7 @@ func _init() -> void:
_check_battle_visual_data(failures)
_check_scene_texture_loading(failures)
_check_hud_focus_text(failures)
_check_hover_intent_badges(failures)
_check_terrain_and_unit_presentation(failures)
_check_attack_motion_profiles(failures)
_check_attack_motion_signal(failures)
@@ -236,6 +237,47 @@ func _check_hud_focus_text(failures: Array[String]) -> void:
scene.free()
func _check_hover_intent_badges(failures: Array[String]) -> void:
var scene = BattleSceneScript.new()
if not scene.state.load_battle("res://data/scenarios/001_yellow_turbans.json"):
failures.append("could not load battle scene state for hover intent badges")
scene.free()
return
scene.battle_started = true
scene.state.select_unit("cao_cao")
scene._refresh_ranges()
scene.hover_cell = Vector2i(2, 3)
var move_badge := scene._target_preview_badge()
if str(move_badge.get("text", "")) != "MOVE" or str(move_badge.get("kind", "")) != "move":
failures.append("reachable empty tile should show MOVE badge: %s" % str(move_badge))
scene.hover_cell = Vector2i(1, 4)
var select_badge := scene._target_preview_badge()
if str(select_badge.get("text", "")) != "SELECT" or str(select_badge.get("kind", "")) != "select":
failures.append("friendly selectable unit should show SELECT badge: %s" % str(select_badge))
scene.hover_cell = Vector2i(7, 2)
var attack_badge := scene._target_preview_badge()
if attack_badge.is_empty() or str(attack_badge.get("kind", "")) == "move" or str(attack_badge.get("text", "")) == "MOVE":
failures.append("enemy hover should keep attack badge priority: %s" % str(attack_badge))
var cao_cao: Dictionary = scene.state.get_unit("cao_cao")
cao_cao["moved"] = true
scene._refresh_ranges()
scene.hover_cell = Vector2i(2, 3)
var moved_badge := scene._target_preview_badge()
if str(moved_badge.get("kind", "")) == "move" or str(moved_badge.get("text", "")) == "MOVE":
failures.append("moved unit should not show MOVE badge: %s" % str(moved_badge))
var default_color := scene._target_preview_badge_color("")
if scene._target_preview_badge_color("move") == default_color:
failures.append("MOVE badge should use a distinct color")
if scene._target_preview_badge_color("select") == default_color:
failures.append("SELECT badge should use a distinct color")
scene.free()
func _check_terrain_and_unit_presentation(failures: Array[String]) -> void:
var scene = BattleSceneScript.new()
if not scene.state.load_battle("res://data/scenarios/001_yellow_turbans.json"):