Summary
Day 16 delivered the Inventory & Equipment system, a major mechanical upgrade to the hero layer of the simulation. Items now drop from defeated monsters, heroes auto-equip the best gear, potions are consumed automatically when HP falls below 30%, the Smith building visit forges real items (not just +1 ATK), and the Merchant sells the cheapest inventory item rather than a fixed gold amount. Three bugs from BUGS.md were also fixed: child age overflow (promoted flag), too many save files (single save.json, SAVE_VERSION 8), and incomplete villager roster in saves. The test suite grew from 728 to 770 passing across 71 files.
Project Manager
Contribution: Led Day 16 scrum, selected features, set scope.
Key Decisions:
- Headlined Inventory & Equipment as the primary feature. The hero has had combat since Day 1 but no tangible progression beyond XP and gold. Gear makes each combat win feel meaningful -- a Rare Silver Blade changes the numbers players see on the HeroPanel.
- Bundled the three BUGS.md items into Day 16: child promotion overflow (the hundreds-of-years-old children bug), single canonical save.json, and full villager roster in saves. These were infrastructure blockers for reliable continued play.
- Deferred multi-hero simulation and World Regions to future days. Both require significant architecture changes better tackled after the hero layer is stable.
Reasoning: Gear drops give the hero a reason to fight beyond XP accumulation. Pairing with bug fixes keeps the sim stable for production runs.
World Designer
Contribution: Defined item catalog, rarity color palette, and loot table themes.
Item design decisions:
- 10 weapons covering all hero archetypes: daggers for rogues (dexBonus), staves for mages (hpBonus), bows for rangers, longswords for warriors and paladins.
- 8 armor pieces from leather (common) through dragonscale and plate (legendary).
- 2 potions: health_potion (12 HP) and greater_health_potion (28 HP), with the greater variant gated behind Drake encounters.
- Rarity color palette: common = grey, uncommon = green, rare = blue, legendary = orange. Consistent with standard RPG conventions so the visual reads instantly.
Loot table themes: Each monster type drops thematically appropriate gear -- Goblins drop bone daggers, Orcs drop iron swords and chain mail, Drakes drop silver blades and dragonscale, Bandits drop shadow cloaks.
Backend Developer
Contribution: Implemented all backend systems.
Files created/modified:
src/core/ItemSystem.js(new): ITEMS catalog, RARITY_RANK, ITEM_SELL_VALUE, MONSTER_LOOT tables, itemScore(), rollLoot(), randomItem()src/entities/Hero.js: added inventory[], equipped{weapon,armor}, addLoot(), usePotion(), forceEquip(), sellCheapest(), serializeInventory(), serializeEquipped(), restoreInventory(), _equip(), _applyBonus(), _unapplyBonus(), _maybeTrimInventory()src/core/CombatSystem.js: resolve() now returns { survived, statusEvents, loot }server/SimEngine.js: Smith forges randomItem, Merchant calls sellCheapest, #runCombat processes loot and auto-potions, snapshot includes equipped/inventoryserver/PersistenceManager.js: SAVE_VERSION 8, single save.json, saves inventory/equipped and full villager rosterserver/ChildSystem.js: fixed promotion withpromotedflag instead of age-transition check
Key implementation notes:
- itemScore = atkBonus + defBonus + dexBonus + hpBonus*0.4 (HP weighted lower)
- Inventory cap: 8 items; trim prefers dropping common rarity
- Potion threshold: 30% of max HP
Frontend Developer
Contribution: Updated HeroPanel to show equipped slots and inventory grid.
Changes to HeroPanel.jsx:
- RARITY_COLOR map matching ItemSystem values
- itemIcon() function: dagger/bow/staff/flask/armor per item id
- EquipSlot component with rarity-colored 60x52 slot border
- Two equipment slots (Weapon, Armor) shown below stats row
- Inventory grid: up to 8 48x52 slots, rarity-bordered, item name tooltip
- New FA icon imports: faDagger, faBow, faStaff, faFlask, faHelmetBattle, faVest
Tester / QA
Contribution: Wrote 100+ tests covering ItemSystem and Hero inventory.
New test files:
src/core/ItemSystem.test.js: ITEMS catalog completeness, RARITY_RANK ordering, ITEM_SELL_VALUE, itemScore formula, MONSTER_LOOT table validity, rollLoot, randomItem with maxRarity filteringsrc/entities/Hero.inventory.test.js: addLoot auto-equip, upgrade path, stash when worse, potion auto-use, inventory cap trim, sellCheapest, serialize/restore round-trip, forceEquip
Bug fixes to test files:
- Fixed NUL bytes in PersistenceManager.test.js (trim trailing nulls)
- Fixed SimEngine.heroVisit.test.js: removed em-dash, updated Smith/Merchant assertions to match new gold-cost and item-forge behavior
- Fixed SAVE_VERSION: test now expects 'save.json' (not timestamped filename)
Final count: 770 passing across 71 test files