javalent / dice-roller

Inline dice rolling for Obsidian.md
272 stars 29 forks source link

🐞 Dice rolls with disadvantage are ignored when a modifier is present #311

Closed Pachtjuilaard closed 1 week ago

Pachtjuilaard commented 5 months ago

Check for existing bug reports before submitting.

Expected Behavior

The formula 1d20kl + 10 should give a range of results from 11 - 21

Current behaviour

The formula 1d20kl + 10 only shows the modifier as the end result (which is only 10). This doesn't happen when rolling with advantage. When hovering over the result, the output is shown as [d + 10]. So a die is being rolled, but the roll gets lost when showing the end result.

Reproduction

  1. Click any die in the Dice Tray.
  2. Click the Disadvantage button.
  3. Add any modifier.
  4. Roll the die.

Which Operating Systems are you using?

Obsidian Version Check

1.5.12 and 1.5.12

Plugin Version

10.5.0

Confirmation

Possible solution

No response

Pachtjuilaard commented 5 months ago

Additional info: I was rolling only one die. When rolling two dice, the plugin works as expected. So, when rolling one die and you keep the lowest, the single rolled result is regarded as the highest result and is dropped, leaving no dice rolled. So, this bug doesn't seem like a problem when actually used as intended (I mean, why roll one die with disadvantage?), but still a weird interaction nonetheless.

ThaddaeusWiedemer commented 4 months ago

I think you might be misunderstanding the kh and kl option. These options keep the highest or lowest die out of all rolled dice. Rolling with advantage/disadvantage as in DnD means rolling two dice and keeping the highest or lowest roll, i.e., dice: 2d20kl+5 rolls with disadvantage and works as expected, dice: 2d20kh+5 rolls with advantage.

I agree however that the behavior of these options when applied to a single die is unclear and could be documented.

Pachtjuilaard commented 3 months ago

I know how (dis-)advantage works, it's just that I'd like for 1d20kl1 actually keeps the lowest rolled die. Now it's just being discarded, making 1d20kl1 functionally the same as 0 while the plugin is still actually rolling the die.

If "roll 1d20 and keep the lowest result" actually kept the lowest rolled die, which is just the roll itself, the behaviour of the keep lowest/highest function would be more consistent. Now the plugin is just rolling a die and putting it away before really looking at the number rolled.