V1.29.0: free roam by invitation, no slot no spell, weapons change at the right moment

- Free roam no longer adds the whole party: the DM adds who is there
- A spell with no slot of its level or higher left cannot be declared; it
  takes the lowest slot left at or above its level. Cantrips take none
- In a battle in progress a player changes the weapon in hand only as the
  battle begins or on their own turn after their attack has landed
- Spells are listed cantrips first, then by level, with the level shown

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-10-12 10:05:25 +02:00
co-authored by Claude Opus 5.5
parent 555765916f
commit 9d0a4a2252
19 changed files with 280 additions and 62 deletions
@@ -335,7 +335,6 @@ export function ActionComposer({
const attacks = actor && !info ? creatureAttacks(actor) : [];
const noTarget = targetCount === 0;
const go = (source: ActionSource) => declare.mutate({ source, actorParticipantId: actor?.id }, { onError });
const slotsLeft = (level: number) => info?.spellSlots?.levels.find((l) => l.level === level)?.remaining ?? 0;
return (
<div className="card action-composer">
@@ -362,7 +361,9 @@ export function ActionComposer({
{info && info.weapons.length === 0 && <span className="combatant-sub">No weapon equipped: equip one on the sheet to attack with it.</span>}
{info?.spells.map((s) => {
const cantrip = s.level === 0;
const spent = !cantrip && Boolean(info.spellSlots) && slotsLeft(s.level) === 0;
// The slot it would take: its own level, or the lowest one above it that is left.
const slot = cantrip ? undefined : info.spellSlots?.levels.find((l) => l.level >= s.level && l.remaining > 0);
const spent = !cantrip && Boolean(info.spellSlots) && !slot;
const how = s.attackRoll
? `${fmtMod(info.spellcasting?.attackBonus ?? 0)} to hit`
: s.saveAbility
@@ -372,15 +373,22 @@ export function ActionComposer({
<button
key={s.characterSpellId}
className="btn action-option"
disabled={noTarget || declare.isPending}
title={[s.description, spent ? `No ${slotLevelLabel(s.level)}-level slot left: it can still be declared, but no slot will be spent.` : null].filter(Boolean).join(' — ')}
disabled={noTarget || spent || declare.isPending}
title={[
s.description,
cantrip ? 'A cantrip: no spell slot needed.' : null,
spent ? `No spell slot of ${slotLevelLabel(s.level)} level or higher left: it cannot be cast until slots come back.` : null,
slot ? `Takes a ${slotLevelLabel(slot.level)}-level slot when it lands (${slot.remaining} left).` : null,
]
.filter(Boolean)
.join(' — ')}
onClick={() => go({ type: 'spell', characterSpellId: s.characterSpellId })}
>
<span className="action-option-name">
✨ {s.name} {spent && <span className="badge badge-hostile">no slot</span>}
✨ {s.name} <span className="badge">{spellLevelLabel(s.level)}</span> {spent && <span className="badge badge-hostile">no slot left</span>}
</span>
<span className="combatant-sub mono">
{spellLevelLabel(s.level)} · {how}
{cantrip ? 'no slot' : slot && slot.level > s.level ? `${slotLevelLabel(slot.level)}-level slot` : 'uses a slot'} · {how}
{s.damageDice ? ` · ${s.damageDice}` : ''}
</span>
</button>