jurpe.system
Class TurnTable

java.lang.Object
  extended by jurpe.system.TurnTable
All Implemented Interfaces:
java.io.Serializable

public class TurnTable
extends java.lang.Object
implements java.io.Serializable

This class is a metaphor for a table in which players sit to play.

See Also:
Serialized Form

Constructor Summary
TurnTable()
          Constructor
 
Method Summary
 void addEffect(EffectType et, int modifier, short nT)
          Add an effect to current player with a duration of n turns
 void addEffect(PC player, EffectType et, int modifier, short nT)
          Add an effect to a particular player with a duration of nT turns
 PC getCurrentPlayer()
          Get current player, based upon current turn.
 int getCurrentTurn()
          Get current turn.
 int getEffect(EffectType et)
          Get the modifier for a specified Effect in charge for current player
 PC getNextPlayer()
          Get next player, based upon current table disposition.
 java.lang.String getOrderDescription()
          Get MVMT description and order of fight.
 int getPlayers()
          Get number of players
 void nextPlayer()
          Advances turn to next player.
 void nextTurn(Log log)
          Current player plays his turn.
 void orderBySpeed()
          Order players, confronting their Speed rating.
 void removeAllEffects()
          Call this method when a combat ends (ie: fightee runs away)
 void subscribe(PC player)
          Add players (either PC or NPC) to the table.
 void unsubscribe(PC player)
          Remove player (either PC or NPC) from table
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

TurnTable

public TurnTable()
Constructor

Method Detail

subscribe

public void subscribe(PC player)
Add players (either PC or NPC) to the table.

Parameters:
player - Player to add

unsubscribe

public void unsubscribe(PC player)
Remove player (either PC or NPC) from table

Parameters:
player - Player to remove

nextPlayer

public void nextPlayer()
Advances turn to next player.


getCurrentPlayer

public PC getCurrentPlayer()
Get current player, based upon current turn.

Returns:
Player that can play now

getNextPlayer

public PC getNextPlayer()
Get next player, based upon current table disposition.

Returns:
Player that can play after current player

getCurrentTurn

public int getCurrentTurn()
Get current turn. A turn is ended when player took an action

Returns:
current turn number

orderBySpeed

public void orderBySpeed()
Order players, confronting their Speed rating. (PC implements compareTo() based on speed)


getOrderDescription

public java.lang.String getOrderDescription()
Get MVMT description and order of fight.

Returns:
verbose description of who begins combat and why.

nextTurn

public void nextTurn(Log log)
Current player plays his turn. A turn happens every time a player (either NPC or PC) chooses a command

Parameters:
log - Log to communicate to

getEffect

public int getEffect(EffectType et)
Get the modifier for a specified Effect in charge for current player

Parameters:
et - Effect type to apply
Returns:
modifier if effect is in charge, 0 else

addEffect

public void addEffect(EffectType et,
                      int modifier,
                      short nT)
Add an effect to current player with a duration of n turns

Parameters:
et - EffectType to add
modifier - Modifier to add to character stats
nT - Number of turns in which effect is in charge

addEffect

public void addEffect(PC player,
                      EffectType et,
                      int modifier,
                      short nT)
Add an effect to a particular player with a duration of nT turns

Parameters:
player - PC who suffers effect
et - EffectType to add
modifier - Modifier to add to character stats
nT - Number of turns in which effect is in charge

removeAllEffects

public void removeAllEffects()
Call this method when a combat ends (ie: fightee runs away)


getPlayers

public int getPlayers()
Get number of players

Returns:
the number of players at this table

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