Files
aetherbound-guild/runtime/tests/p9_10/runtime_fixture.gd
T

60 lines
3.0 KiB
GDScript

class_name P910RuntimeFixture
extends RefCounted
const P99RunService = preload("res://p9_9/run_service.gd")
const P99BattleService = preload("res://p9_9/battle_service.gd")
const P99Fixture = preload("res://tests/p9_9/runtime_fixture.gd")
const P910Service = preload("res://p9_10/contract_service.gd")
const P910BattleService = preload("res://p9_10/battle_service.gd")
static func p99_market_four(claim_id := "CH-RG01-CATALOG-01") -> Dictionary:
var service = P99RunService.new(P99Fixture.claimed_profile(claim_id))
assert(service.set_provisional("p910-fixture-select-1", "P99-D1", true).ok)
assert(service.set_provisional("p910-fixture-select-2", "P99-D3", true).ok)
assert(service.confirm_run("p910-fixture-create").ok)
assert(service.hire("p910-fixture-hire-1", "P99-M1-H1").ok)
assert(service.hire("p910-fixture-hire-2", "P99-M1-H2").ok)
for round_index in range(1, 4):
var route_id := "P99-R%d-Q0" % round_index
assert(service.commit_route("p910-fixture-route-%d" % round_index, route_id).ok)
var battle = P99BattleService.new(claim_id)
assert(battle.start_from_market(service.state).ok)
var guard := 0
while not battle.state.terminal and guard < 2000:
battle.advance_ticks(1)
guard += 1
assert(battle.state.outcome == "victory")
assert(service.settle_battle("p910-fixture-settle-%d" % round_index, battle.state.snapshot()).ok)
assert(service.state.current_market == 4 and service.state.continuation_locked)
return service.state.snapshot()
static func p910_boss_muster(claim_id := "CH-RG01-CATALOG-01", include_projectile := true) -> Dictionary:
var service = P910Service.new(p99_market_four(claim_id))
for round_index in range(4, 13):
if not service.state.available_recruit_offer_ids.is_empty() and service.state.company.size() < service.state.line_capacity:
var offer_id: String = service.state.available_recruit_offer_ids[0]
if round_index == 11 and include_projectile:
offer_id = "P910-M11-H2"
assert(service.hire("p910-boss-hire-%d" % round_index, offer_id).ok)
if not service.state.available_equipment_offer_ids.is_empty():
var target: String = service.state.deployed_recruit_ids[-1]
assert(service.buy_and_equip("p910-boss-equip-%d" % round_index, service.state.available_equipment_offer_ids[0], target).ok)
if round_index == 12:
var order: Array[String] = service.state.deployed_recruit_ids.duplicate()
assert(service.propose_final_order("p910-boss-order-propose", order).ok)
assert(service.confirm_final_order("p910-boss-order-confirm").ok)
var route_id := "P910-R%d-Q0" % round_index
assert(service.commit_route("p910-boss-route-%d" % round_index, route_id).ok)
var battle = P910BattleService.new(claim_id)
assert(battle.start_from_market(service.state).ok)
var guard := 0
while not battle.state.terminal and guard < 2000:
battle.advance_ticks(1)
guard += 1
assert(battle.state.outcome == "victory")
assert(service.settle_battle("p910-boss-settle-%d" % round_index, battle.state.snapshot()).ok)
assert(service.state.current_market == 13 and service.state.boss_muster.size() > 0)
return service.state.snapshot()