From 553e09f28007944bf4ef3619490e3b11bcba92e2 Mon Sep 17 00:00:00 2001 From: Lukas Date: Thu, 9 Apr 2026 00:04:47 +0200 Subject: [PATCH] Enforce maximum values for PF2e numbered conditions Cap dying (4), doomed (3), wounded (3), and slowed (3) at their rule-defined maximums. The domain clamps values in setConditionValue and the condition picker disables the [+] button at the cap. Closes #31 Co-Authored-By: Claude Opus 4.6 (1M context) --- apps/web/src/components/condition-picker.tsx | 43 ++++++++++----- .../src/__tests__/toggle-condition.test.ts | 54 +++++++++++++++++++ packages/domain/src/conditions.ts | 6 +++ packages/domain/src/toggle-condition.ts | 22 ++++++-- specs/003-combatant-state/spec.md | 15 +++++- 5 files changed, 120 insertions(+), 20 deletions(-) diff --git a/apps/web/src/components/condition-picker.tsx b/apps/web/src/components/condition-picker.tsx index d0ebe24..e57cf7d 100644 --- a/apps/web/src/components/condition-picker.tsx +++ b/apps/web/src/components/condition-picker.tsx @@ -162,20 +162,35 @@ export function ConditionPicker({ {editing.value} - + {(() => { + const atMax = + def.maxValue !== undefined && + editing.value >= def.maxValue; + return ( + + ); + })()}