From 5a52ae264e150ed88e93d952f2f1b63e4cc2d170 Mon Sep 17 00:00:00 2001 From: Wickedness Date: Fri, 19 Jun 2026 12:39:49 +0900 Subject: [PATCH] Require castle capture in first battle --- data/scenarios/001_yellow_turbans.json | 13 ++++++++++++- tools/smoke_objective_progress.gd | 22 ++++++++++++++++++++++ 2 files changed, 34 insertions(+), 1 deletion(-) diff --git a/data/scenarios/001_yellow_turbans.json b/data/scenarios/001_yellow_turbans.json index f74a468..e166eb5 100644 --- a/data/scenarios/001_yellow_turbans.json +++ b/data/scenarios/001_yellow_turbans.json @@ -6,7 +6,18 @@ "defeat": "조조가 퇴각하거나 제16턴이 시작되면 패한다." }, "conditions": { - "victory": { "type": "all_units_defeated", "team": "enemy" }, + "victory": { + "type": "all", + "conditions": [ + { "type": "all_units_defeated", "team": "enemy" }, + { + "type": "unit_reaches_tile", + "team": "player", + "unit_ids": ["cao_cao", "xiahou_dun"], + "cells": [[12, 0], [13, 0], [12, 1], [13, 1]] + } + ] + }, "defeat": [ { "type": "any_officer_defeated", "team": "player", "officer_ids": ["cao_cao"] }, { "type": "turn_reached", "turn": 16, "team": "player" } diff --git a/tools/smoke_objective_progress.gd b/tools/smoke_objective_progress.gd index 048b339..f9d0617 100644 --- a/tools/smoke_objective_progress.gd +++ b/tools/smoke_objective_progress.gd @@ -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: