|
OGS Java API Spec | ||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--ogs.core.Die
A die generates random numbers by simulating rolls of polyhedral die.
Each Die
object is homogeneous: only one type of
die is represented by a single object. Type refers to the
number of sides on a die. A single die, however, can be rolled more
than once. The sum of these rolls can be added to a die modifier to
produce an overall range of random numbers.
Field Summary | |
static int |
d10
A ten-sided die. |
static int |
d100
A hundred-sided die. |
static int |
d12
A twelve-sided die. |
static int |
d2
A two-sided die. |
static int |
d20
A twenty-sided die. |
static int |
d3
A three-sided die. |
static int |
d4
A four-sided die. |
static int |
d5
A five-sided die. |
static int |
d6
A six-sided die. |
static int |
d8
An eight-sided die. |
Constructor Summary | |
Die()
Create a d20 die rolled once with no modifier. |
|
Die(int sides)
Create a specific die rolled once with no modifier. |
|
Die(int sides,
int count)
Create a specific die rolled one or more times with no modifier. |
|
Die(int sides,
int count,
int modifier)
Create a specific die rolled one or more times with a modifier. |
Method Summary | |
int |
getCount()
Determine the number of times the die is rolled. |
int |
getMaximumValue()
Retrieve the highest possible value of the die. |
int |
getMinimumValue()
Retrieve the lowest possible value of the die. |
int |
getModifier()
Determine the modifier added to the sum of die rolls. |
int |
getSides()
Determine the number of sides on this die. |
int |
getValue()
Retrieve the value of the die. |
static int |
roll()
Roll a d20 one time. |
static int |
roll(int sides)
Roll a die one time. |
static int |
roll(int sides,
int count)
Roll a die one or more times. |
static int |
roll(int sides,
int count,
int modifier)
Roll a die one or more times and add a modifier. |
int |
rollValue()
Change and retrieve the value of the die. |
void |
setCount(int count)
Change the number of times the die is rolled. |
void |
setModifier(int modifier)
Change the modifier added to the sum of die rolls. |
void |
setSides(int sides)
Change the sides on this die. |
void |
setValue()
Change the value of the die. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
public static final int d4
public static final int d6
public static final int d8
public static final int d10
public static final int d12
public static final int d20
public static final int d2
public static final int d3
public static final int d5
public static final int d100
Constructor Detail |
public Die()
public Die(int sides)
sides
- Number of sides on the die.public Die(int sides, int count)
sides
- Number of sides on the die.count
- Number of times the die is rolled.public Die(int sides, int count, int modifier)
sides
- Number of sides on the die.count
- Number of times the die is rolled.modifier
- Value added to the sum of die rolls.Method Detail |
public static int roll()
roll (d20, 1, 0)
.
public static int roll(int sides)
roll (sides, 1, 0)
.
sides
- Number of sides on die.
public static int roll(int sides, int count)
roll (sides, cound,
0)
.
sides
- Number of sides on die.count
- Number of times to roll die.
public static int roll(int sides, int count, int modifier)
sides
- Number of sides on die. Must be greater than 0.count
- Number of times to roll die. Must be greater than 0.modifier
- Value added to sum of die rolls.
public int getSides()
public void setSides(int sides)
sides
- Number of sides on die.public int getCount()
public void setCount(int count)
count
- Number of times die is rolled.public int getModifier()
public void setModifier(int modifier)
modifier
- Arbitrary value added to sum of rolls.public int getValue()
public void setValue()
public int rollValue()
public int getMinimumValue()
public int getMaximumValue()
|
OGS Java API Spec | ||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |