public class Die
extends java.lang.Object
Constructor and Description |
---|
Die()
By default the max value is 6 because most dice made are 6.
|
Die(int maxValue)
This will set the maximum value of the die to the value passed in.
|
Modifier and Type | Method and Description |
---|---|
boolean |
getHold() |
int |
getLastValue()
This class saves the last value that was rolled for your convenience.
|
int |
getMaxValue()
The maximum value a roll will generate.
|
int |
roll()
Roll will generate a number from 1 to maxValue.
|
void |
setHold(boolean hold) |
void |
setMaxValue(int maxValue)
Sets maxValue field to the absolute value of what is passed into this method.
|
public Die()
public Die(int maxValue)
maxValue
- Takes the absolute value of this number and sets it as max valuepublic void setHold(boolean hold)
public boolean getHold()
public int getLastValue()
public int getMaxValue()
public void setMaxValue(int maxValue)
maxValue
- The magnitude of the maximum possible outcome form this roller.public int roll()