TargetModifier
ComparisonModifier
TargetModifier ⇐ A TargetModifier
determines whether rolls are classed as a success, failure, or neutral.
This modifies the roll values, depending on the state;
success = 1
, failure = -1
, neutral = 0
.
Kind: global class
Extends: ComparisonModifier
- TargetModifier ⇐
ComparisonModifier
- new TargetModifier(successCP, [failureCP])
- .order :
number
- .failureComparePoint ⇒
ComparePoint
|null
- .failureComparePoint
- .name ⇒
string
- .notation ⇒
string
- .successComparePoint ⇒
ComparePoint
- .successComparePoint
- .getStateValue(value) ⇒
number
- .isFailure(value) ⇒
boolean
- .isNeutral(value) ⇒
boolean
- .isSuccess(value) ⇒
boolean
- .run(results, _context) ⇒
RollResults
- .toJSON() ⇒
Object
new TargetModifier(successCP, [failureCP])
Create a TargetModifier
instance.
Throws:
TypeError
failure comparePoint must be instance of ComparePoint or null
Param | Type | Default | Description |
---|---|---|---|
successCP | ComparePoint | The success comparison object | |
[failureCP] | ComparePoint |
| The failure comparison object |
number
targetModifier.order : The default modifier execution order.
Kind: instance property of TargetModifier
ComparePoint
| null
targetModifier.failureComparePoint ⇒ The failure compare point for the modifier
Kind: instance property of TargetModifier
targetModifier.failureComparePoint
Set the failure compare point
Kind: instance property of TargetModifier
Throws:
TypeError
failure comparePoint must be instance of ComparePoint or null
Param | Type |
---|---|
comparePoint | ComparePoint | null |
string
targetModifier.name ⇒ The name of the modifier.
Kind: instance property of TargetModifier
Returns: string
- 'target'
string
targetModifier.notation ⇒ The modifier's notation.
Kind: instance property of TargetModifier
ComparePoint
targetModifier.successComparePoint ⇒ The success compare point for the modifier
Kind: instance property of TargetModifier
targetModifier.successComparePoint
Set the success compare point for the modifier
Kind: instance property of TargetModifier
Param | Type |
---|---|
value | ComparePoint |
number
targetModifier.getStateValue(value) ⇒ Check if the value is a success/failure/neither and return the corresponding state value.
Kind: instance method of TargetModifier
Returns: number
- success = 1
, failure = -1
, neutral = 0
Param | Type | Description |
---|---|---|
value | number | The number to compare against |
boolean
targetModifier.isFailure(value) ⇒ Check if the value
matches the failure compare point.
A response of false
does NOT indicate a success. A value is a success ONLY if it passes the success compare point. A value could be neither a failure nor a success.
Kind: instance method of TargetModifier
Param | Type | Description |
---|---|---|
value | number | The number to compare against |
boolean
targetModifier.isNeutral(value) ⇒ Check if the value
is neither a success nor a failure.
Kind: instance method of TargetModifier
Returns: boolean
- true
if the value doesn't match the success and failure compare points
Param | Type | Description |
---|---|---|
value | number | The number to compare against |
boolean
targetModifier.isSuccess(value) ⇒ Check if the value
matches the success compare point.
A response of false
does NOT indicate a failure. A value is a failure ONLY if it passes the failure compare point. A value could be neither a failure nor a success.
Kind: instance method of TargetModifier
Param | Type | Description |
---|---|---|
value | number | The number to compare against |
RollResults
targetModifier.run(results, _context) ⇒ Run the modifier on the results.
Kind: instance method of TargetModifier
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
targetModifier.toJSON() ⇒ Return an object for JSON serialising.
This is called automatically when JSON encoding the object.
Kind: instance method of TargetModifier