Package megamek.common.rolls
Class Roll
java.lang.Object
megamek.common.rolls.Roll
- All Implemented Interfaces:
Serializable
Encapsulate all information known about a requested roll. This information can be logged for full statistical
analysis and auditing, so hopefully people will finally stop questioning whether the RNG is any good.
- Since:
- July 20, 2004, 4:21 PM
- See Also:
-
Field Summary
Fields -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedRoll(int count, int start) Store the configuration information for this roll. -
Method Summary
Modifier and TypeMethodDescriptionabstract intGet the value of the roll.abstract int[]Get the individual dice values of the roll.intgetMarginOfSuccess(TargetRoll targetRoll) Returns the margin of success/failure of the roll compared to the target roll.abstract StringGet aStringreport that can be parsed to analyse the roll.booleanDeprecated, for removal: This API element is subject to removal in a future version.booleanisTargetRollSuccess(int target) Simple check if the total roll of the virtual die is a success.booleanisTargetRollSuccess(TargetRoll target) Simple check if the total roll of the virtual die is a success.booleanisTargetRollSuccess2isFailure(int target) Deprecated, for removal: This API element is subject to removal in a future version.booleanDeprecated, for removal: This API element is subject to removal in a future version.protected static voidFormatsRolloutput for test harnesses.abstract StringtoString()Get aStringcontaining the roll for each of the virtual dice.
-
Field Details
-
id
protected final long idThe unique identifier for this roll. -
faces
protected final int facesThe number of faces on each virtual die. -
min
protected final int minThe lowest value on each virtual die.
-
-
Constructor Details
-
Roll
protected Roll(int count, int start) Store the configuration information for this roll.- Parameters:
count- - theintnumber of results possible on each virtual die.start- - theintvalue that is the start of the value set of each virtual die.
-
-
Method Details
-
getIntValue
public abstract int getIntValue()Get the value of the roll. This is the total of each of the rolls of each virtual die.- Returns:
- the
intvalue of the roll.
-
toString
Get aStringcontaining the roll for each of the virtual dice. -
getReport
Get aStringreport that can be parsed to analyse the roll.- Returns:
- the
Stringdetails of the roll.
-
output
FormatsRolloutput for test harnesses.- Parameters:
roll- - theRollto be reported.
-
isTargetRollSuccess
public boolean isTargetRollSuccess(int target) Simple check if the total roll of the virtual die is a success.- Returns:
- the
boolvalue of the roll, true if success.
-
isTargetRollSuccess
Simple check if the total roll of the virtual die is a success.- Returns:
- the
boolvalue of the roll, true if success.
-
isTargetRollSuccess2isFailure
@Deprecated(since="0.51.0", forRemoval=true) public boolean isTargetRollSuccess2isFailure(int target) Deprecated, for removal: This API element is subject to removal in a future version.Simple check if the total roll of the virtual die is a success. Automatic failure on a 2.- Returns:
- the
boolvalue of the roll, true if success.
-
isTargetRollSuccess2isFailure
@Deprecated(since="0.51.0", forRemoval=true) public boolean isTargetRollSuccess2isFailure(TargetRoll target) Deprecated, for removal: This API element is subject to removal in a future version.Simple check if the total roll of the virtual die is a success. Automatic failure on a 2.- Returns:
- the
boolvalue of the roll, true if success.
-
getIntValues
public abstract int[] getIntValues()Get the individual dice values of the roll.- Returns:
- the
int[]array of the individual dice values.
-
getMarginOfSuccess
Returns the margin of success/failure of the roll compared to the target roll.- Parameters:
targetRoll- the target roll to compare against- Returns:
- the margin of success/failure
-
isSimpleFailure
Deprecated, for removal: This API element is subject to removal in a future version.Determines if the roll is a simple failure.- Returns:
- true if the roll is a simple failure, false otherwise
-