KeepModifier
Modifier
KeepModifier ⇐ A KeepModifier
will "keep" dice from a roll, dropping (Remove from total calculations) all others.
Kind: global class
Extends: Modifier
See: DropModifier for the opposite of this modifier
- KeepModifier ⇐
Modifier
- new KeepModifier([end], [qty])
- .order :
number
- .end ⇒
string
- .end
- .name ⇒
string
- .notation ⇒
string
- .qty ⇒
number
- .qty
- .rangeToDrop(_results) ⇒
Array.<number>
- .run(results, _context) ⇒
ResultGroup
|RollResults
- .toJSON() ⇒
Object
new KeepModifier([end], [qty])
Create a KeepModifier
instance
Throws:
RangeError
End must be one of 'h' or 'l'TypeError
qty must be a positive integer
Param | Type | Default | Description |
---|---|---|---|
[end] | string | "h" | Either `h |
[qty] | number | 1 | The amount dice to keep |
number
keepModifier.order : The default modifier execution order.
Kind: instance property of KeepModifier
string
keepModifier.end ⇒ Which end the rolls should be kept ("h" = High, "l" = Low).
Kind: instance property of KeepModifier
Returns: string
- 'h' or 'l'
keepModifier.end
Set which end the rolls should be kept ("h" = High, "l" = Low).
Kind: instance property of KeepModifier
Throws:
RangeError
End must be one of 'h' or 'l'
Param | Type | Description |
---|---|---|
value | string | Either 'h' or 'l' |
string
keepModifier.name ⇒ The name of the modifier.
Kind: instance property of KeepModifier
Returns: string
- 'keep-l' or 'keep-h'
string
keepModifier.notation ⇒ The modifier's notation.
Kind: instance property of KeepModifier
number
keepModifier.qty ⇒ The quantity of dice that should be kept.
Kind: instance property of KeepModifier
keepModifier.qty
Set the quantity of dice that should be kept.
Kind: instance property of KeepModifier
Throws:
TypeError
qty must be a positive finite integer
Param | Type |
---|---|
value | number |
Array.<number>
keepModifier.rangeToDrop(_results) ⇒ Determine the start and end (end exclusive) range of rolls to drop.
Kind: instance method of KeepModifier
Returns: Array.<number>
- The min / max range to drop
Param | Type | Description |
---|---|---|
_results | RollResults | The results to drop from |
ResultGroup
| RollResults
keepModifier.run(results, _context) ⇒ Run the modifier on the results.
Kind: instance method of KeepModifier
Returns: ResultGroup
| RollResults
- The modified results
Param | Type | Description |
---|---|---|
results | ResultGroup | RollResults | The results to run the modifier against |
_context | StandardDice | RollGroup | The object that the modifier is attached to |
Object
keepModifier.toJSON() ⇒ Return an object for JSON serialising.
This is called automatically when JSON encoding the object.
Kind: instance method of KeepModifier