Package megamek.common
Class MMRoll
java.lang.Object
megamek.common.Roll
megamek.common.MMRoll
- All Implemented Interfaces:
Serializable
Subclass of the roll tracker for
MMRandom
entropy sources.- Since:
- July 21, 2004, 7:43 AM
- See Also:
-
Field Summary
-
Constructor Summary
ConstructorsConstructorDescriptionMost tolls use standard six sided dice.Most other rolls have a minimum value of zero.Create a set of virtual dice with the given number of faces that start with the given value.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. -
Method Summary
Modifier and TypeMethodDescriptionvoid
Add the result from the given RNG source.int
Get the value of the roll.int[]
Get the individual dice values of the roll.Get aString
report that can be parsed to analyse the roll.static void
FIXME : Convert to actual unit testing Test harness for this class.toString()
Get aString
containing the roll for each of the virtual dice.Methods inherited from class megamek.common.Roll
getMarginOfSuccess, isSimpleFailure, isTargetRollSuccess, isTargetRollSuccess, isTargetRollSuccess2isFailure, isTargetRollSuccess2isFailure, output
-
Constructor Details
-
MMRoll
Most tolls use standard six sided dice.- Parameters:
rng
- - theMMRandom
that produces random numbers.
-
MMRoll
Most other rolls have a minimum value of zero.- Parameters:
rng
- - theMMRandom
that produces random numbers.max
- - the smallestint
value that is higher than all rolls; all rolls will be in the value set [0, max).
-
MMRoll
Create a set of virtual dice with the given number of faces that start with the given value.- Parameters:
rng
- - theMMRandom
that produces random numbers.count
- - theint
number of results possible on each virtual die.start
- - theint
value that is the start of the value set of each virtual die.
-
MMRoll
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
- - theMMRandom
that produces random numbers.count
- - theint
number of results possible on each virtual die.start
- - theint
value that is the start of the value set of each virtual die.keep
- - theint
number of dice to keep from the total rolled
-
-
Method Details
-
addRoll
Add the result from the given RNG source.- Parameters:
rng
- - theMMRandom
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 classRoll
- Returns:
- the
int
value of the roll.
-
toString
Get aString
containing the roll for each of the virtual dice. -
getReport
Get aString
report that can be parsed to analyse the roll. -
main
FIXME : Convert to actual unit testing Test harness for this class.- Parameters:
args
- - the array ofString
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 classRoll
- Returns:
- the
int[]
array of the individual dice values.
-