Package megamek.common.board
Class BoardHelper
java.lang.Object
megamek.common.board.BoardHelper
-
Method Summary
Modifier and TypeMethodDescriptionstatic intatmosphericRowNumber(Game game, Board board, Coords coords) Deprecated, for removal: This API element is subject to removal in a future version.bottomEdge(Board board) Deprecated, for removal: This API element is subject to removal in a future version.coordsColumn(Board board, int x) coordsLine(Board board, Coords hexToCross, int facing) Returns the hexes of a straight line that has the given direction (facing) on the given Board and crosses the hex at the given hexToCross position.static booleancrossesSpaceAtmosphereInterface(Game game, Board board, Coords position1, Coords position2) Returns true when a path between the two given positions on the given board crosses the space/atmosphere interface and the board is actually a high-altitude map.static inteffectiveAtmosphericRowNumber(Game game, Board board, int x) Returns the number of the X position's atmospheric row (i.e.static inteffectiveAtmosphericRowNumber(Game game, Board board, Coords coords) Returns the number of the coords' atmospheric row (i.e.static BoardenclosingBoard(Game game, int boardId) static BoardenclosingBoard(Game game, Board board) static BoardenclosingBoard(Game game, BoardLocation boardLocation) Deprecated, for removal: This API element is subject to removal in a future version.static intenclosingBoardId(Game game, BoardLocation boardLocation) static intstatic intstatic booleanisAtmosphericRow(Game game, BoardLocation boardLocation) Returns true when the given BoardLocation indicates a hex of the atmospheric rows 1-4 (or 1-7 with very high atmosphere conditions) on a high-altitude map, false otherwise.static booleanisAtmosphericRow(Game game, Board board, int x) Returns true when the given X position is a hex of the atmospheric rows 1-4 (or 1-7 with very high atmosphere conditions) on a high-altitude map, false otherwise.static booleanisAtmosphericRow(Game game, Board board, Coords coords) Returns true when the given Coords is a hex of the atmospheric rows 1-4 (or 1-7 with very high atmosphere conditions) on a high-altitude map, false otherwise.static booleanisBelowSpaceAtmosphereInterface(Game game, Board board, Coords coords) Returns true when the given Coords is a hex of the atmospheric rows 1-4 or the ground row on a high-altitude map, false if it is in the space/atmosphere interface or in true space.static booleanisBoardEdge(Board board, Coords coords) Deprecated, for removal: This API element is subject to removal in a future version.static booleanisGroundRowHex(Board board, int x) Returns true when the given X position is a ground row hex on a high-atmospheric map, i.e.static booleanisGroundRowHex(Board board, Coords coords) Returns true when the given Coords is a ground row hex on a high-atmospheric map, i.e.static booleanisSpaceAtmosphereInterface(Game game, Board board, Coords coords) Returns true when the given Coords is a hex of the space-atmosphere interface on a high-altitude map, false otherwise.static booleanisTrueSpaceHex(Game game, Board board, Coords coords) Returns true when the given Coords is a hex that is true space on a high-altitude map, i.e.Deprecated, for removal: This API element is subject to removal in a future version.static booleanonDifferentGroundMaps(Game game, Entity attacker, Targetable target) static CoordspositionOnEnclosingBoard(Game game, int boardId) static CoordspositionOnEnclosingBoard(Game game, Board board) Deprecated, for removal: This API element is subject to removal in a future version.Deprecated, for removal: This API element is subject to removal in a future version.static intDeprecated, for removal: This API element is subject to removal in a future version.
-
Method Details
-
enclosingBoardId
-
enclosingBoard
@Deprecated(since="0.51.0", forRemoval=true) @Nullable public static Board enclosingBoard(Game game, BoardLocation boardLocation) Deprecated, for removal: This API element is subject to removal in a future version. -
enclosingBoard
-
enclosingBoard
-
positionOnEnclosingBoard
@Deprecated(since="0.51.0", forRemoval=true) @Nullable public static Coords positionOnEnclosingBoard(Game game, Board board) Deprecated, for removal: This API element is subject to removal in a future version. -
positionOnEnclosingBoard
-
onDifferentGroundMaps
-
isBoardEdge
@Deprecated(since="0.51.0", forRemoval=true) public static boolean isBoardEdge(Board board, Coords coords) Deprecated, for removal: This API element is subject to removal in a future version. -
topEdge
Deprecated, for removal: This API element is subject to removal in a future version. -
bottomEdge
Deprecated, for removal: This API element is subject to removal in a future version. -
leftEdge
Deprecated, for removal: This API element is subject to removal in a future version. -
rightEdge
Deprecated, for removal: This API element is subject to removal in a future version. -
coordsLine
Returns the hexes of a straight line that has the given direction (facing) on the given Board and crosses the hex at the given hexToCross position. If the board is null or does not contain hexToCross, an empty list is returned. The coords are ordered so that each next hex lies in the given facing direction from the previous (e.g., if facing is 3 = south, the first hex in the resulting line will be on the northern board edge and the last hex on the southern board edge.)- Parameters:
board- The Board on which the line is located; its size determines that start and end of the linehexToCross- Coords that the line crossesfacing- The direction of the line; also determines the order of the coords- Returns:
- A Coords list forming a straight line across the board
-
coordsRow
-
coordsColumn
-
isAtmosphericRow
Returns true when the given Coords is a hex of the atmospheric rows 1-4 (or 1-7 with very high atmosphere conditions) on a high-altitude map, false otherwise. Returns false for ground row hexes and for hexes of the space-atmosphere interface. Also returns false when planetary conditions indicate the atmosphere is "vacuum".- Parameters:
coords- The position on the board to test- Returns:
- True for hexes of the atmospheric rows on a high-altitude map
-
isAtmosphericRow
Returns true when the given X position is a hex of the atmospheric rows 1-4 (or 1-7 with very high atmosphere conditions) on a high-altitude map, false otherwise. Returns false for ground row hexes and for hexes of the space-atmosphere interface. Also returns false when planetary conditions indicate the atmosphere is "vacuum".- Parameters:
x- The X position on the board to test (Coords.getX())- Returns:
- True for hexes of the atmospheric rows on a high-altitude map
-
isAtmosphericRow
Returns true when the given BoardLocation indicates a hex of the atmospheric rows 1-4 (or 1-7 with very high atmosphere conditions) on a high-altitude map, false otherwise. Returns false for ground row hexes and for hexes of the space-atmosphere interface. Also returns false when planetary conditions indicate the atmosphere is "vacuum".- Parameters:
boardLocation- The location to test- Returns:
- True for hexes of the atmospheric rows on a high-altitude map
-
isBelowSpaceAtmosphereInterface
Returns true when the given Coords is a hex of the atmospheric rows 1-4 or the ground row on a high-altitude map, false if it is in the space/atmosphere interface or in true space. Returns false for all hexes if this board is not a high-altitude board or when planetary conditions indicate the atmosphere is "vacuum".- Parameters:
coords- The position on the board to test- Returns:
- true for hexes of atmospheric rows 1-4 and the ground row on a high-altitude map
-
atmosphericRowNumber
@Deprecated(since="0.51.0", forRemoval=true) public static int atmosphericRowNumber(Game game, Board board, Coords coords) Deprecated, for removal: This API element is subject to removal in a future version.Returns the number of the atmospheric row (i.e. 1 to 4 or 1 to 7 for very high atmosphere) of the given Coords on a high-altitude map (see TW p.79). For coords not in an atmospheric row or not on a high-altitude map, returns -1.- Parameters:
coords- The position on the board to test- Returns:
- The number of the atmospheric row on a high-altitude map
-
effectiveAtmosphericRowNumber
Returns the number of the coords' atmospheric row (i.e. 1 to 4 or 1 to 7 for very high atmosphere) that is to be effectively used for rule purposes on a high-altitude map (see TW p.79). This takes into account atmosphere density, see Trace Atmosphere, TO:AR, p.52; in these conditions, it is not equal toatmosphericRowNumber(Game, Board, Coords). For coords not in an atmospheric row or not on a high-altitude map, returns -1.- Parameters:
coords- The position on the board to test- Returns:
- The effective number of the atmospheric row on a high-altitude map
-
effectiveAtmosphericRowNumber
Returns the number of the X position's atmospheric row (i.e. 1 to 4 or 1 to 7 for very high atmosphere) that is to be effectively used for rule purposes on a high-altitude map (see TW p.79). This takes into account atmosphere density, see Trace Atmosphere, TO:AR, p.52; in these conditions, it is not equal toatmosphericRowNumber(Game, Board, Coords). For coords not in an atmospheric row or not on a high-altitude map, returns -1.- Parameters:
x- The X position on the board to test (Coords.getX())- Returns:
- The effective number of the atmospheric row on a high-altitude map
-
isSpaceAtmosphereInterface
Returns true when the given Coords is a hex of the space-atmosphere interface on a high-altitude map, false otherwise.- Parameters:
coords- The position on the board to test- Returns:
- true for hexes of the space-atmosphere interface on a high-atmosphere map
-
isGroundRowHex
Returns true when the given Coords is a ground row hex on a high-atmospheric map, i.e. the lowermost row of hexes. Returns false for atmospheric and ground maps as well as for a space map that is not high-altitude. This is true for ground row hexes even if planetary conditions indicate the atmosphere is "vacuum".- Parameters:
coords- The position on the board to test- Returns:
- true for the ground row hexes on a high atmospheric map
-
isGroundRowHex
Returns true when the given X position is a ground row hex on a high-atmospheric map, i.e. the lowermost row of hexes. Returns false for atmospheric and ground maps as well as for a space map that is not high-altitude. This is true for ground row hexes even if planetary conditions indicate the atmosphere is "vacuum".- Parameters:
x- The X position on the board to test- Returns:
- true for the ground row hexes on a high atmospheric map
-
isTrueSpaceHex
Returns true when the given Coords is a hex that is true space on a high-altitude map, i.e. beyond the space-atmosphere interface, or for any hex of a space map that is not a high-altitude map. Returns false for ground, atmospheric row and space-atmosphere interface hexes as well as for any hex of atmospheric and ground maps.- Parameters:
coords- The position on the board to test- Returns:
- true for true space hexes on a space map
-
spaceAtmosphereInterfacePosition
- Returns:
- The coordinate of the space-atmosphere interface in the given game (i.e., for the atmospheric pressure). Returns -1 for vacuum, 8 in very high atmospheric pressure and 5 otherwise. When game is null, the standard value of 5 is returned. When comparing with Coords (x, y), compare with the x value.
-
highAltAtmosphereRowRangeIncrease
-
highAltSpaceAtmosphereRangeIncrease
-
crossesSpaceAtmosphereInterface
public static boolean crossesSpaceAtmosphereInterface(Game game, Board board, Coords position1, Coords position2) Returns true when a path between the two given positions on the given board crosses the space/atmosphere interface and the board is actually a high-altitude map. Returns false when the board is not a high-altitude board or when one or both positions are on the space/atmosphere interface or both positions are in ground row/atmospheric hexes or both positions are in true space.- Parameters:
game- The gameboard- The board to checkposition1- The first positionposition2- The second position- Returns:
- True when a path between the two positions crosses the space/atmosphere interface
-