Add PF2e weak/elite creature adjustments with stat block toggle
All checks were successful
CI / check (push) Successful in 2m32s
CI / build-image (push) Successful in 19s

Weak/Normal/Elite toggle in PF2e stat block header applies standard
adjustments (level, AC, HP, saves, Perception, attacks, damage) to
individual combatants. Adjusted stats are highlighted blue (elite) or
red (weak). Persisted via creatureAdjustment field on Combatant.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
Lukas
2026-04-11 02:24:30 +02:00
parent a44f82127e
commit 09a801487d
18 changed files with 985 additions and 31 deletions

View File

@@ -455,14 +455,20 @@ export function CombatantRow({
decrementCondition,
toggleConcentration,
} = useEncounterContext();
const { selectedCreatureId, showCreature, toggleCollapse } =
useSidePanelContext();
const {
selectedCreatureId,
selectedCombatantId,
showCreature,
toggleCollapse,
} = useSidePanelContext();
const { handleRollInitiative } = useInitiativeRollsContext();
const { edition } = useRulesEditionContext();
const isPf2e = edition === "pf2e";
// Derive what was previously conditional props
const isStatBlockOpen = combatant.creatureId === selectedCreatureId;
const isStatBlockOpen =
combatant.creatureId === selectedCreatureId &&
combatant.id === selectedCombatantId;
const { creatureId } = combatant;
const hasStatBlock = !!creatureId;
const onToggleStatBlock = hasStatBlock
@@ -470,7 +476,7 @@ export function CombatantRow({
if (isStatBlockOpen) {
toggleCollapse();
} else {
showCreature(creatureId);
showCreature(creatureId, combatant.id);
}
}
: undefined;