Class Movement

    • Field Detail

      • LOGGER

        private static final java.util.logging.Logger LOGGER
      • game

        protected final Game game
      • options

        protected final Options options
    • Constructor Detail

      • Movement

        public Movement​(Game game,
                        Options options)
    • Method Detail

      • 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 java.util.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 java.util.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 java.util.Set<MasterHex> listTeleportMoves​(Legion legion,
                                                          MasterHex hex,
                                                          int movementRoll)
        Return set of hexLabels describing where this legion can teleport.
      • listPossibleEntrySides

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

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

        public java.util.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 java.util.Set<java.lang.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 java.lang.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 java.lang.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 java.lang.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