Interface IDice
Represents a number of dice, each with the name specified number of sides and optional modifier.
public interface IDice
Properties
DieCount
The number of dice to roll. Must be greater than 0.
int DieCount { get; }
Property Value
MaxValue
The maximum value that can be rolled with the specified dice and modifier.
int MaxValue { get; }
Property Value
MinValue
The minimum value that can be rolled with the specified dice and modifier.
int MinValue { get; }
Property Value
Modifier
An optional modifier to add to the total of the dice rolled.
int Modifier { get; }
Property Value
Remarks
The value can be positive or negative, and can be used to adjust the result of the roll.
SideCount
The number of sides on each die. Must be at least 2.
int SideCount { get; }
Property Value
Remarks
A value of 2 represents a coin toss, 3 represents a three-sided die, etc.
Methods
Roll()
Rolls the dice and returns the total value rolled, including any modifier.
int Roll()
Returns
- int
int
ToString()
Returns a string representation of the dice in the format "XdY+Z" where: x is the number of dice, y is the number of sides on each die, z is the modifier (if any).
string ToString()
Returns
- string
string
Remarks
If the modifier is 0, it is omitted from the string.