Package net.royalur.model.dice
Class BinaryDice0AsMax
java.lang.Object
net.royalur.model.dice.Dice
net.royalur.model.dice.BinaryDice
net.royalur.model.dice.BinaryDice0AsMax
A set of binary dice where a roll of zero actually represents
the highest roll possible, rather than the lowest.
-
Constructor Summary
ConstructorsConstructorDescriptionBinaryDice0AsMax(String id, RandomGenerator random, int numDie) Instantiates this binary dice withrandomas the source of randomness to generate rolls. -
Method Summary
Modifier and TypeMethodDescriptiongenerateRoll(int value) Generates a roll with valuevalueusing this dice.intGets the maximum value that could be rolled by this dice.float[]Gets the probability of rolling each value of the dice, where the index into the returned array represents the value of the roll.intGenerates a random roll using this dice, and returns just the value.Methods inherited from class net.royalur.model.dice.Dice
copyFrom, getDiceType, getID, getName, getPossibleRollCount, hasDiceType, hasState, recordRoll, roll, roll
-
Constructor Details
-
BinaryDice0AsMax
Instantiates this binary dice withrandomas the source of randomness to generate rolls.- Parameters:
id- The ID of this dice.random- The source of randomness used to generate dice rolls.numDie- The number of binary dice to roll.
-
-
Method Details
-
getMaxRollValue
public int getMaxRollValue()Description copied from class:DiceGets the maximum value that could be rolled by this dice.- Overrides:
getMaxRollValuein classBinaryDice- Returns:
- The maximum value that this dice could possibly roll.
-
getRollProbabilities
public float[] getRollProbabilities()Description copied from class:DiceGets the probability of rolling each value of the dice, where the index into the returned array represents the value of the roll.- Overrides:
getRollProbabilitiesin classBinaryDice- Returns:
- The probability of rolling each value of the dice.
-
rollValue
public int rollValue()Description copied from class:DiceGenerates a random roll using this dice, and returns just the value. If this dice has state, this should callDice.recordRoll(int).- Overrides:
rollValuein classBinaryDice- Returns:
- A random roll of this dice, and returns just the value.
-
generateRoll
Description copied from class:DiceGenerates a roll with valuevalueusing this dice. This does not update the state of the dice.- Overrides:
generateRollin classBinaryDice- Parameters:
value- The value of the dice to be rolled.- Returns:
- A roll with value
valueof this dice.
-