Files
windroost/tools/build_launch_content.py
T
wushenghua 970cadb129 feat: add offline progress, rebuild and a full-chapter balance simulation
P3b. ProfileStore is now schema 3 with an 8-hour-capped offline report derived
from roster DPS, a claim-once guard, clock-rollback handling, and a rebuild
transaction that clears run state while keeping recruited heroes and granting
wind essence. The skyport shows the claimable report and a rebuild entry.

Balance. simulate_chapter.py plays the whole chapter with two profiles. The
minimum-effort profile clears 9/10 nodes (N08 needs taps); the active profile
clears 10/10 including the boss. This is the evidence that the chapter is
actually completable and that manual input changes the outcome. The boss's
1500 HP was being wrongly multiplied by the node scale; the content generator
now keeps it fixed as the data pack requires.

Paper parity. mvp_validation_sim.py now understands P3a enemy specs, node HP
scale and the recruited-roster filter, so the runtime and paper models stay
aligned beyond the P2 fixture. The 300-result parity gate still passes.

tools/run_p2_checks.sh now runs 15 gates; all pass. Recorded balance note:
an active player kills the boss in ~4s, so the 30s timer and phases are not
yet meaningful. That is a tuning item against the frozen data pack, not a
local fix to smuggle in.
2026-11-17 01:25:30 +08:00

131 lines
5.9 KiB
Python

