Files
aetherbound-guild/runtime/tools/dbgc_tmp.gd
T

51 lines
2.2 KiB
GDScript

extends SceneTree
const Bridge = preload("res://entry/battle_sim_bridge.gd")
const CR = preload("res://p10_0/content_registry.gd")
const ContractRun = preload("res://domain/contract_run.gd")
func _initialize() -> void:
call_deferred("_run")
func _run() -> void:
var catalog: Dictionary = CR.snapshot()
var enemy_ids: Array = []
for row in Array(catalog.get("enemies", [])):
if int(Dictionary(row).get("region", 0)) == 1:
enemy_ids.append(str(Dictionary(row).get("id", "")))
var meta := {"EN-R1-01": {"class": "ordinary", "level": 8}, "EN-R1-02": {"class": "ordinary", "level": 8}}
var professions := ["PF-B01", "PF-B02", "PF-B03", "PF-B04", "PF-B05", "PF-B06", "PF-B07", "PF-B08", "PF-B09", "PF-B10", "PF-B11", "PF-B12"]
var recruits: Array = []
for index in range(professions.size()):
recruits.append({"id": "R-%d" % (index+1), "profession_id": professions[index], "level": 4, "trait_id": "",
"might": 12, "finesse": 11, "insight": 10, "vigor": 13, "resolve": 11})
var formation: Array = []
for recruit in recruits:
formation.append(str(Dictionary(recruit).get("id", "")))
var encounter := ContractRun.ordinary_encounter(1, enemy_ids, 9, 0, 8)
var ids: Array = []
for entry in encounter:
ids.append(str(Dictionary(entry).get("enemy_id", "")))
var result: Dictionary = Bridge.run("dbg", formation, recruits, ids, 1, meta)
print("outcome=%s ticks=%s journal=%d" % [str(result.get("outcome")), str(result.get("ticks")), Array(result.get("journal", [])).size()])
var seen := {}
for record in Array(result.get("journal", [])):
var entry: Dictionary = Dictionary(record)
var key := "%s:%s" % [str(entry.get("actor")), str(entry.get("action"))]
seen[key] = int(seen.get(key, 0)) + 1
var keys: Array = seen.keys()
keys.sort()
print("actions: ", ", ".join(keys))
var allies: Array = Array(result.get("allies", []))
print("allies surviving: %d of %d" % [_survivors(result), allies.size()])
for ally in allies:
var a: Dictionary = Dictionary(ally)
print(" %s hp=%s fallen=%s" % [str(a.get("id")), str(a.get("hp")), str(a.get("fallen"))])
quit(0)
func _survivors(result: Dictionary) -> int:
var n := 0
for ally in Array(result.get("allies", [])):
if not bool(Dictionary(ally).get("fallen", false)):
n += 1
return n