megamek.common
Class MinefieldTarget

java.lang.Object
  extended by megamek.common.MinefieldTarget
All Implemented Interfaces:
java.io.Serializable, Targetable

public class MinefieldTarget
extends java.lang.Object
implements Targetable

See Also:
Serialized Form

Field Summary
 
Fields inherited from interface megamek.common.Targetable
TYPE_BLDG_IGNITE, TYPE_BUILDING, TYPE_ENTITY, TYPE_FLARE_DELIVER, TYPE_FUEL_TANK, TYPE_FUEL_TANK_IGNITE, TYPE_HEX_AERO_BOMB, TYPE_HEX_ARTILLERY, TYPE_HEX_BOMB, TYPE_HEX_CLEAR, TYPE_HEX_EXTINGUISH, TYPE_HEX_IGNITE, TYPE_HEX_SCREEN, TYPE_INARC_POD, TYPE_MINEFIELD_CLEAR, TYPE_MINEFIELD_DELIVER, TYPE_SEARCHLIGHT
 
Constructor Summary
MinefieldTarget(Coords c, IBoard board)
           
 
Method Summary
 int absHeight()
           
static int coordsToId(Coords c)
          The transformation encodes the y value in the top 5 decimal digits and the x value in the bottom 5.
 int getAltitude()
           
 java.lang.String getDisplayName()
           
 int getElevation()
           
 int getHeight()
           
 Coords getPosition()
           
 int getTargetId()
           
 int getTargetType()
           
static Coords idToCoords(int id)
           
 boolean isAirborne()
           
 boolean isAirborneVTOL()
           
 boolean isImmobile()
           
 boolean isOffBoard()
           
 int sideTable(Coords src)
           
 int sideTable(Coords src, boolean usePrior)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

MinefieldTarget

public MinefieldTarget(Coords c,
                       IBoard board)
Method Detail

getTargetType

public int getTargetType()
Specified by:
getTargetType in interface Targetable

getTargetId

public int getTargetId()
Specified by:
getTargetId in interface Targetable

getPosition

public Coords getPosition()
Specified by:
getPosition in interface Targetable
Returns:
the coordinates of the hex containing the target

absHeight

public int absHeight()
Specified by:
absHeight in interface Targetable
Returns:
elevation of the top (e.g. torso) of the target relative to surface

getHeight

public int getHeight()
Specified by:
getHeight in interface Targetable
Returns:
height of the target in elevation levels

getElevation

public int getElevation()
Specified by:
getElevation in interface Targetable
Returns:
elevation of the bottom (e.g. legs) of the target relative to surface

isImmobile

public boolean isImmobile()
Specified by:
isImmobile in interface Targetable
Returns:
true if the target is immobile (-4 to hit)

getDisplayName

public java.lang.String getDisplayName()
Specified by:
getDisplayName in interface Targetable
Returns:
name of the target for ui purposes

coordsToId

public static int coordsToId(Coords c)
The transformation encodes the y value in the top 5 decimal digits and the x value in the bottom 5. Could more efficiently encode this by partitioning the binary representation, but this is more human readable and still allows for a 99999x99999 hex map.


idToCoords

public static Coords idToCoords(int id)

sideTable

public int sideTable(Coords src)
Specified by:
sideTable in interface Targetable
Returns:
side hit from location

sideTable

public int sideTable(Coords src,
                     boolean usePrior)
Specified by:
sideTable in interface Targetable
Returns:
side hit from location

isOffBoard

public boolean isOffBoard()
Specified by:
isOffBoard in interface Targetable
Returns:
if this is off the board

isAirborne

public boolean isAirborne()
Specified by:
isAirborne in interface Targetable
Returns:
Is the entity airborne in the fashion of an aerospace unit? Does not include VTOL movement (see Targetable.isAirborneVTOL()

isAirborneVTOL

public boolean isAirborneVTOL()
Specified by:
isAirborneVTOL in interface Targetable
Returns:
is the entity airborne in the fashion of a VTOL Not used for aerospace units, see Targetable.isAirborne()

getAltitude

public int getAltitude()
Specified by:
getAltitude in interface Targetable
Returns:
altitude of target