Class BattleHex

    • Field Detail

      • LOGGER

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

        private int elevation
        Valid elevations are 0, 1, and 2. Also 3 for JDG Badlands.
      • allHexsides

        private static final char[] allHexsides
        The array of all the valid terrain type for a BattleHex Side.
      • hexsideHazards

        private final HazardHexside[] hexsideHazards
        Hold the HazardHexside type of the six side of the BattleHex (e.g. Slope, Dune, River...). The hexside is marked only in the higher hex.
      • neighbors

        private final BattleHex[] neighbors
        Links to the neighbors of the BattleHex. Neighbors have one hex side in common. Non-existent neighbor are marked with null.
      • IMPASSIBLE_COST

        public static final int IMPASSIBLE_COST
        Movement costs
        See Also:
        Constant Field Values
    • Constructor Detail

      • BattleHex

        public BattleHex​(int xCoord,
                         int yCoord)
    • Method Detail

      • createLabel

        private static java.lang.String createLabel​(int xCoord,
                                                    int yCoord)
      • _intXCoordToXLabel

        private static final char _intXCoordToXLabel​(int x)
        a char for an int: 0:'A'=0, 1:'B', ... int(w):'W', else:'?', <0:undef.
      • getTerrainName

        public java.lang.String getTerrainName()
        Specified by:
        getTerrainName in class Hex
      • getTerrainColor

        public java.awt.Color getTerrainColor()
      • isNativeBonusTerrain

        public boolean isNativeBonusTerrain()
      • isNonNativePenaltyTerrain

        public boolean isNonNativePenaltyTerrain()
      • setHexsideHazard

        public void setHexsideHazard​(int i,
                                     HazardHexside hazard)
      • getHexsideHazard

        public HazardHexside getHexsideHazard​(int i)
        TODO use side enumeration types instead of integers Return the HazardHexside (enumType) at the hex' side number i
        Parameters:
        i - The side number, from 0 to 5
        Returns:
        The HazardHexside type at that side
      • getHexsideImageName

        public java.lang.String getHexsideImageName​(int i)
      • getOppositeHazard

        public HazardHexside getOppositeHazard​(int i)
        Return the hazard type of opposite side of side i.
      • getOppositeHexside

        public char getOppositeHexside​(int i)
        TODO get rid of this char based one Return the character code of the hazard type of opposite side of side i.
      • getElevation

        public int getElevation()
      • setElevation

        public void setElevation​(int elevation)
      • getNeighbor

        public BattleHex getNeighbor​(int i)
      • setNeighbor

        public void setNeighbor​(int i,
                                BattleHex hex)
      • isEntrance

        public boolean isEntrance()
      • hasWall

        public boolean hasWall()
      • blocksLineOfSight

        public boolean blocksLineOfSight()
        Whether this hex blocks rangestrike.
        Returns:
        Whether this hex blocks rangestrike.
      • getEntryCost

        public int getEntryCost​(CreatureType creature,
                                int cameFrom,
                                boolean cumul)
        Return the number of movement points it costs to enter this hex. For fliers, this is the cost to land in this hex, not fly over it. If entry is illegal, just return a cost greater than the maximum possible number of movement points. This caller is responsible for checking to see if this hex is already occupied.
        Parameters:
        creature - The Creature that is trying to move into the BattleHex.
        cameFrom - The HexSide through which the Creature try to enter.
        Returns:
        Cost to enter the BattleHex.
      • canBeFlownOverBy

        public boolean canBeFlownOverBy​(CreatureType creature)
        Check if the Creature given in parameter can fly over the BattleHex, or not.
        Parameters:
        creature - The Creature that want to fly over this BattleHex
        Returns:
        If the Creature can fly over here or not.
      • slowsCreature

        public int slowsCreature​(CreatureType creature)
        Return how much the hex slows the creature for the rest of the battle
        Parameters:
        creature - The Creature that may be slowed.
        Returns:
        How much the Creature is slowed for the rest of the battle.
      • damageToCreature

        public int damageToCreature​(CreatureType creature)
        Return how much damage the Creature should take from this Hex.
        Parameters:
        creature - The Creature that may suffer damage.
        Returns:
        How much damage the Creature should take from being there.
      • isCliff

        public boolean isCliff​(int hexside)
      • getHexsides

        public static char[] getHexsides()