RogueSharp
Show / Hide Table of Contents

Class DiceExpression

The DiceExpression class can be used to fluently add DiceTerms to a collection and then Roll them.

Inheritance
System.Object
DiceExpression
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: RogueSharp.DiceNotation
Assembly: RogueSharp.dll
Syntax
public class DiceExpression

Constructors

| Improve this Doc View Source

DiceExpression()

Construct a new DiceExpression class with an empty list of terms

Declaration
public DiceExpression()

Methods

| Improve this Doc View Source

Constant(Int32)

Add a constant to this DiceExpression with the specified integer value

Declaration
public DiceExpression Constant(int value)
Parameters
Type Name Description
System.Int32 value

An integer constant to add to this DiceExpression

Returns
Type Description
DiceExpression

A DiceExpression representing the previous terms in this DiceExpression plus this newly added Constant

| Improve this Doc View Source

Dice(Int32, Int32)

Add multiple Dice to this DiceExpression with the specified parameters

Declaration
public DiceExpression Dice(int multiplicity, int sides)
Parameters
Type Name Description
System.Int32 multiplicity

The number of Dice

System.Int32 sides

The number of sides per Die

Returns
Type Description
DiceExpression

A DiceExpression representing the previous terms in this DiceExpression plus these newly added Dice

| Improve this Doc View Source

Dice(Int32, Int32, Int32)

Add multiple Dice to this DiceExpression with the specified parameters

Declaration
public DiceExpression Dice(int multiplicity, int sides, int scalar)
Parameters
Type Name Description
System.Int32 multiplicity

The number of Dice

System.Int32 sides

The number of sides per Die

System.Int32 scalar

The value to multiply the result of the Roll of these Dice by

Returns
Type Description
DiceExpression

A DiceExpression representing the previous terms in this DiceExpression plus these newly added Dice

| Improve this Doc View Source

Dice(Int32, Int32, Int32, Nullable<Int32>)

Add multiple Dice to this DiceExpression with the specified parameters

Declaration
public DiceExpression Dice(int multiplicity, int sides, int scalar, int? choose)
Parameters
Type Name Description
System.Int32 multiplicity

The number of Dice

System.Int32 sides

The number of sides per Die

System.Int32 scalar

The value to multiply the result of the Roll of these Dice by

System.Nullable<System.Int32> choose

Optional number of dice to choose out of the total rolled. The highest rolled Dice will be chosen.

Returns
Type Description
DiceExpression

A DiceExpression representing the previous terms in this DiceExpression plus these newly added Dice

| Improve this Doc View Source

Die(Int32)

Add a single Die to this DiceExpression with the specified number of sides

Declaration
public DiceExpression Die(int sides)
Parameters
Type Name Description
System.Int32 sides

The number of sides on the Die to add to this DiceExpression

Returns
Type Description
DiceExpression

A DiceExpression representing the previous terms in this DiceExpression plus this newly added Die

| Improve this Doc View Source

Die(Int32, Int32)

Add a single Die to this DiceExpression with the specified number of sides and scalar

Declaration
public DiceExpression Die(int sides, int scalar)
Parameters
Type Name Description
System.Int32 sides

The number of sides on the Die to add to this DiceExpression

System.Int32 scalar

The value to multiply the result of the Roll of this Die by

Returns
Type Description
DiceExpression

A DiceExpression representing the previous terms in this DiceExpression plus this newly added Die

| Improve this Doc View Source

MaxRoll()

Roll all of the Dice that are part of this DiceExpression, but force all of the rolls to be the highest possible result

Declaration
public DiceResult MaxRoll()
Returns
Type Description
DiceResult

A DiceResult representing the results of this Roll. All dice should have rolled their maximum values

| Improve this Doc View Source

MinRoll()

Roll all of the Dice that are part of this DiceExpression, but force all of the rolls to be the lowest possible result

Declaration
public DiceResult MinRoll()
Returns
Type Description
DiceResult

A DiceResult representing the results of this Roll. All dice should have rolled their minimum values

| Improve this Doc View Source

Roll()

Roll all of the Dice that are part of this DiceExpression

Declaration
public DiceResult Roll()
Returns
Type Description
DiceResult

A DiceResult representing the results of this Roll

Remarks

Uses DotNetRandom as its RNG

| Improve this Doc View Source

Roll(IRandom)

Roll all of the Dice that are part of this DiceExpression

Declaration
public DiceResult Roll(IRandom random)
Parameters
Type Name Description
IRandom random

IRandom RNG used to perform the Roll.

Returns
Type Description
DiceResult

A DiceResult representing the results of this Roll

| Improve this Doc View Source

ToString()

Returns a string that represents this DiceExpression

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

A string representing this DiceExpression

Overrides
System.Object.ToString()
  • Improve this Doc
  • View Source
RogueSharp © 2014-2020 Faron Bracy
Back to top