Class KeepTerm
Term represnting the keep operator -- keeping only the n highest dice from a dice term.
Inheritance
System.Object
KeepTerm
Implements
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: GoRogue.DiceNotation.Terms
Assembly: GoRogue.dll
Syntax
public class KeepTerm : ITerm
Constructors
| Improve this Doc 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. |
Methods
| Improve this Doc View SourceGetResult(IGenerator)
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(IGenerator rng)
Parameters
Type | Name | Description |
---|---|---|
Troschuetz.Random.IGenerator | rng | The rng to use -- passed to the dice term being operated on. |
Returns
Type | Description |
---|---|
System.Int32 | 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 |
---|---|
System.String | A parenthesized string representing the term |
Overrides
System.Object.ToString()