Add opening battle capture events

This commit is contained in:
2026-06-19 18:44:48 +09:00
parent f22d029230
commit feac924a1c
3 changed files with 194 additions and 0 deletions

View File

@@ -476,6 +476,8 @@ func _check_opening_battle_event_dialogue_structure(failures: Array[String]) ->
for event_id in [
"opening_dialogue",
"northern_woods_cache",
"village_supply_secured",
"castle_gate_secured",
"turn_2_warning",
"turn_4_eastern_reserve",
"turn_7_southern_raiders",
@@ -495,6 +497,13 @@ func _check_opening_battle_event_dialogue_structure(failures: Array[String]) ->
var unit_ids: Array = when.get("unit_ids", [])
if not unit_ids.has("yellow_turban_1"):
failures.append("Zhang Mancheng defeat event should watch yellow_turban_1")
for objective_event_id in [
"village_supply_secured",
"castle_gate_secured"
]:
var objective_event := _event_by_id(state, objective_event_id)
if not objective_event.is_empty() and not _event_has_set_objective_action(objective_event):
failures.append("opening battle capture event should update the active objective: %s" % objective_event_id)
func _check_sishui_gate_event_dialogue_structure(failures: Array[String]) -> void:

View File

@@ -173,6 +173,7 @@ func _init() -> void:
_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_opening_battle_capture_events(failures)
_check_sishui_gate_extended_pressure(failures)
_check_xingyang_ambush_extended_pressure(failures)
_check_qingzhou_campaign_extended_pressure(failures)
@@ -361,6 +362,39 @@ func _check_opening_battle_requires_castle_capture(failures: Array[String]) -> v
failures.append("opening battle should end after the turn 11 last rally falls and castle is captured, got %s" % str(state.battle_status))
func _check_opening_battle_capture_events(failures: Array[String]) -> void:
var state = BattleStateScript.new()
if not state.load_battle("res://data/scenarios/001_yellow_turbans.json"):
failures.append("opening capture event smoke could not load scenario")
return
var dialogue_batches := []
state.dialogue_requested.connect(func(lines: Array) -> void:
dialogue_batches.append(lines)
)
var cao_cao: Dictionary = state.get_unit("cao_cao")
cao_cao["pos"] = Vector2i(6, 5)
state._run_events("unit_reaches_tile", BattleStateScript.TEAM_PLAYER, 3, cao_cao)
if int(state.get_inventory_snapshot().get("bean", 0)) != 1:
failures.append("opening village capture should grant one Bean")
if state.get_battle_gold_reward() != 80:
failures.append("opening village capture should grant 80 battle gold, got %d" % state.get_battle_gold_reward())
var village_objective := str(state.objectives.get("victory", ""))
if not village_objective.contains("마을 보급") or not village_objective.contains("동쪽 성채"):
failures.append("opening village capture should update the active objective: %s" % village_objective)
if dialogue_batches.size() < 1:
failures.append("opening village capture should show contextual dialogue")
cao_cao["pos"] = Vector2i(20, 1)
state._run_events("unit_reaches_tile", BattleStateScript.TEAM_PLAYER, 4, cao_cao)
var castle_objective := str(state.objectives.get("victory", ""))
if not castle_objective.contains("성채를 장악") or not castle_objective.contains("마지막 황건 잔당"):
failures.append("opening castle capture should update the active objective: %s" % castle_objective)
if dialogue_batches.size() < 2:
failures.append("opening castle capture should show contextual dialogue")
func _check_log_contains(failures: Array[String], logs: Array, expected: String) -> void:
for log_entry in logs:
if str(log_entry) == expected: