Add opening camp route report
This commit is contained in:
@@ -26,6 +26,7 @@ func _init() -> void:
|
||||
_check_readability_contract(failures)
|
||||
_check_dialogue_localization_and_side(failures)
|
||||
_check_event_dialogue_side_passthrough(failures)
|
||||
_check_opening_battle_camp_context(failures)
|
||||
_check_opening_battle_event_dialogue_structure(failures)
|
||||
_check_sishui_gate_event_dialogue_structure(failures)
|
||||
_check_xingyang_ambush_event_dialogue_structure(failures)
|
||||
@@ -640,6 +641,26 @@ func _check_event_dialogue_side_passthrough(failures: Array[String]) -> void:
|
||||
scene.free()
|
||||
|
||||
|
||||
func _check_opening_battle_camp_context(failures: Array[String]) -> void:
|
||||
var state = BattleStateScript.new()
|
||||
if not state.load_battle("res://data/scenarios/001_yellow_turbans.json"):
|
||||
failures.append("could not load opening battle for camp context")
|
||||
return
|
||||
var conversations: Array = state.get_briefing().get("camp_conversations", [])
|
||||
if conversations.size() < 4:
|
||||
failures.append("opening battle should offer enough camp conversations before the first fight")
|
||||
var villager_report := _camp_conversation_by_id(conversations, "yingchuan_villager_report")
|
||||
if villager_report.is_empty():
|
||||
failures.append("opening battle should include a villager route report before combat")
|
||||
return
|
||||
if str(villager_report.get("group", "")) != "topic":
|
||||
failures.append("villager route report should be a topic conversation")
|
||||
var report_text := _camp_conversation_text(villager_report)
|
||||
for expected in ["영천 백성", "성채", "마을", "다친 병사"]:
|
||||
if not report_text.contains(expected):
|
||||
failures.append("villager route report should mention %s: %s" % [expected, report_text])
|
||||
|
||||
|
||||
func _check_opening_battle_event_dialogue_structure(failures: Array[String]) -> void:
|
||||
var state = BattleStateScript.new()
|
||||
if not state.load_battle("res://data/scenarios/001_yellow_turbans.json"):
|
||||
@@ -1567,6 +1588,24 @@ func _event_dialogue_text(event: Dictionary) -> String:
|
||||
return "\n".join(parts)
|
||||
|
||||
|
||||
func _camp_conversation_by_id(conversations: Array, conversation_id: String) -> Dictionary:
|
||||
for conversation in conversations:
|
||||
if typeof(conversation) == TYPE_DICTIONARY and str(conversation.get("id", "")) == conversation_id:
|
||||
return conversation
|
||||
return {}
|
||||
|
||||
|
||||
func _camp_conversation_text(conversation: Dictionary) -> String:
|
||||
var parts: Array[String] = []
|
||||
var lines: Array = conversation.get("lines", [])
|
||||
for line in lines:
|
||||
if typeof(line) != TYPE_DICTIONARY:
|
||||
continue
|
||||
parts.append(str((line as Dictionary).get("display_speaker", (line as Dictionary).get("speaker", ""))))
|
||||
parts.append(str((line as Dictionary).get("text", "")))
|
||||
return "\n".join(parts)
|
||||
|
||||
|
||||
func _event_has_set_objective_action(event: Dictionary) -> bool:
|
||||
var actions: Array = event.get("actions", [])
|
||||
for action in actions:
|
||||
|
||||
Reference in New Issue
Block a user