Require castle capture in first battle

This commit is contained in:
2026-06-19 12:39:49 +09:00
parent 77db064d03
commit 5a52ae264e
2 changed files with 34 additions and 1 deletions

View File

@@ -58,6 +58,7 @@ func _init() -> void:
_check_event_gated_objective_markers(failures)
_check_event_gated_multi_cell_objective_markers(failures)
_check_turn_gated_objective_does_not_create_marker(failures)
_check_opening_battle_requires_castle_capture(failures)
_check_objective_update(failures)
_check_objective_notice(failures)
_check_terrain_recovery(failures)
@@ -199,6 +200,27 @@ func _check_turn_gated_objective_does_not_create_marker(failures: Array[String])
failures.append("turn-gated objective should not create map markers: %s" % str(marker_cells))
func _check_opening_battle_requires_castle_capture(failures: Array[String]) -> void:
var state = BattleStateScript.new()
if not state.load_battle("res://data/scenarios/001_yellow_turbans.json"):
failures.append("opening castle objective smoke could not load scenario")
return
var marker_cells := state.get_objective_cells()
for castle_cell in [Vector2i(12, 0), Vector2i(13, 0), Vector2i(12, 1), Vector2i(13, 1)]:
if not marker_cells.has(castle_cell):
failures.append("opening battle should mark castle capture cell %s: %s" % [str(castle_cell), str(marker_cells)])
for enemy in state.get_living_units(BattleStateScript.TEAM_ENEMY):
enemy["alive"] = false
state._check_battle_status()
if str(state.battle_status) != BattleStateScript.STATUS_ACTIVE:
failures.append("opening battle should not end before castle capture, got %s" % str(state.battle_status))
var cao_cao: Dictionary = state.get_unit("cao_cao")
cao_cao["pos"] = Vector2i(12, 1)
state._check_battle_status()
if str(state.battle_status) != BattleStateScript.STATUS_VICTORY:
failures.append("opening battle should end after enemies fall and castle is captured, got %s" % str(state.battle_status))
func _check_log_contains(failures: Array[String], logs: Array, expected: String) -> void:
for log_entry in logs:
if str(log_entry) == expected: