spellcast.game
Class Game

java.lang.Object
  extended by spellcast.game.Game
All Implemented Interfaces:
java.io.Serializable, IGame

public class Game
extends java.lang.Object
implements java.io.Serializable, IGame

The Game class is the model for the Spellcast game. No control logic is contained in this class.

Author:
Barrie Treloar
See Also:
Serialized Form

Constructor Summary
Game(java.lang.String theGameName, org.apache.commons.chain.Catalog theCommandCatalog)
          Create a game.
 
Method Summary
 void addWizard(IWizard w)
          Add a wizard to the system.
 GameLog getGameLog()
          Get the value of gameLog.
 java.util.List<IMonster> getMonsters()
          The IMonsters currently in the arena.
 java.lang.String getName()
          Return the game name.
 Turn getTurn()
          Get the value of turn.
 IWizard getWizard(Id idToMatch)
          Find the specified wizard by Id.
 java.util.List<IWizard> getWizards()
          The IWizards currently in the arena.
 boolean hasFinished()
          Returns whether the game has finished.
 boolean hasStarted()
          Returns whether the game has started.
 void processTurn()
          Process the current turn.
 void removeWizard(IWizard w)
          Remove a wizard from the system.
 void setGameLog(GameLog v)
          Set the value of gameLog.
 void setTurn(Turn v)
          Set the the curent turn for the game.
 void update(java.beans.PropertyChangeEvent pce)
          Update the client's local copy of the game with the value contained in the property change event.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Game

public Game(java.lang.String theGameName,
            org.apache.commons.chain.Catalog theCommandCatalog)
Create a game.

Parameters:
theGameName - the name of the game.
theCommandCatalog - contains the commands needed by the Game.
Method Detail

addWizard

public final void addWizard(IWizard w)
Add a wizard to the system.

Specified by:
addWizard in interface IGame
Parameters:
w - Wizard to add to the game.

getGameLog

public final GameLog getGameLog()
Get the value of gameLog.

Specified by:
getGameLog in interface IGame
Returns:
value of gameLog.

getMonsters

public final java.util.List<IMonster> getMonsters()
The IMonsters currently in the arena.

Specified by:
getMonsters in interface IGame
Returns:
The IMonsters currently in the arena.

getName

public final java.lang.String getName()
Return the game name.

Specified by:
getName in interface IGame
Returns:
the game name.

getTurn

public final Turn getTurn()
Get the value of turn.

Specified by:
getTurn in interface IGame
Returns:
value of turn.

getWizard

public final IWizard getWizard(Id idToMatch)
Find the specified wizard by Id. If no match found then return null.

Parameters:
idToMatch - the Id to match
Returns:
the wizard with the matching Id or null otherwise.

getWizards

public final java.util.List<IWizard> getWizards()
The IWizards currently in the arena.

Specified by:
getWizards in interface IGame
Returns:
The IWizards currently in the arena.

hasFinished

public final boolean hasFinished()
Returns whether the game has finished. The game has finished if the current turn is Turn.AFTER_GAME. A game can be started as well as stopped.

Specified by:
hasFinished in interface IGame
Returns:
true if the game has finished, false otherwise.

hasStarted

public final boolean hasStarted()
Returns whether the game has started. The game has started if the current turn is no longer Turn.BEFORE_GAME.

Specified by:
hasStarted in interface IGame
Returns:
true if the game has started, false otherwise.

processTurn

public void processTurn()
Process the current turn.

Specified by:
processTurn in interface IGame

removeWizard

public final void removeWizard(IWizard w)
Remove a wizard from the system.

Specified by:
removeWizard in interface IGame
Parameters:
w - Wizard to remove from the game.

setGameLog

public final void setGameLog(GameLog v)
Set the value of gameLog.

Parameters:
v - Value to assign to gameLog.

setTurn

public final void setTurn(Turn v)
Set the the curent turn for the game.

Specified by:
setTurn in interface IGame
Parameters:
v - the curent turn for the game

update

public final void update(java.beans.PropertyChangeEvent pce)
Update the client's local copy of the game with the value contained in the property change event.

Parameters:
pce - needs more work here.


Copyright © 2001-2005 Spellcast. All Rights Reserved.