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

StandardDice

StandardDice

Represents a standard numerical die.

Kind: global class

  • StandardDice
    • new StandardDice(sides, [qty], [modifiers], [min], [max], [description])
    • .average ⇒ number
    • .modifiers ⇒ Map.<string, Modifier> | null
    • .modifiers
    • .max ⇒ number
    • .min ⇒ number
    • .name ⇒ string
    • .notation ⇒ string
    • .qty ⇒ number
    • .sides ⇒ number
    • .roll() ⇒ RollResults
    • .rollOnce() ⇒ RollResult
    • .toJSON() ⇒ Object
    • .toString() ⇒ string

new StandardDice(sides, [qty], [modifiers], [min], [max], [description])

Create a StandardDice instance.

Throws:

  • RequiredArgumentError sides is required
  • TypeError qty must be a positive integer, and modifiers must be valid
ParamTypeDefaultDescription
sidesnumberThe number of sides the die has (.e.g 6)
[qty]number1The number of dice to roll (e.g. 4)
[modifiers]Map.<string, Modifier> | Array.<Modifier> | Object | nullThe modifiers that affect the die
[min]number | null1The minimum possible roll value
[max]number | nullThe maximum possible roll value. Defaults to number of sides
[description]Description | string | nullThe roll description.

standardDice.average ⇒ number

The average value that the die can roll (Excluding modifiers).

Kind: instance property of StandardDice

standardDice.modifiers ⇒ Map.<string, Modifier> | null

The modifiers that affect this die roll.

Kind: instance property of StandardDice

standardDice.modifiers

Set the modifiers that affect this roll.

Kind: instance property of StandardDice
Throws:

  • TypeError Modifiers should be a Map, array of Modifiers, or an Object
ParamType
valueMap.<string, Modifier> | Array.<Modifier> | Object | null

standardDice.max ⇒ number

The maximum value that can be rolled on the die, excluding modifiers.

Kind: instance property of StandardDice

standardDice.min ⇒ number

The minimum value that can be rolled on the die, excluding modifiers.

Kind: instance property of StandardDice

standardDice.name ⇒ string

The name of the die.

Kind: instance property of StandardDice
Returns: string - 'standard'

standardDice.notation ⇒ string

The dice notation. e.g. 4d6!.

Kind: instance property of StandardDice

standardDice.qty ⇒ number

The number of dice that should be rolled.

Kind: instance property of StandardDice

standardDice.sides ⇒ number

The number of sides the die has.

Kind: instance property of StandardDice

standardDice.roll() ⇒ RollResults

Roll the dice for the specified quantity and apply any modifiers.

Kind: instance method of StandardDice
Returns: RollResults - The result of the roll

standardDice.rollOnce() ⇒ RollResult

Roll a single die and return the value.

Kind: instance method of StandardDice
Returns: RollResult - The value rolled

standardDice.toJSON() ⇒ Object

Return an object for JSON serialising.

This is called automatically when JSON encoding the object.

Kind: instance method of StandardDice

standardDice.toString() ⇒ string

Return the String representation of the object.

This is called automatically when casting the object to a string.

Kind: instance method of StandardDice
See: notation

Edit this page
Last Updated: 07/02/2026, 21:45
Prev
PercentileDice