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
+8
View File
@@ -24,6 +24,14 @@ test('rolling a skill from the sheet shows the roll tray', async ({ page }) => {
await expect(page.locator('text=/= \\d+/').first()).toBeVisible();
});
test('advantage toggle applies to any die, not just d20', async ({ page }) => {
await page.getByRole('link', { name: 'Dice' }).click();
await page.getByRole('button', { name: 'Advantage', exact: true }).click();
await page.getByRole('button', { name: 'd4', exact: true }).click();
// The rolled expression became 2d4kh1 (advantage on a d4)
await expect(page.getByText(/Rolled 2d4kh1/)).toBeVisible();
});
test('dice page: save and use a macro', async ({ page }) => {
await page.getByRole('link', { name: 'Dice' }).click();
await page.getByLabel('Dice expression').fill('2d6+3');