Summary
Day 31 introduced the Hireling/Companion System — heroes can recruit a brave or adventurous villager as a combat companion. The hireling fights alongside the hero each combat round, deals bonus damage to monsters, and can be wounded or killed. Recruited from the local population based on personality traits and hero reputation. SAVE_VERSION bumped to 22. Multiple file truncation corruptions detected and repaired. 1018 tests passing across 87 files.
Project Manager
Contribution: Led Day 31 scrum; selected Hireling/Companion as the feature.
Key Decisions:
- The hero has been a solitary figure for 30 days. The hireling system adds a social dimension to combat and ties the villager simulation directly into hero gameplay — a real named villager you've watched grow up in town can follow you into dungeons.
- Recruitment gated on rep ≥ 1500 (Recognized tier) and eligible personality traits (Brave/Adventurous) ensures it's a reward for hero investment in a town, not a trivial pickup.
- 3% chance per resting hour (~33 hours expected wait) keeps hirelings rare and meaningful — losing one hurts.
- Hireling travels with the hero between towns, so the social geography of the world stays relevant.
- SAVE_VERSION 21 → 22: forward-compat defaults (
hireling: null) ensure old saves load cleanly. - File corruption incidents today: SimEngineHelpers.js, SimSnapshot.js, PersistenceManager.js all truncated by the Write tool. All repaired via Python byte patching. Established repair protocol: write files → immediately run
node --checkon all modified files.
World Designer
Contribution: Defined hireling archetypes, stat values, and narrative flavor.
Hireling Archetypes by Profession:
| Profession | HP | ATK | Flavor |
|---|---|---|---|
| Warrior / Guard | 32–36 | 6–7 | Front-line fighters, sturdy |
| Mage | 16 | 8 | Glass cannon, high damage |
| Hunter | 24 | 5 | Agile, moderate damage |
| Smith | 28 | 5 | Brawler build |
| Farmer / Merchant / Healer | 18–20 | 3–4 | Reluctant heroes |
| Priest | 18 | 4 | Divine conviction |
| Innkeeper | 22 | 3 | Surprisingly tough |
Recruitment Flavor:
- Only Brave and Adventurous villagers are eligible — these traits already exist in the personality system, so the hireling system rewards the designers' earlier work.
- The hireling card in HeroPanel shows name, profession, HP bar (green→orange as wounded), ATK bonus, and home town. The TopBar shows a green
fa-person-military-riflebadge with their name when active.
Backend Developer
Contribution: Implemented HirelingSystem.js, SimEngineHelpers integration, and SimEngine wiring.
HirelingSystem.js — 107 lines:
tryRecruit(heroName, heroTown, villagers, getTraits, heroRep)— 3% chance per resting hour, rep ≥ 1500, picks random eligible villager (Brave/Adventurous trait)tickCombat(heroName, monsters)— hireling attacks first alive monster each round (atk + rand(0–3) − 1 dmg); 22% chance hireling takes 2–9 damage; hireling death clears state and emitshireling_deatheventdismiss()— clears hireling (hero death, travel start)serialize()/restore()— full save/load with null defaults
SimEngineHelpers.js additions:
processHirelingRecruit(hireling, hero, heroTown, npcs1, npcs2, personality, reputation)— delegates to HirelingSystem.tryRecruit with correct villager pool per townprocessHirelingCombat(hireling, hero, monsters)— delegates to HirelingSystem.tickCombat, returns events array
SimEngine.js changes (294 lines, well under 300):
- Import HirelingSystem + two helpers
#hireling = new HirelingSystem()field- In resting block:
processHirelingRecruitcalled when not in dungeon - After
runCombat:processHirelingCombatcalled, events logged - On hero death:
this.#hireling.dismiss() - Snapshot:
hireling: this.#hireling.hireling - Save/Load:
hirelingserialized/restored
PersistenceManager.js: SAVE_VERSION 21 → 22; hireling added to save/load params.
File repairs this session: SimEngineHelpers.js (processQuestEvents truncated), SimSnapshot.js (hireling line truncated), PersistenceManager.js (restoreVillagerPositions truncated). All repaired via Python byte patching after node --check detection.
Frontend Developer & Designer
Contribution: HeroPanel hireling card + TopBar hireling badge.
HeroPanel.jsx:
- New
hirelingprop; rendered between dungeon floor card and quest board section - Green-themed card showing: name + profession, HP bar (green > 50% HP, orange below), ATK value, home town
fa-person-military-rifleicon,fa-heartfor HP- HP bar color shifts orange when hireling is below half health — visual urgency cue
TopBar.jsx:
hirelingprop added; green badge withfa-person-military-rifle+ hireling name when active- Color:
#60d090on dark green background — distinct from guild/dungeon badges
App.jsx:
hireling: state?.hireling ?? nulladded to heroPanelPropshireling={state?.hireling ?? null}passed to TopBar
Tester / QA
Contribution: Wrote HirelingSystem.test.js (Vitest format) — 13 tests.
Test Coverage:
- No hireling on init
- No recruit below rep 1500 (500-trial proof)
- Recruits eligible villager above threshold (500-trial probabilistic proof)
- No recruit when no eligible traits
- No double-recruit
- Hireling attacks monster (damage applied)
- Empty events with no hireling
- Empty events when all monsters dead
- Hireling with 1 HP dies from combat hits (200-trial proof)
- Dismiss returns message + clears hireling
- Dismiss with no hireling → null
- Serialize/restore round-trip preserves all fields
- Serialize null hireling produces null
Results: 1018 tests passing across 87 files (up from 1005).
Corruption repairs caught: node --check failures on SimEngineHelpers.js, SimSnapshot.js, PersistenceManager.js detected and repaired before final test run.