Perfection pass: complete level-up/build flows + dying polish
Second adversarial audit of the freshly-shipped code; fixed bugs + completeness gaps. - abilityBuild stays in sync with totals on level-up (appendLevelIncreases) - 5e feat picker in level-up; PF2e feat-name autocomplete; expertise sets ranks - Higher-level creation collects PF2e skill increases + 5e expertise - PF2e heritage: schema field, wizard picker, sheet, Pathbuilder import - 5e Hit Dice as a tracked resource (half-level long-rest recovery via recoverStep) - Dying flow: knockout sets HP 0, stays unconscious at 0 HP, healing wakes +Wounded, Heroic Recovery (spend hero points); damage-while-dying + recovery reminders (pf2e) - Healing caps at effective max (drained/exhaustion-4) on sheet, tracker, and rest; massive-damage death uses effective max; persistent-damage badge - UX: in-place valued-condition steppers, point-buy budget caps, prepared-vs-known spell guidance, granted skills in review, system-gated score generator Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
@@ -168,3 +168,24 @@ describe('pf2e Refocus', () => {
|
||||
expect(patch.resources?.[0]?.current).toBe(1); // +1, clamped to max — not 3
|
||||
});
|
||||
});
|
||||
|
||||
describe('pf2e Rest for the Night', () => {
|
||||
it('decays drained/doomed, clears wounded/fatigued, and caps HP at the post-decay effective max', () => {
|
||||
const rest = pf2e.restOptions.find((o) => o.id === 'rest')!;
|
||||
const c = {
|
||||
system: 'pf2e', level: 6,
|
||||
resources: [],
|
||||
hp: { current: 5, max: 50, temp: 0 },
|
||||
concentration: null,
|
||||
spellcasting: { slots: [], spells: [] },
|
||||
conditions: [{ name: 'Drained', value: 2 }, { name: 'Fatigued' }],
|
||||
defenses: { exhaustion: 0, deathSaves: { successes: 0, failures: 0 }, dying: 0, wounded: 2, doomed: 1, heroPoints: 1, inspiration: false },
|
||||
} as unknown as Parameters<typeof applyRest>[0];
|
||||
const patch = applyRest(c, rest);
|
||||
expect(patch.conditions).toEqual([{ name: 'Drained', value: 1 }]); // drained −1, fatigued gone
|
||||
expect(patch.defenses!.wounded).toBe(0);
|
||||
expect(patch.defenses!.doomed).toBe(0);
|
||||
// drained 1 remains after decay → effective max 50 − 6 = 44, not 50
|
||||
expect(patch.hp!.current).toBe(44);
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user