Package net.royalur.model.dice
Interface DiceFactory
- All Known Implementing Classes:
DiceType
public interface DiceFactory
A factory that creates dice.
-
Method Summary
Modifier and TypeMethodDescriptionCreate an instance of the dice using a default source of randomness.default Roll
createRoll
(int value) Generates a roll with the given value.default DiceType
Gets the type of this dice.getID()
Gets the ID of this dice type.default String
getName()
Gets the name of this dice.default boolean
Gets whether this dice has an associated dice type.
-
Method Details
-
getID
String getID()Gets the ID of this dice type.- Returns:
- The ID of this dice type.
-
hasDiceType
default boolean hasDiceType()Gets whether this dice has an associated dice type. Custom dice may not have an associated dice type.- Returns:
- Whether this dice has an associated dice type.
-
getDiceType
Gets the type of this dice.- Returns:
- The type of this dice.
-
getName
Gets the name of this dice.- Returns:
- The name of this dice.
-
createDice
Dice createDice()Create an instance of the dice using a default source of randomness.- Returns:
- The instance of the dice using a default source of randomness.
-
createRoll
Generates a roll with the given value. This is used solely for serialisation, and should not be used for simulating games. Implementations may override this and throw an error if they require additional information to create their rolls.- Parameters:
value
- The value of the dice roll.- Returns:
- A roll with the given value.
-