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:
@@ -3,6 +3,7 @@ import { apiClient } from './client';
|
||||
import type {
|
||||
BuildOptions,
|
||||
Campaign,
|
||||
CharacterClass,
|
||||
CampaignLibrary,
|
||||
CampaignMemberSummary,
|
||||
CharacterDetail,
|
||||
@@ -20,6 +21,7 @@ import type {
|
||||
Monster,
|
||||
Note,
|
||||
Npc,
|
||||
ProgressionLevel,
|
||||
SaleOffer,
|
||||
QuickStats,
|
||||
RestResult,
|
||||
@@ -360,6 +362,21 @@ export function useBuildOptions() {
|
||||
});
|
||||
}
|
||||
|
||||
// What each level from 1 to 20 gives a class, with a subclass's lines when one is given.
|
||||
export function useProgression(characterClass: CharacterClass | null | undefined, subclass?: string | null) {
|
||||
return useQuery({
|
||||
queryKey: ['progression', characterClass, subclass ?? null],
|
||||
enabled: Boolean(characterClass),
|
||||
staleTime: Infinity, // rules: they never change while the app is open
|
||||
queryFn: async () =>
|
||||
(
|
||||
await apiClient.get<{ levels: ProgressionLevel[] }>('/reference/progression', {
|
||||
params: { class: characterClass, ...(subclass ? { subclass } : {}) },
|
||||
})
|
||||
).data.levels,
|
||||
});
|
||||
}
|
||||
|
||||
function invalidateCharacter(qc: ReturnType<typeof useQueryClient>, characterId: string) {
|
||||
qc.invalidateQueries({ queryKey: ['character', characterId] });
|
||||
}
|
||||
|
||||
@@ -10,7 +10,40 @@ export type Species =
|
||||
| 'DRAGONBORN'
|
||||
| 'TIEFLING'
|
||||
| 'HALF_ORC'
|
||||
| 'ORC';
|
||||
| 'ORC'
|
||||
| 'AASIMAR'
|
||||
| 'GOLIATH'
|
||||
| 'AARAKOCRA'
|
||||
| 'BUGBEAR'
|
||||
| 'CENTAUR'
|
||||
| 'CHANGELING'
|
||||
| 'DEEP_GNOME'
|
||||
| 'DUERGAR'
|
||||
| 'ELADRIN'
|
||||
| 'FAIRY'
|
||||
| 'FIRBOLG'
|
||||
| 'AIR_GENASI'
|
||||
| 'EARTH_GENASI'
|
||||
| 'FIRE_GENASI'
|
||||
| 'WATER_GENASI'
|
||||
| 'GITHYANKI'
|
||||
| 'GITHZERAI'
|
||||
| 'GOBLIN'
|
||||
| 'HARENGON'
|
||||
| 'HOBGOBLIN'
|
||||
| 'KENKU'
|
||||
| 'KOBOLD'
|
||||
| 'LIZARDFOLK'
|
||||
| 'MINOTAUR'
|
||||
| 'SEA_ELF'
|
||||
| 'SHADAR_KAI'
|
||||
| 'SHIFTER'
|
||||
| 'TABAXI'
|
||||
| 'TORTLE'
|
||||
| 'TRITON'
|
||||
| 'YUAN_TI'
|
||||
| 'OWLIN'
|
||||
| 'SATYR';
|
||||
|
||||
export type CharacterClass =
|
||||
| 'FIGHTER'
|
||||
@@ -24,12 +57,14 @@ export type CharacterClass =
|
||||
| 'BARD'
|
||||
| 'WARLOCK'
|
||||
| 'DRUID'
|
||||
| 'MONK';
|
||||
| 'MONK'
|
||||
| 'ARTIFICER';
|
||||
|
||||
export type BuildStage =
|
||||
| 'NOT_STARTED'
|
||||
| 'ROLLING_SPECIES'
|
||||
| 'ROLLING_CLASS'
|
||||
| 'CHOOSING_SUBCLASS'
|
||||
| 'ROLLING_MOTIVATION'
|
||||
| 'ASSIGNING_SCORES'
|
||||
| 'ASSIGNING_PROFICIENCIES'
|
||||
@@ -81,6 +116,29 @@ export interface BuildOptions {
|
||||
talentPicks: number;
|
||||
background: PickGroup[];
|
||||
appearance: PickGroup[];
|
||||
// Every class's subclasses, and the level each class gets its subclass's first gifts at.
|
||||
subclasses: Record<CharacterClass, SubclassSummary[]>;
|
||||
subclassLevels: Record<CharacterClass, number>;
|
||||
}
|
||||
|
||||
// A subclass as a list shows it: its book, whether it is from the 2014 or
|
||||
// 2024 rules, and the 2014 subclass a 2024 one updates.
|
||||
export interface SubclassSummary {
|
||||
key: string;
|
||||
name: string;
|
||||
summary: string;
|
||||
source: string;
|
||||
edition: '2014' | '2024';
|
||||
replaces: string | null;
|
||||
}
|
||||
|
||||
// One level of a class's road from 1 to 20 (GET /reference/progression).
|
||||
export interface ProgressionLevel {
|
||||
level: number;
|
||||
features: { name: string; text: string; fromSubclass: boolean }[];
|
||||
boon: boolean;
|
||||
choosesSubclass: boolean;
|
||||
unlocksSpellLevel: number | null;
|
||||
}
|
||||
|
||||
export interface User {
|
||||
@@ -416,13 +474,15 @@ export interface CharacterDetail extends CharacterCondition {
|
||||
subclass: string | null;
|
||||
subclassName: string | null;
|
||||
subclassLevel: number | null;
|
||||
subclassOptions: { key: string; name: string; summary: string }[];
|
||||
subclassOptions: SubclassSummary[];
|
||||
// The 2024 subclass that updates the one followed, if there is one.
|
||||
subclassUpgrade: SubclassSummary | null;
|
||||
level: number;
|
||||
xp: number;
|
||||
xpProgress: XpProgress;
|
||||
motivation: string | null;
|
||||
halfElfBonusAbility1: Ability | null;
|
||||
halfElfBonusAbility2: Ability | null;
|
||||
// The species bonuses the player chose, { ability: amount }: a Half-Elf's +1/+1, a Goblin's +2/+1...
|
||||
speciesBonusChoices: Partial<Record<Ability, number>>;
|
||||
rolledScores: Record<Ability, number>;
|
||||
currentHp: number;
|
||||
tempHp: number;
|
||||
|
||||
@@ -0,0 +1,64 @@
|
||||
import { useState } from 'react';
|
||||
import { useProgression } from '../api/queries';
|
||||
import { slotLevelLabel } from '../lib/format';
|
||||
import { Spinner } from './Spinner';
|
||||
import type { CharacterClass } from '../api/types';
|
||||
|
||||
// The road from level 1 to 20 for a class and subclass: what each level
|
||||
// gives. With `currentLevel` the levels already reached are muted, the next
|
||||
// one is marked "next up", and only the road ahead shows until "Show all".
|
||||
export function ProgressionTimeline({
|
||||
characterClass,
|
||||
subclass,
|
||||
currentLevel,
|
||||
subclassName,
|
||||
}: {
|
||||
characterClass: CharacterClass;
|
||||
subclass?: string | null;
|
||||
currentLevel?: number;
|
||||
subclassName?: string | null;
|
||||
}) {
|
||||
const { data: levels, isLoading } = useProgression(characterClass, subclass);
|
||||
const [showAll, setShowAll] = useState(!currentLevel);
|
||||
|
||||
if (isLoading || !levels) return <Spinner label="Reading the road ahead…" />;
|
||||
const shown = showAll || !currentLevel ? levels : levels.filter((l) => l.level >= currentLevel);
|
||||
|
||||
return (
|
||||
<div className="progression">
|
||||
<ol className="progression-list">
|
||||
{shown.map((l) => {
|
||||
const reached = currentLevel !== undefined && l.level <= currentLevel;
|
||||
const nextUp = currentLevel !== undefined && l.level === currentLevel + 1;
|
||||
const empty = l.features.length === 0 && !l.boon && !l.choosesSubclass && !l.unlocksSpellLevel;
|
||||
return (
|
||||
<li key={l.level} className={`progression-level${reached ? ' is-reached' : ''}${nextUp ? ' is-next' : ''}`}>
|
||||
<span className="progression-badge">
|
||||
{l.level}
|
||||
{nextUp && <span className="badge badge-live">next up</span>}
|
||||
</span>
|
||||
<div className="progression-gains">
|
||||
{l.features.map((f) => (
|
||||
<div key={f.name} className="progression-feature" title={f.text}>
|
||||
<strong>{f.name}</strong>
|
||||
{f.fromSubclass && <span className="badge">{subclassName || 'subclass'}</span>}
|
||||
<span className="combatant-sub"> — {f.text}</span>
|
||||
</div>
|
||||
))}
|
||||
{l.boon && <div className="progression-feature">⭐ A Boon of your choice</div>}
|
||||
{l.choosesSubclass && <div className="progression-feature">🧭 Choose your subclass</div>}
|
||||
{l.unlocksSpellLevel && <div className="progression-feature">✨ {slotLevelLabel(l.unlocksSpellLevel)}-level spells unlock</div>}
|
||||
{empty && <div className="combatant-sub">More hit points, and the numbers grow.</div>}
|
||||
</div>
|
||||
</li>
|
||||
);
|
||||
})}
|
||||
</ol>
|
||||
{currentLevel !== undefined && currentLevel > 1 && (
|
||||
<button type="button" className="btn btn-ghost mt-sm" onClick={() => setShowAll((s) => !s)}>
|
||||
{showAll ? 'Hide the levels already reached' : 'Show all 20 levels'}
|
||||
</button>
|
||||
)}
|
||||
</div>
|
||||
);
|
||||
}
|
||||
@@ -1047,6 +1047,61 @@ button.death-pip {
|
||||
font-weight: 700;
|
||||
}
|
||||
|
||||
/* The road from level 1 to 20 (ProgressionTimeline). */
|
||||
.progression-list {
|
||||
list-style: none;
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
border-left: 2px solid var(--border);
|
||||
}
|
||||
.progression-level {
|
||||
display: flex;
|
||||
gap: 0.75rem;
|
||||
padding: 0.35rem 0 0.35rem 0.75rem;
|
||||
position: relative;
|
||||
}
|
||||
.progression-level::before {
|
||||
content: '';
|
||||
position: absolute;
|
||||
left: -6px;
|
||||
top: 0.75rem;
|
||||
width: 10px;
|
||||
height: 10px;
|
||||
border-radius: 50%;
|
||||
background: var(--border);
|
||||
}
|
||||
.progression-level.is-reached {
|
||||
opacity: 0.55;
|
||||
}
|
||||
.progression-level.is-reached::before {
|
||||
background: var(--accent);
|
||||
}
|
||||
.progression-level.is-next::before {
|
||||
background: var(--accent-strong);
|
||||
box-shadow: 0 0 8px var(--accent-strong);
|
||||
}
|
||||
.progression-badge {
|
||||
font-family: var(--font-heading, inherit);
|
||||
font-weight: 700;
|
||||
min-width: 2.2rem;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 0.2rem;
|
||||
align-items: flex-start;
|
||||
}
|
||||
.progression-gains {
|
||||
flex: 1;
|
||||
min-width: 0;
|
||||
font-size: 0.9rem;
|
||||
}
|
||||
.progression-feature + .progression-feature {
|
||||
margin-top: 0.2rem;
|
||||
}
|
||||
.progression-feature .badge {
|
||||
margin-left: 0.4rem;
|
||||
font-size: 0.7rem;
|
||||
}
|
||||
|
||||
.choice-grid {
|
||||
display: grid;
|
||||
grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
|
||||
|
||||
@@ -16,6 +16,7 @@ export const CLASS_SPELLCASTING_ABILITY: Record<CharacterClass, Ability | null>
|
||||
WARLOCK: 'CHA',
|
||||
DRUID: 'WIS',
|
||||
MONK: null,
|
||||
ARTIFICER: 'INT',
|
||||
};
|
||||
|
||||
export const CLASS_HIT_DIE: Record<CharacterClass, number> = {
|
||||
@@ -31,6 +32,7 @@ export const CLASS_HIT_DIE: Record<CharacterClass, number> = {
|
||||
WARLOCK: 8,
|
||||
DRUID: 8,
|
||||
MONK: 8,
|
||||
ARTIFICER: 8,
|
||||
};
|
||||
|
||||
export const CLASS_SAVE_PROFICIENCIES: Record<CharacterClass, Ability[]> = {
|
||||
@@ -46,4 +48,5 @@ export const CLASS_SAVE_PROFICIENCIES: Record<CharacterClass, Ability[]> = {
|
||||
WARLOCK: ['WIS', 'CHA'],
|
||||
DRUID: ['INT', 'WIS'],
|
||||
MONK: ['STR', 'DEX'],
|
||||
ARTIFICER: ['CON', 'INT'],
|
||||
};
|
||||
|
||||
@@ -11,6 +11,39 @@ export const SPECIES_LABELS: Record<string, string> = {
|
||||
TIEFLING: 'Tiefling',
|
||||
HALF_ORC: 'Half-Orc',
|
||||
ORC: 'Orc',
|
||||
AASIMAR: 'Aasimar',
|
||||
GOLIATH: 'Goliath',
|
||||
AARAKOCRA: 'Aarakocra',
|
||||
BUGBEAR: 'Bugbear',
|
||||
CENTAUR: 'Centaur',
|
||||
CHANGELING: 'Changeling',
|
||||
DEEP_GNOME: 'Deep Gnome',
|
||||
DUERGAR: 'Duergar',
|
||||
ELADRIN: 'Eladrin',
|
||||
FAIRY: 'Fairy',
|
||||
FIRBOLG: 'Firbolg',
|
||||
AIR_GENASI: 'Air Genasi',
|
||||
EARTH_GENASI: 'Earth Genasi',
|
||||
FIRE_GENASI: 'Fire Genasi',
|
||||
WATER_GENASI: 'Water Genasi',
|
||||
GITHYANKI: 'Githyanki',
|
||||
GITHZERAI: 'Githzerai',
|
||||
GOBLIN: 'Goblin',
|
||||
HARENGON: 'Harengon',
|
||||
HOBGOBLIN: 'Hobgoblin',
|
||||
KENKU: 'Kenku',
|
||||
KOBOLD: 'Kobold',
|
||||
LIZARDFOLK: 'Lizardfolk',
|
||||
MINOTAUR: 'Minotaur',
|
||||
SEA_ELF: 'Sea Elf',
|
||||
SHADAR_KAI: 'Shadar-kai',
|
||||
SHIFTER: 'Shifter',
|
||||
TABAXI: 'Tabaxi',
|
||||
TORTLE: 'Tortle',
|
||||
TRITON: 'Triton',
|
||||
YUAN_TI: 'Yuan-ti',
|
||||
OWLIN: 'Owlin',
|
||||
SATYR: 'Satyr',
|
||||
};
|
||||
|
||||
export const CLASS_LABELS: Record<string, string> = {
|
||||
@@ -26,6 +59,7 @@ export const CLASS_LABELS: Record<string, string> = {
|
||||
WARLOCK: 'Warlock',
|
||||
DRUID: 'Druid',
|
||||
MONK: 'Monk',
|
||||
ARTIFICER: 'Artificer',
|
||||
};
|
||||
|
||||
export const SKILL_LABELS: Record<string, string> = {
|
||||
|
||||
+173
-1
@@ -16,6 +16,39 @@ export const SPECIES_SPEED: Record<Species, number> = {
|
||||
TIEFLING: 30,
|
||||
HALF_ORC: 30,
|
||||
ORC: 30,
|
||||
AASIMAR: 30,
|
||||
GOLIATH: 35,
|
||||
AARAKOCRA: 30,
|
||||
BUGBEAR: 30,
|
||||
CENTAUR: 40,
|
||||
CHANGELING: 30,
|
||||
DEEP_GNOME: 30,
|
||||
DUERGAR: 30,
|
||||
ELADRIN: 30,
|
||||
FAIRY: 30,
|
||||
FIRBOLG: 30,
|
||||
AIR_GENASI: 35,
|
||||
EARTH_GENASI: 30,
|
||||
FIRE_GENASI: 30,
|
||||
WATER_GENASI: 30,
|
||||
GITHYANKI: 30,
|
||||
GITHZERAI: 30,
|
||||
GOBLIN: 30,
|
||||
HARENGON: 30,
|
||||
HOBGOBLIN: 30,
|
||||
KENKU: 30,
|
||||
KOBOLD: 30,
|
||||
LIZARDFOLK: 30,
|
||||
MINOTAUR: 30,
|
||||
SEA_ELF: 30,
|
||||
SHADAR_KAI: 30,
|
||||
SHIFTER: 30,
|
||||
TABAXI: 30,
|
||||
TORTLE: 30,
|
||||
TRITON: 30,
|
||||
YUAN_TI: 30,
|
||||
OWLIN: 30,
|
||||
SATYR: 35,
|
||||
};
|
||||
|
||||
export const SPECIES_GUIDE: Record<Species, { blurb: string; goodFor: string }> = {
|
||||
@@ -59,6 +92,138 @@ export const SPECIES_GUIDE: Record<Species, { blurb: string; goodFor: string }>
|
||||
blurb: 'Powerful and relentless, raised to survive.',
|
||||
goodFor: 'Strong (+2 Strength) and hardy (+1 Constitution): built for the front line.',
|
||||
},
|
||||
AASIMAR: {
|
||||
blurb: 'Touched by the heavens, carrying a spark of celestial light.',
|
||||
goodFor: 'You choose your bonuses (+2/+1 or +1/+1/+1). Healing hands and a radiant transformation suit Paladins, Clerics and Warlocks.',
|
||||
},
|
||||
GOLIATH: {
|
||||
blurb: 'Towering mountain folk descended from giants, who measure themselves against every peak.',
|
||||
goodFor: 'You choose your bonuses (+2/+1 or +1/+1/+1), and you are quick on your feet (35 ft). A great front-liner.',
|
||||
},
|
||||
AARAKOCRA: {
|
||||
blurb: 'Bird folk of the high winds, at home in open sky.',
|
||||
goodFor: 'You choose your bonuses, and you can fly from level 1. Superb for archers and casters who like to stay out of reach.',
|
||||
},
|
||||
BUGBEAR: {
|
||||
blurb: 'Hulking, stealthy goblinoids who strike from the shadows.',
|
||||
goodFor: 'You choose your bonuses. Long reach and a big opening strike suit Rogues, Rangers and Fighters.',
|
||||
},
|
||||
CENTAUR: {
|
||||
blurb: 'Fey wanderers, half humanoid and half horse, swift across open country.',
|
||||
goodFor: 'You choose your bonuses, and you are the fastest species (40 ft). Built for charging warriors and scouts.',
|
||||
},
|
||||
CHANGELING: {
|
||||
blurb: 'Shapeshifters who can wear any face, and sometimes forget their own.',
|
||||
goodFor: 'You choose your bonuses. Perfect for spies, tricksters and Charisma casters.',
|
||||
},
|
||||
DEEP_GNOME: {
|
||||
blurb: 'Quiet gnomes of the deep caverns, hard to find and harder to enchant.',
|
||||
goodFor: 'You choose your bonuses. Sneaky and resistant to magic: a fine Rogue, Ranger or Wizard.',
|
||||
},
|
||||
DUERGAR: {
|
||||
blurb: 'Grim dwarves of the Underdark, hardened by long servitude.',
|
||||
goodFor: 'You choose your bonuses. Tough, hard to control, and able to grow huge: built for melee.',
|
||||
},
|
||||
ELADRIN: {
|
||||
blurb: 'Elves of the Feywild whose moods shift like the seasons.',
|
||||
goodFor: 'You choose your bonuses. Teleporting at will makes for a slippery caster or duelist.',
|
||||
},
|
||||
FAIRY: {
|
||||
blurb: 'Tiny fey with wings, mischief and a sparkle of magic.',
|
||||
goodFor: 'You choose your bonuses and fly from level 1. A natural for Druids, Bards and Sorcerers.',
|
||||
},
|
||||
FIRBOLG: {
|
||||
blurb: 'Gentle forest giants-kin who guard the wild places.',
|
||||
goodFor: 'You choose your bonuses. Quiet magic and a knack for vanishing suit Druids and Clerics.',
|
||||
},
|
||||
AIR_GENASI: {
|
||||
blurb: 'Born of the elemental air: restless, quick and light.',
|
||||
goodFor: 'You choose your bonuses, and you move fast (35 ft). Good for Monks, Rogues and casters.',
|
||||
},
|
||||
EARTH_GENASI: {
|
||||
blurb: 'Born of the elemental earth: steady, solid and patient.',
|
||||
goodFor: 'You choose your bonuses. Sturdy and stealthy: front-liners and Rangers.',
|
||||
},
|
||||
FIRE_GENASI: {
|
||||
blurb: 'Born of the elemental fire: passionate and quick to anger.',
|
||||
goodFor: 'You choose your bonuses. Built-in fire magic suits Sorcerers, Warlocks and Wizards.',
|
||||
},
|
||||
WATER_GENASI: {
|
||||
blurb: 'Born of the elemental water: calm one moment, crashing the next.',
|
||||
goodFor: 'You choose your bonuses, and you breathe and swim underwater. Great for sea campaigns.',
|
||||
},
|
||||
GITHYANKI: {
|
||||
blurb: 'Warrior raiders from the Astral Sea, with silver swords and iron will.',
|
||||
goodFor: 'You choose your bonuses. Flexible skills and a free teleport suit Fighters, Paladins and Eldritch Knights.',
|
||||
},
|
||||
GITHZERAI: {
|
||||
blurb: 'Ascetic monks of Limbo who bend chaos with pure thought.',
|
||||
goodFor: 'You choose your bonuses. Calm minds and a free Shield suit Monks and Wizards.',
|
||||
},
|
||||
GOBLIN: {
|
||||
blurb: 'Small, scrappy and fearless survivors.',
|
||||
goodFor: 'You choose your bonuses. Hide and slip away every turn: a natural Rogue.',
|
||||
},
|
||||
HARENGON: {
|
||||
blurb: 'Rabbit folk of the Feywild, quick of foot and quicker to act.',
|
||||
goodFor: 'You choose your bonuses. Always first in initiative: great for any class.',
|
||||
},
|
||||
HOBGOBLIN: {
|
||||
blurb: 'Disciplined goblinoids who prize order and teamwork.',
|
||||
goodFor: 'You choose your bonuses. Built to fight shoulder to shoulder: Fighters and Paladins.',
|
||||
},
|
||||
KENKU: {
|
||||
blurb: 'Wingless raven folk with perfect memories and borrowed voices.',
|
||||
goodFor: 'You choose your bonuses. Skilled and observant: Rogues and Rangers.',
|
||||
},
|
||||
KOBOLD: {
|
||||
blurb: 'Small, clever dragon-kin who win by working together.',
|
||||
goodFor: 'You choose your bonuses. Your rallying cry makes the whole party hit more often.',
|
||||
},
|
||||
LIZARDFOLK: {
|
||||
blurb: 'Cold-blooded, practical hunters of the swamps.',
|
||||
goodFor: 'You choose your bonuses. Natural armor and a healing bite make you hard to kill.',
|
||||
},
|
||||
MINOTAUR: {
|
||||
blurb: 'Horned, powerful and never lost in a maze.',
|
||||
goodFor: 'You choose your bonuses. Charging and shoving: a natural Barbarian or Fighter.',
|
||||
},
|
||||
SEA_ELF: {
|
||||
blurb: 'Elves of the deep ocean, as at home among the waves as on land.',
|
||||
goodFor: 'You choose your bonuses. A must for ocean adventures.',
|
||||
},
|
||||
SHADAR_KAI: {
|
||||
blurb: 'Elves bound to the Shadowfell and its somber queen.',
|
||||
goodFor: 'You choose your bonuses. Teleporting and shrugging off damage suits any melee class.',
|
||||
},
|
||||
SHIFTER: {
|
||||
blurb: 'Descendants of lycanthropes, with a beast just under the skin.',
|
||||
goodFor: 'You choose your bonuses. Bursts of toughness and speed suit melee classes.',
|
||||
},
|
||||
TABAXI: {
|
||||
blurb: 'Curious cat folk who chase stories and shiny things.',
|
||||
goodFor: 'You choose your bonuses. Bursts of speed and sharp senses: Rogues, Monks and Rangers.',
|
||||
},
|
||||
TORTLE: {
|
||||
blurb: 'Turtle folk who carry their homes on their backs.',
|
||||
goodFor: 'You choose your bonuses. AC 17 from level 1, whatever your Dexterity: superb for casters and Monks… and anyone.',
|
||||
},
|
||||
TRITON: {
|
||||
blurb: 'Proud guardians of the ocean depths.',
|
||||
goodFor: 'You choose your bonuses. Water magic and swimming for sea campaigns.',
|
||||
},
|
||||
YUAN_TI: {
|
||||
blurb: 'Serpent-blooded schemers with cold eyes and colder plans.',
|
||||
goodFor: 'You choose your bonuses. Advantage on every save against spells is hard to beat.',
|
||||
},
|
||||
OWLIN: {
|
||||
blurb: 'Owl folk, silent on the wing and sharp-eyed in the dark.',
|
||||
goodFor: 'You choose your bonuses. Flight and stealth from level 1: scouts and Wizards.',
|
||||
},
|
||||
SATYR: {
|
||||
blurb: 'Merry fey of song and wine, quick-footed and hard to enchant.',
|
||||
goodFor: 'You choose your bonuses, move quickly (35 ft) and resist magic. A natural Bard.',
|
||||
},
|
||||
};
|
||||
|
||||
export type Toughness = 'Fragile' | 'Average' | 'Sturdy' | 'Very tough';
|
||||
@@ -151,6 +316,13 @@ export const CLASS_GUIDE: Record<
|
||||
skillCount: 2,
|
||||
difficulty: 'Medium',
|
||||
},
|
||||
ARTIFICER: {
|
||||
blurb: 'An inventor who makes magic with tools, gadgets and infused gear.',
|
||||
playsLike: 'Support and versatility: buff the party’s gear, cast handy spells, and build a cannon, armor or a steel companion.',
|
||||
keyAbilities: ['INT', 'CON'],
|
||||
skillCount: 2,
|
||||
difficulty: 'Tricky',
|
||||
},
|
||||
};
|
||||
|
||||
export function hitDieToughness(hitDie: number): Toughness {
|
||||
@@ -226,4 +398,4 @@ export const STEP_GUIDE = {
|
||||
EQUIPMENT: 'What you set out with. Your DM decides what is on offer here, and can hand out more as you play.',
|
||||
} as const;
|
||||
|
||||
export const STEP_NAMES = ['Species', 'Class', 'Motivation', 'Scores', 'Skills', 'Abilities', 'Background', 'Appearance', 'Equipment'] as const;
|
||||
export const STEP_NAMES = ['Species', 'Class', 'Subclass', 'Motivation', 'Scores', 'Skills', 'Abilities', 'Background', 'Appearance', 'Equipment'] as const;
|
||||
|
||||
@@ -14,13 +14,102 @@ export const SPECIES_ABILITY_BONUSES: Record<Species, Partial<Record<Ability, nu
|
||||
TIEFLING: { INT: 1, CHA: 2 },
|
||||
HALF_ORC: { STR: 2, CON: 1 },
|
||||
ORC: { STR: 2, CON: 1 },
|
||||
AASIMAR: {},
|
||||
GOLIATH: {},
|
||||
AARAKOCRA: {},
|
||||
BUGBEAR: {},
|
||||
CENTAUR: {},
|
||||
CHANGELING: {},
|
||||
DEEP_GNOME: {},
|
||||
DUERGAR: {},
|
||||
ELADRIN: {},
|
||||
FAIRY: {},
|
||||
FIRBOLG: {},
|
||||
AIR_GENASI: {},
|
||||
EARTH_GENASI: {},
|
||||
FIRE_GENASI: {},
|
||||
WATER_GENASI: {},
|
||||
GITHYANKI: {},
|
||||
GITHZERAI: {},
|
||||
GOBLIN: {},
|
||||
HARENGON: {},
|
||||
HOBGOBLIN: {},
|
||||
KENKU: {},
|
||||
KOBOLD: {},
|
||||
LIZARDFOLK: {},
|
||||
MINOTAUR: {},
|
||||
SEA_ELF: {},
|
||||
SHADAR_KAI: {},
|
||||
SHIFTER: {},
|
||||
TABAXI: {},
|
||||
TORTLE: {},
|
||||
TRITON: {},
|
||||
YUAN_TI: {},
|
||||
OWLIN: {},
|
||||
SATYR: {},
|
||||
};
|
||||
|
||||
export function speciesBonusFor(species: Species | null, ability: Ability, halfElfBonusAbilities: Ability[] = []): number {
|
||||
// The bonuses a player chooses on top of the fixed ones: one of `patterns`
|
||||
// (+2 and +1, or +1 three times...), each to a different ability, never one
|
||||
// in `exclude`.
|
||||
export interface FlexibleBonus {
|
||||
patterns: number[][];
|
||||
exclude?: Ability[];
|
||||
}
|
||||
export const SPECIES_FLEXIBLE_BONUS: Partial<Record<Species, FlexibleBonus>> = {
|
||||
HALF_ELF: { patterns: [[1, 1]], exclude: ['CHA'] },
|
||||
AASIMAR: { patterns: [[2, 1], [1, 1, 1]] },
|
||||
GOLIATH: { patterns: [[2, 1], [1, 1, 1]] },
|
||||
AARAKOCRA: { patterns: [[2, 1], [1, 1, 1]] },
|
||||
BUGBEAR: { patterns: [[2, 1], [1, 1, 1]] },
|
||||
CENTAUR: { patterns: [[2, 1], [1, 1, 1]] },
|
||||
CHANGELING: { patterns: [[2, 1], [1, 1, 1]] },
|
||||
DEEP_GNOME: { patterns: [[2, 1], [1, 1, 1]] },
|
||||
DUERGAR: { patterns: [[2, 1], [1, 1, 1]] },
|
||||
ELADRIN: { patterns: [[2, 1], [1, 1, 1]] },
|
||||
FAIRY: { patterns: [[2, 1], [1, 1, 1]] },
|
||||
FIRBOLG: { patterns: [[2, 1], [1, 1, 1]] },
|
||||
AIR_GENASI: { patterns: [[2, 1], [1, 1, 1]] },
|
||||
EARTH_GENASI: { patterns: [[2, 1], [1, 1, 1]] },
|
||||
FIRE_GENASI: { patterns: [[2, 1], [1, 1, 1]] },
|
||||
WATER_GENASI: { patterns: [[2, 1], [1, 1, 1]] },
|
||||
GITHYANKI: { patterns: [[2, 1], [1, 1, 1]] },
|
||||
GITHZERAI: { patterns: [[2, 1], [1, 1, 1]] },
|
||||
GOBLIN: { patterns: [[2, 1], [1, 1, 1]] },
|
||||
HARENGON: { patterns: [[2, 1], [1, 1, 1]] },
|
||||
HOBGOBLIN: { patterns: [[2, 1], [1, 1, 1]] },
|
||||
KENKU: { patterns: [[2, 1], [1, 1, 1]] },
|
||||
KOBOLD: { patterns: [[2, 1], [1, 1, 1]] },
|
||||
LIZARDFOLK: { patterns: [[2, 1], [1, 1, 1]] },
|
||||
MINOTAUR: { patterns: [[2, 1], [1, 1, 1]] },
|
||||
SEA_ELF: { patterns: [[2, 1], [1, 1, 1]] },
|
||||
SHADAR_KAI: { patterns: [[2, 1], [1, 1, 1]] },
|
||||
SHIFTER: { patterns: [[2, 1], [1, 1, 1]] },
|
||||
TABAXI: { patterns: [[2, 1], [1, 1, 1]] },
|
||||
TORTLE: { patterns: [[2, 1], [1, 1, 1]] },
|
||||
TRITON: { patterns: [[2, 1], [1, 1, 1]] },
|
||||
YUAN_TI: { patterns: [[2, 1], [1, 1, 1]] },
|
||||
OWLIN: { patterns: [[2, 1], [1, 1, 1]] },
|
||||
SATYR: { patterns: [[2, 1], [1, 1, 1]] },
|
||||
};
|
||||
|
||||
// A character's chosen bonuses, as { ability: amount }.
|
||||
export type BonusChoices = Partial<Record<Ability, number>>;
|
||||
|
||||
export function speciesBonusFor(species: Species | null, ability: Ability, choices: BonusChoices = {}): number {
|
||||
if (!species) return 0;
|
||||
let bonus = SPECIES_ABILITY_BONUSES[species][ability] || 0;
|
||||
if (species === 'HALF_ELF' && halfElfBonusAbilities.includes(ability)) bonus += 1;
|
||||
return bonus;
|
||||
return (SPECIES_ABILITY_BONUSES[species][ability] || 0) + (SPECIES_FLEXIBLE_BONUS[species] ? choices[ability] || 0 : 0);
|
||||
}
|
||||
|
||||
// Whether a set of choices is complete and allowed for the species (mirrors
|
||||
// speciesBonusProblem on the server).
|
||||
export function bonusChoicesValid(species: Species | null, choices: BonusChoices): boolean {
|
||||
const flexible = species ? SPECIES_FLEXIBLE_BONUS[species] : undefined;
|
||||
const entries = Object.entries(choices).filter(([, amount]) => amount);
|
||||
if (!flexible) return entries.length === 0;
|
||||
if (entries.some(([ability]) => flexible.exclude?.includes(ability as Ability))) return false;
|
||||
const amounts = entries.map(([, amount]) => amount as number).sort((a, b) => b - a).join(',');
|
||||
return flexible.patterns.some((pattern) => [...pattern].sort((a, b) => b - a).join(',') === amounts);
|
||||
}
|
||||
|
||||
export function abilityModifier(score: number): number {
|
||||
|
||||
@@ -12,6 +12,39 @@ export const SPECIES_ICONS: Record<Species, string> = {
|
||||
TIEFLING: '😈',
|
||||
HALF_ORC: '🪓',
|
||||
ORC: '👹',
|
||||
AASIMAR: '😇',
|
||||
GOLIATH: '🏔️',
|
||||
AARAKOCRA: '🦅',
|
||||
BUGBEAR: '🐻',
|
||||
CENTAUR: '🐎',
|
||||
CHANGELING: '🎭',
|
||||
DEEP_GNOME: '💎',
|
||||
DUERGAR: '⚒️',
|
||||
ELADRIN: '🍂',
|
||||
FAIRY: '🧚',
|
||||
FIRBOLG: '🌲',
|
||||
AIR_GENASI: '🌬️',
|
||||
EARTH_GENASI: '🪨',
|
||||
FIRE_GENASI: '🔥',
|
||||
WATER_GENASI: '🌊',
|
||||
GITHYANKI: '⚔️',
|
||||
GITHZERAI: '🧘',
|
||||
GOBLIN: '👺',
|
||||
HARENGON: '🐇',
|
||||
HOBGOBLIN: '🛡️',
|
||||
KENKU: '🐦⬛',
|
||||
KOBOLD: '🦎',
|
||||
LIZARDFOLK: '🐊',
|
||||
MINOTAUR: '🐂',
|
||||
SEA_ELF: '🐚',
|
||||
SHADAR_KAI: '🌑',
|
||||
SHIFTER: '🐺',
|
||||
TABAXI: '🐆',
|
||||
TORTLE: '🐢',
|
||||
TRITON: '🔱',
|
||||
YUAN_TI: '🐍',
|
||||
OWLIN: '🦉',
|
||||
SATYR: '🐐',
|
||||
};
|
||||
|
||||
export function speciesIcon(species: Species | null): string {
|
||||
|
||||
@@ -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>
|
||||
)}
|
||||
|
||||
|
||||
@@ -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],
|
||||
|
||||
Reference in New Issue
Block a user