Add selectable camp conversations
This commit is contained in:
@@ -29,6 +29,13 @@ func _check_battle_visual_data(failures: Array[String]) -> void:
|
||||
var briefing := state.get_briefing()
|
||||
if (briefing.get("camp_dialogue", []) as Array).is_empty():
|
||||
failures.append("001 briefing should expose camp dialogue")
|
||||
var conversations: Array = briefing.get("camp_conversations", [])
|
||||
if conversations.size() < 3:
|
||||
failures.append("001 briefing should expose at least three camp conversations")
|
||||
else:
|
||||
_check_camp_conversation(failures, conversations[0], "cao_cao_strategy", "officer", "cao_cao")
|
||||
_check_camp_conversation(failures, conversations[1], "xiahou_dun_vanguard", "officer", "xiahou_dun")
|
||||
_check_camp_conversation(failures, conversations[2], "northern_woods_cache", "topic", "")
|
||||
var merchant := state.get_shop_merchant()
|
||||
if merchant.is_empty() or (merchant.get("lines", []) as Array).is_empty():
|
||||
failures.append("001 shop should expose merchant lines")
|
||||
@@ -63,6 +70,21 @@ func _check_scene_texture_loading(failures: Array[String]) -> void:
|
||||
var panacea: Dictionary = scene.state.get_item_def("panacea")
|
||||
if scene._load_art_texture(str(panacea.get("icon", ""))) == null:
|
||||
failures.append("battle scene should load panacea icon texture")
|
||||
var conversations: Array = scene.state.get_briefing().get("camp_conversations", [])
|
||||
if not conversations.is_empty():
|
||||
var first_lines: Array = (conversations[0] as Dictionary).get("lines", [])
|
||||
if not first_lines.is_empty():
|
||||
var first_line: Dictionary = first_lines[0]
|
||||
if scene._load_art_texture(str(first_line.get("portrait", ""))) == null:
|
||||
failures.append("battle scene should load camp conversation speaker portrait")
|
||||
var scene_conversations: Array = scene._camp_conversation_entries()
|
||||
if scene_conversations.size() < 3:
|
||||
failures.append("battle scene should expose camp conversation entries")
|
||||
var strategy := scene._camp_conversation_by_id("cao_cao_strategy")
|
||||
if strategy.is_empty():
|
||||
failures.append("battle scene should find Cao Cao camp conversation by id")
|
||||
elif not scene._format_camp_conversation_button_text(strategy).contains("Cao Cao"):
|
||||
failures.append("camp conversation button text should include label/speaker")
|
||||
scene.free()
|
||||
|
||||
|
||||
@@ -94,6 +116,26 @@ func _check_attack_motion_signal(failures: Array[String]) -> void:
|
||||
failures.append("attack motion signal missing expected Cao Cao attack: %s" % str(motions))
|
||||
|
||||
|
||||
func _check_camp_conversation(failures: Array[String], conversation: Dictionary, expected_id: String, expected_group: String, expected_officer_id: String) -> void:
|
||||
if str(conversation.get("id", "")) != expected_id:
|
||||
failures.append("camp conversation id mismatch: expected %s got %s" % [expected_id, str(conversation.get("id", ""))])
|
||||
if str(conversation.get("group", "")) != expected_group:
|
||||
failures.append("camp conversation group mismatch for %s" % expected_id)
|
||||
if str(conversation.get("officer_id", "")) != expected_officer_id:
|
||||
failures.append("camp conversation officer mismatch for %s" % expected_id)
|
||||
if str(conversation.get("label", "")).is_empty():
|
||||
failures.append("camp conversation label missing for %s" % expected_id)
|
||||
var lines: Array = conversation.get("lines", [])
|
||||
if lines.is_empty():
|
||||
failures.append("camp conversation lines missing for %s" % expected_id)
|
||||
return
|
||||
var first_line: Dictionary = lines[0]
|
||||
if str(first_line.get("text", "")).is_empty():
|
||||
failures.append("camp conversation first text missing for %s" % expected_id)
|
||||
if expected_group == "officer" and str(first_line.get("portrait", "")).is_empty():
|
||||
failures.append("camp conversation officer portrait missing for %s" % expected_id)
|
||||
|
||||
|
||||
func _check_image_path(failures: Array[String], path: String, context: String) -> void:
|
||||
if path.is_empty():
|
||||
failures.append("%s has an empty image path" % context)
|
||||
|
||||
@@ -105,6 +105,7 @@ $validStatusStats = @("atk", "def", "int", "agi", "move")
|
||||
$validSkillEffectTypes = @("stat_bonus", "damage_over_time", "action_lock")
|
||||
$validSkillAreaShapes = @("single", "diamond")
|
||||
$validDialogueSides = @("left", "right")
|
||||
$validCampConversationGroups = @("officer", "topic")
|
||||
$validPortraitPathPattern = '^res://.+\.(png|jpg|jpeg|webp)$'
|
||||
$minimumPortraitDimension = 512
|
||||
$portraitImageInspectorReady = $false
|
||||
@@ -1698,6 +1699,7 @@ function Check-Briefing($Briefing, [string]$ScenarioId) {
|
||||
foreach ($line in @((Get-Prop $Briefing "camp_dialogue" @()))) {
|
||||
Check-Dialogue-Line $line "Scenario $ScenarioId briefing camp_dialogue"
|
||||
}
|
||||
Check-Camp-Conversations (Get-Prop $Briefing "camp_conversations" $null) $ScenarioId
|
||||
|
||||
$conditionalLines = Get-Prop $Briefing "conditional_lines" @()
|
||||
foreach ($block in @($conditionalLines)) {
|
||||
@@ -1721,6 +1723,55 @@ function Check-Briefing($Briefing, [string]$ScenarioId) {
|
||||
}
|
||||
}
|
||||
|
||||
function Check-Camp-Conversations($Conversations, [string]$ScenarioId) {
|
||||
if ($null -eq $Conversations) {
|
||||
return
|
||||
}
|
||||
if (-not ($Conversations -is [System.Array])) {
|
||||
Fail "Scenario $ScenarioId briefing camp_conversations must be an array."
|
||||
}
|
||||
$seenConversationIds = New-Object System.Collections.Generic.HashSet[string]
|
||||
foreach ($conversation in @($Conversations)) {
|
||||
if ($conversation -is [string] -or $conversation -is [System.Array]) {
|
||||
Fail "Scenario $ScenarioId briefing camp_conversations has malformed entry."
|
||||
}
|
||||
$conversationId = [string](Get-Prop $conversation "id" "")
|
||||
if ([string]::IsNullOrWhiteSpace($conversationId)) {
|
||||
Fail "Scenario $ScenarioId briefing camp_conversations has an empty id."
|
||||
}
|
||||
if (-not ($conversationId -match '^[a-z0-9_]+$')) {
|
||||
Fail "Scenario $ScenarioId briefing camp_conversations has unstable id: $conversationId"
|
||||
}
|
||||
if (-not $seenConversationIds.Add($conversationId)) {
|
||||
Fail "Scenario $ScenarioId briefing camp_conversations has duplicate id: $conversationId"
|
||||
}
|
||||
$label = [string](Get-Prop $conversation "label" "")
|
||||
if ([string]::IsNullOrWhiteSpace($label)) {
|
||||
Fail "Scenario $ScenarioId briefing camp_conversations $conversationId has an empty label."
|
||||
}
|
||||
$group = ([string](Get-Prop $conversation "group" "topic")).Trim().ToLowerInvariant()
|
||||
if (-not $validCampConversationGroups.Contains($group)) {
|
||||
Fail "Scenario $ScenarioId briefing camp_conversations $conversationId has unknown group: $group"
|
||||
}
|
||||
$officerId = [string](Get-Prop $conversation "officer_id" "")
|
||||
if ($group -eq "officer") {
|
||||
if ([string]::IsNullOrWhiteSpace($officerId)) {
|
||||
Fail "Scenario $ScenarioId briefing camp_conversations $conversationId needs officer_id."
|
||||
}
|
||||
if (-not $officerIds.Contains($officerId)) {
|
||||
Fail "Scenario $ScenarioId briefing camp_conversations $conversationId references unknown officer: $officerId"
|
||||
}
|
||||
}
|
||||
$conversationLines = Get-Prop $conversation "lines" $null
|
||||
if ($null -eq $conversationLines -or -not ($conversationLines -is [System.Array]) -or @($conversationLines).Count -le 0) {
|
||||
Fail "Scenario $ScenarioId briefing camp_conversations $conversationId must have non-empty lines."
|
||||
}
|
||||
foreach ($conversationLine in @($conversationLines)) {
|
||||
Check-Dialogue-Line $conversationLine "Scenario $ScenarioId briefing camp_conversations $conversationId"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function Check-Dialogue-Line($Line, [string]$Context) {
|
||||
if ($Line -is [string]) {
|
||||
if ([string]::IsNullOrWhiteSpace([string]$Line)) {
|
||||
|
||||
Reference in New Issue
Block a user