Class DiceExpression
The DiceExpression class can be used to fluently add DiceTerms to a collection and then Roll them.
Inheritance
Inherited Members
Namespace: RogueSharp.DiceNotation
Assembly: RogueSharp.dll
Syntax
public class DiceExpression
Constructors
| Improve this Doc View SourceDiceExpression()
Construct a new DiceExpression class with an empty list of terms
Declaration
public DiceExpression()
Methods
| Improve this Doc View SourceConstant(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 |
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 |
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 |
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 |
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 |
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 |
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 |
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 |
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
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 |
ToString()
Returns a string that represents this DiceExpression
Declaration
public override string ToString()
Returns
Type | Description |
---|---|
System.String | A string representing this DiceExpression |