Show event-gated objective markers
This commit is contained in:
@@ -55,6 +55,9 @@ func _init() -> void:
|
||||
_progress_text("res://data/scenarios/045_fancheng_relief.json", false),
|
||||
"Reach (10, 5): not reached"
|
||||
)
|
||||
_check_event_gated_objective_markers(failures)
|
||||
_check_event_gated_multi_cell_objective_markers(failures)
|
||||
_check_turn_gated_objective_does_not_create_marker(failures)
|
||||
_check_objective_update(failures)
|
||||
_check_objective_notice(failures)
|
||||
|
||||
@@ -125,6 +128,76 @@ func _check_objective_update(failures: Array[String]) -> void:
|
||||
_check_log_contains(failures, logs, "Defeat condition updated: Supply train is lost.")
|
||||
|
||||
|
||||
func _check_event_gated_objective_markers(failures: Array[String]) -> void:
|
||||
var state = BattleStateScript.new()
|
||||
if not state.load_battle("res://data/scenarios/013_wuchao_raid.json"):
|
||||
failures.append("event-gated objective marker smoke could not load Wuchao raid")
|
||||
return
|
||||
|
||||
var depot_cell := Vector2i(14, 4)
|
||||
var initial_cells := state.get_objective_cells()
|
||||
if not initial_cells.has(depot_cell):
|
||||
failures.append("Wuchao depot marker missing before event opens victory condition: %s" % str(initial_cells))
|
||||
|
||||
var cao_cao: Dictionary = state.get_unit("cao_cao_ch13")
|
||||
if cao_cao.is_empty():
|
||||
failures.append("event-gated objective marker smoke missing Cao Cao")
|
||||
return
|
||||
cao_cao["pos"] = depot_cell
|
||||
state._run_events("unit_reaches_tile", "player", 1, cao_cao)
|
||||
var opened_cells := state.get_objective_cells()
|
||||
if opened_cells.has(depot_cell):
|
||||
failures.append("Wuchao depot marker should clear after event opens defeat-all objective: %s" % str(opened_cells))
|
||||
|
||||
|
||||
func _check_event_gated_multi_cell_objective_markers(failures: Array[String]) -> void:
|
||||
var state = BattleStateScript.new()
|
||||
if not state.load_battle("res://data/scenarios/001_yellow_turbans.json"):
|
||||
failures.append("multi-cell event-gated objective marker smoke could not load scenario")
|
||||
return
|
||||
|
||||
state.battle_conditions["victory"] = {
|
||||
"type": "all_units_defeated",
|
||||
"team": "enemy",
|
||||
"after_event": "multi_cell_gate"
|
||||
}
|
||||
state.battle_events.clear()
|
||||
state.battle_events.append({
|
||||
"id": "multi_cell_gate",
|
||||
"once": true,
|
||||
"when": {"type": "unit_reaches_tile", "team": "player", "cells": [[3, 2], [3, 3]]},
|
||||
"actions": [{"type": "log", "text": "Gate opened."}]
|
||||
})
|
||||
|
||||
var marker_cells := state.get_objective_cells()
|
||||
if not marker_cells.has(Vector2i(3, 2)) or not marker_cells.has(Vector2i(3, 3)):
|
||||
failures.append("multi-cell event-gated marker should include every event cell: %s" % str(marker_cells))
|
||||
|
||||
|
||||
func _check_turn_gated_objective_does_not_create_marker(failures: Array[String]) -> void:
|
||||
var state = BattleStateScript.new()
|
||||
if not state.load_battle("res://data/scenarios/001_yellow_turbans.json"):
|
||||
failures.append("turn-gated objective marker smoke could not load scenario")
|
||||
return
|
||||
|
||||
state.battle_conditions["victory"] = {
|
||||
"type": "all_units_defeated",
|
||||
"team": "enemy",
|
||||
"after_event": "turn_gate"
|
||||
}
|
||||
state.battle_events.clear()
|
||||
state.battle_events.append({
|
||||
"id": "turn_gate",
|
||||
"once": true,
|
||||
"when": {"type": "turn_start", "team": "player", "turn": 2},
|
||||
"actions": [{"type": "log", "text": "Turn gate opened."}]
|
||||
})
|
||||
|
||||
var marker_cells := state.get_objective_cells()
|
||||
if not marker_cells.is_empty():
|
||||
failures.append("turn-gated objective should not create map markers: %s" % str(marker_cells))
|
||||
|
||||
|
||||
func _check_log_contains(failures: Array[String], logs: Array, expected: String) -> void:
|
||||
for log_entry in logs:
|
||||
if str(log_entry) == expected:
|
||||
|
||||
Reference in New Issue
Block a user