Phase 16: advantage/disadvantage applies to any single die

applyRollMode (src/lib/dice/notation.ts) now rewrites the first single-die term
of any size (d4/d6/d20/...) to 2dN kh1/kl1, not just d20. Multi-die pools (2d6)
and terms with an existing keep/drop (4d6kh3) are left untouched. Dice page copy
updated; unit tests for d4/d6/d8 + skip cases; e2e toggles Advantage and rolls a
d4 → 2d4kh1.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-06-08 10:18:57 +02:00
parent 04fa90e580
commit ffe24495b6
4 changed files with 32 additions and 12 deletions
+3 -3
View File
@@ -92,7 +92,7 @@ export function DicePage() {
variant={mode === 'advantage' ? 'primary' : 'secondary'}
aria-pressed={mode === 'advantage'}
onClick={() => toggleMode('advantage')}
title="Toggle advantage for d20 rolls"
title="Toggle advantage — rolls the next die twice, keep highest"
>
Advantage
</Button>
@@ -101,14 +101,14 @@ export function DicePage() {
variant={mode === 'disadvantage' ? 'primary' : 'secondary'}
aria-pressed={mode === 'disadvantage'}
onClick={() => toggleMode('disadvantage')}
title="Toggle disadvantage for d20 rolls"
title="Toggle disadvantage — rolls the next die twice, keep lowest"
>
Disadvantage
</Button>
</div>
{mode !== 'normal' && (
<p className="mt-2 text-xs text-accent">
{mode === 'advantage' ? 'Advantage' : 'Disadvantage'} is on d20 rolls use 2d20{mode === 'advantage' ? 'kh1' : 'kl1'}.
{mode === 'advantage' ? 'Advantage' : 'Disadvantage'} is on the next single die rolls twice, keeping the {mode === 'advantage' ? 'highest' : 'lowest'}.
</p>
)}