KeepModifier

KeepModifier ⇐ Modifier

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

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
ParamTypeDefaultDescription
[end]string"h"Either `h
[qty]number1The amount dice to keep

keepModifier.order : number

The default modifier execution order.

Kind: instance property of KeepModifier

keepModifier.end ⇒ string

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'
ParamTypeDescription
valuestringEither 'h' or 'l'

keepModifier.name ⇒ string

The name of the modifier.

Kind: instance property of KeepModifier
Returns: string - 'keep-l' or 'keep-h'

keepModifier.notation ⇒ string

The modifier's notation.

Kind: instance property of KeepModifier

keepModifier.qty ⇒ number

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
ParamType
valuenumber

keepModifier.rangeToDrop(_results) ⇒ Array.<number>

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

ParamTypeDescription
_resultsRollResultsThe results to drop from

keepModifier.run(results, _context) ⇒ ResultGroup | RollResults

Run the modifier on the results.

Kind: instance method of KeepModifier
Returns: ResultGroup | RollResults - The modified results

ParamTypeDescription
resultsResultGroup | RollResultsThe results to run the modifier against
_contextStandardDice | RollGroupThe object that the modifier is attached to

keepModifier.toJSON() ⇒ Object

Return an object for JSON serialising.

This is called automatically when JSON encoding the object.

Kind: instance method of KeepModifier