jurpe.system.generation
Class Dice

java.lang.Object
  extended by jurpe.system.generation.Dice

public class Dice
extends java.lang.Object

Dice. This class implements dice abstraction for the game

Author:
Alessio Saltarin

Constructor Summary
Dice()
          Constructs a six faces dice.
Dice(int facce)
          Builds a die with "facce" faces
 
Method Summary
static short roll()
          Roll a normal six faces die
 int throwDice()
          Rolls 6 faces die.
 int throwDice(int volte)
          Rolls "volte" dice
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Dice

public Dice()
Constructs a six faces dice.


Dice

public Dice(int facce)
Builds a die with "facce" faces

Parameters:
facce - faces of this die.
Method Detail

throwDice

public int throwDice()
Rolls 6 faces die.

Returns:
Random number between 1 and 6

throwDice

public int throwDice(int volte)
Rolls "volte" dice

Parameters:
volte - Number of times to roll dice
Returns:
Sum of dice rolls

roll

public static short roll()
                  throws JurpeException
Roll a normal six faces die

Returns:
Random number between 1 and 6
Throws:
JurpeException

Jurpe - Java Universal Role Playing Engine - http://jurpe.sourceforge.net