RPG Dice RollerRPG Dice Roller
Home
Guide
API
  • Contributing
  • Code of Conduct
GitHub
Home
Guide
API
  • Contributing
  • Code of Conduct
GitHub
  • API

    • Introduction
    • ComparePoint
    • Description
    • DiceRoll
    • DiceRoller
    • RollGroup
  • dice

    • FudgeDice
    • PercentileDice
    • StandardDice
  • exceptions

    • CompareOperatorError
    • DataFormatError
    • DieActionValueError
    • NotationError
    • RequiredArgumentError
  • modifiers

    • ComparisonModifier
    • CriticalFailureModifier
    • CriticalSuccessModifier
    • DropModifier
    • ExplodeModifier
    • KeepModifier
    • MaxModifier
    • MinModifier
    • Modifier
    • ReRollModifier
    • SortingModifier
    • TargetModifier
    • UniqueModifier
    • modifier-flags
  • parser

    • Parser
  • results

    • ResultGroup
    • RollResult
    • RollResults
  • traits

    • HasDescription
  • utilities

    • ExportFormats
    • NumberGenerator
    • math
    • utils

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

  • 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
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

Edit this page
Last Updated: 07/02/2026, 21:45
Prev
SortingModifier
Next
UniqueModifier