# new YearZeroRoll(formula, dataopt, optionsopt)
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
formula |
string
|
The string formula to parse |
|
data |
Object
|
<optional> |
The data object against which to parse attributes within the formula |
game |
GameTypeString
|
<optional> |
The game used |
name |
string
|
<optional> |
The name of the roll |
maxPush |
number
|
<optional> |
The maximum number of times the roll can be pushed |
options |
Object
|
<optional> |
Additional data which is preserved in the database |
game |
GameTypeString
|
<optional> |
The game used |
name |
string
|
<optional> |
The name of the roll |
maxPush |
number
|
<optional> |
The maximum number of times the roll can be pushed |
yzur |
boolean
|
<optional> |
Forces the roll of a YearZeroRoll in Foundry |
Extends
- Roll
Members
Methods
# static create(formula, dataopt, optionsopt) → {YearZeroRoll}
A factory method which constructs a Roll instance using the default configured Roll class.
Parameters:
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
formula |
string
|
The formula used to create the Roll instance |
||
data |
Object
|
<optional> |
{} | The data object which provides component data for the formula |
options |
Object
|
<optional> |
{} | Additional options which modify or describe this Roll |
- See:
-
- (FoundryVTT) Roll.create
The constructed Roll instance
# static createFromDiceQuantities()
- Deprecated:
- Yes
# static forge(dice, dataopt, optionsopt) → {YearZeroRoll}
Generates a roll based on the number of dice.
Parameters:
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
dice |
TermBlok
|
Array.<TermBlok>
|
An array of objects that define the dice |
||
data |
Object
|
<optional> |
{} | Additional data to forge the dice |
title |
string
|
<optional> |
The name of the roll |
|
yzGame |
GameTypeString
|
<optional> |
The game used |
|
maxPush |
number
|
<optional> |
1 | The maximum number of pushes |
options |
Object
|
<optional> |
Additional data which is preserved in the database |
# static generateTermFormula(number, term, flavoropt, maxPushopt) → {string}
Creates a roll formula based on number of dice.
Parameters:
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
number |
number
|
The quantity of those dice |
||
term |
DieDeno
|
The denomination of the dice to create |
||
flavor |
string
|
<optional> |
(optional) Any flavor tied to those dice |
|
maxPush |
number
|
<optional> |
null | (optional) Special maxPush modifier but only for those dice |
string
# async addDice(qty, type, rangeopt, valueopt, optionsopt) → {Promise.<YearZeroRoll>}
Adds a number of dice to the roll. Note: If a negative quantity is passed, instead it removes that many dice.
Parameters:
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
qty |
number
|
The quantity to add |
||
type |
DieTermString
|
The type of dice to add |
||
range |
number
|
<optional> |
6 | The number of faces of the die |
value |
number
|
<optional> |
The predefined value for the new dice |
|
options |
Object
|
<optional> |
Additional options that modify the term |
This roll
Promise.<YearZeroRoll>
# count(type, seedopt, comparisonopt) → {number}
Counts the values of a certain type in the roll.
If seed
is omitted, counts all the dice of a certain type.
Parameters:
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
type |
DieTypeString
|
The type of the die |
||
seed |
number
|
<optional> |
null | The value to search, if any |
comparison |
string
|
<optional> |
'=' | The comparison to use against the seed: |
Total count
number
# async getRollInfos(templateopt) → {Promise.<string>}
Renders the infos of a Year Zero roll.
Parameters:
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
template |
string
|
<optional> |
null | The path to the template |
Promise.<string>
# getTerms(search) → {Array.<YearZeroDie>|Array.<DiceTerm>}
Gets all the dice terms of a certain type or that match an object of values.
Parameters:
Name | Type | Description |
---|---|---|
search |
DieTypeString
|
Object
|
Die type to search or an object with comparison values |
Array.<YearZeroDie>
|
Array.<DiceTerm>
Example
// Gets all terms with the type "skill".
let terms = getTerms('skill');
// Gets all terms that have exactly these specifications (it follows the structure of a DiceTerm).
let terms = getTerms({
type: 'skill',
number: 1,
faces: 6,
options: {
flavor: 'Attack',
// ...etc...
},
results: {
result: 3,
active: true,
// ...etc...
},
});
# async getTooltip() → {Promise.<string>}
Renders the tooltip HTML for a Roll instance.
- See:
-
- (FoundryVTT) Roll.getTooltip
The rendered HTML tooltip as a string
Promise.<string>
# async modify(mod) → {Promise.<YearZeroRoll>}
Applies a difficulty modifier to the roll.
Parameters:
Name | Type | Default | Description |
---|---|---|---|
mod |
number
|
0 | Difficulty modifier (bonus or malus) |
This roll, modified
Promise.<YearZeroRoll>
# async push(optionsopt) → {Promise.<YearZeroRoll>}
Pushes the roll, following the YZ rules.
Parameters:
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
options |
Object
|
<optional> |
{} | Options which inform how the Roll is evaluated |
The roll instance, pushed
Promise.<YearZeroRoll>
# removeDice(qty, search, discardopt, disableopt) → {YearZeroRoll}
Removes a number of dice from the roll.
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
qty |
number
|
The quantity to remove |
|
search |
DieTypeString
|
Object
|
The type of dice to remove, or an object of values for comparison |
|
discard |
boolean
|
<optional> |
Whether the term should be marked as "discarded" instead of removed |
disable |
boolean
|
<optional> |
Whether the term should be marked as "active: false" instead of removed |
This roll
# async render(chatOptionsopt) → {Promise.<string>}
Renders a Roll instance to HTML.
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
chatOptions |
Object
|
<optional> |
An object configuring the behavior of the resulting chat message, which is also passed to the template |
user |
string
|
<optional> |
The ID of the user that renders the roll |
flavor |
string
|
<optional> |
The flavor of the message |
template |
string
|
<optional> |
The path to the template that renders the roll |
infosTemplate |
string
|
<optional> |
✨ The path to the template that renders the infos box under the roll tooltip |
blind |
boolean
|
<optional> |
Whether this is a blind roll |
isPrivate |
boolean
|
<optional> |
Whether this roll is private
(displays sensitive infos with |
- See:
-
- ✨ Extra features added by the override.
- (FoundryVTT) Roll.render
Promise.<string>
# async toMessage(messageDataopt, optionsopt) → {Promise.<(ChatMessage|ChatMessageData)>}
Transform a Roll instance into a ChatMessage, displaying the roll result. This function can either create the ChatMessage directly, or return the data object that will be used to create.
Parameters:
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
messageData |
Object
|
<optional> |
The data object to use when creating the message |
|
user |
string
|
<optional> |
The ID of the user that sends the message |
|
speaker |
Object
|
<optional> |
✨ The identified speaker data |
|
content |
string
|
<optional> |
The HTML content of the message,
overriden by the |
|
type |
number
|
<optional> |
0 | The type to use for the message from |
sound |
string
|
<optional> |
The path to the sound played with the message (WAV format) |
|
options |
options
|
<optional> |
Additional options which modify the created message. |
|
rollMode |
string
|
<optional> |
The template roll mode to use for the message from CONFIG.Dice.rollModes |
|
create |
boolean
|
<optional> |
true | Whether to automatically create the chat message, or only return the prepared chatData object. |
- See:
-
- ✨ Extra features added by the override.
- (FoundryVTT) Roll.toMessage
A promise which resolves to the created ChatMessage entity if create is true or the Object of prepared chatData otherwise.
Promise.<(ChatMessage|ChatMessageData)>