minimumparameter is rerolled and replaced by the new value. An option can allow the higher of the two values to be chosen instead. Differs from reroll() in that new values lower than
minimumare allowed, and are not rerolled indefinitely.
rerollOnce(times, sides, minimum) rerollOnce(times, sides, minimum, chooseHigher)
times- The number of times to roll the dice.
sides- The number of sides the dice possess.
minimum- The lowest number a dice rolled can return without being rerolled.
chooseHigher- Whether the original die may be preserved if it was higher than the rerolled value. Defaults to false.
[t: rerollOnce(2, 6, 3)]
Roll two six-sided dice, rerolling any dice rolled lower than 3, and choose the higher of the two values:
[t: rerollOnce(2, 6, 3, 1)]
Note that if multiple dice are rolled (
times > 1), each die is rolled in sequence, and immediately rerolled if necessary. For example:
[t: rerollOnce(2, 6, 3)] [getNewRolls()]
5 [2, 1, 2, 4]- the first die produced a 2, which was rerolled and replaced by a 1. The second die also produced a 2, and was rerolled and replaced by a 4. The total returned is then
chooseHigherwas set to true, the first 2 would not have been replaced by a lower value, so the total returned would instead have been
6for the same sequence of rolls.