99 lines
4.1 KiB
GDScript
99 lines
4.1 KiB
GDScript
class_name P98RuntimeFixture
|
|
extends RefCounted
|
|
|
|
const LegacyService = preload("res://p9_3/core_loop_service.gd")
|
|
const LegacyState = preload("res://p9_3/core_loop_state.gd")
|
|
const P97MarketService = preload("res://p9_7/market_service.gd")
|
|
const P97BattleService = preload("res://p9_7/battle_service.gd")
|
|
const RoundService = preload("res://p9_8/round_service.gd")
|
|
const RoundBattleService = preload("res://p9_8/battle_service.gd")
|
|
|
|
|
|
static func market8() -> Dictionary:
|
|
var market = P97MarketService.new(_complete_p96())
|
|
for step in [
|
|
{"market": 5, "recruit": "P97-M5-R2", "route": "P97-R5-Q0"},
|
|
{"market": 6, "recruit": "P97-M6-R2", "route": "P97-R6-Q0"},
|
|
{"market": 7, "recruit": "P97-M7-R3", "route": "P97-R7-Q0"},
|
|
]:
|
|
market.focus_recruit_offer(String(step.recruit))
|
|
market.hire("p98-runtime-fixture-hire-%d" % int(step.market), String(step.recruit))
|
|
market.commit_deployment("p98-runtime-fixture-deploy-%d" % int(step.market), market.auto_order_candidate())
|
|
market.focus_route(String(step.route))
|
|
market.commit_route("p98-runtime-fixture-route-%d" % int(step.market), String(step.route))
|
|
var battle = P97BattleService.new()
|
|
battle.start_from_market(market.state)
|
|
var guard := 0
|
|
while not battle.state.terminal and guard < 2000:
|
|
battle.advance_ticks(1)
|
|
guard += 1
|
|
market.settle_battle("p98-runtime-fixture-settle-%d" % int(step.market), battle.state.snapshot())
|
|
if market.state.recovery_required:
|
|
market.recover_injured_company("p98-runtime-fixture-recover-%d" % int(step.market))
|
|
return market.state.snapshot()
|
|
|
|
|
|
static func boss_muster() -> Dictionary:
|
|
var market = RoundService.new(market8())
|
|
market.choose_artifact("p98-runtime-fixture-artifact", "AR-001")
|
|
_commit_promotion(market, "p98-runtime-fixture-promotion")
|
|
for market_index in [8, 9, 10, 11, 12]:
|
|
if market.state.company.size() < 10:
|
|
var recruit_id := String(market.state.available_recruit_offer_ids[0])
|
|
market.focus_recruit_offer(recruit_id)
|
|
market.hire("p98-runtime-fixture-hire-%d" % market_index, recruit_id)
|
|
market.commit_deployment("p98-runtime-fixture-line-%d" % market_index, market.auto_order_candidate())
|
|
var route_id := "P98-R%d-Q0" % market_index
|
|
market.focus_route(route_id)
|
|
market.commit_route("p98-runtime-fixture-route-%d" % market_index, route_id)
|
|
var battle = RoundBattleService.new()
|
|
battle.start_from_market(market.state)
|
|
var guard := 0
|
|
while not battle.state.terminal and guard < 2000:
|
|
battle.advance_ticks(1)
|
|
guard += 1
|
|
market.settle_battle("p98-runtime-fixture-settle-%d" % market_index, battle.state.snapshot())
|
|
if market.state.recovery_required:
|
|
market.recover_injured_company("p98-runtime-fixture-recover-%d" % market_index)
|
|
_commit_promotion(market, "p98-runtime-fixture-promotion")
|
|
var full_line: Array[String] = []
|
|
for recruit_id in market.state.company.slice(0, mini(market.state.line_capacity, market.state.company.size())):
|
|
full_line.append(String(recruit_id))
|
|
market.commit_deployment("p98-runtime-fixture-boss-line", full_line)
|
|
return market.state.snapshot()
|
|
|
|
|
|
static func _complete_p96() -> Dictionary:
|
|
var service = LegacyService.new()
|
|
service.enter_hall()
|
|
service.focus_offer("Farstring")
|
|
service.hire("Farstring")
|
|
_complete_legacy_battle(service, "open_road")
|
|
service.focus_offer("Kindhand")
|
|
service.hire("Kindhand")
|
|
_complete_legacy_battle(service, "crosswind")
|
|
service.focus_equipment("EQ-002")
|
|
service.equip_focused("Hearthguard")
|
|
_complete_legacy_battle(service, "bell_breach")
|
|
service.choose_rift_tide_plan("press_on")
|
|
_complete_legacy_battle(service, "rift_tide")
|
|
return service.state.snapshot()
|
|
|
|
|
|
static func _complete_legacy_battle(service, encounter_id: String) -> void:
|
|
service.select_encounter(encounter_id)
|
|
service.start_battle()
|
|
var guard := 0
|
|
while service.state.phase == LegacyState.Phase.BATTLE and guard < 4000:
|
|
service.advance_battle_ticks(1)
|
|
guard += 1
|
|
service.claim_and_return()
|
|
|
|
|
|
static func _commit_promotion(market, operation_id: String) -> void:
|
|
if market.state.promotion_draft.is_empty():
|
|
return
|
|
var recruit_id := String(market.state.promotion_draft.recruit_id)
|
|
var promotion_id := String(market.state.promotion_draft.offer_ids[0])
|
|
market.confirm_promotion(operation_id, recruit_id, promotion_id)
|