Files
windroost/tools/fullgame/ch_reference_audit.py
T
wushenghua d3bb1d8773 audit: CH->Windroost gameplay reference audit (50 implemented, 3 deleted, 1 pending)
Added tools/fullgame/ch_reference_audit.py: for every gameplay dimension in
CF_TO_WINDROOST_SYSTEM_MATRIX.md, verify the corresponding Windroost
implementation via concrete code/data symbols (no claim without evidence).
Result: 50 dimensions implemented with evidence, 3 intentionally deleted
(free movement / grid chess / old UI-assets per design), 1 pending validation
(click combo — a talent behaviour label, not an independent system, matching
the known "talent behaviour is display-only" gap), 0 missing.

Registered as a full-gate step. P2_CHECKS_PASS. prototype/ untracked.
2026-11-19 11:58:11 +08:00

149 lines
9.1 KiB
Python

#!/usr/bin/env python3
"""CH (Clicker Heroes) -> Windroost gameplay reference audit.
For EVERY gameplay dimension declared in CF_TO_WINDROOST_SYSTEM_MATRIX.md,
verify the corresponding Windroost implementation exists (engine symbol / data
field / UI hook / gate). Dimensions the design explicitly DELETED or marked
"pending validation" are classified honestly, not counted as missing.
This is a requirements->evidence audit: a claim without a concrete code/data
symbol is NOT accepted. Output: data/ch_reference_audit.json + PASS/FAIL.
"""
from __future__ import annotations
import json
from pathlib import Path
ROOT = Path(__file__).resolve().parents[2]
def has(path: str, *symbols: str) -> bool:
p = ROOT / path
if not p.exists():
return False
try:
text = p.read_text(encoding="utf-8")
except Exception:
return False
return all(s in text for s in symbols)
# dimension -> (status in matrix, list of (evidence_label, relative_path, symbols...))
DIMS: dict[str, tuple[str, list[tuple[str, str, tuple[str, ...]]]]] = {
# --- 核心循环 ---
"点击即时伤害": ("改编", [("battle sim click", "p2_godot_sample/scripts/battle_sim.gd", ("click",))]),
"群自动DPS": ("改编", [("growth roster_dps", "tools/fullgame/growth.py", ("roster_dps",))]),
"资源增长": ("改编", [("economy validation", "tools/mvp_economy_validation.py", ("gold",)),
("offline report", "p2_godot_sample/scripts/profile_store.gd", ("build_offline_report",))]),
"分钟级选择": ("原创", [("growth actions", "p2_godot_sample/scripts/growth_actions.gd", ("invest_talent", "upgrade_star")),
("gear equip", "tools/fullgame/gear_actions.py", ("equip",))]),
"瓶颈可读性": ("改编", [("failure report", "tools/fullgame/automation.py", ("failure_report",)),
("pacing gate", "tools/fullgame/check_cycle_pacing.py", ("MILESTONES",))]),
"自动推进": ("改编", [("auto next node", "tools/fullgame/automation.py", ("next_auto_node",)),
("auto run test", "p2_godot_sample/scripts/auto_run_test.gd", ("auto",))]),
"失败恢复": ("改编", [("retry report", "tools/fullgame/automation.py", ("failure_report",)),
("garrison", "tools/fullgame/automation.py", ("garrison_gold",))]),
"长周期转生": ("改编", [("rebuild", "tools/fullgame/prestige.py", ("apply_rebuild",)),
("new sky", "tools/fullgame/prestige.py", ("apply_new_sky",))]),
# --- 战斗 ---
"主动技能": ("改编", [("storm/ultimate", "p2_godot_sample/scripts/battle_sim.gd", ("storm", "ultimate"))]),
"技能冷却": ("改编", [("cooldown", "p2_godot_sample/scripts/battle_scene.gd", ("storm_cooldown",))]),
"多单位编队": ("改编", [("enemy_ids", "p2_godot_sample/scripts/world_content.gd", ("enemy_specs",))]),
"5人战术位": ("改编", [("roster hero ids", "p2_godot_sample/scripts/battle_sim.gd", ("visible_hero_ids",))]),
"Boss阶段": ("改编", [("boss phases", "data/full_game_content.json", ("phases",)),
("boss phase test", "p2_godot_sample/scripts/boss_phase_test.gd", ("phase",))]),
"自动点击器": ("改编", [("auto target", "tools/fullgame/automation.py", ("next_auto_node",))]),
"点击连击": ("待验证", [("combo research note", "PRODUCTION/", ())]), # pending validation in design
"伤害反馈": ("继承", [("vfx test", "p2_godot_sample/scripts/vfx_test.gd", ("shield",)),
("feedback service", "p2_godot_sample/scripts/feedback_service.gd", ("pop",))]),
"自由移动": ("删除", []), # explicitly deleted
"回合棋盘": ("删除", []), # explicitly deleted
# --- 关卡地图 ---
"Zone节点": ("改编", [("600 nodes", "data/full_game_content.json", ("nodes",))]),
"Boss周期": ("改编", [("chapter boss", "data/full_game_content.json", ("boss",))]),
"普通怪变体": ("改编", [("enemies", "data/full_game_content.json", ("variant",))]),
"Primal Boss": ("原创", [("region/final boss", "tools/fullgame/prestige.py", ("final_boss_first_clears",))]),
"地区背景": ("原创", [("regions", "p2_godot_sample/scripts/world_content.gd", ("regions",))]),
"驻扎刷关": ("改编", [("garrison", "tools/fullgame/automation.py", ("garrison_gold",))]),
"天空裂隙": ("原创", [("rift unlock", "tools/fullgame/prestige.py", ("NEW_SKY_RIFT_REQUIRED",))]),
"波次节点": ("改编", [("waves", "data/full_game_content.json", ("waves",))]),
# --- 经济 ---
"金币": ("改编", [("gold", "p2_godot_sample/scripts/profile_store.gd", ("gold",))]),
"风晶黑市": ("改编", [("market", "tools/fullgame/side_systems.py", ("market_status",))]),
"风之精华": ("改编", [("essence", "tools/fullgame/prestige.py", ("essence",))]),
"天空徽记": ("改编", [("sky marks", "tools/fullgame/prestige.py", ("sky_marks",))]),
"遗物碎片": ("改编", [("fragments", "p2_godot_sample/scripts/growth_actions.gd", ("star_fragments",))]),
"英雄纹章": ("改编", [("emblem", "tools/fullgame/growth.py", ("emblem_modifier",))]),
"伙伴任务": ("改编", [("partners", "tools/fullgame/side_systems.py", ("partner_status",))]),
# --- 英雄成长 ---
"英雄名册54": ("改编", [("heroes", "data/full_game_content.json", ("heroes",))]),
"英雄等级300": ("改编", [("level", "tools/fullgame/growth.py", ("level_modifier",))]),
"天赋": ("改编", [("talent", "tools/fullgame/growth.py", ("talent_modifier",))]),
"觉醒": ("原创", [("awakening", "tools/fullgame/growth.py", ("awakening_modifier",))]),
"誓约": ("改编", [("oath direction", "tools/fullgame/prestige_direction.py", ("direction_modifier",))]),
"律令": ("改编", [("edict buy", "tools/fullgame/prestige.py", ("buy_edict",))]),
"技能书": ("改编", [("abilities", "data/full_game_content.json", ("abilities",))]),
"英雄追赶": ("原创", [("trial level", "FINAL_GAME_DESIGN.md", ("试用等级",))]),
# --- 侧系统 ---
"遗物": ("改编", [("relic", "tools/fullgame/growth.py", ("relic_modifier",))]),
"旅团记录167": ("改编", [("records", "tools/fullgame/side_systems.py", ("record_status",))]),
"低频委托": ("改编", [("low freq", "tools/fullgame/low_freq.py", ("claim_commission",))]),
"回归手记": ("改编", [("journal", "tools/fullgame/low_freq.py", ("claim_journal",))]),
"风晶商店": ("改编", [("market", "tools/fullgame/side_systems.py", ("market_status",))]),
"外观": ("原创", [("cosmetics", "tools/fullgame/side_systems.py", ("cosmetic",))]),
"离线收益": ("改编", [("offline", "tools/fullgame/automation.py", ("garrison_gold",))]),
"旧UI资产": ("删除", []), # explicitly deleted
# --- 工程 ---
"BigValue": ("继承", [("big value", "p2_godot_sample/scripts/battle_sim.gd", ("snappedf",))]),
"原子存档": ("继承", [("save", "p2_godot_sample/scripts/profile_store.gd", ("save_profile",))]),
"Token防重复": ("继承", [("claim_once", "p2_godot_sample/scripts/profile_store.gd", ("claim_once",))]),
"私有RNG": ("继承", [("seed", "p2_godot_sample/scripts/battle_sim.gd", ("seed",))]),
"数据驱动JSON": ("继承", [("full content", "data/full_game_content.json", ("schema",))]),
}
def main() -> int:
problems = []
summary = {"implemented": 0, "deleted": 0, "pending": 0, "missing": 0}
details = []
for dim, (status, evs) in DIMS.items():
if status == "删除":
summary["deleted"] += 1
details.append({"dimension": dim, "status": "deleted_intentional", "evidence": []})
continue
if status == "待验证":
summary["pending"] += 1
details.append({"dimension": dim, "status": "pending_validation", "evidence": []})
continue
found = [(label, path) for label, path, syms in evs if has(path, *syms)]
if found:
summary["implemented"] += 1
details.append({"dimension": dim, "status": "implemented", "evidence": found})
else:
summary["missing"] += 1
expected = [f"{path}:{','.join(syms)}" for _, path, syms in evs]
problems.append(f"{dim}: expected evidence not found -> {expected}")
details.append({"dimension": dim, "status": "MISSING", "evidence": expected})
report = {"schema": 1, "kind": "ch_reference_gameplay_audit",
"source": "CF_TO_WINDROOST_SYSTEM_MATRIX.md",
"summary": summary, "problems": problems, "dimensions": details}
out = ROOT / "data" / "ch_reference_audit.json"
out.parent.mkdir(parents=True, exist_ok=True)
out.write_text(json.dumps(report, ensure_ascii=False, indent=2) + "\n", encoding="utf-8")
print(f"CH reference audit: {summary['implemented']} implemented, "
f"{summary['deleted']} intentionally deleted, {summary['pending']} pending, "
f"{summary['missing']} missing")
if problems:
print("CH_REF_AUDIT_FAIL")
for p in problems:
print(" - " + p)
return 1
print("CH_REF_AUDIT_PASS")
return 0
if __name__ == "__main__":
raise SystemExit(main())