step 10.17: wip (not ticked)

This commit is contained in:
bepis
2026-10-23 07:01:49 +11:00
parent a475eaf8eb
commit e4ac3f49c5
9 changed files with 520 additions and 57 deletions
+5 -2
View File
@@ -8,9 +8,9 @@
## Current Focus
- **Phase:** 10
- **Step:** 10.17 — (next)
- **Step:** 10.18 — (next)
- **Blocked?** No
- **Last verified working command:** `npm test` — 273/273 passing (97 unit + 176 integration incl. 9 public leaderboard/profile tests), 2026-10-23 step 10.16
- **Last verified working command:** `npm test` — 284/284 passing (97 unit + 187 integration incl. 11 step-10.17 tests), 2026-10-23 step 10.17
## Project Health
| Item | State |
@@ -180,6 +180,9 @@
- [x] **10.13** Starter kit (GAME_DESIGN §Items): `createCharacter` grants, in the same transaction, one class-appropriate common weapon (warrior Rusty Sword, mage Apprentice Staff, ranger Hunter's Shortbow) already equipped in the weapon slot, plus 2 Minor Healing Potions.
*Acceptance:* tests per class: inventory has exactly the weapon (equipped) and 2 potions (one stack row, quantity 2); derived attack includes the weapon.
*Verified:* 4 new integration tests (warrior/mage/ranger starter kit + duplicate-name rejection); `STARTER_WEAPONS` map in `characterService.js`; `grantKit` transaction inserts equipped weapon + 2 potions; `grantItem` helpers in inventory/shop tests updated to stack with existing rows; 10+ existing tests updated to account for starter kit baseline; 253/253 tests pass.
- [x] **10.17** Build `public/leaderboard.html` + `public/js/leaderboard.js`: tabs Level/Gold/Kills, rank, hero name (link to profile.html?name=...), class, value; `textContent` only. Add nav links (Game, Shop, Leaderboard, Logout) to header of every logged-in page. Remove temporary link-checker exception from 10.5.
*Acceptance:* leaderboard page loads, tabs switch, entries render with profile links; nav links on game.html, shop.html, create-hero.html, leaderboard.html; link-checker passes.
*Verified:* 11 integration tests (4 nav-link checks, 3 page-structure, 1 code-quality, 3 API integration); `leaderboard.html` with tabs/table/pagination; `leaderboard.js` uses createElement + textContent only, no innerHTML; nav-links CSS added to main.css; nav links added to game.html, shop.html, create-hero.html, leaderboard.html; 284/284 tests pass.
### E. Economy
- [x] **10.14** Fix material sell prices. The code uses `defaultRate * heroLevel / itemMinLevel`; BALANCE.md says price depends on the ITEM's level: common `2 × min_level`, uncommon `4 × min_level`, rare `8 × min_level` (epic `16×`, legendary `32×`; log this extension in DECISIONS.md), minimum 1. Note BALANCE.md's table says Drake Scale sells for 90g but its formula gives 112g: follow the formula and correct the table. Use ONE function (`materialSellPrice` in `src/game/rewards.js`) for the shop list AND for selling.
*Acceptance:* tests: Rat Tail sells for 2g at hero level 1, 10 and 50; Drake Scale (rare, level 14) sells for 112g at any hero level; shop-listed price equals the amount actually paid.