feat(parse): reroll modifiers (r/ro) with chained compare points - #25
Merged
Conversation
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>
Merged
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Adds Roll20-style reroll modifiers:
r<CP>rerolls a matching die until it clears andro<CP>rerolls once, with bare-number /</>/=compare points and chaining (6d6r2r4r6). Reroll is decided up front — before explode → keep/drop → multiply — through a singledraw_with_rerollhelper shared by the animated arena, the headlessevaluate, and the stats sampler so the rule can't drift, and discarded faces show in the-v/--jsonbreakdown while the arena only ever shows the survivor. A recurring reroll that would match every face is rejected at parse time (roof 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, withcargo fmtandclippy -D warningsclean.🤖 Generated with Claude Code