Class GenericNumericDie

java.lang.Object
de.kaiserpfalzedv.rpg.core.dice.bag.GenericNumericDie
All Implemented Interfaces:
Die
Direct Known Subclasses:
D10, D100, D12, D2, D20, D4, D6, D8

public class GenericNumericDie extends Object implements Die
GenericNumericDie -- Implements the die rolling for numeric die from 1 to max.
Since:
2020-08-12
Author:
rlichti <rlichti@kaiserpfalz-edv.de>
  • Field Details

    • max

      public final int max
      The number of sides of the die.
  • Constructor Details

    • GenericNumericDie

      public GenericNumericDie(int max)
  • Method Details

    • roll

      public DieResult roll()
      Description copied from interface: Die
      a single die roll.
      Specified by:
      roll in interface Die
      Returns:
      result of the single die roll.
    • roll

      public final DieResult[] roll(int number)
      Description copied from interface: Die
      the result of multiple dice rolls.
      Specified by:
      roll in interface Die
      Parameters:
      number - the number of dice rolls.
      Returns:
      ann array of Integer containing the results. The first element contains the sum, starting with index 1 the results of the single rolls are returned.
    • isNumericDie

      public boolean isNumericDie()
      Specified by:
      isNumericDie in interface Die
      Returns:
      TRUE, if the result can be parsed as integer (and therefore calculations can be done)
    • getDieType

      public String getDieType()
      Specified by:
      getDieType in interface Die
      Returns:
      The name of the die.
    • equals

      public final boolean equals(Object o)
      Overrides:
      equals in class Object
    • hashCode

      public final int hashCode()
      Overrides:
      hashCode in class Object
    • toString

      public final String toString()
      Overrides:
      toString in class Object