rl.leviathan.server
Class LeviathanGameServer

java.lang.Object
  extended by rl.server.game.GameServer
      extended by rl.leviathan.server.LeviathanGameServer
All Implemented Interfaces:
CommandProcessorListener, GameListener, LeviathanFiringRoundListener, LeviathanGameListener, LeviathanGameTurnListener, LeviathanMovementRoundListener, LeviathanPointDefenceRoundListener, GameLogger

public class LeviathanGameServer
extends GameServer
implements LeviathanGameListener, LeviathanGameTurnListener, LeviathanMovementRoundListener, LeviathanFiringRoundListener, LeviathanPointDefenceRoundListener


Field Summary
 
Fields inherited from class rl.server.game.GameServer
m_AdminConnection
 
Constructor Summary
LeviathanGameServer(java.lang.String name, java.lang.String type)
           
 
Method Summary
protected  boolean canConnect()
          returns true if other players than the admin player are allowed to connect
 void commanderSelected(LeviathanGameSide side, Commander commander)
          Called when a commander has been selected for a side
 void commanderToBeSelected(LeviathanGameSide side, java.util.Vector<Commander> commanders)
          Called when there is more than one commander available for a side.
 void elementFiring(GameElementIdentifier element, GameElementIdentifier target, Coordinate sourceCoord, Coordinate targetCoord)
           
 void elementFiringComplete(GameElementIdentifier element, boolean roundComplete)
           
 void elementFiringPointDefence(GameElementIdentifier element, GameElementIdentifier target, Coordinate sourceCoord, Coordinate targetCoord)
           
 void elementFiringPointDefenceComplete(GameElementIdentifier element, boolean roundComplete)
           
 void elementSelectionRequired(LeviathanGameSide side, java.util.Vector<GameElementIdentifier> list)
           
 void elementsEligibleToFire(Player p, java.util.Vector<GameElementIdentifier> elements)
           
 void elementsEligibleToFirePointDefence(Player p, java.util.Vector<GameElementIdentifier> elements)
           
 void elementToMove(Player p, GameElementIdentifier element)
           
 void elementTypeMoving(LeviathanMovementRound.ElementType type)
           
 void firingPhaseCompleted()
           
 void firingRoundCompleted()
           
 void firingRoundStarted(LeviathanFiringRound round)
           
 void gameElementDamaged(GameElementDamageSummary geds)
           
 void gameElementFiring(GameElementFiringSummary gefs)
           
 void gameElementFiringPointDefence(GameElementFiringSummary gefs)
           
 java.lang.String getGameTypeName()
           
 void initiativeResult(LeviathanGameSide winner, LeviathanGameSide loser)
           
 void movementPhaseCompleted()
           
 void movementRoundCompleted()
           
 void movementRoundStarted(LeviathanMovementRound round)
           
 void phaseChange(java.lang.String phaseName, java.lang.String subPhaseName)
          Lets the clients know that there is a new phase/subphase
 void playerFiringAttempts(Player p, java.util.Vector<FireAttemptRecord> attempts)
           
 void playerPointDefenceAttempts(Player p, java.util.Vector<PointDefenceAttemptRecord> attempts)
           
 void pointDefencePhaseCompleted()
           
 void pointDefenceRoundCompleted()
           
 void pointDefenceRoundStarted(LeviathanPointDefenceRound round)
           
 void powerAllocationRequired(Player p, java.util.Vector<GameElementIdentifier> elements)
           
 void powerAllocationSet(Player p, CapitalShipPowerAllocation cspa)
           
 void selectMovementTeamOrder(LeviathanGameSide initiativeWinner)
           
 void teamAMovementRoundComplete()
           
 void transientElementAdded(GameElement ge)
           
 void transientElementRemoved(GameElement ge)
           
 void turnCompleted(LeviathanGameTurn turn)
          Lets the clients know this turn is complete
 void turnStarted(LeviathanGameTurn turn)
          Lets the clients know this turn has started
 
