Class MMRoll

java.lang.Object
megamek.common.Roll
megamek.common.MMRoll
All Implemented Interfaces:
Serializable

public class MMRoll extends Roll
Subclass of the roll tracker for MMRandom entropy sources.
Since:
July 21, 2004, 7:43 AM
See Also:
  • Constructor Details

    • MMRoll

      public MMRoll(MMRandom rng)
      Most tolls use standard six sided dice.
      Parameters:
      rng - - the MMRandom that produces random numbers.
    • MMRoll

      public MMRoll(MMRandom rng, int max)
      Most other rolls have a minimum value of zero.
      Parameters:
      rng - - the MMRandom that produces random numbers.
      max - - the smallest int value that is higher than all rolls; all rolls will be in the value set [0, max).
    • MMRoll

      public MMRoll(MMRandom rng, int count, int start)
      Create a set of virtual dice with the given number of faces that start with the given value.
      Parameters:
      rng - - the MMRandom that produces random numbers.
      count - - the int number of results possible on each virtual die.
      start - - the int value that is the start of the value set of each virtual die.
    • MMRoll

      public MMRoll(MMRandom rng, int count, int start, int keep)
      Create a set of virtual dice with the given number of faces that start with the given value, where only a subset of the highest will be kept.
      Parameters:
      rng - - the MMRandom that produces random numbers.
      count - - the int number of results possible on each virtual die.
      start - - the int value that is the start of the value set of each virtual die.
      keep - - the int number of dice to keep from the total rolled
  • Method Details

    • addRoll

      public void addRoll(MMRandom rng)
      Add the result from the given RNG source.
      Parameters:
      rng - - the MMRandom that produces random numbers.
    • getIntValue

      public int getIntValue()
      Get the value of the roll. This is the total of each of the rolls of each virtual die.
      Specified by:
      getIntValue in class Roll
      Returns:
      the int value of the roll.
    • toString

      public String toString()
      Get a String containing the roll for each of the virtual dice.
      Specified by:
      toString in class Roll
      Returns:
      the String value of the roll.
    • getReport

      public String getReport()
      Get a String report that can be parsed to analyse the roll.
      Specified by:
      getReport in class Roll
      Returns:
      the String details of the roll.
    • main

      public static void main(String[] args)
      FIXME : Convert to actual unit testing Test harness for this class.
      Parameters:
      args - - the array of String arguments: first is the number of rolls (defaults to two), second is number of sides (defaults to six sides), third is the starting number (defaults to one for six sided dice, zero for anything else).
    • getIntValues

      public int[] getIntValues()
      Description copied from class: Roll
      Get the individual dice values of the roll.
      Specified by:
      getIntValues in class Roll
      Returns:
      the int[] array of the individual dice values.