Add story beats to Dingtao Counterattack

This commit is contained in:
2026-06-19 16:33:57 +09:00
parent 009d7ac857
commit 04c3f9d615
2 changed files with 189 additions and 0 deletions

View File

@@ -28,11 +28,13 @@ func _init() -> void:
_check_xingyang_ambush_event_dialogue_structure(failures)
_check_qingzhou_campaign_event_dialogue_structure(failures)
_check_puyang_raid_event_dialogue_structure(failures)
_check_dingtao_counterattack_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_dingtao_counterattack_story_beats(failures)
_check_pixel_unit_helpers(failures)
if failures.is_empty():
@@ -444,6 +446,67 @@ func _check_puyang_raid_event_dialogue_structure(failures: Array[String]) -> voi
failures.append("Puyang Raid encirclement event should clarify the final objective")
func _check_dingtao_counterattack_event_dialogue_structure(failures: Array[String]) -> void:
var state = BattleStateScript.new()
if not state.load_battle("res://data/scenarios/006_dingtao_counterattack.json"):
failures.append("could not load Dingtao Counterattack for event dialogue structure")
return
for event_id in [
"opening_dialogue",
"turn_3_fortified_reserve",
"turn_3_pressed_lu_bu_charge",
"turn_3_counterattack",
"turn_5_hold_center",
"turn_6_flank_pressure",
"turn_9_lu_bu_second_charge",
"gao_shun_line_falls",
"lu_bu_counterattack_falls",
"lu_bu_second_charge_breaks"
]:
var event := _event_by_id(state, event_id)
if event.is_empty():
failures.append("Dingtao Counterattack missing event: %s" % event_id)
continue
if not _event_has_dialogue_action(event):
failures.append("Dingtao Counterattack event should include contextual dialogue: %s" % event_id)
var gao_shun_event := _event_by_id(state, "gao_shun_line_falls")
if not gao_shun_event.is_empty():
var when: Dictionary = gao_shun_event.get("when", {})
if str(when.get("type", "")) != "unit_defeated":
failures.append("Gao Shun line defeat event should trigger when the unit is defeated")
var unit_ids: Array = when.get("unit_ids", [])
if not unit_ids.has("gao_shun_line"):
failures.append("Gao Shun line defeat event should watch gao_shun_line")
if not _event_has_set_objective_action(gao_shun_event):
failures.append("Gao Shun line defeat event should clarify the next objective")
var lu_bu_event := _event_by_id(state, "lu_bu_counterattack_falls")
if not lu_bu_event.is_empty():
var when: Dictionary = lu_bu_event.get("when", {})
if str(when.get("type", "")) != "unit_defeated":
failures.append("Lu Bu counterattack defeat event should trigger when the unit is defeated")
var unit_ids: Array = when.get("unit_ids", [])
if not unit_ids.has("lu_bu_counterattack"):
failures.append("Lu Bu counterattack defeat event should watch lu_bu_counterattack")
if not _event_has_set_objective_action(lu_bu_event):
failures.append("Lu Bu counterattack defeat event should clarify the next objective")
var second_charge_break_event := _event_by_id(state, "lu_bu_second_charge_breaks")
if not second_charge_break_event.is_empty():
var when: Dictionary = second_charge_break_event.get("when", {})
if str(when.get("type", "")) != "unit_defeated":
failures.append("Lu Bu second charge break event should trigger when the unit is defeated")
var unit_ids: Array = when.get("unit_ids", [])
if not unit_ids.has("lu_bu_second_rider"):
failures.append("Lu Bu second charge break event should watch lu_bu_second_rider")
if not _event_has_set_objective_action(second_charge_break_event):
failures.append("Lu Bu second charge break event should clarify the next objective")
var counterattack_event := _event_by_id(state, "turn_3_counterattack")
if not counterattack_event.is_empty() and not _event_has_set_objective_action(counterattack_event):
failures.append("Dingtao Counterattack turn 3 event should clarify the pressure objective")
var second_charge_event := _event_by_id(state, "turn_9_lu_bu_second_charge")
if not second_charge_event.is_empty() and not _event_has_set_objective_action(second_charge_event):
failures.append("Dingtao Counterattack second charge 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"):
@@ -634,6 +697,67 @@ func _check_puyang_raid_story_beats(failures: Array[String]) -> void:
failures.append("Lu Bu banner defeat objective should still point to camp control and the encirclement")
func _check_dingtao_counterattack_story_beats(failures: Array[String]) -> void:
var state = BattleStateScript.new()
if not state.load_battle("res://data/scenarios/006_dingtao_counterattack.json"):
failures.append("could not load Dingtao Counterattack 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, 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() < 4:
failures.append("Dingtao Counterattack should add dialogue beats for each major countercharge phase")
var victory_text := str(state.objectives.get("victory", ""))
if not victory_text.contains("두 번째 돌격") or not victory_text.contains("중앙 방진"):
failures.append("Dingtao Counterattack turn 9 event should update the victory objective for the second charge")
if not state._condition_gate_open({"after_event": "turn_9_lu_bu_second_charge"}):
failures.append("Dingtao Counterattack final objective gate should open after the turn 9 second charge")
var gao_shun: Dictionary = state.get_unit("gao_shun_line")
if gao_shun.is_empty():
failures.append("Dingtao Counterattack should include Gao Shun line for the center story beat")
else:
gao_shun["alive"] = false
state._run_events("unit_defeated", BattleStateScript.TEAM_ENEMY, 9, gao_shun)
if dialogue_batches.size() < 5:
failures.append("Dingtao Counterattack should show dialogue when Gao Shun line falls")
var gao_shun_objective_text := str(state.objectives.get("victory", ""))
if not gao_shun_objective_text.contains("중앙 방진") or not gao_shun_objective_text.contains("재돌격"):
failures.append("Gao Shun line defeat objective should still point to the center and second charge")
var lu_bu_counterattack: Dictionary = state.get_unit("lu_bu_counterattack")
if lu_bu_counterattack.is_empty():
failures.append("Dingtao Counterattack should include Lu Bu counterattack for the major pressure story beat")
else:
lu_bu_counterattack["alive"] = false
state._run_events("unit_defeated", BattleStateScript.TEAM_ENEMY, 9, lu_bu_counterattack)
if dialogue_batches.size() < 6:
failures.append("Dingtao Counterattack should show dialogue when Lu Bu counterattack falls")
var lu_bu_objective_text := str(state.objectives.get("victory", ""))
if not lu_bu_objective_text.contains("중앙 방진") or not lu_bu_objective_text.contains("재돌격"):
failures.append("Lu Bu counterattack defeat objective should still point to the center and second charge")
var second_charge_rider: Dictionary = state.get_unit("lu_bu_second_rider")
if second_charge_rider.is_empty():
failures.append("Dingtao Counterattack should include Lu Bu second charge rider for the final charge story beat")
else:
second_charge_rider["alive"] = false
state._run_events("unit_defeated", BattleStateScript.TEAM_ENEMY, 9, second_charge_rider)
if dialogue_batches.size() < 7:
failures.append("Dingtao Counterattack should show dialogue when Lu Bu second charge breaks")
var second_charge_objective_text := str(state.objectives.get("victory", ""))
if not second_charge_objective_text.contains("중앙 방진") or not second_charge_objective_text.contains("남은"):
failures.append("Lu Bu second charge break objective should still point to the center and remaining charge")
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: