spetzel2020/quick-encounters

Support more than the "standard 7" dice; best would be to support all Foundry roll formulas

tuirgin opened this issue · 5 comments

Great module that goes some distance to bridge the gap with Fantasy Ground's encounters system!

However, it seems like maybe only the "standard 7" dice are recognized. The following rolls are rejected: 1d3, 1d5, 1d7. And I've confirmed that I can't do workarounds like {1d4-1}min1 or ceil(1d6/2). It'd be nice if the quick encounter input.num-actors supported all Foundry roll formulas. Barring that, at least any arbitrary XdY formulation would be nice. 1d3 isn't uncommon in old school adventures—I've run into them prepping Stonehell, for example—and DCC has its funky array of non-platonic dice.

Regardless, this module is a lot of help when I need it. So, thanks!

image

getNumActors only validates using Roll.validate() which should accept all Foundry legal rolls. That suggests that roll formulae extracted from Journal entries will work, but that some extra validation is being done on ones entered through the QE dialog.

Correction:

  • QESheet.js#_updateObject() validates using dieRollReg.test() which only accepts the format ndx+/-y. It seems this could be changed easily to Roll.validate()
  • In QuickEncounter.js#extractFromEmbedded() we do multiplier = prevSibling.textContent.match(dieRollReg); which searches for the strings in dierollReg which only allows certain formats. However, if a string is not recognized, it is passed through unchanged so, it is actually accepting more complex dice rolls entered in Journal Entries as [[/r 1d3]]
  • However, if those extracted formulae are changed, then the more restrictive validation is applied.

Fixed in 1.2.2a (not yet released)
However, the edit field in the QEDialog needs to be expanded to allow these more complicated formulae.
Also, nonsense entries are being accepted so need to check what error conditions Roll.validate() throws

In 1.2.2b (not yet released): Expanded QEDialog field to accommodate larger formulas
Seems to be catching simple garbage with an pop-up error from Foundry

Released in 1.2.2.
Should now support all Foundry legal roll formulas.