46 lines
1.4 KiB
GDScript
46 lines
1.4 KiB
GDScript
class_name P101RuntimeFixture
|
|
extends RefCounted
|
|
|
|
const P100Fixture = preload("res://tests/p10_0/runtime_fixture.gd")
|
|
const CrossingFixture = preload("res://tests/p10_1/first_crossing_fixture.gd")
|
|
const BattleService = preload("res://p10_1/first_crossing_battle_service.gd")
|
|
const ResolutionService = preload("res://p10_1/first_crossing_resolution_service.gd")
|
|
|
|
|
|
static func gate_snapshot() -> Dictionary:
|
|
return P100Fixture.rg02_state()
|
|
|
|
|
|
static func market_snapshot() -> Dictionary:
|
|
var service = CrossingFixture.new().market_with_healer()
|
|
assert(service != null)
|
|
return service.state.snapshot()
|
|
|
|
|
|
static func prepared_snapshot(route_index := 2) -> Dictionary:
|
|
var snapshot := CrossingFixture.new().prepared_snapshot(route_index)
|
|
assert(not snapshot.is_empty())
|
|
return snapshot
|
|
|
|
|
|
static func recovery_snapshot() -> Dictionary:
|
|
return _settled_snapshot(2, "hold_line")
|
|
|
|
|
|
static func market_2_snapshot() -> Dictionary:
|
|
return _settled_snapshot(2, "follow_tide")
|
|
|
|
|
|
static func _settled_snapshot(route_index: int, plan_id: String) -> Dictionary:
|
|
var prepared := prepared_snapshot(route_index)
|
|
var battle: Dictionary = BattleService.new(prepared).run_to_terminal(plan_id)
|
|
assert(battle.ok)
|
|
var resolver = ResolutionService.new(prepared)
|
|
var settled: Dictionary = resolver.settle(
|
|
"p101-runtime-fixture-%d-%s" % [route_index, plan_id],
|
|
resolver.state.revision,
|
|
battle.snapshot
|
|
)
|
|
assert(settled.ok)
|
|
return Dictionary(settled.snapshot).duplicate(true)
|