Class Movement

java.lang.Object
net.sf.colossus.game.Movement
Direct Known Subclasses:
MovementClientSide, MovementServerSide

public abstract class Movement extends Object
  • Field Details

    • LOGGER

      private static final Logger LOGGER
    • game

      protected final Game game
    • options

      protected final Options options
  • Constructor Details

    • Movement

      public Movement(Game game, Options options)
  • Method Details

    • findEntrySide

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

      protected static int findBlock(MasterHex hex)
    • findNearbyUnoccupiedHexes

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

      public boolean titanTeleportAllowed()
    • towerTeleportAllowed

      protected boolean towerTeleportAllowed()
    • towerToTowerTeleportAllowed

      protected boolean towerToTowerTeleportAllowed()
    • towerToNonTowerTeleportAllowed

      protected boolean towerToNonTowerTeleportAllowed()
    • listTeleportMoves

      protected Set<MasterHex> listTeleportMoves(Legion legion, MasterHex hex, int movementRoll, boolean inAdvance)
      Return set of hexLabels describing where this legion can teleport.
      Returns:
      set of hexlabels
    • listTeleportMoves

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

      public 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.
    • listAllMoves

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

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

      public Set<MasterHex> listNormalMoves(Legion legion, MasterHex hex, int movementRoll)
    • listNormalMoves

      public Set<MasterHex> listNormalMoves(Legion legion, MasterHex hex, int movementRoll, boolean ignoreFriends, MasterHex fromHex, boolean inAdvance)
      Return set of hexLabels describing where this legion can move without teleporting. Include moves currently blocked by friendly legions if ignoreFriends is true.
      Returns:
      set of hexlabels
    • findNormalMoves

      public Set<String> findNormalMoves(MasterHex hex, Legion legion, int roll, int block, int cameFrom, MasterHex fromHex, boolean ignoreFriends)
      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. TODO get rid of this String serialization and return a proper data structure
      Returns:
      a set of hexLabel:entrySide tuples.
    • isValidTeleportMove

      public String isValidTeleportMove(Legion legion, MasterHex hex, int roll)
      Verify whether this is a valid teleport move.
      Parameters:
      legion -
      hex -
      roll -
      Returns:
      Reason why it is not a valid teleport move, null if valid move
    • isValidNormalMove

      public String isValidNormalMove(Legion legion, MasterHex hex, Player player, int roll)
      Verify whether this is a valid normal move.
      Parameters:
      legion -
      hex -
      player -
      Returns:
      Reason why it is not a normal move, null if valid move
    • isValidEntrySide

      public String isValidEntrySide(Legion legion, MasterHex hex, boolean teleport, EntrySide entrySide)
      Verify whether this is a valid entry side.
      Parameters:
      legion - The moving legion
      hex - The aimed target hex
      teleport - Whether this is a teleported move
      Returns:
      Reason why it is not a valid entry side, null if valid