TargetModifier

TargetModifier ⇐ ComparisonModifier

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

new TargetModifier(successCP, [failureCP])

Create a TargetModifier instance.

Throws:

  • TypeError failure comparePoint must be instance of ComparePoint or null
ParamTypeDefaultDescription
successCPComparePointThe success comparison object
[failureCP]ComparePointThe failure comparison object

targetModifier.order : number

The default modifier execution order.

Kind: instance property of TargetModifier

targetModifier.failureComparePoint ⇒ ComparePoint | null

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
ParamType
comparePointComparePoint | null

targetModifier.name ⇒ string

The name of the modifier.

Kind: instance property of TargetModifier
Returns: string - 'target'

targetModifier.notation ⇒ string

The modifier's notation.

Kind: instance property of TargetModifier

targetModifier.successComparePoint ⇒ ComparePoint

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

ParamType
valueComparePoint

targetModifier.getStateValue(value) ⇒ number

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

ParamTypeDescription
valuenumberThe number to compare against

targetModifier.isFailure(value) ⇒ boolean

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

ParamTypeDescription
valuenumberThe number to compare against

targetModifier.isNeutral(value) ⇒ boolean

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

ParamTypeDescription
valuenumberThe number to compare against

targetModifier.isSuccess(value) ⇒ boolean

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

ParamTypeDescription
valuenumberThe number to compare against

targetModifier.run(results, _context) ⇒ RollResults

Run the modifier on the results.

Kind: instance method of TargetModifier
Returns: RollResults - The modified results

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

targetModifier.toJSON() ⇒ Object

Return an object for JSON serialising.

This is called automatically when JSON encoding the object.

Kind: instance method of TargetModifier