Qdr /

Exploding

Qdr.ExpUp History

Hide minor edits - Show changes to output

Added lines 1-44:
(:title Exploding:)
(:category: Function :)
(:Summary: Makes an exploding roll. :)
(:format: @@expUp(roll[, target[, newRoll[, newTarget[, limit]]]])@@ :)
(:sinceVersion: 1.2.0 :)
(:lastVersion: 2.0.0 :)


{$:Summary}

! Usage
:Format: {$:format}

:Parameters: \
@@roll@@: A formula representing the dice to roll. Must be an indeterministic formula.\\
@@target@@: Optional. The value to reach to obtain an explosion. If not specified is equal to the maximum of ''roll''.\\
@@newRoll@@: Optional. The formula representing the dice to roll after an explosion. If not specified is equal to ''roll''.\\
@@newTarget@@: Optional. The value to reach to obtain an explosion from newRoll. If not specified is equal to the maximum of ''newRoll''.\\
@@limit@@: Optional. The maximum number of explosions. Set to 0 to make explosions limitless. If not specified is set to 0.

:Returns: The value of ''roll'', eventually exploded. Read the description for further details.

! Description
Makes an exploding roll. In such rolls if the outcome is high enough the die is rolled again and the result is added to the previous.

The value of ''roll'' is evaluated once. If its value is greater or equal to ''target'', ''newRoll'' is evaluated and added to the previous result.

As long as the result of ''newRoll'' is greater or equal to ''newTarget'', ''newRoll'' is evaluated again (for a maximum of ''limit'' times) and added to the previous result.

To avoid infinite loops, at least one outcome out of 3 of ''roll'' and ''newRoll'' should not explode, otherwise an error is generated and the function is not computed.

! Examples
The formula @@expUp(1d10)@@ is the same as @@expUp(1d10, 10, 1d10, 10, 0)@@.\\
Some results generated by @@expUp(1d10, 10, 1d10-1, 9, 0)@@:\\
[8] = 8\\
[10»3] = 13 (each "»" denotes an extra roll)\\
[1»7] = -6\\
[10»9»6] = 25\\
[10»0] = 10\\
[10»9»9»6] = 34

! History
Supported since Quick Dice Roller {$:sinceVersion}\\
Optional parameters available since Quick Dice Roller {$:lastVersion}
Page last modified on October 06, 2014, at 04:19 PM