Extends
Members
faces :number
- Source:
- Overrides:
The number of faces on the die
Type:
- number
formula
- Source:
- Overrides:
Return a standardized representation for the displayed formula associated with this DiceTerm
modifiers :Array.<string>
- Source:
- Overrides:
An Array of dice term modifiers which are applied
Type:
- Array.<string>
number :number
- Source:
- Overrides:
The number of dice of this term to roll, before modifiers are applied
Type:
- number
options :object
- Source:
- Overrides:
An object of additional options which modify the dice term
Type:
- object
results :Array.<object>
- Source:
- Overrides:
The array of dice term results which have been rolled
Type:
- Array.<object>
total :number|null
- Source:
- Overrides:
Return the total result of the DiceTerm if it has been evaluated
Type:
- number | null
values :Array.<number>
- Source:
- Overrides:
Return an array of rolled values which are still active within this term
Type:
- Array.<number>
Methods
(static) getResultLabel()
- Source:
alter(multiply, add) → {DiceTerm}
- Source:
- Overrides:
Alter the DiceTerm by adding or multiplying the number of dice which are rolled
Parameters:
Name | Type | Description |
---|---|---|
multiply |
number | A factor to multiply. Dice are multiplied before any additions. |
add |
number | A number of dice to add. Dice are added after multiplication. |
Returns:
The altered term
- Type
- DiceTerm
evaluate(minimizeopt, maximizeopt) → {DiceTerm}
- Source:
- Overrides:
Evaluate the roll term, populating the results Array.
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
minimize |
boolean |
<optional> |
Apply the minimum possible result for each roll. |
maximize |
boolean |
<optional> |
Apply the maximum possible result for each roll. |
Returns:
The evaluated dice term
- Type
- DiceTerm
roll(minimizeopt, maximizeopt) → {object}
- Source:
- Overrides:
Roll the DiceTerm by mapping a random uniform draw against the faces of the dice term.
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
minimize |
boolean |
<optional> |
Apply the minimum possible result instead of a random result. |
maximize |
boolean |
<optional> |
Apply the maximum possible result instead of a random result. |
Returns:
- Type
- object
toJSON() → {object}
- Source:
- Overrides:
Serialize the DiceTerm to a JSON string which allows it to be saved in the database or embedded in text. This method should return an object suitable for passing to the JSON.stringify function.
Returns:
- Type
- object