Skip to content

feat(parse): reroll modifiers (r/ro) with chained compare points - #25

Merged
puradox merged 2 commits into
mainfrom
roll20-notation-feature-gaps
Jul 19, 2026
Merged

feat(parse): reroll modifiers (r/ro) with chained compare points#25
puradox merged 2 commits into
mainfrom
roll20-notation-feature-gaps

Conversation

@puradox

@puradox puradox commented Jul 19, 2026

Copy link
Copy Markdown
Owner

Adds Roll20-style reroll modifiers: r<CP> rerolls a matching die until it clears and ro<CP> rerolls once, with bare-number / < / > / = compare points and chaining (6d6r2r4r6). Reroll is decided up front — before explode → keep/drop → multiply — through a single draw_with_reroll helper shared by the animated arena, the headless evaluate, and the stats sampler so the rule can't drift, and discarded faces show in the -v/--json breakdown while the arena only ever shows the survivor. A recurring reroll that would match every face is rejected at parse time (ro of the same shape is allowed since it always terminates), and the README plus the help overlay document reroll after exploding, ordered by most common syntax. Covered by new parser/evaluator/CLI tests alongside the existing suite, with cargo fmt and clippy -D warnings clean.

🤖 Generated with Claude Code

puradox and others added 2 commits July 18, 2026 18:55
Reroll (`r<CP>`) redraws a die whose face matches a compare point until it
clears; `ro<CP>` redraws once. A bare number means equality (`r1` = `r=1`),
and `<`/`>`/`=` work too. Chain compare points to reroll several faces
(`6d6r2r4r6`). A recurring reroll that would match every face is rejected;
`ro` of the same shape is allowed since it always terminates.

Reroll is decided up front, before explode/keep/drop/multiply, through a
single `draw_with_reroll` helper shared by the animated path, the headless
`evaluate`, and the stats sampler, so the rule can't drift. Discarded faces
ride along in `OutcomeDie.rerolled` for the `-v`/`--json` breakdown; the arena
only ever shows the survivor.

Docs (README, help overlay, AGENT.md, CONTRIBUTING.md) updated for the new
reroll -> explode -> keep/drop -> multiply order.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
… row

Order the notation reference by most common syntax — the Reroll section now
follows Exploding in both the README and the help overlay. Restore the standalone
`2d20kl1` disadvantage row that had been folded into the advantage line, trimming
the redundant Separators hint so the help overlay still fits its 28-row budget.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@puradox
puradox merged commit c2224dd into main Jul 19, 2026
2 checks passed
@puradox
puradox deleted the roll20-notation-feature-gaps branch July 19, 2026 02:14
@puradox puradox mentioned this pull request Jul 19, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant