Open thomasdellaert opened 1 year ago
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
![Kobold-statblock1](https://github.com/javalent/dice-roller/assets/831154/35c6e9c1-88e9-43e4-8f78-2237d2e45a08)
Manually setting the hit dice also incorrectly computes a 9:
creature: Kobold
hit_dice: 2d6 - 2
(Note the formula is slightly different: `- 2` instead of `+ -2`)
![Kobold-statblock2](https://github.com/javalent/dice-roller/assets/831154/bde6da13-56bb-4c9f-ac77-5e7eb395b8f7)
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.
Check for existing bug reports before submitting.
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:
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?
Obsidian Version Check
1.3.7
Plugin Version
3.9.0
Confirmation
Possible solution
No response