V1.23.0: every subclass, 43 species, the Artificer, and the road to level 20

- All 123 official subclasses (2014 books and the 2024 Player's Handbook), each
  with its book and features up to level 20; one file per class
- The builder has a subclass step after the class: pick one, let a die suggest
  one, or decide later; its gifts arrive at the class's choice level
- 2024 updates (Wild Heart, Warrior of the Elements) offer a one-click switch
- The Road Ahead: a level 1-20 timeline on every sheet and in the builder
- 33 new species (2024 Aasimar and Goliath, Monsters of the Multiverse) with
  chosen +2/+1 or +1/+1/+1 bonuses; species roll is now a d8 by family
- The Artificer: class, half-caster slots from level 1, features, Flash of Genius
- Class tables and counters run to level 20; a fifth Boon, Resolve

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-10-11 16:02:51 +02:00
co-authored by Claude Opus 5.5
parent e7b6e0065a
commit 18d9e7301c
56 changed files with 4720 additions and 825 deletions
+268 -63
View File
@@ -6,12 +6,13 @@ import { Spinner, ErrorBanner } from '../components/Spinner';
import { NumberInput } from '../components/NumberInput';
import { InfoTip } from '../components/InfoTip';
import { ABILITY_LABELS, CLASS_LABELS, SKILL_LABELS, SPECIES_LABELS, extractErrorMessage, fmtMod, spellLevelLabel } from '../lib/format';
import { SPECIES_ABILITY_BONUSES, abilityModifier, speciesBonusFor } from '../lib/speciesData';
import { SPECIES_ABILITY_BONUSES, SPECIES_FLEXIBLE_BONUS, abilityModifier, bonusChoicesValid, speciesBonusFor, type BonusChoices } from '../lib/speciesData';
import { CLASS_SPELLCASTING_ABILITY, CLASS_HIT_DIE, CLASS_SAVE_PROFICIENCIES } from '../lib/classData';
import { ABILITY_GUIDE, CLASS_GUIDE, SKILL_GUIDE, SPECIES_GUIDE, SPECIES_SPEED, STEP_GUIDE, STEP_NAMES, hitDieToughness } from '../lib/guide';
import { speciesIcon } from '../lib/speciesIcons';
import { ProgressionTimeline } from '../components/ProgressionTimeline';
import { armorClass, hpMax, passivePerception, proficiencyBonus, saveBonus, spellAttackBonus, spellSaveDC } from '../lib/previewCalc';
import type { Ability, BuildOptions, CharacterClass, DiceMode, NamedAbility, PickGroup, Picks, ScoreMethod, Species } from '../api/types';
import type { Ability, BuildOptions, CharacterClass, DiceMode, NamedAbility, PickGroup, Picks, ScoreMethod, Species, SubclassSummary } from '../api/types';
interface SpeciesChoices {
type: 'choice' | 'wildcard';
@@ -20,6 +21,7 @@ interface SpeciesChoices {
interface ClassChoices {
type: 'choice' | 'wildcard' | 'reroll';
options: string[];
canReroll?: boolean; // a 7: the Artificer, or one reroll
}
// A rolled score; the standard array and point buy come as scores alone, no dice.
interface AbilityRoll {
@@ -31,10 +33,14 @@ interface BuildState {
speciesRoll?: number;
speciesChoices?: SpeciesChoices;
species?: Species;
halfElfBonusAbilities?: Ability[];
halfElfBonusAbilities?: Ability[]; // a build begun before chosen bonuses were general
speciesBonusChoices?: BonusChoices;
classRoll?: number;
classChoices?: ClassChoices;
characterClass?: CharacterClass;
subclassRoll?: number;
subclassSuggestion?: string;
subclass?: string | null;
motivationRoll?: number;
motivationText?: string | null;
abilityRolls?: AbilityRoll[];
@@ -53,12 +59,12 @@ const ABILITIES: Ability[] = ['STR', 'DEX', 'CON', 'INT', 'WIS', 'CHA'];
// at 8, and raising it to 15 at most spends from a budget of 27.
const POINT_BUY_BUDGET = 27;
const POINT_BUY_COSTS: Record<number, number> = { 8: 0, 9: 1, 10: 2, 11: 3, 12: 4, 13: 5, 14: 7, 15: 9 };
const HALF_ELF_ELIGIBLE: Ability[] = ['STR', 'DEX', 'CON', 'INT', 'WIS'];
const ALL_SKILLS = Object.keys(SKILL_LABELS);
// The six steps, in order, matching STEP_NAMES.
// The steps, in order, matching STEP_NAMES.
const STEP_STAGES = [
'ROLLING_SPECIES',
'ROLLING_CLASS',
'CHOOSING_SUBCLASS',
'ROLLING_MOTIVATION',
'ASSIGNING_SCORES',
'ASSIGNING_PROFICIENCIES',
@@ -110,7 +116,8 @@ export function CharacterBuilderPage() {
const patchDiceMode = usePatchDiceMode(characterId);
const [formError, setFormError] = useState<string | null>(null);
const [halfElfTouched, setHalfElfPick] = useState<Ability[] | null>(null);
const [bonusTouched, setBonusPick] = useState<BonusChoices | null>(null);
const [pendingSubclass, setPendingSubclass] = useState<string | null | undefined>(undefined);
// Species and class are picked first and only sent to the server on "Next",
// so a player can click around and watch the preview before committing.
const [pendingSpecies, setPendingSpecies] = useState<Species | null>(null);
@@ -150,7 +157,8 @@ export function CharacterBuilderPage() {
// Until the player touches a step they have come back to, it shows what
// they chose last time.
const halfElfPick = halfElfTouched ?? bs.halfElfBonusAbilities ?? [];
const savedBonuses: BonusChoices = bs.speciesBonusChoices ?? Object.fromEntries((bs.halfElfBonusAbilities ?? []).map((a) => [a, 1]));
const bonusPick = bonusTouched ?? savedBonuses;
const assignments = assignmentsTouched ?? bs.abilityAssignments ?? {};
const motivationPick = pendingMotivation ?? bs.motivationChoice ?? null;
const talents = talentsTouched ?? bs.talents ?? [];
@@ -196,20 +204,25 @@ export function CharacterBuilderPage() {
const classPick = pendingClass ?? bs.characterClass ?? null;
const pickedSpecies = onSpeciesStep && speciesPick && bs.speciesChoices?.options.includes(speciesPick) ? speciesPick : null;
const pickedClass = onClassStep && classPick && bs.classChoices?.options.includes(classPick) ? classPick : null;
const speciesReady = Boolean(pickedSpecies) && (pickedSpecies !== 'HALF_ELF' || halfElfPick.length === 2);
const speciesReady = Boolean(pickedSpecies) && bonusChoicesValid(pickedSpecies, bonusPick);
// What the preview shows: everything already locked in, with the step being
// worked on replaced by whatever is currently picked there.
const previewBs: BuildState = {
...bs,
species: onSpeciesStep ? (pickedSpecies ?? undefined) : bs.species,
halfElfBonusAbilities: onSpeciesStep ? (pickedSpecies === 'HALF_ELF' ? halfElfPick : undefined) : bs.halfElfBonusAbilities,
speciesBonusChoices: onSpeciesStep ? bonusPick : savedBonuses,
characterClass: onClassStep ? (pickedClass ?? undefined) : bs.characterClass,
abilityAssignments: stage === 'ASSIGNING_SCORES' ? undefined : bs.abilityAssignments,
};
// Where Back leads from here, if anywhere.
const stepOrder = STEP_STAGES.filter((s) => s !== 'ROLLING_MOTIVATION' || !campaignData?.campaign.skipMotivationRoll);
// Where Back leads from here, if anywhere. A campaign can leave the
// subclass and the motivation out.
const stepOrder = STEP_STAGES.filter(
(s) =>
(s !== 'ROLLING_MOTIVATION' || !campaignData?.campaign.skipMotivationRoll) &&
(s !== 'CHOOSING_SUBCLASS' || campaignData?.campaign.subclassesEnabled !== false)
);
const stepIndex = stepOrder.indexOf(stage);
const backLabel =
stage === 'CHOOSING_EQUIPMENT' && bs.equipment
@@ -240,7 +253,7 @@ export function CharacterBuilderPage() {
</div>
</div>
<BuildProgress stage={stage} />
<BuildProgress stage={stage} steps={stepOrder} />
{formError && <ErrorBanner message={formError} />}
@@ -267,10 +280,10 @@ export function CharacterBuilderPage() {
<>
{stage === 'ROLLING_SPECIES' && (
<div className="card mt-md text-center">
<div className="card-title">Step 1 — Species</div>
<div className="card-title">Species</div>
<p className="step-intro">{STEP_GUIDE.SPECIES}</p>
{!bs.speciesRoll ? (
<RollControl sides={6} diceMode={diceMode} onRoll={safeRoll} rolling={roll.isPending} label="Roll a d6 to see which species you can choose between." />
<RollControl sides={8} diceMode={diceMode} onRoll={safeRoll} rolling={roll.isPending} label="Roll a d8 to see which family of species you can choose from." />
) : (
<>
<div className="roll-result animate">{bs.speciesRoll}</div>
@@ -280,7 +293,7 @@ export function CharacterBuilderPage() {
Wildcard! Pick any species <InfoTip term="WILDCARD" />
</>
) : (
'Your roll offers these two. Click one to try it on:'
'Your roll offers these. Click one to try it on:'
)}
</p>
<div className="choice-grid">
@@ -293,7 +306,7 @@ export function CharacterBuilderPage() {
title={`${speciesIcon(s)} ${SPECIES_LABELS[s]}`}
selected={pickedSpecies === s}
onSelect={() => {
if (pickedSpecies !== s) setHalfElfPick([]);
if (pickedSpecies !== s) setBonusPick({});
setPendingSpecies(s);
}}
>
@@ -301,46 +314,29 @@ export function CharacterBuilderPage() {
<span>{SPECIES_GUIDE[s].goodFor}</span>
<span className="choice-card-facts">
{bonuses.join(' · ')}
{s === 'HALF_ELF' && ' · +1 to two of your choice'} · Speed {SPECIES_SPEED[s]} ft
{SPECIES_FLEXIBLE_BONUS[s] && `${bonuses.length ? ' · ' : ''}${flexibleLabel(s)}`} · Speed {SPECIES_SPEED[s]} ft
</span>
{options && <span className="choice-card-facts">Grants: {options.speciesTraits[s].map((t) => t.name).join(', ')}</span>}
</ChoiceCard>
);
})}
</div>
{pickedSpecies === 'HALF_ELF' && (
<div className="card mt-md" style={{ textAlign: 'left' }}>
<p style={{ marginTop: 0 }}>
Half-Elves get +2 Charisma, plus +1 to two other abilities of your choice. Pick two:
</p>
<div className="flex-row flex-wrap">
{HALF_ELF_ELIGIBLE.map((a) => (
<label key={a} className="checkbox-row">
<input
type="checkbox"
checked={halfElfPick.includes(a)}
disabled={!halfElfPick.includes(a) && halfElfPick.length >= 2}
onChange={(e) =>
setHalfElfPick(e.target.checked ? [...halfElfPick, a] : halfElfPick.filter((x) => x !== a))
}
/>
{ABILITY_LABELS[a]} <InfoTip text={ABILITY_GUIDE[a].affects} label={`What ${ABILITY_LABELS[a]} affects`} />
</label>
))}
</div>
</div>
{pickedSpecies && SPECIES_FLEXIBLE_BONUS[pickedSpecies] && (
<SpeciesBonusPicker key={pickedSpecies} species={pickedSpecies} value={bonusPick} onChange={setBonusPick} />
)}
<StepFooter
hint={
!pickedSpecies
? 'Nothing is locked in until you press Next.'
: pickedSpecies === 'HALF_ELF' && halfElfPick.length !== 2
? 'Pick two abilities for the Half-Elf bonus.'
: !speciesReady
? `Choose where the ${SPECIES_LABELS[pickedSpecies]} bonuses go.`
: `${SPECIES_LABELS[pickedSpecies]} selected — you can still change your mind.`
}
disabled={!speciesReady || choose.isPending}
onNext={() =>
safeChoose(pickedSpecies === 'HALF_ELF' ? { species: pickedSpecies, halfElfBonusAbilities: halfElfPick } : { species: pickedSpecies })
safeChoose(
pickedSpecies && SPECIES_FLEXIBLE_BONUS[pickedSpecies] ? { species: pickedSpecies, bonusChoices: bonusPick } : { species: pickedSpecies }
)
}
/>
</>
@@ -350,7 +346,7 @@ export function CharacterBuilderPage() {
{stage === 'ROLLING_CLASS' && (
<div className="card mt-md text-center">
<div className="card-title">Step 2 — Class</div>
<div className="card-title">Class</div>
<p className="step-intro">{STEP_GUIDE.CLASS}</p>
{!bs.classRoll || bs.classChoices?.type === 'reroll' ? (
<>
@@ -374,7 +370,9 @@ export function CharacterBuilderPage() {
Wildcard! Pick any class <InfoTip term="WILDCARD" />
</>
) : (
'Your roll offers these two. Click one to try it on:'
bs.classChoices?.canReroll
? 'A 7: the Artificer is yours to take, or you may roll once more (and keep what that gives).'
: 'Your roll offers these. Click one to try it on:'
)}
</p>
<div className="choice-grid">
@@ -405,6 +403,11 @@ export function CharacterBuilderPage() {
);
})}
</div>
{bs.classChoices?.canReroll && (
<div className="mt-md">
<RollControl sides={8} diceMode={diceMode} onRoll={safeRoll} rolling={roll.isPending} label="Or reroll the d8 — the new roll stands." />
</div>
)}
<p className="subtitle" style={{ textAlign: 'left' }}>
Hit die <InfoTip term="HIT_DICE" /> · Best abilities <InfoTip term="KEY_ABILITY" /> · Spellcasting{' '}
<InfoTip term="SPELLCASTING" /> · Saves <InfoTip term="SAVE_PROFICIENCY" />
@@ -423,10 +426,27 @@ export function CharacterBuilderPage() {
</div>
)}
{stage === 'CHOOSING_SUBCLASS' && bs.characterClass && (
<SubclassStep
characterClass={bs.characterClass}
subclasses={options?.subclasses[bs.characterClass] ?? []}
subclassLevel={options?.subclassLevels[bs.characterClass] ?? 3}
roll={bs.subclassRoll}
suggestion={bs.subclassSuggestion}
picked={pendingSubclass !== undefined ? pendingSubclass : (bs.subclass ?? null)}
onPick={setPendingSubclass}
diceMode={diceMode}
onRoll={safeRoll}
rolling={roll.isPending}
submitting={choose.isPending}
onSubmit={(subclass) => safeChoose({ subclass })}
/>
)}
{stage === 'ROLLING_MOTIVATION' && (
<div className="card mt-md text-center">
<div className="card-title">
<span>Step 3 — Motivation</span>
<span>Motivation</span>
{options && (
<button className="btn" onClick={() => setPendingMotivation(randomOf(options.motivations.filter((m) => m.key !== motivationPick)).key)}>
🎲 Surprise me
@@ -473,7 +493,7 @@ export function CharacterBuilderPage() {
{stage === 'ASSIGNING_PROFICIENCIES' && (
<div className="card mt-md">
<div className="card-title">
Step 5 — Skill Proficiencies <InfoTip term="SKILL_BONUS" />
Skill Proficiencies <InfoTip term="SKILL_BONUS" />
</div>
<p className="step-intro">{STEP_GUIDE.SKILLS}</p>
<p className="subtitle">
@@ -581,7 +601,7 @@ export function CharacterBuilderPage() {
{stage === 'CHOOSING_BACKGROUND' &&
(options ? (
<PickGroupsStep
title="Step 7 — Background"
title="Background"
intro={STEP_GUIDE.BACKGROUND}
groups={options.background}
picks={backgroundPicks}
@@ -596,7 +616,7 @@ export function CharacterBuilderPage() {
{stage === 'CHOOSING_APPEARANCE' &&
(options ? (
<PickGroupsStep
title="Step 8 — Appearance"
title="Appearance"
intro={STEP_GUIDE.APPEARANCE}
groups={options.appearance}
picks={appearancePicks}
@@ -748,7 +768,7 @@ function TalentsStep({
return (
<div className="card mt-md">
<div className="card-title">
<span>Step 6 — Special Abilities</span>
<span>Special Abilities</span>
<button className="btn" onClick={() => setTalents(randomSample(options.talents, need).map((t) => t.key))}>
🎲 Surprise me
</button>
@@ -940,14 +960,13 @@ function RollControl({
);
}
function BuildProgress({ stage }: { stage: string }) {
const steps = STEP_STAGES;
function BuildProgress({ stage, steps }: { stage: string; steps: string[] }) {
const idx = steps.indexOf(stage);
return (
<ol className="build-steps" style={{ listStyle: 'none', padding: 0, margin: 0 }} aria-label="Build steps">
{steps.map((s, i) => (
<li key={s} className={`badge${i < idx ? ' is-done' : i === idx ? ' is-current' : ''}`} aria-current={i === idx ? 'step' : undefined}>
{i < idx ? '✓' : i + 1} {STEP_NAMES[i]}
{i < idx ? '✓' : i + 1} {STEP_NAMES[STEP_STAGES.indexOf(s)]}
</li>
))}
</ol>
@@ -983,7 +1002,7 @@ function AssignScoresStep({
if (!bs.abilityRolls && method === 'STANDARD_ARRAY') {
return (
<div className="card mt-md text-center">
<div className="card-title">Step 4 — Ability Scores</div>
<div className="card-title">Ability Scores</div>
<p className="step-intro">{STEP_GUIDE.SCORES}</p>
<p>This campaign uses the standard array: the six scores 15, 14, 13, 12, 10 and 8, for you to place.</p>
<button className="btn btn-primary" onClick={() => onRoll()} disabled={rolling}>
@@ -998,7 +1017,7 @@ function AssignScoresStep({
}
return (
<div className="card mt-md text-center">
<div className="card-title">Step 4 — Ability Scores</div>
<div className="card-title">Ability Scores</div>
<p className="step-intro">{STEP_GUIDE.SCORES}</p>
<p>
Roll 4d6 (drop the lowest) six times — one set per ability. <InfoTip term="ROLL_4D6" />
@@ -1012,7 +1031,7 @@ function AssignScoresStep({
const usedIndexes = new Set(Object.values(assignments));
const species = bs.species ?? null;
const halfElfBonusAbilities = bs.halfElfBonusAbilities || [];
const bonusChoices = bs.speciesBonusChoices ?? {};
const complete = ABILITIES.every((a) => assignments[a] !== undefined) && usedIndexes.size === 6;
const keyAbilities = bs.characterClass ? CLASS_GUIDE[bs.characterClass].keyAbilities : [];
@@ -1026,7 +1045,7 @@ function AssignScoresStep({
return (
<div className="card mt-md">
<div className="card-title">Step 4 — Assign Ability Scores</div>
<div className="card-title">Assign Ability Scores</div>
<p className="step-intro">{STEP_GUIDE.SCORES}</p>
<div className="flex-between flex-wrap">
<span className="subtitle">
@@ -1053,7 +1072,7 @@ function AssignScoresStep({
{ABILITIES.map((ability) => {
const assignedIndex = assignments[ability];
const rolledTotal = assignedIndex !== undefined ? bs.abilityRolls![assignedIndex].total : null;
const bonus = speciesBonusFor(species, ability, halfElfBonusAbilities);
const bonus = speciesBonusFor(species, ability, bonusChoices);
const final = rolledTotal !== null ? rolledTotal + bonus : null;
return (
<div className={`stat-block${keyAbilities.includes(ability) ? ' is-key' : ''}`} key={ability}>
@@ -1120,7 +1139,7 @@ function PointBuyStep({ bs, onSubmit, submitting }: { bs: BuildState; onSubmit:
return (
<div className="card mt-md">
<div className="card-title">
<span>Step 4 — Buy Ability Scores</span>
<span>Buy Ability Scores</span>
<span className={`badge${left < 0 ? ' badge-hostile' : ''}`}>
{left} of {POINT_BUY_BUDGET} points left
</span>
@@ -1130,7 +1149,7 @@ function PointBuyStep({ bs, onSubmit, submitting }: { bs: BuildState; onSubmit:
</p>
<div className="grid grid-cols-3 mt-md">
{ABILITIES.map((ability) => {
const bonus = speciesBonusFor(species, ability, bs.halfElfBonusAbilities || []);
const bonus = speciesBonusFor(species, ability, bs.speciesBonusChoices ?? {});
const final = scores[ability] + bonus;
return (
<div className={`stat-block${keyAbilities.includes(ability) ? ' is-key' : ''}`} key={ability}>
@@ -1172,6 +1191,187 @@ function PointBuyStep({ bs, onSubmit, submitting }: { bs: BuildState; onSubmit:
);
}
// "Choose +2/+1 or +1/+1/+1": a species' flexible bonuses in a few words.
function flexibleLabel(species: Species): string {
const flexible = SPECIES_FLEXIBLE_BONUS[species];
if (!flexible) return '';
return `Choose ${flexible.patterns.map((pattern) => pattern.map((n) => `+${n}`).join('/')).join(' or ')}`;
}
// Where a species' flexible bonuses go: one of its patterns (+2/+1, or
// +1/+1/+1), each amount to a different ability.
function SpeciesBonusPicker({ species, value, onChange }: { species: Species; value: BonusChoices; onChange: (value: BonusChoices) => void }) {
const flexible = SPECIES_FLEXIBLE_BONUS[species]!;
const amountsOf = (choices: BonusChoices) => Object.values(choices).filter(Boolean).sort((a, b) => (b ?? 0) - (a ?? 0)).join(',');
const matching = flexible.patterns.findIndex((pattern) => pattern.join(',') === amountsOf(value));
const [patternIndex, setPatternIndex] = useState(Math.max(0, matching));
const pattern = flexible.patterns[patternIndex];
const eligible = ABILITIES.filter((a) => !flexible.exclude?.includes(a));
// Which ability fills each slot of the pattern, read back from the value.
const slots: (Ability | '')[] = [];
const used = new Set<Ability>();
for (const amount of pattern) {
const found = ABILITIES.find((a) => value[a] === amount && !used.has(a));
if (found) used.add(found);
slots.push(found ?? '');
}
function setSlot(index: number, ability: Ability | '') {
const next = [...slots];
next[index] = ability;
const choices: BonusChoices = {};
next.forEach((a, i) => {
if (a) choices[a] = pattern[i];
});
onChange(choices);
}
return (
<div className="card mt-md" style={{ textAlign: 'left' }}>
<p style={{ marginTop: 0 }}>
{SPECIES_LABELS[species]} choose their own ability bonuses
{flexible.exclude?.length ? ` (besides ${flexible.exclude.map((a) => ABILITY_LABELS[a]).join(', ')})` : ''}.
</p>
{flexible.patterns.length > 1 && (
<div className="flex-row flex-wrap gap-sm">
{flexible.patterns.map((p, i) => (
<label key={i} className="checkbox-row">
<input
type="radio"
name="bonus-pattern"
checked={patternIndex === i}
onChange={() => {
setPatternIndex(i);
onChange({});
}}
/>
{p.map((n) => `+${n}`).join(' / ')}
</label>
))}
</div>
)}
<div className="flex-row flex-wrap gap-sm mt-sm">
{pattern.map((amount, i) => (
<label key={`${patternIndex}-${i}`} className="flex-row gap-sm">
+{amount} to
<select value={slots[i]} onChange={(e) => setSlot(i, e.target.value as Ability | '')} aria-label={`Ability for the +${amount}`}>
<option value="">—</option>
{eligible.map((a) => (
<option key={a} value={a} disabled={slots.includes(a) && slots[i] !== a}>
{ABILITY_LABELS[a]}
</option>
))}
</select>
</label>
))}
</div>
</div>
);
}
// The subclass step: a die with a face per subclass suggests one, and the
// player picks freely, or leaves it until the class chooses at its level.
function SubclassStep({
characterClass,
subclasses,
subclassLevel,
roll,
suggestion,
picked,
onPick,
diceMode,
onRoll,
rolling,
submitting,
onSubmit,
}: {
characterClass: CharacterClass;
subclasses: SubclassSummary[];
subclassLevel: number;
roll?: number;
suggestion?: string;
picked: string | null;
onPick: (key: string | null) => void;
diceMode: DiceMode;
onRoll: (body?: { value?: number }) => void;
rolling: boolean;
submitting: boolean;
onSubmit: (subclass: string | null) => void;
}) {
const [previewing, setPreviewing] = useState<string | null>(null);
const pickedName = subclasses.find((sub) => sub.key === picked)?.name;
return (
<div className="card mt-md">
<div className="card-title">Subclass</div>
<p className="step-intro">
Your subclass is the path you take within your class. Choose it now and its gifts arrive at level {subclassLevel}; or decide
later, when you get there. Every {CLASS_LABELS[characterClass]} path is here, from the 2014 books and the 2024 Player’s Handbook.
</p>
{subclasses.length > 0 && !roll && (
<div className="text-center">
<RollControl sides={subclasses.length} diceMode={diceMode} onRoll={onRoll} rolling={rolling} label={`Can’t decide? Roll a d${subclasses.length} for a suggestion.`} />
</div>
)}
{roll && suggestion && (
<p className="text-center">
<span className="roll-result animate">{roll}</span>
<br />
The dice suggest <strong>{subclasses.find((sub) => sub.key === suggestion)?.name}</strong>. You are free to pick any.
</p>
)}
<div className="choice-grid mt-md">
{subclasses.map((sub) => (
<ChoiceCard
key={sub.key}
title={sub.name}
tag={sub.key === suggestion ? '🎲 Suggested' : sub.edition === '2024' ? '2024 rules' : undefined}
selected={picked === sub.key}
onSelect={() => onPick(sub.key)}
>
<span className="choice-card-blurb">{sub.summary}</span>
<span className="choice-card-facts">{sub.source}</span>
<span
className="btn btn-ghost btn-sm"
role="button"
tabIndex={0}
onClick={(e) => {
e.stopPropagation();
setPreviewing(previewing === sub.key ? null : sub.key);
}}
onKeyDown={(e) => {
if (e.key === 'Enter' || e.key === ' ') {
e.preventDefault();
e.stopPropagation();
setPreviewing(previewing === sub.key ? null : sub.key);
}
}}
>
{previewing === sub.key ? 'Hide the road' : 'Levels 1–20 →'}
</span>
</ChoiceCard>
))}
</div>
{previewing && (
<div className="card mt-md">
<div className="card-title">{subclasses.find((sub) => sub.key === previewing)?.name}: levels 1 to 20</div>
<ProgressionTimeline characterClass={characterClass} subclass={previewing} subclassName={subclasses.find((sub) => sub.key === previewing)?.name} />
</div>
)}
<div className="flex-between flex-wrap mt-md">
<button className="btn" onClick={() => onSubmit(null)} disabled={submitting}>
Decide at level {subclassLevel}
</button>
<StepFooter
hint={pickedName ? `${pickedName} selected — you can still change your mind.` : 'Pick a path, or decide later.'}
disabled={!picked || submitting}
onNext={() => onSubmit(picked)}
/>
</div>
</div>
);
}
function PhysicalAbilityRollForm({ onRoll, rolling }: { onRoll: (body?: { abilitySets?: number[][] }) => void; rolling: boolean }) {
const [sets, setSets] = useState<string[][]>(Array.from({ length: 6 }, () => ['', '', '', '']));
@@ -1183,7 +1383,7 @@ function PhysicalAbilityRollForm({ onRoll, rolling }: { onRoll: (body?: { abilit
return (
<div className="card mt-md">
<div className="card-title">Step 4 — Ability Scores (Physical Dice)</div>
<div className="card-title">Ability Scores (Physical Dice)</div>
<p>Roll 4d6 six times at the table, then enter each set's four results below (drop-the-lowest is applied automatically).</p>
{sets.map((set, i) => (
<div key={i} className="flex-row flex-wrap mt-sm">
@@ -1275,7 +1475,7 @@ function EquipmentStep({
<div className="card mt-md">
<div className="card-title">
<span>
Step 9 — Starting Equipment <InfoTip term="STARTING_EQUIPMENT" />
Starting Equipment <InfoTip term="STARTING_EQUIPMENT" />
</span>
</div>
<p className="step-intro">{STEP_GUIDE.EQUIPMENT}</p>
@@ -1356,12 +1556,12 @@ function BuildPreview({
talents: string[];
}) {
const species = bs.species ?? null;
const halfElfBonusAbilities = bs.halfElfBonusAbilities || [];
const bonusChoices = bs.speciesBonusChoices ?? {};
const characterClass = bs.characterClass ?? null;
const abilityFinals: Partial<Record<Ability, number>> = {};
for (const ability of ABILITIES) {
const bonus = speciesBonusFor(species, ability, halfElfBonusAbilities);
const bonus = speciesBonusFor(species, ability, bonusChoices);
const assignedIndex = assignments[ability] ?? bs.abilityAssignments?.[ability];
const rolledTotal = assignedIndex !== undefined ? bs.abilityRolls?.[assignedIndex]?.total : undefined;
if (rolledTotal !== undefined) {
@@ -1403,7 +1603,7 @@ function BuildPreview({
<p style={{ marginTop: 0 }}>
<strong>{SPECIES_LABELS[species]}</strong>
{Object.entries({ STR: 0, DEX: 0, CON: 0, INT: 0, WIS: 0, CHA: 0 })
.map(([a]) => [a as Ability, speciesBonusFor(species, a as Ability, halfElfBonusAbilities)] as const)
.map(([a]) => [a as Ability, speciesBonusFor(species, a as Ability, bonusChoices)] as const)
.filter(([, bonus]) => bonus !== 0)
.map(([a, bonus]) => (
<span key={a} className="preview-highlight" style={{ marginLeft: 6 }}>
@@ -1420,6 +1620,11 @@ function BuildPreview({
{saveProfs && saveProfs.length > 0 && (
<span style={{ color: 'var(--text-muted)' }}> · {saveProfs.map((a) => ABILITY_LABELS[a]).join('/')} saves</span>
)}
{bs.subclass && options && (
<span className="preview-highlight" style={{ display: 'block' }}>
Path: {options.subclasses[characterClass]?.find((sub) => sub.key === bs.subclass)?.name} (from level {options.subclassLevels[characterClass]})
</span>
)}
</p>
)}
+56 -2
View File
@@ -41,6 +41,7 @@ import { CharacterState } from '../components/CharacterState';
import { Rollable } from '../components/Rollable';
import { withBonus } from '../lib/diceRoller';
import { LevelUpModal } from '../components/LevelUpModal';
import { ProgressionTimeline } from '../components/ProgressionTimeline';
import { GearInForce } from '../components/CharacterPanel';
import { effectsSummary } from '../lib/gear';
import { InfoTip } from '../components/InfoTip';
@@ -48,6 +49,7 @@ import { Pagination } from '../components/Paginated';
import { usePagination } from '../hooks/usePagination';
import {
ABILITY_LABELS,
CLASS_LABELS,
classLabel,
xpLabel,
COINS,
@@ -566,7 +568,7 @@ export function CharacterSheetPage() {
onBlur={(e) => Number(e.target.value) !== character.level && patchCharacter.mutate({ level: Number(e.target.value) })}
/>
</label>
{character.subclassLevel != null && character.level >= character.subclassLevel && (
{character.subclassLevel != null && (
<label
className="flex-row gap-sm"
title="The path within the class. Changing it takes the old subclass's lines out of Special Abilities and writes the new one's, up to this level."
@@ -580,8 +582,9 @@ export function CharacterSheetPage() {
>
<option value="">Not chosen</option>
{character.subclassOptions.map((option) => (
<option key={option.key} value={option.key} title={option.summary}>
<option key={option.key} value={option.key} title={`${option.summary} (${option.source})`}>
{option.name}
{option.edition === '2024' ? ' (2024)' : ''}
</option>
))}
</select>
@@ -1093,6 +1096,57 @@ export function CharacterSheetPage() {
{/* Composed by the character builder from the player's picks. Players
read them; only the DM can rewrite them (new abilities on level-up,
a scar earned in play). */}
{character.characterClass && character.buildStage === 'COMPLETE' && (
<div data-jump="Road ahead" className="card mt-md">
<div className="card-title">
<span>The Road Ahead</span>
<span className="badge">Level {character.level} of 20</span>
</div>
{character.subclassName ? (
<p style={{ marginTop: 0 }}>
Path: <strong>{character.subclassName}</strong>
{character.subclassOptions.find((o) => o.key === character.subclass) && (
<span className="combatant-sub"> · {character.subclassOptions.find((o) => o.key === character.subclass)!.source}</span>
)}
{character.subclassLevel != null && character.level < character.subclassLevel && (
<span className="combatant-sub"> · its gifts begin at level {character.subclassLevel}</span>
)}
</p>
) : (
character.subclassLevel != null && (
<p style={{ marginTop: 0 }} className="combatant-sub">
No path chosen yet: {CLASS_LABELS[character.characterClass]}s choose one at level {character.subclassLevel}.
</p>
)
)}
{character.subclassUpgrade && (
<div className="flex-row flex-wrap gap-sm mb-2">
<span className="combatant-sub">
The 2024 Player’s Handbook updates this path as <strong>{character.subclassUpgrade.name}</strong>.
</span>
{isDM && (
<button
className="btn btn-sm"
disabled={patchCharacter.isPending}
onClick={() =>
patchCharacter.mutate({ subclass: character.subclassUpgrade!.key }, { onError: (err) => setFormError(extractErrorMessage(err)) })
}
title="Swaps the old path's lines in Special Abilities for the new one's, up to this level."
>
Switch to the 2024 version
</button>
)}
</div>
)}
<ProgressionTimeline
characterClass={character.characterClass}
subclass={character.subclass}
subclassName={character.subclassName}
currentLevel={character.level}
/>
</div>
)}
{(
[
['specialAbilities', 'Special Abilities', 'One per line, e.g. “Reckless Attack — gained at level 2.”', 6],