# Roll-Your-Character Build Flow — Implementation Spec This is the guided, dice-driven character creation flow referenced in the build prompt. It should work for both a DM building a character for a player and a player building their own, and the UI must tell the user exactly which die to roll at each step (this is the whole point of the feature — it should feel like rolling at a physical table, not filling out a form). Model this as a state machine on `Character.buildStage` (see Prisma schema) with the in-progress rolls/choices held in `Character.buildState` (JSON) until the build is finalized, at which point the real columns (`species`, `characterClass`, ability scores, proficiencies) get set and `buildStage` becomes `COMPLETE`. ## Step 1 — Roll Species (d8) Tell the player: **"Roll a d8."** Then offer the family of species that result maps to; keep the flavor text short. | d8 Roll | Choose from | |---|---| | 1 | Human, Half-Elf, Elf, Half-Orc | | 2 | Dwarf, Gnome, Halfling, Deep Gnome, Duergar | | 3 | Dragonborn, Tiefling, Aasimar, Goliath | | 4 | Orc, Goblin, Hobgoblin, Bugbear, Kobold | | 5 | Eladrin, Sea Elf, Shadar-kai, Githyanki, Githzerai, Changeling | | 6 | Air, Earth, Fire or Water Genasi, Triton, Tortle | | 7 | Tabaxi, Kenku, Aarakocra, Harengon, Lizardfolk, Owlin, Minotaur, Centaur, Satyr, Shifter, Firbolg, Fairy, Yuan-ti | | 8 | Wildcard — pick any species | If the species has chosen bonuses, immediately prompt for where they go — this choice has to happen here, not be silently defaulted. A Half-Elf picks two abilities (other than Charisma) for +1 each; the 2024 and Multiverse species pick +2 and +1, or +1 to three abilities. ## Step 2 — Roll Class (d8) Tell the player: **"Roll a d8."** | d8 Roll | Choose between | |---|---| | 1 | Fighter or Barbarian | | 2 | Rogue or Ranger | | 3 | Wizard or Sorcerer | | 4 | Cleric or Paladin | | 5 | Bard or Warlock | | 6 | Druid or Monk | | 7 | Artificer, or reroll once (the reroll stands) | | 8 | Wildcard — pick any class | ## Step 2b — Choose a Subclass When the campaign uses subclasses, the player now picks the path within their class from its full list (each with its book and a level 1–20 preview), or rolls a die with one face per subclass for a suggestion, or leaves it until the class reaches the level it chooses at. A path chosen here only starts giving at that level. ## Step 3 — Roll Motivation (d6, optional flavor) Tell the player: **"Roll a d6"** (optional — DM can skip this step for the whole campaign via a campaign setting). | d6 Roll | Motivation | |---|---| | 1 | Revenge for a past wrong | | 2 | Seeking fortune or wealth | | 3 | Protecting someone they love | | 4 | Redemption for a past mistake | | 5 | Driven by curiosity or knowledge | | 6 | Duty or oath to a cause or order | Store this as free text on the character (a `motivation` field, or fold it into `notes`) — it's flavor, not a mechanical input. ## Step 4 — Roll Ability Scores Standard method: **roll 4d6, drop the lowest die, sum the remaining 3** — six times, once per ability (STR, DEX, CON, INT, WIS, CHA). Let the UI roll these (server-side, so results can't be tampered with client-side) and then let the player **assign** each of the six results to an ability score of their choice. Show the running math live (base roll → + species bonus → final score → modifier) as they assign, using the calculation module from GAME_RULES_REFERENCE.md — don't let this drift out of sync with the sheet view. ## Step 5 — Skill & Save Proficiencies Present the 18 skills with their governing ability (`seed-data/skills.json`) and let the player check proficiencies — respect each class's normal "choose N skills from list" limits if you want to be strict, or keep v1 permissive (DM can always correct it). Saving throw proficiencies are **not** a choice — they're fixed per class (`seed-data/classes.json`) and should just be set automatically. ## Step 6 — Starting Equipment Pull `startingItemCount` and `startingSpellCount` from the campaign's settings (DM configures these when creating/configuring the campaign — see `Campaign.startingItemCount` / `Campaign.startingSpellCount` in the schema). Let the player pick that many starting items from the campaign's weapon/item pool and, if their class has spellcasting, that many starting spells from the campaign's spell list. ## Step 7 — Finalize Compute and freeze HP max (`currentHp = hpMax` on finalize), AC, initiative, and all derived stats via the calculation module. Set `buildStage = COMPLETE`. From this point the character sheet is editable directly (level up, stat changes, inventory, notes) rather than walking the dice flow again. ## UI Notes - Every step should show a big, obvious "Roll d_N_" button that triggers a server-side roll (never trust a client-submitted roll result) and animates/ displays the die result before revealing the choice(s) it maps to. - The DM should be able to build a character for a player using this exact same flow (same component, different "who is this for" context) — don't build two separate builders. - Players building their own characters need the same flow, gated to campaigns they're a member of.