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:
@@ -0,0 +1,22 @@
|
||||
import { type Page } from '@playwright/test';
|
||||
|
||||
/**
|
||||
* Walk the guided creation wizard and land on the new character's sheet.
|
||||
* Uses the default class; selects the minimum required trained skills.
|
||||
*/
|
||||
export async function createCharacter(page: Page, name: string): Promise<void> {
|
||||
await page.getByRole('button', { name: '+ New character' }).first().click();
|
||||
await page.getByLabel('Name').fill(name);
|
||||
await page.getByRole('button', { name: 'Next' }).click(); // → Abilities (standard array is valid by default)
|
||||
await page.getByRole('button', { name: 'Next' }).click(); // → Skills
|
||||
|
||||
const next = page.getByRole('button', { name: 'Next' });
|
||||
const boxes = page.locator('input[type="checkbox"]');
|
||||
const count = await boxes.count();
|
||||
for (let i = 0; i < count; i++) {
|
||||
if (!(await next.isDisabled())) break;
|
||||
await boxes.nth(i).check();
|
||||
}
|
||||
await next.click(); // → Review
|
||||
await page.getByRole('button', { name: 'Create character' }).click();
|
||||
}
|
||||
Reference in New Issue
Block a user