Files
AIGame/Tools/seed_formal_heroes.py
T
udxandClaude Opus 5.5 89e0fa246f Add formal enemies, remaining formal partners and synthesized UI SFX
- UI SFX v3: procedurally synthesized one-shots (Tools/synth_ui_sfx.py) wired to
  buttons, rewards, errors and red dots via UiSfx, gated by the SFX setting.
- Five formal enemies (Hornlet, Dashlet, Shellhorn, HornCaptain, GreatHorn):
  Hunyuan 50k -> 2000-tri XPbr, DGXA TokenRig, Idle/Walk/Attack, nested per type
  in PrototypeArena; PrototypeBattle.Enemy gains presentation-only Moving/Strikes.
- Formal partners for all ten pets in the arena and portraits, including new
  VineSprite, ThunderLeopard and TideWhale.
- Pipeline fixes: reject local TokenRig fallback, drop loose mesh islands,
  configurable Unity run_script timeout, companion static stage.
- Also includes concurrent work from another tool in this working tree
  (FlameLion, enemy combat FX, challenge mode, home explorer, server updates).
- Resources registered in Doc/ResDesc_*.md; verified on isolated :18081.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-21 12:23:55 +08:00

30 lines
1.5 KiB
Python

"""Seed only the isolated formal-heroes database so 1-1 fields SparkBird and BubbleTurtle."""
import json
from pathlib import Path
import sqlite3
root = Path(__file__).resolve().parents[1]
test_root = (root / "Tools/output/formal_heroes").resolve()
database = (test_root / "bird_turtle.db").resolve()
username = (test_root / "account.txt").read_text(encoding="utf-8-sig").strip()
if test_root not in database.parents or not username.startswith("formalheroes_"):
raise RuntimeError("Refusing to edit a database or account outside the isolated formal-heroes fixture")
with sqlite3.connect(database) as conn:
row = conn.execute(
"SELECT u.pid, g.state FROM users u JOIN game_states g ON g.pid = u.pid WHERE u.username = ?",
(username,),
).fetchone()
if row is None:
raise RuntimeError("Isolated account has no game state")
state = json.loads(row[1])
if state.get("schema") != 9 or state.get("pendingShot") or state.get("pendingBattle"):
raise RuntimeError("Isolated save is not a settled schema 9 state")
if len(state.get("stages", [])) != 10 or len(state.get("formation", [])) != 6:
raise RuntimeError("Unexpected roster or formation width")
state["stages"][3] = 1
state["stages"][4] = 1
state["formation"] = [4, 3, -1, -1, -1, -1]
state["revision"] = int(state.get("revision", 0)) + 1
conn.execute("UPDATE game_states SET state = ? WHERE pid = ?", (json.dumps(state, ensure_ascii=False), row[0]))
print("Seeded isolated account to own and field SparkBird (3) and BubbleTurtle (4)")