#!/usr/bin/env python3
"""Build the frozen P3a launch-content data file.
The launch data pack (PRODUCTION/00-launch-content-data-pack.md) is the
authoritative source for ids, names, families, wave composition and rewards.
This generator turns its *relative* enemy stats into absolute runtime values
with an explicit, reviewable per-node scale. Nothing here invents new content
rows: every id and wave comes from the data pack.
Output: data/mvp_launch_content.json
"""
from __future__ import annotations
import json
from pathlib import Path
from typing import Dict, List
OUT = Path("data/mvp_launch_content.json")
# From PRODUCTION/00 section 3.1. signature_dps follows the same ratio as the
# P2 fixture; final balancing is done against the simulator, not by hand.
HEROES = [
{"id": "H01", "signature": "break", "base_atk": 10, "base_spd": 90, "base_dps": 8,
"signature_dps": 4.0, "unlock": "R1-C01-N01", "art_id": "H01"},
{"id": "H02", "signature": "single", "base_atk": 14, "base_spd": 110, "base_dps": 12,
"signature_dps": 5.0, "unlock": "R1-C01-N01", "art_id": "H02"},
{"id": "H03", "signature": "aoe", "base_atk": 16, "base_spd": 95, "base_dps": 13,
"signature_dps": 5.5, "unlock": "R1-C01-N01", "art_id": "H03"},
{"id": "H04", "signature": "click", "base_atk": 11, "base_spd": 100, "base_dps": 9,
"signature_dps": 3.0, "unlock": "R1-C01-N02", "art_id": "H04"},
{"id": "H05", "signature": "tempo", "base_atk": 15, "base_spd": 120, "base_dps": 13,
"signature_dps": 5.0, "unlock": "R1-C01-N03", "art_id": "H05"},
{"id": "H06", "signature": "sustain", "base_atk": 12, "base_spd": 105, "base_dps": 10,
"signature_dps": 4.5, "unlock": "R1-C01-CLEAR", "art_id": "H06"},
]
# From PRODUCTION/00 section 4.1. base_hp = round(600 * hp_mult), which keeps
# E-R1-F1-V1 at the familiar 480 from the P2 fixture.
ENEMY_ROWS = [
("E-R1-F1-V1", "草原狼", "aoe", 0.8, 1, 0),
("E-R1-F2-V1", "空盗斥候", "click", 0.9, 1, 0),
("E-R1-F3-V1", "树精守卫", "break", 2.0, 3, 60),
("E-R1-F4-V1", "毒藤", "sustain", 1.0, 1, 0),
("E-R1-F5-V1", "岩石傀儡", "break", 1.8, 5, 40),
("E-R1-F6-V1", "地精爆破手", "aoe", 0.6, 1, 0),
("E-R1-F7-V1", "沙虫", "single", 1.4, 2, 0),
("E-R1-F8-V1", "木乃伊祭司", "break", 1.1, 2, 50),
("E-R1-F9-V1", "风暴精灵", "aoe", 0.7, 1, 0),
("E-R1-F10-V1", "虚空信徒", "single", 1.0, 1, 20),
]
REBUILD = {
"E-R1-F3-V1": (60.0, [6.0, 12.0], 220.0),
"E-R1-F5-V1": (40.0, [8.0], 120.0),
"E-R1-F8-V1": (50.0, [6.0], 100.0),
"E-R1-F10-V1": (20.0, [10.0], 60.0),
}
ENEMIES = []
for enemy_id, name, weak_tag, mult, armor, shield in ENEMY_ROWS:
rebuild_at = REBUILD.get(enemy_id, (float(shield), [], 0.0))[1]
rebuild_amount = REBUILD.get(enemy_id, (float(shield), [], 0.0))[2]
ENEMIES.append({
"id": enemy_id, "name": name, "weak_tag": weak_tag,
"hp_mult": mult, "base_hp": round(600 * mult),
"armor": armor, "shield_max": shield,
"rebuild_at": rebuild_at, "rebuild_amount": rebuild_amount,
"art_id": "EG01",
})
BOSS = {
"id": "B-R1-01", "name": "空盗船长·红鸢",
"hp": 1500, "armor": 5, "shield_max": 200,
"timer_sec": 30, "weak_tag": "break",
"rebuild_at": [8.0, 16.0], "rebuild_amount": 420.0,
"art_id": "B01", "phases": ["B-R1-01-P1", "B-R1-01-P2"],
}
# From PRODUCTION/00 section 6.1. Event nodes are kept as nodes with no waves;
# their choice is resolved as a small reward at runtime.
NODE_ROWS = [
("R1-C01-N01", 1, "normal", [["E-R1-F1-V1", "E-R1-F1-V1"]], "REWARD-R1-C01-N01", 30, []),
("R1-C01-N02", 2, "normal", [["E-R1-F2-V1", "E-R1-F2-V1", "E-R1-F1-V1"]], "REWARD-R1-C01-N02", 40, ["H04"]),
("R1-C01-N03", 3, "elite", [["E-R1-F3-V1", "E-R1-F4-V1"], ["E-R1-F4-V1", "E-R1-F4-V1"]], "REWARD-R1-C01-N03", 50, ["H05"]),
("R1-C01-N04", 4, "event", [], "REWARD-R1-C01-N04", 35, []),
("R1-C01-N05", 5, "normal", [["E-R1-F2-V1", "E-R1-F2-V1", "E-R1-F2-V1"]], "REWARD-R1-C01-N05", 60, []),
("R1-C01-N06", 6, "elite", [["E-R1-F5-V1"], ["E-R1-F6-V1", "E-R1-F6-V1"]], "REWARD-R1-C01-N06", 70, []),
("R1-C01-N07", 7, "event", [], "REWARD-R1-C01-N07", 0, []),
("R1-C01-N08", 8, "normal", [["E-R1-F1-V1", "E-R1-F1-V1", "E-R1-F2-V1", "E-R1-F2-V1"]], "REWARD-R1-C01-N08", 80, []),
("R1-C01-N09", 9, "elite", [["E-R1-F9-V1", "E-R1-F10-V1"], ["E-R1-F10-V1", "E-R1-F10-V1"]], "REWARD-R1-C01-N09", 100, []),
("R1-C01-N10", 10, "boss", [["B-R1-01"]], "DROP-R1-BOSS-01", 100, ["H06"]),
]
NODES = []
for node_id, index, node_type, waves, reward_id, gold, unlocks in NODE_ROWS:
NODES.append({
"id": node_id, "index": index, "type": node_type,
"waves": waves, "reward_id": reward_id, "gold": gold,
"crystal": 5 if node_type == "boss" else 0,
"unlocks": unlocks,
# The boss uses its fixed 1500 HP from the data pack; the CH-derived
# node scale applies to regular enemies only.
"hp_scale": 1.0 if node_type == "boss" else round(1.0 + 0.12 * (index - 1), 4),
"timeout_sec": 30 if node_type == "boss" else 45,
})
def main() -> int:
content = {
"schema": 1,
"purpose": "Frozen P3a launch content: 6 heroes, 10 enemies, 1 boss, 10 nodes. Derived from PRODUCTION/00-launch-content-data-pack.md; not a second source of truth for ids or waves.",
"source_contract": "PRODUCTION/00-launch-content-data-pack.md",
"region": {"id": "R1", "name_key": "content.region.R1"},
"heroes": HEROES,
"enemies": ENEMIES,
"boss": BOSS,
"nodes": NODES,
"hp_formula": "base_hp * node.hp_scale; boss uses its fixed hp",
}
OUT.write_text(
json.dumps(content, ensure_ascii=False, indent=2) + "\n", encoding="utf-8"
)
print(
f"wrote {OUT}: {len(HEROES)} heroes, {len(ENEMIES)} enemies, "
f"1 boss, {len(NODES)} nodes"
)
return 0
if __name__ == "__main__":
raise SystemExit(main())