Module ROT.Dice
A module used to roll and manipulate roguelike based dice Based off the RL-Dice library at https://github.com/timothymtorres/RL-Dice
Functions
init (dice_notation[, minimum]) | Constructor that creates a new dice instance |
setMin (value) | Sets dice minimum result boundaries (if nil, no minimum result) |
getNum () | Get number of total dice |
getFaces () | Get number of total faces on a dice |
getBonus () | Get bonus to be added to the dice total |
getRerolls () | Get rerolls to be added to the dice |
getSets () | Get number of total dice sets |
getTotalBonus () | Get bonus to be added to all dice (if double bonus enabled) otherwise regular bonus |
getTotalRerolls () | Get rerolls to be added to all dice (if double reroll enabled) otherwise regular reroll |
isDoubleReroll () | Returns boolean that checks if all dice are to be rerolled together or individually |
isDoubleBonus () | Returns boolean that checks if all dice are to apply a bonus together or individually |
__add (value) | Modifies bonus |
__sub (value) | Modifies bonus |
__mul (value) | Modifies number of dice |
__div (value) | Modifies amount of dice faces |
__pow (value) | Modifies rerolls |
__mod (value) | Modifies dice sets |
__tostring () | Returns a formatted dice string in roguelike notation |
__concat (pluralism_notation) | Modifies whether reroll or bonus applies to individual dice or all of them (pluralism_notation string must be one of the following operators `- + ^` The operator may be double signed to indicate pluralism) |
roll (self[, minimum[, rng]]) | Rolls the dice |
Functions
- init (dice_notation[, minimum])
-
Constructor that creates a new dice instance
Parameters:
- dice_notation int or string Can be either a dice string, or int
- minimum int Sets dice instance roll's minimum result boundaries (optional)
Returns:
-
dice
- setMin (value)
-
Sets dice minimum result boundaries (if nil, no minimum result)
Parameters:
- value
- getNum ()
- Get number of total dice
- getFaces ()
- Get number of total faces on a dice
- getBonus ()
- Get bonus to be added to the dice total
- getRerolls ()
- Get rerolls to be added to the dice
- getSets ()
- Get number of total dice sets
- getTotalBonus ()
- Get bonus to be added to all dice (if double bonus enabled) otherwise regular bonus
- getTotalRerolls ()
- Get rerolls to be added to all dice (if double reroll enabled) otherwise regular reroll
- isDoubleReroll ()
- Returns boolean that checks if all dice are to be rerolled together or individually
- isDoubleBonus ()
- Returns boolean that checks if all dice are to apply a bonus together or individually
- __add (value)
-
Modifies bonus
Parameters:
- value
- __sub (value)
-
Modifies bonus
Parameters:
- value
- __mul (value)
-
Modifies number of dice
Parameters:
- value
- __div (value)
-
Modifies amount of dice faces
Parameters:
- value
- __pow (value)
-
Modifies rerolls
Parameters:
- value
- __mod (value)
-
Modifies dice sets
Parameters:
- value
- __tostring ()
- Returns a formatted dice string in roguelike notation
- __concat (pluralism_notation)
-
Modifies whether reroll or bonus applies to individual dice or all of them (pluralism_notation string must be one of the following operators `- + ^` The operator may be double signed to indicate pluralism)
Parameters:
- pluralism_notation
- roll (self[, minimum[, rng]])
-
Rolls the dice
Parameters:
- self int, dice or str
- minimum int (optional)
- rng
ROT.RNG
When called directly as ROT.Dice.roll, is used
in call to ROT.Dice.new. Not used when called on an instance of ROT.Dice.
i.e.: `ROT.Dice.roll('3d6', 1, rng) -- rng arg used`
`d = ROT.Dice:new('3d6', 1); d:roll(nil, rng) -- rng arg not used`
(optional)