saif-ellafi / play-by-the-writing

Play by the Writing is a bundle of scripts for Espanso, written in python to expand SOLO RPG rulesets as you write
Apache License 2.0
24 stars 6 forks source link

Roll dice with drop lowest outputs dropped die as sum #12

Open jeremy-w opened 7 months ago

jeremy-w commented 7 months ago

Reported in Discord:

4d6x: [2,2,6 ~~ 1] = 1 (I'd expect 10 here, as I want it to drop the lowest, not tell me the number it dropped)

4d6X: [4,3,3 ~~ 6] = 6 (here I'd expect it to also print 10, having dropped the highest, not tell me the one it dropped)

4d6: [6,6,1,3] = 16 (gives me the total I was expecting)

And no, I didn't hit delete 🙂

jeremy-w commented 7 months ago

pretty sure this is a bug in the dice lib itself. I think they copy-pasted the K/k keep logic a bit too closely, and are summing the wrong cluster of dice for the X/x drop handling. I'll see about filing a bug and then later a PR as time allows. recommend using keep as a workaround in the meantime.

jeremy-w commented 7 months ago

Filed https://github.com/fionafibration/py-rolldice/issues/11. This looks like a one-line fix, so I'll see about throwing up a PR later this weekend.

jeremy-w commented 7 months ago

PR opened: https://github.com/fionafibration/py-rolldice/pull/12