Add PF2e persistent damage condition tags
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:
@@ -301,6 +301,52 @@ describe("rehydrateCombatant", () => {
|
||||
expect(result?.side).toBeUndefined();
|
||||
});
|
||||
|
||||
it("preserves valid persistent damage entries", () => {
|
||||
const result = rehydrateCombatant({
|
||||
...minimalCombatant(),
|
||||
persistentDamage: [
|
||||
{ type: "fire", formula: "2d6" },
|
||||
{ type: "bleed", formula: "1d4" },
|
||||
],
|
||||
});
|
||||
expect(result?.persistentDamage).toEqual([
|
||||
{ type: "fire", formula: "2d6" },
|
||||
{ type: "bleed", formula: "1d4" },
|
||||
]);
|
||||
});
|
||||
|
||||
it("filters out invalid persistent damage entries", () => {
|
||||
const result = rehydrateCombatant({
|
||||
...minimalCombatant(),
|
||||
persistentDamage: [
|
||||
{ type: "fire", formula: "2d6" },
|
||||
{ type: "radiant", formula: "1d4" },
|
||||
{ type: "bleed", formula: "" },
|
||||
{ type: "acid" },
|
||||
{ formula: "1d6" },
|
||||
],
|
||||
});
|
||||
expect(result?.persistentDamage).toEqual([
|
||||
{ type: "fire", formula: "2d6" },
|
||||
]);
|
||||
});
|
||||
|
||||
it("returns undefined persistentDamage for non-array value", () => {
|
||||
const result = rehydrateCombatant({
|
||||
...minimalCombatant(),
|
||||
persistentDamage: "fire",
|
||||
});
|
||||
expect(result?.persistentDamage).toBeUndefined();
|
||||
});
|
||||
|
||||
it("returns undefined persistentDamage for empty array", () => {
|
||||
const result = rehydrateCombatant({
|
||||
...minimalCombatant(),
|
||||
persistentDamage: [],
|
||||
});
|
||||
expect(result?.persistentDamage).toBeUndefined();
|
||||
});
|
||||
|
||||
it("drops invalid tempHp — keeps combatant", () => {
|
||||
for (const tempHp of [-1, 1.5, "3"]) {
|
||||
const result = rehydrateCombatant({
|
||||
|
||||
Reference in New Issue
Block a user