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:
@@ -106,4 +106,20 @@ describe('applyRest', () => {
|
||||
// no concentration → no concentration key in the patch
|
||||
expect('concentration' in applyRest(makeCharacter(), short)).toBe(false);
|
||||
});
|
||||
|
||||
it('long rest caps restored HP at the effective max while exhaustion stays 4+', () => {
|
||||
const c = { ...makeCharacter(), defenses: { ...makeCharacter().defenses, exhaustion: 5 } };
|
||||
const long = dnd5e.restOptions.find((o) => o.id === 'long')!;
|
||||
const patch = applyRest(c, long);
|
||||
// exhaustion 5 → 4 after the rest; max HP still halved (30 → 15)
|
||||
expect(patch.defenses!.exhaustion).toBe(4);
|
||||
expect(patch.hp!.current).toBe(15);
|
||||
});
|
||||
|
||||
it('a per-resource recoverStep restores by that amount, not to max (Hit Dice)', () => {
|
||||
const base = makeCharacter();
|
||||
const c = { ...base, resources: [{ id: 'hd', name: 'Hit Dice', current: 0, max: 5, recovery: 'long' as const, recoverStep: 3 }] };
|
||||
const long = dnd5e.restOptions.find((o) => o.id === 'long')!;
|
||||
expect(applyRest(c, long).resources![0]!.current).toBe(3); // 0 + ceil(5/2)=3, not 5
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user