Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Drop highest/lowest (X/x) operator returns sum of dropped dice as result rather than sum of kept dice #11

Open
jeremy-w opened this issue Apr 19, 2024 · 0 comments

Comments

@jeremy-w
Copy link

The section involved is:

results.append(sum(group_result[:num_to_drop]))
roll = ','.join([str(i) for i in group_result[num_to_drop:]]) + ' ~~ ' # Same as above.
roll += ','.join([str(i) for i in group_result[:num_to_drop]])

You can see it summing the rolls from index 0 up to num_to_drop and adding that to results. But those are the dropped dice, not the kept ones.

Example output for rolling 6d6 and dropping the lowest 2:

>>> rolldice.roll_dice('6d6x2')
(3, '[2,2,2,4 ~~ 1,2]')

It dropped 1 and 2, and the result shown is 3, even though it kept 4 dice summing to 10.

Expected output thus would have been:

>>> rolldice.roll_dice('6d6x2')
(10, '[2,2,2,4 ~~ 1,2]')
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

No branches or pull requests

1 participant