Class dice

A library used to roll and manipulate roguelike based dice

Info:

  • Copyright: 2013
  • License: MIT/X11
  • Author: Timothy Torres

Methods

dice:new (dice_notation[, minimum])
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
dice:setClassMin ([min])
Sets class minimum for dice module

Parameters:

  • min int Sets dice class minimum result boundaries (if nil, no minimum result) (optional)
dice:resetCache ()
Resets the cache for dice instances
dice:getNotation ()
The raw notation including all negatives

Returns:

    string
dice:getNum ()
Number of total dice

Returns:

    int
dice:getFaces ()
Number of total faces on a dice

Returns:

    int
dice:getBonus ()
Bonus to be added to the dice total

Returns:

    int
dice:getRerolls ()
Rerolls to be added to the dice

Returns:

    int
dice:getSets ()
Number of total dice sets

Returns:

    int
dice:getTotalBonus ()
Bonus to be added to all dice (if double bonus enabled) otherwise regular bonus

Returns:

    int
dice:getTotalRerolls ()
Rerolls to be added to all dice (if double reroll enabled) otherwise regular reroll

Returns:

    int
dice:isDoubleReroll ()
Determines if all dice are to be rerolled together or individually

Returns:

    bool
dice:isDoubleBonus ()
Determines if all dice are to apply a bonus together or individually

Returns:

    bool
dice:setMin ([min])
Sets dice minimum for instance

Parameters:

  • min int Sets dice instance minimum result boundaries (if nil, no minimum result) (optional)
dice:roll (self[, minimum])
Rolls the dice

Parameters:

  • self int, dice or str
  • minimum int (optional)

Metamethods

dice:__add (value)
Modifies bonus

Parameters:

  • value int

Returns:

    dice
dice:__sub (value)
Modifies bonus

Parameters:

  • value int

Returns:

    dice
dice:__mul (value)
Modifies number of dice

Parameters:

  • value int

Returns:

    dice
dice:__div (value)
Modifies amount of dice faces

Parameters:

  • value int

Returns:

    dice
dice:__pow (value)
Modifies rerolls

Parameters:

  • value int

Returns:

    dice
dice:__mod (value)
Modifies dice sets

Parameters:

  • value int

Returns:

    dice
dice:__tostring ()
Gets a formatted dice string in roguelike notation

Returns:

    string
dice:__concat (pluralism_notation)
Modifies whether reroll or bonus applies to individual dice or all of them

Parameters:

  • pluralism_notation str String must be one of the following operators - + ^ The operator may be double signed to indicate pluralism.

Returns:

    dice
generated by LDoc 1.4.3 Last updated 2017-07-06 21:00:14