V1.21.0: a DM's toolkit: the battle at a glance, subclasses, character state, rolls, XP
Seven steps in one commit, 1.15.0 to 1.21.0. They change the same files and were not saved apart, so they go in together. - The battle at a glance (1.15). A strip across the top of an encounter lists everyone in turn order and stays in view; a click goes to that card. On a wide screen the stat block of whoever is on turn stays beside the cards, and Pin keeps anyone else's there. Saving throws, every skill and passive Perception, Investigation and Insight are on encounter cards and in the character panel, which "Sheet" on a card and a button on the party overview open. For the DM, N is Next Turn and S opens the sheet of whoever is on turn. The party overview shows passive scores and spell save DC. - Subclasses (1.16). Three per class, picked in the level-up checklist at level 2 (cleric, druid, wizard) or 3, shown beside the class everywhere, and changed by the DM from the sheet: the old one's lines come out of Special Abilities and the new one's go in. Characters already at that level keep the path they were on. - Character state (1.17). Inspiration, exhaustion and conditions on the sheet and in the panel, and counters for what a class does a set number of times (Rage, Ki, Channel Divinity...), which the player spends and a rest gives back. A long rest takes a level of exhaustion off. A character's conditions are their own now: they stay from one encounter to the next. - Faster battles (1.18). Up to 20 of a monster added at once, numbered. One button rolls initiative for the monsters and NPCs. A condition can be given a number of rounds and then comes off by itself. Hovering over a condition shows its rule, and damaging someone who is Concentrating shows the save to call for. - Rolls from the sheet (1.19). A number with a dotted underline rolls when clicked, with its bonus: skills, saves, ability checks, attacks, damage, spell dice, and a monster's attack, damage and abilities. The dice roller has advantage and disadvantage. "Call for a roll" rolls one check or save for the whole party. Rolls stay in the browser. - XP and difficulty (1.20). An encounter shows the DM how hard it is, Trivial to Deadly, from the monsters' challenge ratings against the characters in it, and what it is worth in XP; one button shares that out, once. The sheet and the party overview show XP and when a level is due. Levelling up stays the DM's decision. - Subclasses are optional per campaign (1.21). With "Characters choose a subclass" unticked in the campaign's Settings nobody is asked, each class follows its first subclass, and none is named. - Conditions, exhaustion, counters and subclass features are reminders for the table: none of them changes a number on the sheet. - The docs cover all of it, with generated tables of what each subclass adds. - New migrations: a character's subclass; inspiration, exhaustion, conditions and spent counters on a character; the rounds left on a combatant's conditions; the XP awarded for an encounter; the campaign's subclass setting. - All packages at version 1.21.0. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -3,13 +3,17 @@ import { useCampaign, useCampaignCharacters, usePatchCharacterWeapon, usePatchIn
|
||||
import { useAuth } from '../auth/useAuth';
|
||||
import { useLastCampaignId } from '../lib/lastCampaign';
|
||||
import { closeCharacterPanel, openCharacterPanel, useCharacterPanelId } from '../lib/characterPanel';
|
||||
import { CLASS_LABELS, SPECIES_LABELS, fmtMod, formatPurse, spellLevelLabel } from '../lib/format';
|
||||
import { SPECIES_LABELS, classLabel, fmtMod, formatPurse, spellLevelLabel } from '../lib/format';
|
||||
import { effectLabel, effectsSummary } from '../lib/gear';
|
||||
import { speciesIcon } from '../lib/speciesIcons';
|
||||
import { Spinner, ErrorBanner } from './Spinner';
|
||||
import { HpBar } from './HpBar';
|
||||
import { DeathSaves } from './DeathSaves';
|
||||
import { SpellSlotTracker } from './SpellSlots';
|
||||
import { SheetNumbers } from './SheetNumbers';
|
||||
import { CharacterState } from './CharacterState';
|
||||
import { Rollable } from './Rollable';
|
||||
import { withBonus } from '../lib/diceRoller';
|
||||
import { useState } from 'react';
|
||||
import { extractErrorMessage } from '../lib/format';
|
||||
import type { ActiveGear } from '../api/types';
|
||||
@@ -73,7 +77,7 @@ function PanelBody({ characterId, isDM }: { characterId: string; isDM: boolean }
|
||||
<span aria-hidden="true">{speciesIcon(data.species)}</span> {data.name}
|
||||
</h3>
|
||||
<div className="combatant-sub">
|
||||
{data.species && SPECIES_LABELS[data.species]} {data.characterClass && CLASS_LABELS[data.characterClass]} · Level {data.level}
|
||||
{data.species && SPECIES_LABELS[data.species]} {classLabel(data.characterClass, data.subclassName)} · Level {data.level}
|
||||
</div>
|
||||
</div>
|
||||
<Link to={`/characters/${data.id}`} className="btn" onClick={closeCharacterPanel}>
|
||||
@@ -113,6 +117,37 @@ function PanelBody({ characterId, isDM }: { characterId: string; isDM: boolean }
|
||||
))}
|
||||
</div>
|
||||
|
||||
<div className="mt-sm">
|
||||
<CharacterState
|
||||
characterId={characterId}
|
||||
name={data.name}
|
||||
inspiration={data.inspiration}
|
||||
exhaustion={data.exhaustion}
|
||||
conditions={data.conditions}
|
||||
resources={data.resources}
|
||||
canUse={!data.restricted}
|
||||
isDM={isDM}
|
||||
onError={(err) => setEquipError(extractErrorMessage(err))}
|
||||
/>
|
||||
</div>
|
||||
|
||||
<details className="card mt-md" open>
|
||||
<summary className="card-title">Saves and skills</summary>
|
||||
<SheetNumbers
|
||||
who={data.name}
|
||||
saves={data.saves}
|
||||
skills={data.skills}
|
||||
passives={{ perception: data.passivePerception, investigation: data.passiveInvestigation, insight: data.passiveInsight }}
|
||||
/>
|
||||
</details>
|
||||
|
||||
{data.specialAbilities && (
|
||||
<details className="card mt-md" open>
|
||||
<summary className="card-title">Special Abilities</summary>
|
||||
<p style={{ margin: 0, whiteSpace: 'pre-wrap' }}>{data.specialAbilities}</p>
|
||||
</details>
|
||||
)}
|
||||
|
||||
{(data.gear.effects.length > 0 || data.gear.notes.length > 0) && (
|
||||
<div className="card mt-md">
|
||||
<div className="card-title">From equipped gear</div>
|
||||
@@ -125,7 +160,10 @@ function PanelBody({ characterId, isDM }: { characterId: string; isDM: boolean }
|
||||
<div className="card mt-md">
|
||||
<div className="card-title">Spellcasting</div>
|
||||
<p style={{ margin: 0 }}>
|
||||
Save DC {data.spellcasting.saveDC} · Attack {fmtMod(data.spellcasting.attackBonus)}
|
||||
Save DC {data.spellcasting.saveDC} ·{' '}
|
||||
<Rollable label={`${data.name}: spell attack`} modifier={data.spellcasting.attackBonus}>
|
||||
Attack {fmtMod(data.spellcasting.attackBonus)}
|
||||
</Rollable>
|
||||
</p>
|
||||
{/* The character's own player and the DM spend slots here; the DM can also give them back. */}
|
||||
{data.spellSlots && (
|
||||
@@ -158,7 +196,15 @@ function PanelBody({ characterId, isDM }: { characterId: string; isDM: boolean }
|
||||
{w.quantity > 1 && <span className="combatant-sub"> ×{w.quantity}</span>}
|
||||
<Flags equipped={w.equipped} usable={w.usable} level={w.level} />
|
||||
<div className="combatant-sub">
|
||||
Lv {w.level} · attack {fmtMod(w.attackBonus)} · {w.damageDice} {fmtMod(w.damageBonus)} {w.damageType}
|
||||
Lv {w.level} ·{' '}
|
||||
<Rollable label={`${data.name}: ${w.name} attack`} modifier={w.attackBonus}>
|
||||
attack {fmtMod(w.attackBonus)}
|
||||
</Rollable>{' '}
|
||||
·{' '}
|
||||
<Rollable label={`${data.name}: ${w.name} damage`} dice={withBonus(w.damageDice, w.damageBonus)}>
|
||||
{w.damageDice} {fmtMod(w.damageBonus)}
|
||||
</Rollable>{' '}
|
||||
{w.damageType}
|
||||
</div>
|
||||
{effectsSummary(w.effects, w.effectNote) && <div className="combatant-sub">✦ {effectsSummary(w.effects, w.effectNote)}</div>}
|
||||
</div>
|
||||
@@ -181,8 +227,8 @@ function PanelBody({ characterId, isDM }: { characterId: string; isDM: boolean }
|
||||
<p className="combatant-sub mt-md">Their pack, spells and purse are their own business.</p>
|
||||
) : (
|
||||
<>
|
||||
<div className="card mt-md">
|
||||
<div className="card-title">Inventory · {data.inventory.length}</div>
|
||||
<details className="card mt-md" open>
|
||||
<summary className="card-title">Inventory · {data.inventory.length}</summary>
|
||||
{data.inventory.length === 0 && <p className="combatant-sub" style={{ margin: 0 }}>Nothing carried.</p>}
|
||||
{data.inventory.map((item) => (
|
||||
<div key={item.inventoryItemId} className="reward-row">
|
||||
@@ -209,7 +255,7 @@ function PanelBody({ characterId, isDM }: { characterId: string; isDM: boolean }
|
||||
</div>
|
||||
</div>
|
||||
))}
|
||||
</div>
|
||||
</details>
|
||||
|
||||
<div className="card mt-md">
|
||||
<div className="card-title">
|
||||
@@ -219,32 +265,33 @@ function PanelBody({ characterId, isDM }: { characterId: string; isDM: boolean }
|
||||
</div>
|
||||
|
||||
{data.spells.length > 0 && (
|
||||
<div className="card mt-md">
|
||||
<div className="card-title">Spells · {data.spells.length}</div>
|
||||
<details className="card mt-md" open>
|
||||
<summary className="card-title">Spells · {data.spells.length}</summary>
|
||||
{data.spells.map((s) => (
|
||||
<div key={s.characterSpellId} className="reward-row">
|
||||
<strong>{s.name}</strong>
|
||||
<span className="combatant-sub">
|
||||
{' '}
|
||||
{spellLevelLabel(s.level)}
|
||||
{s.damageDice && ` · ${s.damageDice}`}
|
||||
{s.damageDice && (
|
||||
<>
|
||||
{' · '}
|
||||
<Rollable label={`${data.name}: ${s.name}`} dice={s.damageDice}>
|
||||
{s.damageDice}
|
||||
</Rollable>
|
||||
</>
|
||||
)}
|
||||
</span>
|
||||
{s.prepared && <span className="badge badge-live" style={{ marginLeft: 6 }}>prepared</span>}
|
||||
{!s.usable && <span className="badge badge-hostile" style={{ marginLeft: 6 }}>needs level {s.level}</span>}
|
||||
{s.description && <div className="combatant-sub">{s.description}</div>}
|
||||
</div>
|
||||
))}
|
||||
</div>
|
||||
</details>
|
||||
)}
|
||||
</>
|
||||
)}
|
||||
|
||||
{data.specialAbilities && (
|
||||
<div className="card mt-md">
|
||||
<div className="card-title">Special Abilities</div>
|
||||
<p style={{ margin: 0, whiteSpace: 'pre-wrap' }}>{data.specialAbilities}</p>
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
);
|
||||
}
|
||||
@@ -275,7 +322,7 @@ export function CharacterPanel() {
|
||||
<button
|
||||
className="fab-quickstats"
|
||||
onClick={() => openCharacterPanel(fallback.id)}
|
||||
title={isDM ? 'Characters: stats and inventory' : 'Your character: stats and inventory'}
|
||||
title={isDM ? 'Characters: stats, skills and inventory' : 'Your character: stats, skills and inventory'}
|
||||
aria-label="Open the character panel"
|
||||
>
|
||||
🧙
|
||||
|
||||
Reference in New Issue
Block a user