Package net.sf.colossus.game
Class Movement
java.lang.Object
net.sf.colossus.game.Movement
- Direct Known Subclasses:
MovementClientSide
,MovementServerSide
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected static int
protected static EntrySide
findEntrySide
(MasterHex hex, int cameFrom) Set the entry side relative to the hex label.findNearbyUnoccupiedHexes
(MasterHex hex, Legion legion, int roll, int cameFrom) Recursively find all unoccupied hexes within roll hexes, for tower teleport.findNormalMoves
(MasterHex hex, Legion legion, int roll, int block, int cameFrom, MasterHex fromHex, boolean ignoreFriends) Recursively find conventional moves from this hex.isValidEntrySide
(Legion legion, MasterHex hex, boolean teleport, EntrySide entrySide) Verify whether this is a valid entry side.isValidNormalMove
(Legion legion, MasterHex hex, Player player, int roll) Verify whether this is a valid normal move.isValidTeleportMove
(Legion legion, MasterHex hex, int roll) Verify whether this is a valid teleport move.listAllMoves
(Legion legion, MasterHex hex, int movementRoll) Return set of hexLabels describing where this legion can move.listAllMoves
(Legion legion, MasterHex hex, int movementRoll, boolean inAdvance) Return set of hexLabels describing where this legion can move.listNormalMoves
(Legion legion, MasterHex hex, int movementRoll) 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.listPossibleEntrySides
(Legion legion, MasterHex targetHex, boolean teleport) Return a Set of Strings "Left" "Right" or "Bottom" describing possible entry sides.listTeleportMoves
(Legion legion, MasterHex hex, int movementRoll) Return set of hexLabels describing where this legion can teleport.listTeleportMoves
(Legion legion, MasterHex hex, int movementRoll, boolean inAdvance) Return set of hexLabels describing where this legion can teleport.boolean
protected boolean
protected boolean
protected boolean
-
Field Details
-
LOGGER
-
game
-
options
-
-
Constructor Details
-
Movement
-
-
Method Details
-
findEntrySide
Set the entry side relative to the hex label. -
findBlock
-
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
Return set of hexLabels describing where this legion can teleport. -
listPossibleEntrySides
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
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
-
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
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
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
Verify whether this is a valid entry side.- Parameters:
legion
- The moving legionhex
- The aimed target hexteleport
- Whether this is a teleported move- Returns:
- Reason why it is not a valid entry side, null if valid
-