Package dev.davwheat
Class Dice
- java.lang.Object
-
- dev.davwheat.Dice
-
public class Dice extends java.lang.ObjectHandles the rolling of dice to decide player movement.
-
-
Constructor Summary
Constructors Constructor Description Dice()
-
Method Summary
Modifier and Type Method Description intgetOneRoll(int diceNumber)Gets the value of one specific dice roll.intgetTotalRoll()Get the total value of both dice rolls.booleanisDouble()Is the roll a double?DicerollAllDice()Rolls two dice and updates the instance of this class accordingly.static introllDice()Gets a random number between 1 and 6.
-
-
-
Method Detail
-
rollDice
public static int rollDice()
Gets a random number between 1 and 6.- Returns:
- int (1-6)
-
rollAllDice
public Dice rollAllDice()
Rolls two dice and updates the instance of this class accordingly.To get the total roll, call: rollAllDice().getTotalRoll()
- Returns:
- the current dice object
-
isDouble
public boolean isDouble()
Is the roll a double?- Returns:
- true for double
-
getTotalRoll
public int getTotalRoll()
Get the total value of both dice rolls.- Returns:
- total roll value
-
getOneRoll
public int getOneRoll(int diceNumber)
Gets the value of one specific dice roll.- Parameters:
diceNumber- Number dice to fetch value from (1 or 2)- Returns:
- The roll value
-
-