Methods inherited from class rl.server.game.GameServer
addConnection, addListener, addObserverToGame, broadcastCommand, disconnected, elementNoLongerVisible, elementPlacementComplete, elementRemoved, elementVisible, gameDrawn, gameLost, gamePhase, gameWon, getCurrentTurn, getName, getStatus, getType, hasBeenAbandoned, isConnected, isReadyForConnection, log, notifyServerStatusChanged, observersAllowed, playerAdded, playerRemoved, postCommand, raceSelectionAllowed, registerHandler, removeConnection, removeListener, removeObserverFromGame, removePlayerFromGame, sendCurrentParticipants, sendGameSides, sendParticipationSelection, setGame, setName, setType
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface rl.leviathan.game.LeviathanGameListener
elementRemoved, elementVisible
 

Constructor Detail

LeviathanGameServer

public LeviathanGameServer(java.lang.String name,
                           java.lang.String type)
Method Detail

getGameTypeName

public java.lang.String getGameTypeName()
Specified by:
getGameTypeName in class GameServer

canConnect

protected boolean canConnect()
returns true if other players than the admin player are allowed to connect

Specified by:
canConnect in class GameServer

transientElementAdded

public void transientElementAdded(GameElement ge)
Specified by:
transientElementAdded in interface LeviathanGameTurnListener

transientElementRemoved

public void transientElementRemoved(GameElement ge)
Specified by:
transientElementRemoved in interface LeviathanGameTurnListener

commanderToBeSelected

public void commanderToBeSelected(LeviathanGameSide side,
                                  java.util.Vector<Commander> commanders)
Description copied from interface: LeviathanGameListener
Called when there is more than one commander available for a side.

Specified by:
commanderToBeSelected in interface LeviathanGameListener
Parameters:
side - The game side the decision has to be made for
commanders - List of available Commanders to choose from.

commanderSelected

public void commanderSelected(LeviathanGameSide side,
                              Commander commander)
Description copied from interface: LeviathanGameListener
Called when a commander has been selected for a side

Specified by:
commanderSelected in interface LeviathanGameListener
Parameters:
side - The game side the commander belongs to
commander - Commander that was selected as overall force commander

turnStarted

public void turnStarted(LeviathanGameTurn turn)
Lets the clients know this turn has started

Specified by:
turnStarted in interface LeviathanGameListener
Specified by:
turnStarted in interface LeviathanGameTurnListener

turnCompleted

public void turnCompleted(LeviathanGameTurn turn)
Lets the clients know this turn is complete

Specified by:
turnCompleted in interface LeviathanGameListener
Specified by:
turnCompleted in interface LeviathanGameTurnListener

phaseChange

public void phaseChange(java.lang.String phaseName,
                        java.lang.String subPhaseName)
Lets the clients know that there is a new phase/subphase

Specified by:
phaseChange in interface LeviathanGameTurnListener

initiativeResult

public void initiativeResult(LeviathanGameSide winner,
                             LeviathanGameSide loser)
Specified by:
initiativeResult in interface LeviathanGameTurnListener

powerAllocationRequired

public void powerAllocationRequired(Player p,
                                    java.util.Vector<GameElementIdentifier> elements)
Specified by:
powerAllocationRequired in interface LeviathanGameTurnListener

powerAllocationSet

public void powerAllocationSet(Player p,
                               CapitalShipPowerAllocation cspa)
Specified by:
powerAllocationSet in interface LeviathanGameTurnListener

selectMovementTeamOrder

public void selectMovementTeamOrder(LeviathanGameSide initiativeWinner)
Specified by:
selectMovementTeamOrder in interface LeviathanGameTurnListener

movementRoundStarted

public void movementRoundStarted(LeviathanMovementRound round)
Specified by:
movementRoundStarted in interface LeviathanGameTurnListener

firingRoundStarted

public void firingRoundStarted(LeviathanFiringRound round)
Specified by:
firingRoundStarted in interface LeviathanGameTurnListener

pointDefenceRoundStarted

public void pointDefenceRoundStarted(LeviathanPointDefenceRound round)
Specified by:
pointDefenceRoundStarted in interface LeviathanGameTurnListener

