Add objective progress tracker
This commit is contained in:
72
tools/smoke_objective_progress.gd
Normal file
72
tools/smoke_objective_progress.gd
Normal file
@@ -0,0 +1,72 @@
|
||||
extends SceneTree
|
||||
|
||||
const BattleStateScript := preload("res://scripts/core/battle_state.gd")
|
||||
|
||||
|
||||
func _init() -> void:
|
||||
var failures: Array[String] = []
|
||||
|
||||
_check_contains(
|
||||
failures,
|
||||
"001 HUD progress",
|
||||
_progress_text("res://data/scenarios/001_yellow_turbans.json", false),
|
||||
"Enemies defeated 0/"
|
||||
)
|
||||
_check_contains(
|
||||
failures,
|
||||
"001 briefing progress",
|
||||
_progress_text("res://data/scenarios/001_yellow_turbans.json", true),
|
||||
"Allies remaining"
|
||||
)
|
||||
_check_contains(
|
||||
failures,
|
||||
"002 gated victory progress",
|
||||
_progress_text("res://data/scenarios/002_sishui_gate.json", false),
|
||||
"Objective unlocks on Turn 2"
|
||||
)
|
||||
_check_contains(
|
||||
failures,
|
||||
"002 pending enemy progress",
|
||||
_progress_text("res://data/scenarios/002_sishui_gate.json", false),
|
||||
"Enemies defeated 0/"
|
||||
)
|
||||
_check_contains(
|
||||
failures,
|
||||
"007 destination progress",
|
||||
_progress_text("res://data/scenarios/007_xian_emperor_escort.json", false),
|
||||
"Destination (14, 5): not reached"
|
||||
)
|
||||
_check_contains(
|
||||
failures,
|
||||
"007 protected-unit risk progress",
|
||||
_progress_text("res://data/scenarios/007_xian_emperor_escort.json", true),
|
||||
"Imperial Envoy safe"
|
||||
)
|
||||
_check_contains(
|
||||
failures,
|
||||
"045 gated destination progress",
|
||||
_progress_text("res://data/scenarios/045_fancheng_relief.json", false),
|
||||
"Reach (10, 5): not reached"
|
||||
)
|
||||
|
||||
if failures.is_empty():
|
||||
print("objective progress smoke ok")
|
||||
quit(0)
|
||||
return
|
||||
|
||||
for failure in failures:
|
||||
push_error(failure)
|
||||
quit(1)
|
||||
|
||||
|
||||
func _progress_text(path: String, include_defeat_risks: bool) -> String:
|
||||
var state = BattleStateScript.new()
|
||||
if not state.load_battle(path):
|
||||
return "<load failed: %s>" % path
|
||||
return state.get_objective_progress_text(include_defeat_risks)
|
||||
|
||||
|
||||
func _check_contains(failures: Array[String], label: String, text: String, expected: String) -> void:
|
||||
if text.contains(expected):
|
||||
return
|
||||
failures.append("%s expected `%s` in `%s`" % [label, expected, text])
|
||||
Reference in New Issue
Block a user