Improve unit focus HUD details

This commit is contained in:
2026-06-18 17:26:57 +09:00
parent 26741b97dd
commit c928bb64b7
5 changed files with 118 additions and 46 deletions

View File

@@ -8,6 +8,7 @@ func _init() -> void:
var failures: Array[String] = []
_check_battle_visual_data(failures)
_check_scene_texture_loading(failures)
_check_hud_focus_text(failures)
_check_attack_motion_signal(failures)
if failures.is_empty():
@@ -88,6 +89,36 @@ func _check_scene_texture_loading(failures: Array[String]) -> void:
scene.free()
func _check_hud_focus_text(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 HUD focus text")
scene.free()
return
var cao_cao: Dictionary = scene.state.get_unit("cao_cao")
var cao_text := scene._format_unit_focus_text(cao_cao, "Selected")
if not cao_text.contains("Command tactics"):
failures.append("Cao Cao HUD focus should describe command role: %s" % cao_text)
if not cao_text.contains("Tile 2,4"):
failures.append("Cao Cao HUD focus should include current tile: %s" % cao_text)
if not cao_text.contains("Cost 1"):
failures.append("Cao Cao HUD focus should include terrain move cost: %s" % cao_text)
if not cao_text.contains("DEF +0"):
failures.append("Cao Cao HUD focus should include terrain defense: %s" % cao_text)
var xiahou_dun: Dictionary = scene.state.get_unit("xiahou_dun")
xiahou_dun["pos"] = Vector2i(3, 1)
var forest_text := scene._unit_current_terrain_text(xiahou_dun)
if not forest_text.contains("Forest") or not forest_text.contains("Cost 3"):
failures.append("Cavalry movement should use mounted move_type cost on forest: %s" % forest_text)
var archer: Dictionary = scene.state.get_unit("yellow_turban_3")
var archer_text := scene._format_unit_focus_text(archer, "Hover")
if not archer_text.contains("Ranged pressure"):
failures.append("Archer HUD focus should describe ranged role: %s" % archer_text)
if not scene._unit_current_terrain_text(archer).contains("Plain"):
failures.append("Archer terrain text should reflect its current plain tile")
scene.free()
func _check_attack_motion_signal(failures: Array[String]) -> void:
var state = BattleStateScript.new()
if not state.load_battle("res://data/scenarios/001_yellow_turbans.json"):