1.3 KiB
1.3 KiB
Quickstart: Display Initiative
Overview
Add initiative display to creature stat blocks. Three layers touched:
- Domain: New
calculateInitiativepure function +initiativeProficiencyfield onCreature - Adapter: Parse
initiative.proficiencyfrom raw 5etools JSON - UI: Show "Initiative +X (Y)" next to AC in stat block header
Key Files
| File | Change |
|---|---|
packages/domain/src/creature-types.ts |
Add initiativeProficiency: number to Creature |
packages/domain/src/initiative.ts |
New file: calculateInitiative, formatInitiativeModifier |
packages/domain/src/index.ts |
Export new function/types |
packages/domain/src/__tests__/initiative.test.ts |
New file: unit tests |
apps/web/src/adapters/bestiary-adapter.ts |
Parse initiative.proficiency from raw JSON |
apps/web/src/components/stat-block.tsx |
Display initiative in header |
Implementation Order
- Add
initiativeProficiencytoCreaturetype - Create
calculateInitiative+formatInitiativeModifierin domain with tests - Update bestiary adapter to parse initiative proficiency
- Update stat block component to display initiative
Verification
pnpm check # Must pass — knip + format + lint + typecheck + test
Spot-check: Aboleth should display "Initiative +7 (17)".