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
ConstructorDescriptionBinaryDice0AsMax
(String id, RandomGenerator random, int numDie) Instantiates this binary dice withrandom
as the source of randomness to generate rolls. -
Method Summary
Modifier and TypeMethodDescriptiongenerateRoll
(int value) Generates a roll with valuevalue
using this dice.int
Gets 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.int
Generates a random roll using this dice, and returns just the value.Methods inherited from class net.royalur.model.dice.Dice
copyFrom, getDiceType, getID, getName, hasDiceType, hasState, recordRoll, roll, roll
-
Constructor Details
-
BinaryDice0AsMax
Instantiates this binary dice withrandom
as 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:Dice
Gets the maximum value that could be rolled by this dice.- Overrides:
getMaxRollValue
in classBinaryDice
- Returns:
- The maximum value that this dice could possibly roll.
-
getRollProbabilities
public float[] getRollProbabilities()Description copied from class:Dice
Gets the probability of rolling each value of the dice, where the index into the returned array represents the value of the roll.- Overrides:
getRollProbabilities
in classBinaryDice
- Returns:
- The probability of rolling each value of the dice.
-
rollValue
public int rollValue()Description copied from class:Dice
Generates a random roll using this dice, and returns just the value. If this dice has state, this should callDice.recordRoll(int)
.- Overrides:
rollValue
in classBinaryDice
- Returns:
- A random roll of this dice, and returns just the value.
-
generateRoll
Description copied from class:Dice
Generates a roll with valuevalue
using this dice. This does not update the state of the dice.- Overrides:
generateRoll
in classBinaryDice
- Parameters:
value
- The value of the dice to be rolled.- Returns:
- A roll with value
value
of this dice.
-