Add story beats to Puyang Raid

This commit is contained in:
2026-06-19 16:28:49 +09:00
parent ebad9aed7d
commit 009d7ac857
2 changed files with 139 additions and 0 deletions

View File

@@ -27,10 +27,12 @@ func _init() -> void:
_check_sishui_gate_event_dialogue_structure(failures)
_check_xingyang_ambush_event_dialogue_structure(failures)
_check_qingzhou_campaign_event_dialogue_structure(failures)
_check_puyang_raid_event_dialogue_structure(failures)
_check_opening_battle_story_beats(failures)
_check_sishui_gate_story_beats(failures)
_check_xingyang_ambush_story_beats(failures)
_check_qingzhou_campaign_story_beats(failures)
_check_puyang_raid_story_beats(failures)
_check_pixel_unit_helpers(failures)
if failures.is_empty():
@@ -393,6 +395,55 @@ func _check_qingzhou_campaign_event_dialogue_structure(failures: Array[String])
failures.append("Qingzhou Campaign last stand event should clarify the final objective")
func _check_puyang_raid_event_dialogue_structure(failures: Array[String]) -> void:
var state = BattleStateScript.new()
if not state.load_battle("res://data/scenarios/005_puyang_raid.json"):
failures.append("could not load Puyang Raid for event dialogue structure")
return
for event_id in [
"opening_dialogue",
"turn_2_alarm",
"turn_3_lu_bu_arrives",
"turn_5_pressure",
"turn_6_zhang_liao_closes",
"turn_9_lu_bu_encirclement",
"zhang_liao_vanguard_falls",
"lu_bu_banner_falls"
]:
var event := _event_by_id(state, event_id)
if event.is_empty():
failures.append("Puyang Raid missing event: %s" % event_id)
continue
if not _event_has_dialogue_action(event):
failures.append("Puyang Raid event should include contextual dialogue: %s" % event_id)
var vanguard_event := _event_by_id(state, "zhang_liao_vanguard_falls")
if not vanguard_event.is_empty():
var when: Dictionary = vanguard_event.get("when", {})
if str(when.get("type", "")) != "unit_defeated":
failures.append("Zhang Liao vanguard defeat event should trigger when the unit is defeated")
var unit_ids: Array = when.get("unit_ids", [])
if not unit_ids.has("zhang_liao_vanguard"):
failures.append("Zhang Liao vanguard defeat event should watch zhang_liao_vanguard")
if not _event_has_set_objective_action(vanguard_event):
failures.append("Zhang Liao vanguard defeat event should clarify the next objective")
var lu_bu_banner_event := _event_by_id(state, "lu_bu_banner_falls")
if not lu_bu_banner_event.is_empty():
var when: Dictionary = lu_bu_banner_event.get("when", {})
if str(when.get("type", "")) != "unit_defeated":
failures.append("Lu Bu banner defeat event should trigger when the unit is defeated")
var unit_ids: Array = when.get("unit_ids", [])
if not unit_ids.has("lu_bu_banner"):
failures.append("Lu Bu banner defeat event should watch lu_bu_banner")
if not _event_has_set_objective_action(lu_bu_banner_event):
failures.append("Lu Bu banner defeat event should clarify the next objective")
var lu_bu_arrival_event := _event_by_id(state, "turn_3_lu_bu_arrives")
if not lu_bu_arrival_event.is_empty() and not _event_has_set_objective_action(lu_bu_arrival_event):
failures.append("Puyang Raid Lu Bu arrival event should clarify the pressure objective")
var encirclement_event := _event_by_id(state, "turn_9_lu_bu_encirclement")
if not encirclement_event.is_empty() and not _event_has_set_objective_action(encirclement_event):
failures.append("Puyang Raid encirclement event should clarify the final objective")
func _check_opening_battle_story_beats(failures: Array[String]) -> void:
var state = BattleStateScript.new()
if not state.load_battle("res://data/scenarios/001_yellow_turbans.json"):
@@ -533,6 +584,56 @@ func _check_qingzhou_campaign_story_beats(failures: Array[String]) -> void:
failures.append("Qingzhou chief defeat objective should still point to the village road and remaining enemies")
func _check_puyang_raid_story_beats(failures: Array[String]) -> void:
var state = BattleStateScript.new()
if not state.load_battle("res://data/scenarios/005_puyang_raid.json"):
failures.append("could not load Puyang Raid for story beat checks")
return
var dialogue_batches: Array = []
state.dialogue_requested.connect(func(lines: Array) -> void:
dialogue_batches.append(lines)
)
state._run_events("turn_start", BattleStateScript.TEAM_ENEMY, 2)
state._run_events("turn_start", BattleStateScript.TEAM_ENEMY, 3)
state._run_events("turn_start", BattleStateScript.TEAM_PLAYER, 5)
state._run_events("turn_start", BattleStateScript.TEAM_ENEMY, 6)
state._run_events("turn_start", BattleStateScript.TEAM_ENEMY, 9)
if dialogue_batches.size() < 5:
failures.append("Puyang Raid should add dialogue beats for each major night raid pressure phase")
var victory_text := str(state.objectives.get("victory", ""))
if not victory_text.contains("포위망") or not victory_text.contains("군영"):
failures.append("Puyang Raid turn 9 event should update the victory objective for the encirclement")
if not state._condition_gate_open({"after_event": "turn_9_lu_bu_encirclement"}):
failures.append("Puyang Raid final objective gate should open after the turn 9 encirclement")
var zhang_liao: Dictionary = state.get_unit("zhang_liao_vanguard")
if zhang_liao.is_empty():
failures.append("Puyang Raid should include Zhang Liao vanguard for the defeat story beat")
else:
zhang_liao["alive"] = false
state._run_events("unit_defeated", BattleStateScript.TEAM_ENEMY, 9, zhang_liao)
if dialogue_batches.size() < 6:
failures.append("Puyang Raid should show dialogue when Zhang Liao vanguard falls")
var vanguard_objective_text := str(state.objectives.get("victory", ""))
if not vanguard_objective_text.contains("군영") or not vanguard_objective_text.contains("포위망"):
failures.append("Zhang Liao vanguard defeat objective should still point to camp control and the encirclement")
var lu_bu_banner: Dictionary = state.get_unit("lu_bu_banner")
if lu_bu_banner.is_empty():
failures.append("Puyang Raid should include Lu Bu banner for the final pressure story beat")
else:
lu_bu_banner["alive"] = false
state._run_events("unit_defeated", BattleStateScript.TEAM_ENEMY, 9, lu_bu_banner)
if dialogue_batches.size() < 7:
failures.append("Puyang Raid should show dialogue when Lu Bu banner falls")
var banner_objective_text := str(state.objectives.get("victory", ""))
if not banner_objective_text.contains("군영") or not banner_objective_text.contains("포위망"):
failures.append("Lu Bu banner defeat objective should still point to camp control and the encirclement")
func _event_by_id(state, event_id: String) -> Dictionary:
for event in state.battle_events:
if typeof(event) == TYPE_DICTIONARY and str(event.get("id", "")) == event_id: