V1.11.0: gear that applies itself, equipping that matters, a character panel
- Weapons and items can carry effects: bonuses and penalties to AC, speed, initiative, max HP, passive Perception, ability scores, saving throws and skills, plus a note. They apply on their own while equipped and stop when the thing comes off. Armor is an item with an AC effect. The DM sets them with "Effects" on a row in the weapon or item pool. - The sheet's "armor bonus" is now "Extra AC", the DM's own adjustment on top of gear, and only the DM can set it. - Only what is equipped counts: a weapon has to be equipped to be used in an encounter. A character can have two things equipped at once, one of them a weapon (campaign settings). Equipping at the limit is refused with a message, and can be changed at any time, mid-encounter included. - A built-in item library: armor, shields, worn gear and supplies, with their effects set. The weapon library gains paired weapons (a pair of daggers is one weapon). - A floating character button on every page opens a panel with a character's numbers and everything they hold, with equip ticks. Players get their own characters, the DM everyone's, and each character card in an encounter has an Inventory button. It replaces the quick stats drawer. - A player's own characters stand out: marked and highlighted in encounters, with a button that jumps to their card; highlighted on the party screen; and listed once, not twice, on the campaign page. - All packages at version 1.11.0. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -36,7 +36,8 @@ import { JumpNav } from '../components/JumpNav';
|
||||
import { useRememberCampaign } from '../lib/lastCampaign';
|
||||
import { HpBar } from '../components/HpBar';
|
||||
import { DeathSaves } from '../components/DeathSaves';
|
||||
import { QuickStatsFab } from '../components/QuickStatsDrawer';
|
||||
import { GearInForce } from '../components/CharacterPanel';
|
||||
import { effectsSummary } from '../lib/gear';
|
||||
import { InfoTip } from '../components/InfoTip';
|
||||
import { usePagination, Pagination } from '../components/Paginated';
|
||||
import {
|
||||
@@ -333,6 +334,16 @@ export function CharacterSheetPage() {
|
||||
}
|
||||
}
|
||||
|
||||
// Equipping can be refused (too much on already). The reason goes in the
|
||||
// banner at the top, so the page goes there too.
|
||||
const equipResult = {
|
||||
onSuccess: () => setFormError(null),
|
||||
onError: (err: unknown) => {
|
||||
setFormError(extractErrorMessage(err));
|
||||
window.scrollTo({ top: 0, behavior: 'smooth' });
|
||||
},
|
||||
};
|
||||
|
||||
async function handleGold(sign: 1 | -1) {
|
||||
const amount = Math.floor(Number(goldAmount));
|
||||
if (!(amount > 0)) return;
|
||||
@@ -503,18 +514,21 @@ export function CharacterSheetPage() {
|
||||
onBlur={(e) => patchCharacter.mutate({ tempHp: Number(e.target.value) })}
|
||||
/>
|
||||
</label>
|
||||
<label className="flex-row gap-sm">
|
||||
Armor Bonus <InfoTip term="ARMOR_BONUS" />
|
||||
<NumberInput
|
||||
key={`armor:${character.armorBonus}`}
|
||||
min={0}
|
||||
max={30}
|
||||
keepValue
|
||||
defaultValue={character.armorBonus}
|
||||
style={{ width: 70 }}
|
||||
onBlur={(e) => patchCharacter.mutate({ armorBonus: Number(e.target.value) })}
|
||||
/>
|
||||
</label>
|
||||
{/* Armor is an equipped item now; this is the DM's own adjustment on top. */}
|
||||
{isDM && (
|
||||
<label className="flex-row gap-sm" title="Added to AC on top of what equipped gear gives. Can be negative.">
|
||||
Extra AC (DM) <InfoTip term="ARMOR_BONUS" />
|
||||
<NumberInput
|
||||
key={`armor:${character.armorBonus}`}
|
||||
min={-30}
|
||||
max={30}
|
||||
keepValue
|
||||
defaultValue={character.armorBonus}
|
||||
style={{ width: 70 }}
|
||||
onBlur={(e) => patchCharacter.mutate({ armorBonus: Number(e.target.value) })}
|
||||
/>
|
||||
</label>
|
||||
)}
|
||||
</div>
|
||||
)}
|
||||
|
||||
@@ -555,6 +569,16 @@ export function CharacterSheetPage() {
|
||||
<p className="subtitle mt-sm">📍 Currently at: <strong>{character.currentLocation.name}</strong></p>
|
||||
)}
|
||||
|
||||
{(sheet.gear.effects.length > 0 || sheet.gear.notes.length > 0) && (
|
||||
<div className="card mt-md">
|
||||
<div className="card-title">From Equipped Gear</div>
|
||||
<GearInForce gear={sheet.gear} />
|
||||
<p className="subtitle" style={{ margin: '0.4rem 0 0' }}>
|
||||
Already counted in every number on this sheet. Take something off and its line goes.
|
||||
</p>
|
||||
</div>
|
||||
)}
|
||||
|
||||
<JumpNav />
|
||||
|
||||
<div data-jump="Abilities" className="card mt-md">
|
||||
@@ -632,6 +656,9 @@ export function CharacterSheetPage() {
|
||||
Lv {cw.level} · {cw.scaledDamageDice} {cw.weapon.damageType} · x{cw.quantity}
|
||||
</span>
|
||||
{!cw.usable && <RequiresLevel level={cw.level} />}
|
||||
{effectsSummary(cw.weapon.effects, cw.weapon.effectNote) && (
|
||||
<div style={{ color: 'var(--text-muted)', fontSize: '0.85rem' }}>✦ While equipped: {effectsSummary(cw.weapon.effects, cw.weapon.effectNote)}</div>
|
||||
)}
|
||||
</div>
|
||||
{canEdit && (
|
||||
<div className="flex-row gap-sm">
|
||||
@@ -641,7 +668,7 @@ export function CharacterSheetPage() {
|
||||
type="checkbox"
|
||||
checked={cw.equipped}
|
||||
disabled={!cw.usable}
|
||||
onChange={(e) => patchWeapon.mutate({ weaponId: cw.weaponId, equipped: e.target.checked })}
|
||||
onChange={(e) => patchWeapon.mutate({ weaponId: cw.weaponId, equipped: e.target.checked }, equipResult)}
|
||||
/>
|
||||
</label>
|
||||
{isDM && (
|
||||
@@ -758,6 +785,9 @@ export function CharacterSheetPage() {
|
||||
{held.scaledDamageDice && ` · ${held.scaledDamageDice}`} · x{held.quantity}
|
||||
</span>
|
||||
{!held.usable && <RequiresLevel level={held.level} />}
|
||||
{effectsSummary(held.item.effects, held.item.effectNote) && (
|
||||
<div style={{ color: 'var(--text-muted)', fontSize: '0.85rem' }}>✦ While equipped: {effectsSummary(held.item.effects, held.item.effectNote)}</div>
|
||||
)}
|
||||
{held.item.description && (
|
||||
<div style={{ color: 'var(--text-muted)', fontSize: '0.85rem' }}>{held.item.description}</div>
|
||||
)}
|
||||
@@ -770,7 +800,7 @@ export function CharacterSheetPage() {
|
||||
type="checkbox"
|
||||
checked={held.equipped}
|
||||
disabled={!held.usable}
|
||||
onChange={(e) => patchItem.mutate({ itemId: held.itemId, equipped: e.target.checked })}
|
||||
onChange={(e) => patchItem.mutate({ itemId: held.itemId, equipped: e.target.checked }, equipResult)}
|
||||
/>
|
||||
</label>
|
||||
{isDM && (
|
||||
@@ -1031,7 +1061,6 @@ export function CharacterSheetPage() {
|
||||
<Pagination page={notesPage.page} pageCount={notesPage.pageCount} onPrev={notesPage.prevPage} onNext={notesPage.nextPage} />
|
||||
</div>
|
||||
|
||||
<QuickStatsFab characterId={characterId} />
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user