Proper guided character builder + level-up wizard
The bare name/class/level form left new characters as shells (1 HP, all-10
abilities, no proficiencies). Now creation and level-up are guided and auto-populate.
- Hand-authored progression tables (no SRD class/slot data exists on disk):
src/lib/rules/{dnd5e,pf2e}/progression.ts — core classes' hit die/HP, key
abilities, save & perception proficiencies, trained-skill counts, caster type;
5e full/half/pact spell-slot tables, pf2e slot approximation; ASI/boost/skill
schedules.
- src/lib/rules/progression.ts: getClassDefs/getClassDef, classSkillChoices/Count,
buildCharacter() (HP from hit die + CON over levels, trained saves/skills, spell
slots + ability), planLevelUp() (HP gain, new slots, ASI/boost/skill choices),
applyIncreases/bumpRank. Pure + 12 unit tests.
- Multi-step CreationWizard (Basics → Abilities → Skills → Review) replaces the
old form; pulls PF2e ancestry HP/speed from the bestiary; review previews HP/AC/
saves/skills/slots; lands on a ready-to-play sheet.
- LevelUpModal reworked into a guided wizard: auto HP + spell slots, presents the
level's actual choices (5e ASI/feat, pf2e ability boosts + skill increase) and
applies them; keeps the strategic build-route advisor.
e2e helper drives the wizard; updated 7 specs to the new flow; new character-wizard
spec asserts a complete level-3 Wizard (HP 17, slots 4xL1 2xL2).
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
import { test, expect } from '@playwright/test';
|
||||
import { createCharacter } from './helpers';
|
||||
|
||||
test.beforeEach(async ({ page }) => {
|
||||
await page.goto('/');
|
||||
@@ -14,18 +15,12 @@ test('generate ability scores and level up', async ({ page }) => {
|
||||
await page.locator('input[data-autofocus]').fill('Build');
|
||||
await page.getByRole('button', { name: 'Create' }).click();
|
||||
await page.getByRole('link', { name: 'Characters' }).click();
|
||||
await page.getByRole('button', { name: '+ New character' }).first().click();
|
||||
await page.locator('input[data-autofocus]').fill('Builder');
|
||||
await page.getByRole('button', { name: 'Create' }).click();
|
||||
await page.getByRole('link', { name: /Builder/ }).click();
|
||||
|
||||
// Generate scores via standard array (default assignment 15,14,13,12,10,8)
|
||||
await page.getByRole('button', { name: 'Generate' }).click();
|
||||
await page.getByRole('button', { name: 'Apply' }).click();
|
||||
// Guided wizard builds a complete level-1 character (standard array → STR 15).
|
||||
await createCharacter(page, 'Builder');
|
||||
await expect(page.getByLabel('STR score')).toHaveValue('15');
|
||||
|
||||
// Level up from 1 -> 2
|
||||
// Guided level-up from 1 -> 2 (HP + any choices applied automatically)
|
||||
await page.getByRole('button', { name: 'Level up' }).click();
|
||||
await page.getByRole('button', { name: 'Level up' }).last().click();
|
||||
await page.getByRole('button', { name: /Apply level 2/ }).click();
|
||||
await expect(page.getByRole('spinbutton', { name: 'Level', exact: true })).toHaveValue('2');
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user