Files
agentic-labs-challenge/body-snatcher/build/_p4.md
T
2026-08-13 07:25:35 +02:00

1.7 KiB

Implement PHASE 4 ONLY (procgen + progression + shop + save/load). Preserve 1-3.

  • Procedural dungeon: random walk + room carving. Per floor: 5-8 rooms (4x4 to 8x6), L-shaped 1-wide corridors (never diagonal), exit stairs in the FARthest room from spawn, shop pad on floors 3/5/7/9, enemies scale 4+N per floor, 1-2 chests. Layouts MUST differ across runs (Math.random-based) — verify.js generates 3 and compares wall positions. Difficulty scaling per AGENTS.md (which enemy types appear on which floors).
  • 10 floors with escalating enemy variety.
  • Between-floor shop: after every floor exit (descend), show a shop with 3 random upgrade choices BEFORE the next floor. All 11 upgrades across Ghost/Body/Meta trees with per-tree prerequisites (T1->T2->T3->T4) and the essence costs in AGENTS.md.
  • Save/load via localStorage key 'bodysnatcher_save'. Autosave on floor transition, shop purchase, possession change. Save floor, essence, upgrades, player state (incl. the possessed host), and the current floor layout. load() MUST validate/normalize the stored data (treat it as untrusted/malformed), re-link player.host/body to the restored host object, and restore G._exit by scanning the grid. Because verify.js may overwrite the exit tile TYPE during other tests, ALSO trigger descend when the player stands on the recorded G._exit coordinates during step().
  • Shop API: openShop() (debug) sets state 'shop' AND grants essence>=30 so buy(0) works; the between-floor shop uses earned essence; buy() hard-blocks insufficient essence and enforces prereqs; expose the 3 choices on G.choices. Finish by running (procgen is randomized, so run it a few times): for i in 1 2 3 4 5; do node verify.js $i || break; done (all must exit 0).