Continued PRODUCTION/51. Edicts were flat +3% numbers; their descriptions (连战加速/持续伤害/能量/召唤/...) now drive actual global rules: - edict_rules.py / .gd: 6 combat edicts rewrite EVERY visible hero's skills (疾风 cooldown x0.85, 守望 weakness, 烈焰 poison DoT, 影行 lowest-hp+crit, 星辉 energy, 根脉 summon); 3 meta edicts (商路 econ / 远征 branches / 裂隙 challenge affixes) honestly kept as out-of-combat rules, not faked into DPS. - hero_skill_loader gained active_edicts param (identity preserved); game_root injects edicts alongside talents/growth on the live P3a path. - test_edict_rules.py PASS 6 checks (each combat edict changes behaviour, rules mostly distinct, global across heroes, meta untouched, real battle outcome differs); check_edict_rules_parity.py PASS 7 cases python==gd. - run_edict_rules_ui_test.sh PASS (real game_root): D01 shortens intervals [2,3,100,6]->[1.7,2.55,85,5.1]; D03 adds 18 poison events, skill events 19->36. - 3 new gates; full P2_CHECKS_PASS (78 gates), identity preserved. Edicts now differ mechanically from talents (global rule vs per-hero rewrite) and from skills (rule hook vs archetype). Stage E (enemy/boss mechanics) remains. prototype/ untracked.
103 lines
3.4 KiB
GDScript
103 lines
3.4 KiB
GDScript
extends SceneTree
|
|
|
|
## Real-runtime Stage D proof: activating a combat edict in the live game shell
|
|
## changes the battle (skills are rebuilt with the global edict rule).
|
|
|
|
const OUTPUT_PATH := "res://artifacts/edict_rules_ui_test.json"
|
|
const NODE := "R1-C01-N01"
|
|
|
|
var _problems: Array = []
|
|
var _records: Array = []
|
|
|
|
|
|
func _init() -> void:
|
|
_run.call_deferred()
|
|
|
|
|
|
func _fail(msg: String) -> void:
|
|
_problems.append(msg)
|
|
|
|
|
|
func _run_battle(shell: GameRoot, edicts: Dictionary) -> Dictionary:
|
|
var profile := shell.get_profile()
|
|
profile["gold"] = 0
|
|
profile["crystal"] = 0
|
|
profile["hero_levels"] = {}
|
|
profile["unlocked_heroes"] = ["H05"]
|
|
profile["completed_nodes"] = []
|
|
profile["claimed_rewards"] = []
|
|
profile["talents"] = {}
|
|
profile["edicts"] = edicts.duplicate()
|
|
shell.start_node(NODE)
|
|
await process_frame
|
|
await process_frame
|
|
var battle := shell.get_battle()
|
|
if battle == null:
|
|
_fail("no battle instance")
|
|
return {}
|
|
battle.set_process(false)
|
|
var guard := 0
|
|
while not battle.finished and guard < 600:
|
|
battle.advance_ticks(1)
|
|
guard += 1
|
|
var skill_ev := 0
|
|
var poison_ev := 0
|
|
var intervals: Array = []
|
|
for e in battle.state.get("event_log", []):
|
|
if str((e as Dictionary).get("type", "")) == "skill_effect":
|
|
skill_ev += 1
|
|
if str((e as Dictionary).get("primitive", "")) == "poison":
|
|
poison_ev += 1
|
|
for s in battle.state.get("skill_rt", {}).get("skills", []):
|
|
intervals.append(float((s as Dictionary).get("interval", 0.0)))
|
|
return {"result": str(battle.state.get("result", "")),
|
|
"duration": snappedf(float(battle.state.get("duration_seconds", 0.0)), 0.0001),
|
|
"skill_events": skill_ev, "poison_events": poison_ev, "intervals": intervals}
|
|
|
|
|
|
func _run() -> void:
|
|
var shell := load("res://scenes/game_root.tscn").instantiate() as GameRoot
|
|
root.add_child(shell)
|
|
await process_frame
|
|
await process_frame
|
|
|
|
var off := await _run_battle(shell, {})
|
|
var swift := await _run_battle(shell, {"D01": true})
|
|
var flame := await _run_battle(shell, {"D03": true})
|
|
_records.append({"mode": "off", "data": off})
|
|
_records.append({"mode": "D01_swift", "data": swift})
|
|
_records.append({"mode": "D03_flame", "data": flame})
|
|
|
|
if off.is_empty() or swift.is_empty() or flame.is_empty():
|
|
_fail("missing battle result")
|
|
else:
|
|
# D01 疾风: cooldown x0.85 -> max interval must shrink.
|
|
var off_max := 0.0
|
|
var swift_max := 0.0
|
|
for x in off["intervals"]:
|
|
off_max = maxf(off_max, float(x))
|
|
for x in swift["intervals"]:
|
|
swift_max = maxf(swift_max, float(x))
|
|
if swift_max >= off_max:
|
|
_fail("D01 must shorten intervals: off=%f swift=%f" % [off_max, swift_max])
|
|
# D03 烈焰: poison effect events must appear.
|
|
if flame["poison_events"] <= off["poison_events"]:
|
|
_fail("D03 must add poison skill events: off=%d flame=%d" % [off["poison_events"], flame["poison_events"]])
|
|
|
|
var payload := {"records": _records, "problems": _problems}
|
|
var dir := ProjectSettings.globalize_path("res://artifacts")
|
|
DirAccess.make_dir_recursive_absolute(dir)
|
|
var f := FileAccess.open(OUTPUT_PATH, FileAccess.WRITE)
|
|
if f != null:
|
|
f.store_string(JSON.stringify(payload, "\t", true))
|
|
f.close()
|
|
for rec in _records:
|
|
print("EDICT_UI %s %s" % [rec["mode"], JSON.stringify(rec["data"])])
|
|
if _problems.is_empty():
|
|
print("EDICT_UI_PASS combat edicts change real runtime battle")
|
|
else:
|
|
print("EDICT_UI_FAIL %d problem(s)" % _problems.size())
|
|
for p in _problems:
|
|
print(" " + p)
|
|
quit(0 if _problems.is_empty() else 1)
|