Introduction
Almost every MUD is going to need dice, so for convenience the core module provides a simple way to roll arbitrary numbers and kinds of dice. Just inject the DiceService into your Spring bean and you're all set.
The DiceService returns a DiceResult containing data about the total rolled as well as each of the rolls that occurred.
To roll a single 20 sided die:
DiceResult roll = diceService.roll(1, 20, 0);
if (roll.getRoll(0) == 20) {
LOGGER.info("Crit!");
}