Continued PRODUCTION/51. Effect primitives now reach the real battle sims: - skill_runtime.py / skill_runtime.gd bridge folds skills into per-tick state (poison/execute/chain/buff/summon/stun/damage), parity 7 cases python==gd. - Both mvp_validation_sim.py and battle_sim.gd call skill_runtime each tick; skill_rt stored in state; buffs/summons adjust effective roster/signature DPS without compounding; identity when no skills (null -> neutral multipliers). - check_skill_battle.py: SAME encounter with 6 different skills yields 6 distinct durations [20.3/6.0/11.0/19.6/5.9/4.7], py==gd. This is the concrete proof that skills are no longer just "+DPS numbers". - 5 new gates registered; full P2_CHECKS_PASS (69 gates), identity preserved (300 results byte-identical, mvp_parity_gate PASS). This closes the core of the user's "not perfunctory" requirement: skills now produce genuinely different combat behaviour. Stages B-E (per-hero archetype assignment, talent behaviour, edict rules, enemy mechanics) remain. prototype/ untracked.
62 lines
2.7 KiB
GDScript
62 lines
2.7 KiB
GDScript
extends SceneTree
|
|
|
|
## Emits SkillRuntime (GDScript) tick outputs for parity with skill_runtime.py.
|
|
|
|
const SkillRuntime = preload("res://scripts/skill_runtime.gd")
|
|
const OUTPUT_PATH := "res://artifacts/skill_runtime_parity_gd.json"
|
|
|
|
|
|
func _init() -> void:
|
|
_run.call_deferred()
|
|
|
|
|
|
func _mk_enemies() -> Array:
|
|
return [
|
|
{"id": "E1#1", "content_id": "E1", "hp": 500.0, "max_hp": 500.0, "armor": 1.0, "shield": 0.0, "dead": false},
|
|
{"id": "E2#2", "content_id": "E2", "hp": 500.0, "max_hp": 500.0, "armor": 1.0, "shield": 0.0, "dead": false},
|
|
]
|
|
|
|
|
|
func _run() -> void:
|
|
var scenarios: Array = [
|
|
{"name": "identity", "skills": []},
|
|
{"name": "damage", "skills": [{"hero_id": "H1", "interval": 1.0, "effects": [{"type": "damage", "value": 100}]}]},
|
|
{"name": "execute", "skills": [{"hero_id": "H2", "interval": 1.0, "effects": [{"type": "execute", "threshold": 0.5}]}]},
|
|
{"name": "chain", "skills": [{"hero_id": "H3", "interval": 1.0, "effects": [{"type": "chain", "value": 50, "jumps": 1}]}]},
|
|
{"name": "buff", "skills": [{"hero_id": "H4", "interval": 1.0, "effects": [{"type": "buff", "stat": "atk", "value": 0.5}]}]},
|
|
{"name": "poison", "skills": [{"hero_id": "H5", "interval": 1.0, "effects": [{"type": "poison", "value": 20, "duration": 3.0}]}]},
|
|
{"name": "mixed", "skills": [
|
|
{"hero_id": "H1", "interval": 0.5, "effects": [{"type": "damage", "value": 30}, {"type": "lifesteal", "value": 0.2}]},
|
|
{"hero_id": "H2", "interval": 2.0, "effects": [{"type": "chain", "value": 40, "jumps": 1}, {"type": "stun", "duration": 1.0}]},
|
|
]},
|
|
]
|
|
var results: Array = []
|
|
for sc in scenarios:
|
|
var rt := SkillRuntime.init_runtime(sc)
|
|
var enemies := _mk_enemies()
|
|
var events: Array = []
|
|
var total_damage := 0.0
|
|
var total_killed := 0
|
|
var total_events := 0
|
|
for t in range(10):
|
|
var time := float(t) * 0.5
|
|
var out := SkillRuntime.tick(rt, enemies, time, 0.5, events)
|
|
total_damage += float(out["extra_damage"])
|
|
total_killed += int(out["killed"])
|
|
total_events += int(out["effect_events"])
|
|
results.append({
|
|
"name": str(sc["name"]), "total_damage": snappedf(total_damage, 0.0001),
|
|
"total_killed": total_killed, "total_events": total_events,
|
|
"enemy_hp": [snappedf(float(enemies[0]["hp"]), 0.0001), snappedf(float(enemies[1]["hp"]), 0.0001)],
|
|
"damage_mult": snappedf(SkillRuntime.damage_mult(rt["skill_state"]), 0.0001),
|
|
"events_sample": events.slice(0, 3),
|
|
})
|
|
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({"results": results}, "\t", true))
|
|
f.close()
|
|
print("SKILL_RT_PARITY_GD cases=%d" % results.size())
|
|
quit(0)
|