net.sf.colossus.client
Class Movement

java.lang.Object
  extended by net.sf.colossus.client.Movement

public final class Movement
extends java.lang.Object

Class Movement handles client-side masterboard moves.

Author:
David Ripton

Field Summary
private  Client client
           
private static java.util.logging.Logger LOGGER
           
 
Constructor Summary
Movement(Client client)
           
 
Method Summary
 void dispose()
           
private static int findBlock(MasterHex hex)
           
private static EntrySide findEntrySide(MasterHex hex, int cameFrom)
          Set the entry side relative to the hex label.
private  java.util.Set<MasterHex> findNearbyUnoccupiedHexes(MasterHex hex, Legion legion, int roll, int cameFrom)
          Recursively find all unoccupied hexes within roll hexes, for tower teleport.
private  java.util.Set<java.lang.String> findNormalMoves(MasterHex hex, Legion legion, int roll, int block, int cameFrom, MasterHex fromHex)
          Recursively find conventional moves from this hex.
 java.util.Set<MasterHex> listAllMoves(Legion legion, MasterHex hex, int movementRoll)
          Return set of hexLabels describing where this legion can move.
 java.util.Set<MasterHex> listAllMoves(Legion legion, MasterHex hex, int movementRoll, boolean inAdvance)
          Return set of hexLabels describing where this legion can move.
 java.util.Set<MasterHex> listNormalMoves(Legion legion, MasterHex hex, int movementRoll)
           
private  java.util.Set<MasterHex> listNormalMoves(Legion legion, MasterHex hex, int movementRoll, boolean inAdvance, MasterHex fromHex)
          Return set of hexLabels describing where this legion can move without teleporting.
(package private)  java.util.Set<EntrySide> listPossibleEntrySides(Legion legion, MasterHex targetHex, boolean teleport)
          Return a Set of Strings "Left" "Right" or "Bottom" describing possible entry sides.
 java.util.Set<MasterHex> listTeleportMoves(Legion legion, MasterHex hex, int movementRoll)
          Return set of hexLabels describing where this legion can teleport.
private  java.util.Set<MasterHex> listTeleportMoves(Legion legion, MasterHex hex, int movementRoll, boolean inAdvance)
          Return set of hexLabels describing where this legion can teleport.
 boolean titanTeleportAllowed()
           
private  boolean towerTeleportAllowed()
           
private  boolean towerToNonTowerTeleportAllowed()
           
private  boolean towerToTowerTeleportAllowed()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

LOGGER

private static final java.util.logging.Logger LOGGER

client

private Client client
Constructor Detail

Movement

Movement(Client client)
Method Detail

findEntrySide

private static EntrySide findEntrySide(MasterHex hex,
                                       int cameFrom)
Set the entry side relative to the hex label.


findNormalMoves

private java.util.Set<java.lang.String> findNormalMoves(MasterHex hex,
                                                        Legion legion,
                                                        int roll,
                                                        int block,
                                                        int cameFrom,
                                                        MasterHex fromHex)
Recursively find conventional moves from this hex. If block >= 0, go only that way. If block == -1, use arches and arrows. If block == -2, use only arrows. Do not double back in the direction you just came from. Return a set of hexLabel:entrySide tuples. TODO get rid of this String serialization and return a proper data structure


findNearbyUnoccupiedHexes

private java.util.Set<MasterHex> findNearbyUnoccupiedHexes(MasterHex hex,
                                                           Legion legion,
                                                           int roll,
                                                           int cameFrom)
Recursively find all unoccupied hexes within roll hexes, for tower teleport.


listAllMoves

public java.util.Set<MasterHex> listAllMoves(Legion legion,
                                             MasterHex hex,
                                             int movementRoll)
Return set of hexLabels describing where this legion can move.


listAllMoves

public java.util.Set<MasterHex> listAllMoves(Legion legion,
                                             MasterHex hex,
                                             int movementRoll,
                                             boolean inAdvance)
Return set of hexLabels describing where this legion can move.


findBlock

private static int findBlock(MasterHex hex)

listNormalMoves

public java.util.Set<MasterHex> listNormalMoves(Legion legion,
                                                MasterHex hex,
                                                int movementRoll)

listNormalMoves

private java.util.Set<MasterHex> listNormalMoves(Legion legion,
                                                 MasterHex hex,
                                                 int movementRoll,
                                                 boolean inAdvance,
                                                 MasterHex fromHex)
Return set of hexLabels describing where this legion can move without teleporting.


towerTeleportAllowed

private boolean towerTeleportAllowed()

towerToTowerTeleportAllowed

private boolean towerToTowerTeleportAllowed()

towerToNonTowerTeleportAllowed

private boolean towerToNonTowerTeleportAllowed()

titanTeleportAllowed

public boolean titanTeleportAllowed()

listTeleportMoves

public java.util.Set<MasterHex> listTeleportMoves(Legion legion,
                                                  MasterHex hex,
                                                  int movementRoll)
Return set of hexLabels describing where this legion can teleport.


listTeleportMoves

private java.util.Set<MasterHex> listTeleportMoves(Legion legion,
                                                   MasterHex hex,
                                                   int movementRoll,
                                                   boolean inAdvance)
Return set of hexLabels describing where this legion can teleport.


listPossibleEntrySides

java.util.Set<EntrySide> listPossibleEntrySides(Legion legion,
                                                MasterHex targetHex,
                                                boolean teleport)
Return a Set of Strings "Left" "Right" or "Bottom" describing possible entry sides. If the hex is unoccupied, just return one entry side since it doesn't matter.


dispose

public void dispose()