Package megamek.common.units
Interface Targetable
- All Superinterfaces:
BTObject,InGameObject,Serializable
- All Known Implementing Classes:
AbstractBuildingEntity,Aero,AeroSpaceFighter,BattleArmor,BattlefieldSupportAsset,BipedMek,BuildingEntity,BuildingTarget,CombatVehicleEscapePod,ConvFighter,ConvInfantry,Dropship,EjectedCrew,Entity,EscapePods,FighterSquadron,FixedWingSupport,FloorTarget,GunEmplacement,HandheldWeapon,HexTarget,INarcPod,Infantry,Jumpship,LandAirMek,LargeSupportTank,Mek,MekWarrior,MekWithArms,MinefieldTarget,MobileStructure,ProtoMek,QuadMek,QuadVee,SmallCraft,SpaceStation,SuperHeavyTank,SupportTank,SupportVTOL,Tank,TeleMissile,TripodMek,VTOL,Warship
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final int -
Method Summary
Modifier and TypeMethodDescriptionstatic booleanareAtSamePosition(Targetable first, Targetable second) Utility function used to safely tell whether two Targetable's are in the same hex.booleanintdefault intdefault BoardLocationintReturns the elevation of this target, relative to the position Hex's surfaceintReturns the height of the target, that is, how many levels above its elevation it is for LOS purposes.intinthashCode()booleanbooleandefault booleanisBomber()default booleandefault booleanReplaced most instances of `instanceof GunEmplacement` to supportBuildingEntitybooleanDetermines if this target should be considered the enemy of the supplied player.default booleanbooleanReturns true if the target is considered immobile (-4 to hit).booleandefault booleanisOnBoard(int boardID) intintintdefault booleanUsed to identify a target that tracks heat buildup (Meks, ASFs, and small craft).Methods inherited from interface megamek.common.units.BTObject
generalName, getFluffImage, getIcon, hasAerodyneSpheroidDistinction, isAero, isAerodyne, isAerospace, isAerospaceFighter, isAerospaceSV, isBattleArmor, isBattlefieldSupportAsset, isBattleMek, isCarryableObject, isCombatVehicle, isConventionalFighter, isConventionalInfantry, isDropShip, isFighter, isFixedWingSupport, isGround, isHandheldWeapon, isIndustrialMek, isInfantry, isJumpShip, isLargeAerospace, isMek, isObjectiveMarker, isProtoMek, isQuadMek, isSingleUnit, isSmallCraft, isSpaceStation, isSpheroid, isSupportVehicle, isTripodMek, isUnitGroup, isVehicle, isWarShip, specificNameMethods inherited from interface megamek.common.game.InGameObject
countForStrengthSum, getId, getOwnerId, getStrength, hasOwner, setId, setOwnerId
-
Field Details
-
TYPE_ENTITY
static final int TYPE_ENTITY- See Also:
-
TYPE_HEX_CLEAR
static final int TYPE_HEX_CLEAR- See Also:
-
TYPE_HEX_IGNITE
static final int TYPE_HEX_IGNITE- See Also:
-
TYPE_BUILDING
static final int TYPE_BUILDING- See Also:
-
TYPE_BLDG_IGNITE
static final int TYPE_BLDG_IGNITE- See Also:
-
TYPE_MINEFIELD_CLEAR
static final int TYPE_MINEFIELD_CLEAR- See Also:
-
TYPE_MINEFIELD_DELIVER
static final int TYPE_MINEFIELD_DELIVER- See Also:
-
TYPE_HEX_ARTILLERY
static final int TYPE_HEX_ARTILLERY- See Also:
-
TYPE_HEX_EXTINGUISH
static final int TYPE_HEX_EXTINGUISH- See Also:
-
TYPE_I_NARC_POD
static final int TYPE_I_NARC_POD- See Also:
-
TYPE_SEARCHLIGHT
static final int TYPE_SEARCHLIGHT- See Also:
-
TYPE_FLARE_DELIVER
static final int TYPE_FLARE_DELIVER- See Also:
-
TYPE_HEX_BOMB
static final int TYPE_HEX_BOMB- See Also:
-
TYPE_FUEL_TANK
static final int TYPE_FUEL_TANK- See Also:
-
TYPE_FUEL_TANK_IGNITE
static final int TYPE_FUEL_TANK_IGNITE- See Also:
-
TYPE_HEX_SCREEN
static final int TYPE_HEX_SCREEN- See Also:
-
TYPE_HEX_AERO_BOMB
static final int TYPE_HEX_AERO_BOMB- See Also:
-
TYPE_HEX_TAG
static final int TYPE_HEX_TAG- See Also:
-
TYPE_BLDG_TAG
static final int TYPE_BLDG_TAG- See Also:
-
TYPE_SATURATION
static final int TYPE_SATURATION- See Also:
-
-
Method Details
-
getTargetType
int getTargetType() -
getPosition
Coords getPosition()- Returns:
- the coordinates of the hex containing the target
-
getBoardId
default int getBoardId()- Returns:
- The board ID of the board this targetable is on. This defaults to 0 so that any code that doesn't support multiple boards yet safely points to the first (and only) board; should eventually default to -1
-
getBoardLocation
- See Also:
-
isOnBoard
default boolean isOnBoard(int boardID) -
getSecondaryPositions
-
relHeight
int relHeight()- Returns:
- elevation of the top (e.g. torso) of the target relative to surface
-
getHeight
int getHeight()Returns the height of the target, that is, how many levels above its elevation it is for LOS purposes.- Returns:
- height of the target in elevation levels
-
getElevation
int getElevation()Returns the elevation of this target, relative to the position Hex's surface- Returns:
- elevation of the bottom (e.g. legs) of the target relative to surface
-
getAltitude
int getAltitude()- Returns:
- altitude of target
-
isImmobile
boolean isImmobile()Returns true if the target is considered immobile (-4 to hit). If this is a game unit, implementations should check the status of the unit (shutdown, damage) and also the status of the crew (unconscious) if any.- Returns:
- True if the target is considered immobile
-
getDisplayName
String getDisplayName()- Returns:
- name of the target for ui purposes
-
sideTable
- Returns:
- side hit from location
-
sideTable
- Returns:
- side hit from location
-
isOffBoard
boolean isOffBoard()- Returns:
- if this is off the board
-
isBomber
default boolean isBomber()- Returns:
- if this is an
Entitycapable of carrying and using bombs
-
isAirborne
boolean isAirborne()- Returns:
- Is the entity airborne in the fashion of an aerospace unit? Does not include VTOL movement (see
isAirborneVTOLorWIGE()
-
isAirborneVTOLorWIGE
boolean isAirborneVTOLorWIGE()- Returns:
- is the entity airborne in the fashion of a VTOL Not used for aerospace units, see
isAirborne()
-
equals
-
isEnemyOf
Determines if this target should be considered the enemy of the supplied player. Targets that aren't owned by any player, such as buildings or terrain, are always considered enemies, since this will most often be used to determine if something is valid to be shot at. -
isHexBeingBombed
default boolean isHexBeingBombed() -
tracksHeat
default boolean tracksHeat()Used to identify a target that tracks heat buildup (Meks, ASFs, and small craft).- Returns:
- Whether the target tracks heat buildup.
-
isBracing
default boolean isBracing() -
hashCode
int hashCode() -
areAtSamePosition
Utility function used to safely tell whether two Targetable's are in the same hex. Does not throw exceptions in case of nulls. -
isBuildingEntityOrGunEmplacement
default boolean isBuildingEntityOrGunEmplacement()Replaced most instances of `instanceof GunEmplacement` to supportBuildingEntity- Returns:
- true if this unit is a
BuildingEntityorGunEmplacement, false otherwise
-