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

public interface Targetable extends InGameObject, Serializable
  • Field Details

  • 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

      default BoardLocation getBoardLocation()
      See Also:
    • isOnBoard

      default boolean isOnBoard(int boardID)
    • getSecondaryPositions

      Map<Integer,Coords> 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

      int sideTable(Coords src)
      Returns:
      side hit from location
    • sideTable

      int sideTable(Coords src, boolean usePrior)
      Returns:
      side hit from location
    • isOffBoard

      boolean isOffBoard()
      Returns:
      if this is off the board
    • isBomber

      default boolean isBomber()
      Returns:
      if this is an Entity capable 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

      boolean equals(Object obj)
      Overrides:
      equals in class Object
    • isEnemyOf

      boolean isEnemyOf(Entity other)
      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()
      Overrides:
      hashCode in class Object
    • areAtSamePosition

      static boolean areAtSamePosition(@Nullable Targetable first, @Nullable Targetable second)
      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 support BuildingEntity
      Returns:
      true if this unit is a BuildingEntity or GunEmplacement, false otherwise