obsidian-dice-roller
obsidian-dice-roller copied to clipboard
All operators are treated as addition when computing dice roll averages
Check for existing bug reports before submitting.
- [X] I searched for existing Bug Reports and found no similar reports.
Expected Behavior
When displaying dice rolls in the statblock, the average is computed to the left of the dice icon and formula. Averages should look like:
- 4d6+5 = 19
- 4d6-5 = 9
- 4d6*5 = 70
- 4d6/5 = 2(.8)
- (4d6+1)/5 = 3
- (4d6+1)-5 = 10
- (4d6+1)*5 = 75
Current behaviour
When multiplication is involved in the dice formula, the average value is computed as if the multiplication is addition.
So rather than the average of ((3D6+30)*5) being computed as (10(.5)+30)*5 = 200, it is computed as (10(.5)+30)+5 = 45(.5)
I've replicated this with division and subtraction as well, and confirmed that the behavior doesn't occur in Dice Roller by itself (I actually don't know how to get dice roller to display averages at all).
Clicking on the dice to roll them computes the total correctly, as expected.
Reproduction
Launch obsidian sandbox, and install Dice Roller and Fantasy Statblocks In a statblock, define a formula involving an operation that doesn't include addition
Which Operating Systems are you using?
- [ ] Android
- [ ] iPhone/iPad
- [ ] Linux
- [X] macOS
- [ ] Windows
Obsidian Version Check
1.3.7
Plugin Version
3.9.0
Confirmation
- [x] I have disabled all other plugins and the issue still persists.
Possible solution
No response
I've replicated this with division and subtraction as well, and confirmed that the behavior doesn't occur in Dice Roller by itself (I actually don't know how to get dice roller to display averages at all).
Append the |avg
flag
I can confirm I am seeing the same issue on Obsidian 1.4.16 on iOS and macOS with dice roller 10.4.3 and fantasty-statblocks 3.16.3.
This issue appears to only present inside the statblock
block. For example, this correctly computes a 5:
`dice: 2d6 - 2|avg`
But the Kobold (which has 2d6 - 2
for hit dice), incorrectly computes a 9:
```statblock
creature: Kobold
```
Manually setting the hit dice also incorrectly computes a 9:
```statblock
creature: Kobold
hit_dice: 2d6 - 2
```
(Note the formula is slightly different: - 2
instead of + -2
)
Given all this, it might actually be an issue with fantasy-statblocks instead of dice roller. Unsure though. Thoughts, @valentine195?
One more thing: This only appears to affect the initial average value. All dice rolls made on the statblock appear to use other operators correctly.