Class KeepTerm
Term representing the keep operator -- keeping only the n highest dice from a dice term.
Implements
Inherited Members
Namespace: GoRogue.DiceNotation.Terms
Assembly: GoRogue.dll
Syntax
[DataContract]
public class KeepTerm : ITerm
Constructors
View SourceKeepTerm(ITerm, DiceTerm)
Constructor. Takes a term representing the number of dice to keep, and the dice term to operate on.
Declaration
public KeepTerm(ITerm keep, DiceTerm diceTerm)
Parameters
Type | Name | Description |
---|---|---|
ITerm | keep | Term representing the number of dice to keep. |
DiceTerm | diceTerm | The dice term to operate on. |
Fields
View SourceDiceTerm
The dice term to operate on.
Declaration
[DataMember]
public readonly DiceTerm DiceTerm
Field Value
Type | Description |
---|---|
DiceTerm |
Keep
The number of dice to keep.
Declaration
[DataMember]
public readonly ITerm Keep
Field Value
Type | Description |
---|---|
ITerm |
Methods
View SourceGetResult(IEnhancedRandom)
Evaluates the term (as well as the dice expression), returning the sum of the highest n rolls in the dice term.
Declaration
public int GetResult(IEnhancedRandom rng)
Parameters
Type | Name | Description |
---|---|---|
IEnhancedRandom | rng | The rng to use -- passed to the dice term being operated on. |
Returns
Type | Description |
---|---|
int | The sum of the highest n rolls of the dice term being operated on, where n is equal to the value of the keep variable taken in the constructor. |
ToString()
Returns a parenthesized string representing the term -- eg (4d6k3) or (2d6k2)
Declaration
public override string ToString()
Returns
Type | Description |
---|---|
string | A parenthesized string representing the term |