maubot / dice

A maubot plugin that rolls dice.
GNU Affero General Public License v3.0
19 stars 8 forks source link

Include zero in dice roll results #6

Open eandersons opened 1 year ago

eandersons commented 1 year ago

In some cases zero is desirable in roll results.

I took a quick look at the code, and it seems that zero is never returned as a possible outcome (except for !roll d0 or !roll 3d0 where 0 is the only result).

I would like to try to implement this, but before that some things should be clarified. What would be the best way to explicitly instruct the !roll command to include zero as one of the possible dice roll outcomes? A few options come in my mind:

Personally I like the last the most.

I am not completely sure though how well any of these proposed options would comply with the rest of !roll's functionality.

tulir commented 1 year ago

Math is already supported: !roll 1d10 - 1

eandersons commented 1 year ago

This issue is not about math.

From what I have observed, !roll 10d9 or !roll 10d9 - 1 will not give a results set that includes zeros (for example: 10d9: 8 0 2 2 5 1 0 7 9 3) because the range always starts from 1, but sometimes zero is desirable as well.

tulir commented 1 year ago

Right, multiple dice with the show individual rolls option is a different case, all other cases would be about math