Show / Hide Table of Contents

Class DiceExpression

The default class for representing a parsed dice expression.

Inheritance
object
DiceExpression
Inherited Members
object.GetType()
object.MemberwiseClone()
object.Equals(object)
object.Equals(object, object)
object.ReferenceEquals(object, object)
object.GetHashCode()
Namespace: GoRogue.DiceNotation
Assembly: GoRogue.dll
Syntax
[DataContract]
public class DiceExpression

Constructors

View Source

DiceExpression(ITerm)

Constructor. Takes the last term in the dice expression (the root of the expression tree).

Declaration
public DiceExpression(ITerm rootTerm)
Parameters
Type Name Description
ITerm rootTerm

The root of the expression tree -- by evaluating this term, all others will be evaluated recursively.

Fields

View Source

RootTerm

The root term in this expression tree.

Declaration
[DataMember]
public readonly ITerm RootTerm
Field Value
Type Description
ITerm

Methods

View Source

MaxRoll()

Returns the maximum possible result of the dice expression.

Declaration
public int MaxRoll()
Returns
Type Description
int

The maximum possible result of the dice expression.

View Source

MinRoll()

Returns the minimum possible result of the dice expression.

Declaration
public int MinRoll()
Returns
Type Description
int

The minimum possible result of the dice expression.

View Source

Roll(IEnhancedRandom?)

Rolls the expression using the RNG given, returning the result.

Declaration
public int Roll(IEnhancedRandom? rng = null)
Parameters
Type Name Description
IEnhancedRandom rng

The RNG to use. If null is specified, the default RNG is used.

Returns
Type Description
int

The result obtained by rolling the dice expression.

View Source

ToString()

Returns a parenthesized string representing the dice expression in dice notation

Declaration
public override string ToString()
Returns
Type Description
string

A parenthesized string representing the expression.

Overrides
object.ToString()

Extension Methods

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