playerFiringAttempts

public void playerFiringAttempts(Player p,
                                 java.util.Vector<FireAttemptRecord> attempts)
Specified by:
playerFiringAttempts in interface LeviathanGameTurnListener

gameElementFiring

public void gameElementFiring(GameElementFiringSummary gefs)
Specified by:
gameElementFiring in interface LeviathanGameTurnListener

playerPointDefenceAttempts

public void playerPointDefenceAttempts(Player p,
                                       java.util.Vector<PointDefenceAttemptRecord> attempts)
Specified by:
playerPointDefenceAttempts in interface LeviathanGameTurnListener

gameElementFiringPointDefence

public void gameElementFiringPointDefence(GameElementFiringSummary gefs)
Specified by:
gameElementFiringPointDefence in interface LeviathanGameTurnListener

gameElementDamaged

public void gameElementDamaged(GameElementDamageSummary geds)
Specified by:
gameElementDamaged in interface LeviathanGameTurnListener

elementSelectionRequired

public void elementSelectionRequired(LeviathanGameSide side,
                                     java.util.Vector<GameElementIdentifier> list)
Specified by:
elementSelectionRequired in interface LeviathanMovementRoundListener

teamAMovementRoundComplete

public void teamAMovementRoundComplete()
Specified by:
teamAMovementRoundComplete in interface LeviathanMovementRoundListener

movementRoundCompleted

public void movementRoundCompleted()
Specified by:
movementRoundCompleted in interface LeviathanMovementRoundListener

movementPhaseCompleted

public void movementPhaseCompleted()
Specified by:
movementPhaseCompleted in interface LeviathanMovementRoundListener

elementToMove

public void elementToMove(Player p,
                          GameElementIdentifier element)
Specified by:
elementToMove in interface LeviathanMovementRoundListener

elementTypeMoving

public void elementTypeMoving(LeviathanMovementRound.ElementType type)
Specified by:
elementTypeMoving in interface LeviathanMovementRoundListener

elementsEligibleToFire

public void elementsEligibleToFire(Player p,
                                   java.util.Vector<GameElementIdentifier> elements)
Specified by:
elementsEligibleToFire in interface LeviathanFiringRoundListener

firingRoundCompleted

public void firingRoundCompleted()
Specified by:
firingRoundCompleted in interface LeviathanFiringRoundListener

firingPhaseCompleted

public void firingPhaseCompleted()
Specified by:
firingPhaseCompleted in interface LeviathanFiringRoundListener

elementFiring

public void elementFiring(GameElementIdentifier element,
                          GameElementIdentifier target,
                          Coordinate sourceCoord,
                          Coordinate targetCoord)
Specified by:
elementFiring in interface LeviathanFiringRoundListener

elementFiringComplete

public void elementFiringComplete(GameElementIdentifier element,
                                  boolean roundComplete)
Specified by:
elementFiringComplete in interface LeviathanFiringRoundListener

elementsEligibleToFirePointDefence

public void elementsEligibleToFirePointDefence(Player p,
                                               java.util.Vector<GameElementIdentifier> elements)
Specified by:
elementsEligibleToFirePointDefence in interface LeviathanPointDefenceRoundListener

pointDefenceRoundCompleted

public void pointDefenceRoundCompleted()
Specified by:
pointDefenceRoundCompleted in interface LeviathanPointDefenceRoundListener

pointDefencePhaseCompleted

public void pointDefencePhaseCompleted()
Specified by:
pointDefencePhaseCompleted in interface LeviathanPointDefenceRoundListener

elementFiringPointDefence

public void elementFiringPointDefence(GameElementIdentifier element,
                                      GameElementIdentifier target,
                                      Coordinate sourceCoord,
                                      Coordinate targetCoord)
Specified by:
elementFiringPointDefence in interface LeviathanPointDefenceRoundListener

elementFiringPointDefenceComplete

public void elementFiringPointDefenceComplete(GameElementIdentifier element,
                                              boolean roundComplete)
Specified by:
elementFiringPointDefenceComplete in interface LeviathanPointDefenceRoundListener