Skip to content

fix: cap keep/drop modifiers to the requested dice count - #8

Merged
darkliquid merged 1 commit into
masterfrom
fix/khcap-not-working
Oct 6, 2026
Merged

darkliquid merged 1 commit into
masterfrom
fix/khcap-not-working

Conversation

@darkliquid

Copy link
Copy Markdown
Owner

Summary

  • kh/kl/dh/dl now keep exactly the requested number of dice. Previously any value appearing more than once was kept in full, so 4d6kh3 rolling 6,2,2,2 kept all four dice (total 12) instead of three (total 10).
  • Rerolls were silently ignored after being extracted into a helper; the empty-check was inverted. This is corrected too.
  • Adds direct unit tests for the keep/drop logic and seeded spec regressions for the duplicate-boundary cases, and rebuilds docs/roll.wasm.

Fixes #7

💘 Generated with Crush

Keep-highest, keep-lowest, drop-highest and drop-lowest kept every
copy of a value that straddled the keep/drop boundary: the running
count of each kept value was never actually decremented, so a roll
like 6,2,2,2 under 4d6kh3 kept all four dice instead of three.

Rerolls were also silently skipped after being moved into a helper
because the empty-check was inverted. Both paths are corrected and
covered by direct unit tests plus seeded spec regressions.

Fixes #7

💘 Generated with Crush

Assisted-by: Crush:deepseek-v4.1-flash
@darkliquid
darkliquid merged commit 6dea9af into master Oct 6, 2026
1 check passed
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.

Keep Highest doesn't actually cap the number of dice

1 participant