Show / Hide Table of Contents

Class DiceTerm

Represents a dice term, eg 1d4 or 2d6.

Inheritance
System.Object
DiceTerm
Implements
ITerm
Inherited Members
System.Object.Equals(System.Object)
System.Object.Equals(System.Object, System.Object)
System.Object.GetHashCode()
System.Object.GetType()
System.Object.MemberwiseClone()
System.Object.ReferenceEquals(System.Object, System.Object)
Namespace: GoRogue.DiceNotation.Terms
Assembly: GoRogue.dll
Syntax
public class DiceTerm : ITerm

Constructors

| Improve this Doc View Source

DiceTerm(ITerm, ITerm)

Constructor. Takes the terms representing multiplicity and number of sides.

Declaration
public DiceTerm(ITerm multiplicity, ITerm sides)
Parameters
Type Name Description
ITerm multiplicity

Term representing the number of dice being rolled -- 2d6 has multiplicity 2.

ITerm sides

Term representing the number of sides the dice have -- 2d6 has 6 sides.

Properties

| Improve this Doc View Source

DiceResults

An enumerable of integers representing the result of each dice roll. The expression 2d6 rolls 2 dice, and as such this enumerable would be of length 2 and contain the result of each individual die.

Declaration
public IEnumerable<int> DiceResults { get; }
Property Value
Type Description
System.Collections.Generic.IEnumerable<System.Int32>
| Improve this Doc View Source

LastMultiplicity

The result of evaluating the Multiplicity term that was used during the last call to GetResult(IGenerator).

Declaration
public int LastMultiplicity { get; }
Property Value
Type Description
System.Int32
| Improve this Doc View Source

LastSidedness

The result of evaluating the Sides term that was used during the last call to GetResult(IGenerator).

Declaration
public int LastSidedness { get; }
Property Value
Type Description
System.Int32
| Improve this Doc View Source

Multiplicity

Term representing the number of dice being rolled -- 2d6 has multiplicity 2.

Declaration
public ITerm Multiplicity { get; }
Property Value
Type Description
ITerm
| Improve this Doc View Source

Sides

Term representing the number of sides the dice have -- 2d6 has 6 sides.

Declaration
public ITerm Sides { get; }
Property Value
Type Description
ITerm

Methods

| Improve this Doc View Source

GetResult(IGenerator)

Rolls the dice, returning the sum.

Declaration
public int GetResult(IGenerator rng)
Parameters
Type Name Description
Troschuetz.Random.IGenerator rng

The RNG to use for rolling,

Returns
Type Description
System.Int32

The sum of the roll.

| Improve this Doc View Source

ToString()

Gets a parenthesized string representation of the dice term, eg (2d6).

Declaration
public override string ToString()
Returns
Type Description
System.String

A parenthesized representation of the term.

Overrides
System.Object.ToString()

Implements

ITerm

Extension Methods

Utility.Yield<T>(T)
  • Improve this Doc
  • View Source
Back to top Generated by DocFX