Package net.sf.colossus.variant
Class BattleHex
java.lang.Object
net.sf.colossus.variant.Hex
net.sf.colossus.variant.BattleHex
- Direct Known Subclasses:
ShowCreatureDetails.SimulatedBattleHex
Class BattleHex holds game state for battle hex.
- Author:
- David Ripton, Romain Dolbeau
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate static final char[]
The array of all the valid terrain type for a BattleHex Side.private int
Valid elevations are 0, 1, and 2.private final HazardHexside[]
Hold the HazardHexside type of the six side of the BattleHex (e.g.static final int
Movement costsprivate static final Logger
private final BattleHex[]
Links to the neighbors of the BattleHex.private static final int
private static final int
private static final int
private HazardTerrain
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprivate static final char
_intXCoordToXLabel
(int x) a char for an int: 0:'A'=0, 1:'B', ...boolean
Whether this hex blocks rangestrike.boolean
canBeFlownOverBy
(CreatureType creature) Check if the Creature given in parameter can fly over the BattleHex, or not.private static String
createLabel
(int xCoord, int yCoord) int
damageToCreature
(CreatureType creature) Return how much damage the Creature should take from this Hex.int
int
getEntryCost
(CreatureType creature, int cameFrom, boolean cumul) Return the number of movement points it costs to enter this hex.getHexsideHazard
(int i) TODO use side enumeration types instead of integers Return the HazardHexside (enumType) at the hex' side number igetHexsideImageName
(int i) static char[]
getNeighbor
(int i) getOppositeHazard
(int i) Return the hazard type of opposite side of side i.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.boolean
hasWall()
boolean
isCliff
(int hexside) boolean
boolean
boolean
void
setElevation
(int elevation) void
setHexsideHazard
(int i, HazardHexside hazard) void
setNeighbor
(int i, BattleHex hex) void
setTerrain
(HazardTerrain terrain) int
slowsCreature
(CreatureType creature) Return how much the hex slows the creature for the rest of the battle
-
Field Details
-
LOGGER
-
elevation
private int elevationValid elevations are 0, 1, and 2. Also 3 for JDG Badlands. -
allHexsides
private static final char[] allHexsidesThe array of all the valid terrain type for a BattleHex Side. -
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
Links to the neighbors of the BattleHex. Neighbors have one hex side in common. Non-existent neighbor are marked with null. -
terrain
-
IMPASSIBLE_COST
public static final int IMPASSIBLE_COSTMovement costs- See Also:
-
SLOW_COST
private static final int SLOW_COST- See Also:
-
NORMAL_COST
private static final int NORMAL_COST- See Also:
-
SLOW_INCREMENT_COST
private static final int SLOW_INCREMENT_COST- See Also:
-
-
Constructor Details
-
BattleHex
public BattleHex(int xCoord, int yCoord)
-
-
Method Details
-
createLabel
-
_intXCoordToXLabel
private static final char _intXCoordToXLabel(int x) a char for an int: 0:'A'=0, 1:'B', ... int(w):'W', else:'?', <0:undef. -
getTerrain
-
setTerrain
-
getTerrainName
- Specified by:
getTerrainName
in classHex
-
getTerrainColor
-
isNativeBonusTerrain
public boolean isNativeBonusTerrain() -
isNonNativePenaltyTerrain
public boolean isNonNativePenaltyTerrain() -
setHexsideHazard
-
getHexsideHazard
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
-
getOppositeHazard
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
-
setNeighbor
-
isEntrance
public boolean isEntrance() -
hasWall
public boolean hasWall() -
blocksLineOfSight
public boolean blocksLineOfSight()Whether this hex blocks rangestrike.- Returns:
- Whether this hex blocks rangestrike.
-
getEntryCost
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
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
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
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()
-