Show / Hide Table of Contents

Class KeepTerm

Term representing the keep operator -- keeping only the n highest dice from a dice term.

Inheritance
object
KeepTerm
Implements
ITerm
Inherited Members
object.GetType()
object.MemberwiseClone()
object.Equals(object)
object.Equals(object, object)
object.ReferenceEquals(object, object)
object.GetHashCode()
Namespace: GoRogue.DiceNotation.Terms
Assembly: GoRogue.dll
Syntax
[DataContract]
public class KeepTerm : ITerm

Constructors

View Source

KeepTerm(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 Source

DiceTerm

The dice term to operate on.

Declaration
[DataMember]
public readonly DiceTerm DiceTerm
Field Value
Type Description
DiceTerm
View Source

Keep

The number of dice to keep.

Declaration
[DataMember]
public readonly ITerm Keep
Field Value
Type Description
ITerm

Methods

View Source

GetResult(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.

View Source

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

Overrides
object.ToString()

Implements

ITerm

Extension Methods

Utility.Yield<T>(T)
  • View Source
In this article
Back to top Generated by DocFX