javalent / dice-roller

Inline dice rolling for Obsidian.md
269 stars 28 forks source link

[Bug] Divsion operator does not work? #86

Closed namtrah closed 2 years ago

namtrah commented 2 years ago

Hi, I was trying to determine a group save using a simple division operator, like:

`dice: 4d20 / 4`

But it returned the following: (4d20 / 4) -> ([17, 4, 18, 16] / 4 -> 1 where 1 is definitely not the average.

Am I doing something wrong or is division not supported? How can one do simple group checks?

valentine195 commented 2 years ago

I think that this is actually a rounding issue. If it doesn't perfectly divide, it just turns into 1. Would you rather it round?

namtrah commented 2 years ago

Well, the result (17+4+18+16)/ 4 is definitely not 1, even without rounding. (small pointed joke)

That aside. I believe the D&D 5e RAW state that such rolls should be rounded up. So yes, please round.

namtrah commented 2 years ago

Or at least write out the value up to the decimal point. You could make an option to "round up/down or leave alone" to manage all types of TTRPG systems.