Add PF2e persistent damage condition tags
CI / check (push) Successful in 2m39s
CI / build-image (push) Successful in 19s

Persistent damage displayed as compact tags with damage type icon and
formula (e.g., Flame + "2d6"). Supports fire, bleed, acid, cold,
electricity, poison, and mental types. One instance per type, added via
sub-picker in the condition picker. PF2e only, persists across reload.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
Lukas
2026-04-11 12:09:31 +02:00
parent 09a801487d
commit 4b1c1deda2
20 changed files with 1257 additions and 111 deletions
+15
View File
@@ -3,6 +3,7 @@ import {
type ConditionEntry,
type CreatureId,
deriveHpStatus,
type PersistentDamageEntry,
type PlayerIcon,
type RollMode,
} from "@initiative/domain";
@@ -19,6 +20,7 @@ import { ConditionPicker } from "./condition-picker.js";
import { ConditionTags } from "./condition-tags.js";
import { D20Icon } from "./d20-icon.js";
import { HpAdjustPopover } from "./hp-adjust-popover.js";
import { PersistentDamageTags } from "./persistent-damage-tags.js";
import { PLAYER_COLOR_HEX, PLAYER_ICON_MAP } from "./player-icon-map.js";
import { RollModeMenu } from "./roll-mode-menu.js";
import { ConfirmButton } from "./ui/confirm-button.js";
@@ -33,6 +35,7 @@ interface Combatant {
readonly tempHp?: number;
readonly ac?: number;
readonly conditions?: readonly ConditionEntry[];
readonly persistentDamage?: readonly PersistentDamageEntry[];
readonly isConcentrating?: boolean;
readonly color?: string;
readonly icon?: string;
@@ -454,6 +457,8 @@ export function CombatantRow({
setConditionValue,
decrementCondition,
toggleConcentration,
addPersistentDamage,
removePersistentDamage,
} = useEncounterContext();
const {
selectedCreatureId,
@@ -615,14 +620,24 @@ export function CombatantRow({
onOpenPicker={() => setPickerOpen((prev) => !prev)}
/>
</div>
{isPf2e && (
<PersistentDamageTags
entries={combatant.persistentDamage}
onRemove={(damageType) => removePersistentDamage(id, damageType)}
/>
)}
{!!pickerOpen && (
<ConditionPicker
anchorRef={conditionAnchorRef}
activeConditions={combatant.conditions}
activePersistentDamage={combatant.persistentDamage}
onToggle={(conditionId) => toggleCondition(id, conditionId)}
onSetValue={(conditionId, value) =>
setConditionValue(id, conditionId, value)
}
onAddPersistentDamage={(damageType, formula) =>
addPersistentDamage(id, damageType, formula)
}
onClose={() => setPickerOpen(false)}
/>
)}