SortingModifier
ComparisonModifier
SortingModifier ⇐ A SortingModifier
sorts roll results by their value, either ascending or descending.
Kind: global class
Extends: ComparisonModifier
- SortingModifier ⇐
ComparisonModifier
- new SortingModifier([direction])
- .order :
number
- .direction ⇒
string
- .direction
- .name ⇒
string
- .notation ⇒
string
- .run(results, _context) ⇒
RollResults
- .toJSON() ⇒
Object
new SortingModifier([direction])
Create a SortingModifier
instance.
Throws:
RangeError
Direction must be 'a' or 'd'
Param | Type | Default | Description |
---|---|---|---|
[direction] | string | "a" | The direction to sort in; 'a' (Ascending) or 'd' (Descending) |
number
sortingModifier.order : The default modifier execution order.
Kind: instance property of SortingModifier
string
sortingModifier.direction ⇒ The sort direction.
Kind: instance property of SortingModifier
Returns: string
- Either 'a' or 'd'
sortingModifier.direction
Set the sort direction.
Kind: instance property of SortingModifier
Throws:
RangeError
Direction must be 'a' or 'd'
Param | Type | Description |
---|---|---|
value | string | Either 'a' (Ascending) or 'd' (Descending) |
string
sortingModifier.name ⇒ The name of the modifier.
Kind: instance property of SortingModifier
Returns: string
- 'sorting'
string
sortingModifier.notation ⇒ The modifier's notation.
Kind: instance property of SortingModifier
RollResults
sortingModifier.run(results, _context) ⇒ Run the modifier on the results.
Kind: instance method of SortingModifier
Returns: RollResults
- The modified results
Param | Type | Description |
---|---|---|
results | RollResults | The results to run the modifier against |
_context | StandardDice | RollGroup | The object that the modifier is attached to |
Object
sortingModifier.toJSON() ⇒ Return an object for JSON serialising.
This is called automatically when JSON encoding the object.
Kind: instance method of SortingModifier