loop: baseline

This commit is contained in:
bepis
2026-10-20 20:33:35 +11:00
parent f1ae7b3119
commit 9a308b697d
32 changed files with 959 additions and 2046 deletions
+18 -1
View File
@@ -31,4 +31,21 @@ Format:
- Decision: Static HTML/CSS/JS served by Express.
- Consequences: Slightly more DOM boilerplate; far fewer moving parts.
<!-- Add D-004 onward below -->
## D-004: Both combatants attack every round
- Date: 2026-10-20 (review)
- Context: Combat treated "higher speed acts first" as "only the faster side acts", so the slower side never attacked.
- Decision: Each round, both attack; faster first; hero wins speed ties; a kill ends the round.
- Consequences: Round log has up to 2 entries per round (max 40). Win rates need re-tuning (see STATUS issue 1).
## D-005: Equipment stats are counted once in derived stats
- Context: maxHp added equipment VIT twice (once in totalVit, once as a separate term).
- Decision: `calcDerived` in `src/game/stats.js` is the ONLY derived-stat formula; combat and services call it.
## D-006: Real SQLite session store everywhere; unref its cleanup timer
- Context: better-sqlite3-session-store ignores `expired.clear:false` (`clear || true`), so its setInterval kept tests alive; the project had used a memory store in tests, so the real store was never exercised.
- Decision: Wrap store creation so its interval is unref'd. Tests now use the real store.
## D-007: `src/utils/time.js` is the only clock
- Decision: Services call `time.now()`; tests use `time.setNow()`. Game functions take `nowMs`/`rng` as parameters.
<!-- Add D-008 onward below -->