Qdr /


Qdr.Exp History

Hide minor edits - Show changes to output

Added lines 1-46:
(:title Exploding/Collapsing:)
(:category: Function :)
(:Summary: Make an exploding/collapsing roll. :)
(:format: @@exp(roll[, upperTarget[, lowerTarget[, upperLimit[, lowerLimit]]]])@@ :)
(:sinceVersion: 1.2.0 :)
(:lastVersion: 2.0.0 :)


! Usage
:Format: {$:format}

:Parameters: \
@@roll@@: A formula representing the dice to explode or collapse. Must be an indeterministic formula.\\
@@upperTarget@@: Optional. The value to reach to obtain an explosion. If not specified is equal to the maximum of ''roll''.\\
@@lowerTarget@@: Optional. The value not to be exceeded to obtain a collapse. If not specified is equal to the minimum of ''roll''.\\
@@upperLimit@@: Optional. The maximum number of allowed explosions. Set to ''0'' to make explosions limitless. If not specified is set to ''0''.\\
@@lowerLimit@@: Optional. The maximum number of allowed collapses. Set to ''0'' to make collapses limitless. If not specified is set to ''0''.

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

! Description
Make an exploding/collapsing roll.

The value of ''roll'' is evaluated. If its value is greater or equal to ''upperTarget'' the die explode: ''roll'' is evaluated again and added to the previous result.

On the other hands, if the value evaluated is lower or equal to ''lowerTarget'', the die collapse: ''roll'' is evaluated again and subtracted from the previous result.

This goes on as long as the number of explosions is less than ''upperLimit'' and the number of collapses is less than ''lowerLimit''.

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

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

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