RPTools / maptool

Virtual Tabletop for playing roleplaying games with remote players or face to face.
http://rptools.net
GNU Affero General Public License v3.0
788 stars 259 forks source link

[Feature]: Extend dice expression XdYe and related dice function explode() #4397

Open Baaaaaz opened 10 months ago

Baaaaaz commented 10 months ago

Describe the Problem

The dice expression XdYe and related dice function explode() only explode when a number is rolled equal to the number of sides on the dice, however some games systems explode dice on a certain condition (e.g. certain d100 game systems have a 'high open-ended' roll which explode on a 96-100) which MT does not natively support.

The Solution you'd like

To be able to specify a conditional when a dice explodes. It would simplify the MTscript needed to implement the three general open-ended roll types: high open-ended roll, low open-ended roll, and open-ended roll; and could even be a stepping stone towards them in a future request.

Alternatives that you've considered.

  1. Create a completely new and separate dice expression/function for this instead of adjusting the existing XdYe / explode().
  2. Amending similar exploding expressions/functions XdYo / openTest() and XdYesT / explodingSuccess(). These could be amended for consistency.
  3. Provide native dice expression/support for all generalised open-ended roll types, namely: high open-ended roll, low open-ended roll, and open-ended roll (which is both a high and low open-ended roll). Low-ended rolls and open-ended rolls get a bit more complex and additional guardrails needed, but are based on conditional explosions (or conditional implosions!) and could be the subject of future request following on from this one. Also, as far as I am aware open-ended roll types in these game systems only use a single dice for the initial roll, so results would need to be batched or repeated somehow if the initial dice request X/times was > 1.
  4. Provide native dice expression/support for specific game system open-ended roll types, noting that some different games systems refer to some open-ended roll types differently which needs to be unpicked/analysed a bit.

Additional Context

Examples of some games systems which use open-ended rolls are:

Generally there are three types of open-ended rolls used by these games systems, with each game system employing one or more open-ended types:

N.B. RM Unified denotes open-ended rolls as d100OE. Lightmaster refers to "open-ended rolls" as "extended rolls" and denotes them as 1E20.

Example MTscript of an open-ended d20 roll currently possible:

[h: "<!-- 1d20 extended roll (1E20)-->"]
[h: sides = 20]
[h: roll = roll(1, sides)]
[h, if(roll == 1): roll = roll - explode(1, sides)]
[h, if(roll == sides): roll = roll + explode(1, sides)]
[h: broadcast(strFormat("* %s rolls 1d%soe => <span title='%s'>%s</span>", getPlayerName(), sides, getRolled(), roll))]

Example MTscript of an open-ended d100 roll not currently possible, but would be enabled by extending the explode() dice function in this feature request.

[h: "<!-- 1d100 open-ended roll (e.g. RM 1d100OE)-->"]
[h: sides = 100]
[h: implodeCondition = 5]
[h: explodeCondition = 96]
[h: roll = roll(1, sides)]
[h, if(roll <= implodeCondition): roll = roll - explode(1, sides, explodeCondition)]
[h, if(roll >= explodeCondition): roll = roll + explode(1, sides, explodeCondition)]
[h: broadcast(strFormat("* %s rolls 1d%soe => <span title='%s'>%s</span>", getPlayerName(), sides, getRolled(), roll))]
Baaaaaz commented 10 months ago

Noting that conditional exploding dice is also mentioned as part of a larger dice roller parser change here #244

bubblobill commented 10 months ago

I seem to recall that Cyberspace had open ended rolls in both directions. Any roll >= 96 roll again and add to total, roll <= 4 and it was roll again and subtract. So you rolling 03, 99, 99, 99, 14 became 03 - 00(-97) - 00(-197) - 99(-296) - 14(-310).

Baaaaaz commented 10 months ago

I seem to recall that Cyberspace had open ended rolls in both directions. Any roll >= 96 roll again and add to total, roll <= 4 and it was roll again and subtract. So you rolling 03, 99, 99, 99, 14 became 03 - 00(-97) - 00(-197) - 99(-296) - 14(-310).

Cyberpsace and its predecessor Space Master also came from ICE's rpg stables, though I never played those and do not have the rule books to determine which flavour of open-ended goodness they favoured so thanks for the example.

Baaaaaz commented 8 months ago

https://github.com/RPTools/maptool/pull/4644 now seems to force this feature request down an alternative solution route (most likely a new dice function/expression?) or will just have to wait for https://github.com/RPTools/maptool/issues/244 if that ever sees the light of day if people other than myself want native support for this!