Class Entity

All Implemented Interfaces:
Serializable, BTObject, CombatRole, Deployable, ForceAssignable, InGameObject, ITechnology, ITurnOrdered, PhaseUpdated, RoundUpdated, Targetable, Transporter
Direct Known Subclasses:
Aero, HandheldWeapon, Infantry, Mek, ProtoMek, Tank

Entity is a master class for basically anything on the board except terrain.
See Also:
  • Field Details

    • DOES_NOT_TRACK_HEAT

      public static final int DOES_NOT_TRACK_HEAT
      See Also:
    • UNLIMITED_JUMP_DOWN

      public static final int UNLIMITED_JUMP_DOWN
      See Also:
    • ETYPE_MEK

      public static final long ETYPE_MEK
      Entity Type Id Definitions These are used to identify the type of Entity, such as 'Mek or aero.
      See Also:
    • ETYPE_BIPED_MEK

      public static final long ETYPE_BIPED_MEK
      See Also:
    • ETYPE_LAND_AIR_MEK

      public static final long ETYPE_LAND_AIR_MEK
      See Also:
    • ETYPE_QUAD_MEK

      public static final long ETYPE_QUAD_MEK
      See Also:
    • ETYPE_ARMLESS_MEK

      public static final long ETYPE_ARMLESS_MEK
      See Also:
    • ETYPE_AERO

      public static final long ETYPE_AERO
      See Also:
    • ETYPE_JUMPSHIP

      public static final long ETYPE_JUMPSHIP
      See Also:
    • ETYPE_WARSHIP

      public static final long ETYPE_WARSHIP
      See Also:
    • ETYPE_SPACE_STATION

      public static final long ETYPE_SPACE_STATION
      See Also:
    • ETYPE_CONV_FIGHTER

      public static final long ETYPE_CONV_FIGHTER
      See Also:
    • ETYPE_FIXED_WING_SUPPORT

      public static final long ETYPE_FIXED_WING_SUPPORT
      See Also:
    • ETYPE_FIGHTER_SQUADRON

      public static final long ETYPE_FIGHTER_SQUADRON
      See Also:
    • ETYPE_SMALL_CRAFT

      public static final long ETYPE_SMALL_CRAFT
      See Also:
    • ETYPE_DROPSHIP

      public static final long ETYPE_DROPSHIP
      See Also:
    • ETYPE_TELEMISSILE

      public static final long ETYPE_TELEMISSILE
      See Also:
    • ETYPE_INFANTRY

      public static final long ETYPE_INFANTRY
      See Also:
    • ETYPE_BATTLEARMOR

      public static final long ETYPE_BATTLEARMOR
      See Also:
    • ETYPE_MEKWARRIOR

      public static final long ETYPE_MEKWARRIOR
      See Also:
    • ETYPE_PROTOMEK

      public static final long ETYPE_PROTOMEK
      See Also:
    • ETYPE_TANK

      public static final long ETYPE_TANK
      See Also:
    • ETYPE_GUN_EMPLACEMENT

      public static final long ETYPE_GUN_EMPLACEMENT
      See Also:
    • ETYPE_SUPER_HEAVY_TANK

      public static final long ETYPE_SUPER_HEAVY_TANK
      See Also:
    • ETYPE_SUPPORT_TANK

      public static final long ETYPE_SUPPORT_TANK
      See Also:
    • ETYPE_LARGE_SUPPORT_TANK

      public static final long ETYPE_LARGE_SUPPORT_TANK
      See Also:
    • ETYPE_VTOL

      public static final long ETYPE_VTOL
      See Also:
    • ETYPE_SUPPORT_VTOL

      public static final long ETYPE_SUPPORT_VTOL
      See Also:
    • ETYPE_TRIPOD_MEK

      public static final long ETYPE_TRIPOD_MEK
      See Also:
    • ETYPE_QUADVEE

      public static final long ETYPE_QUADVEE
      See Also:
    • ETYPE_AEROSPACEFIGHTER

      public static final long ETYPE_AEROSPACEFIGHTER
      See Also:
    • ETYPE_HANDHELD_WEAPON

      public static final long ETYPE_HANDHELD_WEAPON
      See Also:
    • BLOOD_STALKER_TARGET_CLEARED

      public static final int BLOOD_STALKER_TARGET_CLEARED
      See Also:
    • LOC_NONE

      public static final int LOC_NONE
      See Also:
    • LOC_DESTROYED

      public static final int LOC_DESTROYED
      See Also:
    • MAX_C3_NODES

      public static final int MAX_C3_NODES
      See Also:
    • MAX_C3i_NODES

      public static final int MAX_C3i_NODES
      See Also:
    • GRAPPLE_BOTH

      public static final int GRAPPLE_BOTH
      See Also:
    • GRAPPLE_RIGHT

      public static final int GRAPPLE_RIGHT
      See Also:
    • GRAPPLE_LEFT

      public static final int GRAPPLE_LEFT
      See Also:
    • DMG_NONE

      public static final int DMG_NONE
      See Also:
    • DMG_LIGHT

      public static final int DMG_LIGHT
      See Also:
    • DMG_MODERATE

      public static final int DMG_MODERATE
      See Also:
    • DMG_HEAVY

      public static final int DMG_HEAVY
      See Also:
    • DMG_CRIPPLED

      public static final int DMG_CRIPPLED
      See Also:
    • game

      protected transient Game game
    • iGame

      protected transient IGame iGame
    • id

      protected int id
    • camouflage

      protected Camouflage camouflage
    • externalId

      protected String externalId
      ID settable by external sources (such as mm.net)
    • weight

      protected double weight
    • omni

      protected boolean omni
    • chassis

      protected String chassis
    • model

      protected String model
    • clanChassisName

      protected String clanChassisName
      The special chassis name for Clan Meks such as Timber Wolf for the Mad Cat. This is appended to the base chassis name to form the full chassis name such as Mad Cat (Timber Wolf) in getShortNameRaw() and getFullChassis(). This is only saved in mtf files (as of 2024).
    • mulId

      protected int mulId
      If this is a unit from an official source, the MUL ID links it to its corresponding entry in the online Master Unit List.
    • year

      protected int year
    • techLevel

      protected int techLevel
    • structuralTechRating

      protected ITechnology.TechRating structuralTechRating
      Used by support vehicles to define the structural tech rating (TM pg 117). The values should come from EquipmentType.TechRating.A-X.
    • armorTechRating

      protected ITechnology.TechRating armorTechRating
      Used by support vehicles to define tech rating of armor. Default value indicates that structural tech rating should be used, as in most cases the armor and structural tech ratings match.
    • engineTechRating

      protected ITechnology.TechRating engineTechRating
      Used by support vehicles to define tech rating of armor. Default value indicates that structural tech rating should be used, as in most cases the engine and structural tech ratings match.
    • mixedTech

      protected boolean mixedTech
    • designValid

      protected boolean designValid
    • useManualBV

      protected boolean useManualBV
    • manualBV

      protected int manualBV
    • initialBV

      protected int initialBV
    • owner

      protected transient Player owner
    • ownerId

      protected int ownerId
    • traitorId

      protected int traitorId
    • targetBay

      protected int targetBay
    • STARTING_ANY_NONE

      public static final int STARTING_ANY_NONE
      See Also:
    • nCrew

      protected int nCrew
    • nPassenger

      protected int nPassenger
    • nMarines

      protected int nMarines
    • manualShutdown

      protected boolean manualShutdown
    • startupThisPhase

      protected boolean startupThisPhase
    • shutDown

      protected boolean shutDown
    • shutDownThisPhase

      protected boolean shutDownThisPhase
    • doomed

      protected boolean doomed
    • destroyed

      protected boolean destroyed
    • secondaryPositions

      protected Map<Integer,Coords> secondaryPositions
      Used for Entities that are bigger than a single hex. This contains the central hex plus all of the other hexes this entity occupies. The central hex is important for drawing multi-hex sprites.
    • facing

      protected int facing
    • sec_facing

      protected int sec_facing
    • twistedPhase

      protected GamePhase twistedPhase
    • walkMP

      protected int walkMP
    • jumpMP

      protected int jumpMP
    • done

      protected boolean done
    • prone

      protected boolean prone
    • hullDown

      protected boolean hullDown
    • findingClub

      protected boolean findingClub
    • armsFlipped

      protected boolean armsFlipped
    • unjammingRAC

      protected boolean unjammingRAC
    • selfDestructing

      protected boolean selfDestructing
    • selfDestructInitiated

      protected boolean selfDestructInitiated
    • boobyTrapInitiated

      protected boolean boobyTrapInitiated
    • selfDestructedThisTurn

      protected boolean selfDestructedThisTurn
    • hasExternalSearchlight

      protected boolean hasExternalSearchlight
      True when the entity has an undestroyed searchlight that is neither a Quirk searchlight nor a mounted (0.5t / 1slot) searchlight.
    • illuminated

      protected boolean illuminated
    • searchlightIsActive

      protected boolean searchlightIsActive
    • usedSearchlight

      protected boolean usedSearchlight
    • stuckInSwamp

      protected boolean stuckInSwamp
    • canUnstickByJumping

      protected boolean canUnstickByJumping
    • taggedBy

      protected int taggedBy
    • layingMines

      protected boolean layingMines
    • _isEMId

      protected boolean _isEMId
    • hardenedArmorDamaged

      protected boolean[] hardenedArmorDamaged
    • locationBlownOff

      protected boolean[] locationBlownOff
    • locationBlownOffThisPhase

      protected boolean[] locationBlownOffThisPhase
    • armorType

      protected int[] armorType
    • armorTechLevel

      protected int[] armorTechLevel
    • isJumpingNow

      protected boolean isJumpingNow
    • convertingNow

      protected boolean convertingNow
    • previousMovementMode

      protected EntityMovementMode previousMovementMode
    • displacementAttack

      protected DisplacementAttackAction displacementAttack
    • heat

      public int heat
    • heatBuildup

      public int heatBuildup
    • heatFromExternal

      public int heatFromExternal
    • coolFromExternal

      public int coolFromExternal
    • delta_distance

      public int delta_distance
    • mpUsed

      public int mpUsed
    • underwaterRounds

      public int underwaterRounds
    • moved

      public EntityMovementType moved
    • movedLastRound

      public EntityMovementType movedLastRound
    • mpUsedLastRound

      protected int mpUsedLastRound
    • gotPavementOrRoadBonus

      public boolean gotPavementOrRoadBonus
    • wigeBonus

      public int wigeBonus
    • inReverse

      public boolean inReverse
    • struck

      protected boolean struck
    • fell

      protected boolean fell
    • damageThisPhase

      public int damageThisPhase
    • damageThisRound

      public int damageThisRound
    • engineHitsThisPhase

      public int engineHitsThisPhase
    • rolledForEngineExplosion

      public boolean rolledForEngineExplosion
    • dodging

      public boolean dodging
    • reckless

      public boolean reckless
    • spotting

      public boolean spotting
    • killerId

      protected int killerId
    • vectors

      protected int[] vectors
    • infernos

      public InfernoTracker infernos
      The object that tracks this unit's Inferno round hits.
    • aTracker

      public ArtilleryTracker aTracker
    • tmTracker

      public TeleMissileTracker tmTracker
    • c3NetIdString

      protected String c3NetIdString
    • c3Master

      protected int c3Master
    • c3CompanyMasterIndex

      protected int c3CompanyMasterIndex
    • structureType

      protected int structureType
    • structureTechLevel

      protected int structureTechLevel
    • source

      protected String source
    • asewAffectedTurns

      protected int asewAffectedTurns
      Keeps track of the current ASEW effect on this entity
    • equipmentList

      protected List<Mounted<?>> equipmentList
      A list of all mounted equipment. (Weapons, ammo, and misc)
    • weaponList

      protected List<WeaponMounted> weaponList
      A list of all mounted weapons. This only includes regular weapons, not bay mounts or grouped weapon mounts.
    • weaponBayList

      protected List<WeaponMounted> weaponBayList
      A list of all mounted weapon bays
    • weaponGroupList

      protected List<WeaponMounted> weaponGroupList
      A list of all mounted weapon groups
    • totalWeaponList

      protected List<WeaponMounted> totalWeaponList
      A list of every weapon mount, including bay mounts and weapon group mounts
    • ammoList

      protected List<AmmoMounted> ammoList
      A list of all mounted ammo.
    • bombList

      protected List<BombMounted> bombList
      A list of all mounted bombs.
    • miscList

      protected List<MiscMounted> miscList
      A list of all remaining equipment.
    • pendingINarcPods

      protected ArrayList<INarcPod> pendingINarcPods
    • iNarcPods

      protected ArrayList<INarcPod> iNarcPods
    • pendingNarcPods

      protected ArrayList<NarcPod> pendingNarcPods
    • narcPods

      protected ArrayList<NarcPod> narcPods
    • failedEquipmentList

      protected ArrayList<String> failedEquipmentList
    • m_lNarcedBy

      protected long m_lNarcedBy
    • m_lPendingNarc

      protected long m_lPendingNarc
    • crits

      protected CriticalSlot[][] crits
      This matrix stores critical slots in the format [location][slot #]. What locations entities have and how many slots there are in each is determined by the subclasses of Entity such as Mek.
    • movementMode

      protected EntityMovementMode movementMode
      Stores the current movement mode.
    • isHidden

      protected boolean isHidden
      Flag that determines if this Entity is a hidden unit or not (see TW pg 259).
    • madePointblankShot

      protected boolean madePointblankShot
      Used to determine if this Entity has made a pointblank shot so far this round.
    • hiddenActivationPhase

      protected GamePhase hiddenActivationPhase
      Keeps track of whether this Entity should activate in a particular game phase. Generally this will be Game.Phase.UNKNOWN, indicating the unit isn't activating.
    • carcass

      protected boolean carcass
    • sensorContacts

      public Set<Integer> sensorContacts
      Contains the ids of all entities that have been detected by this entity's sensors. Used for double-blind on space maps - SO p117

      Entities need only be cleared from this when they move out of range, are destroyed, or move off the board

    • firingSolutions

      public Set<Integer> firingSolutions
      Contains the ids of all entities that this entity has established a firing solution on. Used for double-blind on space maps - SO p117

      Entities need only be cleared from this when they move out of range, are destroyed, or move off the board

    • elevation

      protected int elevation
      this is the elevation of the Entity--with respect to the surface of the hex it's in. In other words, this may need to *change* as it moves from hex to hex--without it going up or down. I.e.--level 0 hex, elevation 5--it moves to a level 2 hex, without going up or down. elevation is now 3.
    • altitude

      protected int altitude
      altitude is different from elevation. It is used to measure the vertical distance of Aero units from the ground on low atmosphere and ground maps.
    • lastTarget

      protected int lastTarget
    • lastTargetDisplayName

      protected String lastTargetDisplayName
    • isCarefulStanding

      protected boolean isCarefulStanding
    • heatSinkCoolantFailureFactor

      protected int heatSinkCoolantFailureFactor
    • taserShutdownRounds

      protected int taserShutdownRounds
    • shutdownByBATaser

      protected boolean shutdownByBATaser
    • taserFeedBackRounds

      protected int taserFeedBackRounds
    • taserInterference

      protected int taserInterference
    • taserInterferenceRounds

      protected int taserInterferenceRounds
    • taserInterferenceHeat

      protected boolean taserInterferenceHeat
    • fluff

      protected EntityFluff fluff
    • armorTonnage

      protected double armorTonnage
    • MASC_FAILURE

      protected static int[] MASC_FAILURE
    • ALTERNATE_MASC_FAILURE

      protected static int[] ALTERNATE_MASC_FAILURE
    • ALTERNATE_MASC_FAILURE_ENHANCED

      protected static int[] ALTERNATE_MASC_FAILURE_ENHANCED
    • nMASCLevel

      protected int nMASCLevel
    • bMASCWentUp

      protected boolean bMASCWentUp
    • usedMASC

      protected boolean usedMASC
    • nSuperchargerLevel

      protected int nSuperchargerLevel
    • bSuperchargerWentUp

      protected boolean bSuperchargerWentUp
    • usedSupercharger

      protected boolean usedSupercharger
    • military

      protected boolean military
    • hasDamagedRHS

      protected boolean hasDamagedRHS
      Keeps track of whether or not this Entity has a critically hit radical heat sink. Using a flag will prevent having to iterate over all of the Entity's mounted equipment
    • consecutiveRHSUses

      protected int consecutiveRHSUses
      Keeps track of the number of consecutive turns a radical heat sink has been used.
    • incomingGuidedAttacks

      protected ArrayList<WeaponAttackAction> incomingGuidedAttacks
      Vector storing references to friendly weapon attack actions this entity may need to support; Primarily used by Princess to speed up TAG utility calculations.
    • icon

      protected Base64Image icon
      The icon for this unit; This is empty unless the unit file has an embedded icon.
    • TA_OMNI

      protected static final TechAdvancement TA_OMNI
    • TA_PATCHWORK_ARMOR

      protected static final TechAdvancement TA_PATCHWORK_ARMOR
    • TA_MIXED_TECH

      protected static final TechAdvancement TA_MIXED_TECH
    • TA_ARMORED_COMPONENT

      protected static final TechAdvancement TA_ARMORED_COMPONENT
  • Constructor Details

    • Entity

      public Entity()
      Generates a new, blank, entity.
  • Method Details

    • getUnitType

      public abstract int getUnitType()
      See Also:
    • defaultCrewType

      public CrewType defaultCrewType()
    • initMilitary

      protected void initMilitary()
    • hasViableWeapons

      protected boolean hasViableWeapons()
    • restore

      public void restore()
      Restores the entity after serialization
    • getId

      public int getId()
      Description copied from interface: InGameObject
      Returns this InGameObject's id. The id must be unique to this InGameObject within the current game. equals() must return true for two InGameObject objects with the same id.
      Specified by:
      getId in interface InGameObject
      Returns:
      The game-unique id of this InGameObject (Entity, AlphaStrikeElement etc.)
    • setId

      public void setId(int id)
      Sets the ID number of this Entity, which will also set the display name and short name to null.
      Specified by:
      setId in interface InGameObject
      Parameters:
      id - the new ID.
    • getExternalId

      public int getExternalId()
      This returns the external ID.

      Taharqa: I am changing externalId to a string so I can use UUIDs in MHQ.

      Returns:
      the ID settable by external sources (such as mm.net)
      Throws:
      NumberFormatException - if the stored ID is not an integer
      See Also:
    • getExternalIdAsString

      public String getExternalIdAsString()
    • setExternalIdAsString

      public void setExternalIdAsString(String externalId)
      This sets the external ID.
      Parameters:
      externalId - the new external ID for this Entity.
      See Also:
    • setExternalId

      public void setExternalId(int id)
    • getGame

      @Nullable public Game getGame()
      This returns the game this Entity belongs to.
      Returns:
      the game.
    • setIGame

      public void setIGame(IGame iGame)
    • setGame

      public void setGame(Game game)
      This sets the game the entity belongs to. It also restores the entity and checks that the game is in a consistent state. This function takes care of the units transported by this entity.
      Specified by:
      setGame in interface Transporter
      Parameters:
      game - The current Game
    • getModel

      public String getModel()
      Returns the unit code for this entity.
    • setModel

      public void setModel(String model)
      Sets the unit code for this Entity.
      Parameters:
      model - The unit code.
    • getChassis

      public String getChassis()
      Returns:
      The pure chassis name without any additions, e.g. "Mad Cat"
    • getFullChassis

      public String getFullChassis()
      Returns:
      The full chassis name plus the additional name, if any, e.g. Mad Cat (Timber Wolf)
    • setChassis

      public void setChassis(String chassis)
      sets the chassis name for this entity.
      Parameters:
      chassis - The chassis name.
    • setClanChassisName

      public void setClanChassisName(String name)
      Sets the clanChassisName for this unit, e.g. "Timber Wolf".
    • getClanChassisName

      public String getClanChassisName()
      Returns:
      The clanChassisName for this unit, e.g. "Timber Wolf", or "" if there is none.
    • getFluff

      public EntityFluff getFluff()
      Returns the fluff for this entity.
    • getTechLevel

      public int getTechLevel()
      Returns the unit tech for this entity.
    • setTechLevel

      public void setTechLevel(int techLevel)
      Sets the tech level for this Entity.
      Parameters:
      techLevel - The tech level, it must be one of the TechConstants .
    • initTechAdvancement

      protected void initTechAdvancement()
      Sets initial TechAdvancement without equipment based on construction options.
    • factionTechLevel

      public CompositeTechLevel factionTechLevel(ITechnology.Faction techFaction)
    • addTechComponent

      protected void addTechComponent(ITechnology tech)
    • isIntroLevel

      public boolean isIntroLevel()
      Specified by:
      isIntroLevel in interface ITechnology
    • isUnofficial

      public boolean isUnofficial()
      Specified by:
      isUnofficial in interface ITechnology
    • getIntroductionDateAndEra

      public String getIntroductionDateAndEra()
    • getIntroductionDate

      public int getIntroductionDate()
      Specified by:
      getIntroductionDate in interface ITechnology
    • getIntroductionDate

      public int getIntroductionDate(boolean clan, ITechnology.Faction faction)
      Specified by:
      getIntroductionDate in interface ITechnology
    • getEarliestTechDate

      public int getEarliestTechDate()
      Returns:
      The earliest date this unit could be built, based on the latest intro date of the components.
    • getEarliestTechDateAndEra

      public String getEarliestTechDateAndEra()
      Returns:
      The earliest date this unit could be built, based on the latest intro date of the components.
    • getPrototypeRangeDate

      public String getPrototypeRangeDate()
    • getProductionDateRange

      public String getProductionDateRange()
    • getCommonDateRange

      public String getCommonDateRange()
    • getPrototypeDate

      public int getPrototypeDate()
      Specified by:
      getPrototypeDate in interface ITechnology
    • getPrototypeDate

      public int getPrototypeDate(boolean clan, ITechnology.Faction faction)
      Specified by:
      getPrototypeDate in interface ITechnology
    • getProductionDate

      public int getProductionDate()
      Specified by:
      getProductionDate in interface ITechnology
    • getProductionDate

      public int getProductionDate(boolean clan, ITechnology.Faction faction)
      Specified by:
      getProductionDate in interface ITechnology
    • getCommonDate

      public int getCommonDate()
      Specified by:
      getCommonDate in interface ITechnology
    • getExtinctionDate

      public int getExtinctionDate()
      Specified by:
      getExtinctionDate in interface ITechnology
    • getExtinctionDate

      public int getExtinctionDate(boolean clan, ITechnology.Faction faction)
      Specified by:
      getExtinctionDate in interface ITechnology
    • getReintroductionDate

      public int getReintroductionDate()
      Specified by:
      getReintroductionDate in interface ITechnology
    • getReintroductionDate

      public int getReintroductionDate(boolean clan, ITechnology.Faction faction)
      Specified by:
      getReintroductionDate in interface ITechnology
    • getTechRating

      public ITechnology.TechRating getTechRating()
      Specified by:
      getTechRating in interface ITechnology
    • getStaticTechLevel

      public SimpleTechLevel getStaticTechLevel()
      Description copied from interface: ITechnology
      For non-era-based usage, provide a single tech level that does not vary with date.
      Specified by:
      getStaticTechLevel in interface ITechnology
      Returns:
      The base rules level of the equipment or unit.
    • getTechBaseDescription

      public String getTechBaseDescription()
    • getTechBaseDescriptions

      public static List<String> getTechBaseDescriptions()
    • getBaseAvailability

      public ITechnology.AvailabilityValue getBaseAvailability(ITechnology.Era era)
      Specified by:
      getBaseAvailability in interface ITechnology
    • getExtinctionRange

      public String getExtinctionRange()
      Specified by:
      getExtinctionRange in interface ITechnology
    • getConstructionTechAdvancement

      public abstract TechAdvancement getConstructionTechAdvancement()
      return - the base construction option tech advancement
    • recalculateTechAdvancement

      public void recalculateTechAdvancement()
      Resets techAdvancement to initial value and adjusts for all installed equipment.
    • getOmniAdvancement

      public static TechAdvancement getOmniAdvancement()
    • getOmniAdvancement

      public static TechAdvancement getOmniAdvancement(Entity en)
    • getPatchworkArmorAdvancement

      public static TechAdvancement getPatchworkArmorAdvancement()
    • getMixedTechAdvancement

      public static TechAdvancement getMixedTechAdvancement()
    • getArmoredComponentTechAdvancement

      public static TechAdvancement getArmoredComponentTechAdvancement()
    • addSystemTechAdvancement

      protected void addSystemTechAdvancement(CompositeTechLevel ctl)
      Incorporate dates for components that are not in the equipment list, such as engines and structure.
    • getRecoveryTurn

      public int getRecoveryTurn()
    • setRecoveryTurn

      public void setRecoveryTurn(int r)
    • isManualShutdown

      public boolean isManualShutdown()
    • setManualShutdown

      public void setManualShutdown(boolean tf)
    • performManualShutdown

      public void performManualShutdown()
    • performManualStartup

      public void performManualStartup()
    • isClan

      public boolean isClan()
      Checks if this is a clan unit. This is determined by tech level.
      Specified by:
      isClan in interface ITechnology
      Returns:
      true if this unit is a clan unit.
      See Also:
    • isClanArmor

      public boolean isClanArmor(int loc)
    • getTechBase

      public ITechnology.TechBase getTechBase()
      Specified by:
      getTechBase in interface ITechnology
    • isMixedTech

      public boolean isMixedTech()
      Specified by:
      isMixedTech in interface ITechnology
    • setMixedTech

      public void setMixedTech(boolean mixedTech)
    • isDesignValid

      public boolean isDesignValid()
    • setDesignValid

      public void setDesignValid(boolean designValid)
    • getYear

      public int getYear()
    • setYear

      public void setYear(int year)
    • getWeight

      public double getWeight()
      Returns:
      the tonnage of the Entity, not its weight
    • getWeightClass

      public int getWeightClass()
    • getWeightClassName

      public String getWeightClassName()
    • isSuperHeavy

      public boolean isSuperHeavy()
    • setWeight

      public void setWeight(double weight)
    • isOmni

      public boolean isOmni()
    • setOmni

      public void setOmni(boolean omni)
    • locations

      public abstract int locations()
      Returns the number of locations in the entity
    • getBodyLocation

      public int getBodyLocation()
      Determines where to place equipment that does not require a specific location. What this means varies by Entity type.
      Returns:
      The location to place equipment that is not required to be assigned a location, defaulting to Entity.LOC_NONE for unit types that do not have such a location.
    • getOwner

      @Nullable public Player getOwner()

      Returns the player that "owns" this entity.

      Unfortunately, entities freshly created may not have the game set. Therefore, fall back to the old version when game == null or the player is no longer in the game

      Server and other central classes already used AbstractGame.getPlayer(int). It is noted that owner property is not reliable and should be avoided except in special situations like when entities freshly created may not have the game set

      Returns:
      The player that owns this entity. Null if the entity is not owned by anyone.
    • setOwner

      public void setOwner(Player player)
    • setOwnerId

      public void setOwnerId(int ownerId)
      Description copied from interface: InGameObject
      Sets the unique id of this InGameObject's owning player. This id may be Player.NONE.
      Specified by:
      setOwnerId in interface InGameObject
      Parameters:
      ownerId - The player id of the owner of this InGameObject.
    • getOwnerId

      public int getOwnerId()
      Description copied from interface: InGameObject
      Returns the unique id of this InGameObject's owning player. This id may be Player.NONE.
      Specified by:
      getOwnerId in interface InGameObject
      Returns:
      The player id of the owner of this InGameObject.
    • isEnemyOf

      public boolean isEnemyOf(Entity other)
      Returns true if the other entity is an enemy of this entity. This is more reliable than Player.isEnemyOf since it knows that an entity will never be an enemy of itself.
      Specified by:
      isEnemyOf in interface Targetable
      Returns:
    • getCrew

      public Crew getCrew()
    • setCrew

      public void setCrew(Crew crew)
    • getNCrew

      public int getNCrew()
      Returns:
      The total number of crew available to supplement marines on boarding actions. Includes officers, enlisted, and bay personnel, but not marines/ba or passengers.
    • setNCrew

      public void setNCrew(int crew)
    • getNPassenger

      public int getNPassenger()
      Returns:
      The number of passengers on this unit. Intended for spacecraft, where we want to get the crews of transported units plus actual passengers assigned to quarters
    • setNPassenger

      public void setNPassenger(int pass)
    • getNMarines

      public int getNMarines()
      Returns:
      The number conventional marines available to vessels for boarding actions.
    • setNMarines

      public void setNMarines(int marines)
      Updates the number of marines aboard
      Parameters:
      marines - The number of marines to add/subtract
    • hasCommandConsoleBonus

      public boolean hasCommandConsoleBonus()
      Units with a cockpit command console provide an initiative bonus to their side, provided that the commander is not currently functioning as pilot, the unit has advanced fire control, and the unit is heavy or assault weight class.
      Returns:
      Whether the Entity qualifies for initiative bonus from cockpit command console.
    • isShutDown

      public boolean isShutDown()
    • setShutDown

      public void setShutDown(boolean shutDown)
    • setShutDownThisPhase

      public void setShutDownThisPhase(boolean shutDown)
    • isShutDownThisPhase

      public boolean isShutDownThisPhase()
    • setStartupThisPhase

      public void setStartupThisPhase(boolean shutDown)
    • isStartupThisPhase

      public boolean isStartupThisPhase()
    • isDoomed

      public boolean isDoomed()
    • setDoomed

      public void setDoomed(boolean doomed)
    • isDestroyed

      public boolean isDestroyed()
    • setDestroyed

      public void setDestroyed(boolean destroyed)
    • getTargetType

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

      public int getHeight()
      Description copied from interface: Targetable
      Returns the height of the target, that is, how many levels above its elevation it is for LOS purposes.
      Specified by:
      getHeight in interface Targetable
      Returns:
      height of the target in elevation levels
    • isDone

      public boolean isDone()
    • setDone

      public void setDone(boolean done)
    • setUnloaded

      public void setUnloaded(boolean unloaded)
      This method should only be called when needed to remove a dead swarmer's game turn.
    • setLoadedThisTurn

      public void setLoadedThisTurn(boolean loaded)
    • isActive

      public boolean isActive()
      Determine if this entity participate in the current game phase.
      Returns:
      true if this entity is not shut down, is not destroyed, has an active crew, and was not unloaded from a transport this turn. false otherwise.
    • isActive

      public boolean isActive(int turn)
    • isSelectableThisTurn

      public boolean isSelectableThisTurn()
      Returns true if this entity is selectable for action. Transported entities can not be selected.
    • isLoadableThisTurn

      public boolean isLoadableThisTurn()
      Returns true if this entity could potentially be loaded (did not move from starting hex)
    • isUnloadedThisTurn

      public boolean isUnloadedThisTurn()
      Determine if this Entity was unloaded previously this turn.
      Returns:
      true if this entity was unloaded for any reason during this turn.
    • wasLoadedThisTurn

      public boolean wasLoadedThisTurn()
    • isTargetable

      public boolean isTargetable()
      Returns true if this entity is targetable for attacks. A unit is targetable if it is not destroyed, not doomed, deployed, not off board, not being transported, and not captured.
    • isProne

      public boolean isProne()
    • setProne

      public void setProne(boolean prone)
    • isHullDown

      public boolean isHullDown()
    • setHullDown

      public void setHullDown(boolean down)
    • isImmobile

      public boolean isImmobile()
      Is this entity shut down or is the crew unconscious?
      Specified by:
      isImmobile in interface Targetable
      Returns:
      true if the target is immobile (-4 to hit)
    • isImmobileForJump

      public boolean isImmobileForJump()
    • isImmobile

      public boolean isImmobile(boolean checkCrew)
      Is this entity shut down, or if applicable is the crew unconscious?
      Parameters:
      checkCrew - If true, consider the fitness of the crew when determining if the entity is immobile.
    • isPermanentlyImmobilized

      public boolean isPermanentlyImmobilized(boolean checkCrew)
      This method returns true if a unit is permanently immobilized either because its crew is dead/gone or because of damage
      Returns:
      true if unit is permanently immobile
    • isCharging

      public boolean isCharging()
    • isPushing

      public boolean isPushing()
    • isMakingDfa

      public boolean isMakingDfa()
    • hasDisplacementAttack

      public boolean hasDisplacementAttack()
    • getDisplacementAttack

      public DisplacementAttackAction getDisplacementAttack()
    • setDisplacementAttack

      public void setDisplacementAttack(DisplacementAttackAction displacementAttack)
    • isTargetOfDisplacementAttack

      public boolean isTargetOfDisplacementAttack()
      Returns true if any other entities this entity knows of are making a displacement attack on this entity.
    • findTargetedDisplacement

      @Nullable public DisplacementAttackAction findTargetedDisplacement()
      Returns any known displacement attacks (should only be one) that this entity is a target of.
    • isUnjammingRAC

      public boolean isUnjammingRAC()
    • setUnjammingRAC

      public void setUnjammingRAC(boolean u)
    • isFindingClub

      public boolean isFindingClub()
    • setFindingClub

      public void setFindingClub(boolean findingClub)
    • setArmsFlipped

      public void setArmsFlipped(boolean armsFlipped)
      Set whether or not the Mek's arms are flipped to the rear
    • setArmsFlipped

      public void setArmsFlipped(boolean armsFlipped, boolean fireEvent)
      Set whether or not the Mek's arms are flipped to the rear. Does not fire the game event, useful for when it's called repeatedly such as during bot turn calculations
    • getArmsFlipped

      public boolean getArmsFlipped()
      Returns true if the Mek's arms are flipped to the rear
    • isMakingVTOLGroundAttack

      public boolean isMakingVTOLGroundAttack()
      Returns:
      true if the VTOL or LAM is making a VTOL strafe or VTOL/AirMek bomb attack
    • getPosition

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

      public HashSet<Coords> getOccupiedCoords()
      Returns:
      a set of the coords this Entity occupies
    • setPosition

      public void setPosition(Coords position)
    • setPosition

      public void setPosition(Coords position, boolean gameUpdate)
      Sets the current position of this entity on the board.
      Parameters:
      position - the new position.
    • getPriorPosition

      public Coords getPriorPosition()
      Returns:
      the coords of the second to last position on the passed through vector or the current position if too small
    • setElevation

      public void setElevation(int elevation)
      Sets the current elevation of this entity above the ground. This is the number of levels the unit is above the level of the hex.
      Parameters:
      elevation - an int representing the new elevation.
    • calcElevation

      public int calcElevation(Hex current, Hex next, int assumedElevation, boolean climb)
      Calculates the elevation of the entity in the next hex.
      Parameters:
      current - The current hex
      next - The next hex
      assumedElevation - The assumed elevation from the previous hex
      climb - Whether the entity is climbing or not
      Returns:
      The elevation of the entity in the next hex
      See Also:
    • calcElevation

      public int calcElevation(Hex current, Hex next)
    • getElevation

      public int getElevation()
      Description copied from interface: Targetable
      Returns the elevation of this target, relative to the position Hex's surface
      Specified by:
      getElevation in interface Targetable
      Returns:
      The elevation of this Entity, relative to the current Hex's surface. When the unit is transported, returns the elevation of the carrier.
    • canGoDown

      public boolean canGoDown()
    • canGoDown

      public boolean canGoDown(int assumedElevation, Coords assumedPos, int boardId)
      is it possible to go down, or are we landed/just above the water/treeline? assuming passed elevation.
    • canGoUp

      public boolean canGoUp(int assumedElevation, Coords assumedPos, int boardId)
      is it possible to go up, or are we at maximum altitude? assuming passed elevation.
    • isElevationValid

      public boolean isElevationValid(int assumedElevation, Hex hex)
      Check if this entity can legally occupy the requested elevation. Does not check stacking, only terrain limitations
    • height

      public int height()
      Returns the height of the unit, that is, how many levels above its elevation it is for LOS purposes. Default is 0.
    • relHeight

      public int relHeight()
      Returns the elevation of the entity's highest point relative to the surface of the hex the entity is in, i.e. relHeight() == getElevation() + getHeight()
      Specified by:
      relHeight in interface Targetable
      Returns:
      elevation of the top (e.g. torso) of the target relative to surface
    • isOnAtmosphericGroundMap

      public boolean isOnAtmosphericGroundMap()
      Convenience method to determine whether this entity is on a ground map with an atmosphere
    • isAirborneAeroOnGroundMap

      public boolean isAirborneAeroOnGroundMap()
      Convenience method to determine whether this entity should be treated as an airborne aero on a ground map.
      Returns:
      True if this is an airborne aircraft on a ground map.
    • isAeroLandedOnGroundMap

      public boolean isAeroLandedOnGroundMap()
      Convenience method to determine whether this entity should be treated as a landed aero on a ground map.
      Returns:
      True if this is an aero landed on a ground map.
    • getDuplicateMarker

      public int getDuplicateMarker()
      Gets the marker used to disambiguate this entity from others with the same name. These are monotonically increasing values, starting from one.
    • setDuplicateMarker

      public void setDuplicateMarker(int duplicateMarker)
      Sets the marker used to disambiguate this entity from others with the same name. These are monotonically increasing values, starting from one.
      Parameters:
      duplicateMarker - A marker to disambiguate this entity from others with the same name.
    • updateDuplicateMarkerAfterDelete

      public boolean updateDuplicateMarkerAfterDelete(int removedMarker)
      Updates the marker used to disambiguate this entity from others with the same name after one of them has been removed from the game.
      Parameters:
      removedMarker - The marker of the removed entity.
      Returns:
      A value indicating whether or not this entity updated its duplicate marker.
    • getDisplayName

      public String getDisplayName()
      Returns the display name for this entity.
      Specified by:
      getDisplayName in interface Targetable
      Returns:
      name of the target for ui purposes
    • setDisplayName

      protected void setDisplayName(String displayName)
      Sets the display name for this entity.
      Parameters:
      displayName - The new display name.
    • generateDisplayName

      public void generateDisplayName()
      Generates the display name for this entity.

      Sub-classes are allowed to override this method. The display name is in the format [Chassis] [Model] ([Player Name]).

    • getShortName

      public String getShortName()
      A short name, suitable for displaying above a unit icon. The short name is basically the same as the display name, minus the player name.
    • generateShortName

      public void generateShortName()
      Generate the short name for a unit

      Sub-classes are allowed to override this method. The display name is in the format [Chassis] [Model].

    • getShortNameRaw

      public String getShortNameRaw()
    • getFacing

      public int getFacing()
      Returns the primary facing, or -1 if n/a
    • getFacingName

      public String getFacingName(int facing)
    • setFacing

      public void setFacing(int facing)
      Sets the primary facing.
    • getSecondaryFacing

      public int getSecondaryFacing()
      Returns the secondary facing, or -1 if n/a
    • setSecondaryFacing

      public void setSecondaryFacing(int sec_facing)
    • setSecondaryFacing

      public void setSecondaryFacing(int sec_facing, boolean fireEvent)
      Sets the secondary facing. Optionally does not fire a game change event (useful for bot evaluation)
    • postProcessFacingChange

      public void postProcessFacingChange()
      Utility function that handles situations where a facing change imparts some kind of permanent effect to the entity.
    • canChangeSecondaryFacing

      public abstract boolean canChangeSecondaryFacing()
      Can this entity change secondary facing at all?
    • isValidSecondaryFacing

      public abstract boolean isValidSecondaryFacing(int dir)
      Can this entity torso/turret twist the given direction?
    • clipSecondaryFacing

      public abstract int clipSecondaryFacing(int dir)
      Returns the closest valid secondary facing to the given direction.
      Returns:
      the closest valid secondary facing.
    • getAlreadyTwisted

      public boolean getAlreadyTwisted()
      Returns:
      whether this entity already changed a secondary facing in an earlier phase
    • setAlreadyTwisted

      public void setAlreadyTwisted(boolean value)
      Used by TargetingPhaseDisplay.java and FiringDisplay.java
      Parameters:
      value - true sets twistedPhase to current phase (or leaves it if set); false unsets twistedPhase
    • canUnjamRAC

      public boolean canUnjamRAC()
      Returns true if the entity has an RAC which is jammed and not destroyed As of 5/22/2012 also returns true if there is a jammed and not destroyed Ultra AC and the unofficial options is enabled. Jammed ACs and LACs can also be unjammed if rapid-fire ACs is turned on.
    • canFlipArms

      public boolean canFlipArms()
      Returns true if the entity can flip its arms
    • canPickupGroundObject

      public boolean canPickupGroundObject()
      Returns true if the entity can pick up ground objects
    • maxGroundObjectTonnage

      public double maxGroundObjectTonnage()
      The maximum tonnage of ground objects that can be picked up by this unit
    • pickupGroundObject

      public void pickupGroundObject(ICarryable carryable, Integer location)
      Put a ground object into the given location
    • dropGroundObject

      public void dropGroundObject(ICarryable carryable, boolean isUnload)
      Remove a specific carried object - useful for when you have the object but not its location, or when an object is being carried in multiple locations.
    • dropGroundObject

      public void dropGroundObject(int location)
      Remove a ground object (cargo) from the given location
    • dropGroundObjects

      public void dropGroundObjects()
      Convenience method to drop all cargo. TODO HHW - Psi
    • getCarriedObject

      public ICarryable getCarriedObject(int location)
      Get the object carried in the given location. May return null.
    • getCarriedObjects

      public Map<Integer,ICarryable> getCarriedObjects()
    • setCarriedObjects

      public void setCarriedObjects(Map<Integer,ICarryable> value)
      TODO HHW - Psi
    • getDistinctCarriedObjects

      public List<ICarryable> getDistinctCarriedObjects()
    • getDefaultPickupLocations

      protected List<Integer> getDefaultPickupLocations()
      A list of the "default" cargo pick up locations for when none is specified
    • getValidHalfWeightPickupLocations

      public List<Integer> getValidHalfWeightPickupLocations(ICarryable cargo)
      A list of all the locations that the entity can use to pick up cargo following the TacOps "one handed" pickup rules
    • canFireWeapon

      public boolean canFireWeapon(int location)
      Whether a weapon in a given location can be fired, given the entity's currently carried cargo
    • getBlockedFiringLocations

      protected Map<Integer,List<Integer>> getBlockedFiringLocations()
      Method that returns the mapping between locations which, if cargo is carried, block other locations from firing.
    • getOriginalWalkMP

      public int getOriginalWalkMP()
      Returns this entity's original walking movement points
    • setOriginalWalkMP

      public void setOriginalWalkMP(int walkMP)
      Sets this entity's original walking movement points
    • getWalkMP

      public int getWalkMP()
      Returns:
      this entity's walking/cruising mp, factoring in all MP-changing effects.
    • getWalkMP

      public int getWalkMP(MPCalculationSetting mpCalculationSetting)
    • getHeatMPReduction

      public int getHeatMPReduction()
      Returns:
      The number of movement points (MP) lost due to the current heat level of the unit
    • getStandingHeat

      public int getStandingHeat()
      get the heat generated by this Entity when standing still
    • getWalkHeat

      public int getWalkHeat()
      get the heat generated by this Entity when walking/cruising
    • getOriginalRunMP

      public int getOriginalRunMP()
      Returns:
      This entity's unmodified running/flank mp.
    • getRunMP

      public int getRunMP()
      Returns:
      This entity's running/flank mp modified for all in-game effects.
    • getRunMP

      public int getRunMP(MPCalculationSetting mpCalculationSetting)
    • getRunMPwithoutMASC

      public int getRunMPwithoutMASC()
      Returns run MP without considering any MASC systems
    • getRunMPasString

      public String getRunMPasString()
      Returns this entity's running/flank mp as a string. Includes both the base mp and the potential mp with speed enhancers, including the current status of such speed enhancers.
      Returns:
      A string like 9(15) if there is no current Game, or a string like 9(15) MASC:0(3+) if there is one.
    • getRunMPasString

      public String getRunMPasString(boolean gameState)
      Returns this entity's running/flank mp as a string. Includes both the base mp and the potential mp with speed enhancers, optionally including the current status of such speed enhancers.
      Parameters:
      gameState - Set this to true to include information about the current state of equipment like MASC.
      Returns:
      A string like 9(15) if gameState is false or there is no current Game, or a string like 9(15) MASC:0(3+) otherwise.
    • getRunHeat

      public int getRunHeat()
      get the heat generated by this Entity when running/flanking
    • getSprintMP

      public int getSprintMP()
      Returns this entity's sprinting MP, modified for all its current circumstances such as gravity and damage. See MPCalculationSetting.STANDARD. For units that can't sprint, this is equal to the modified run/flank MP.
      Returns:
      This entity's modified sprinting MP
    • getSprintMP

      public int getSprintMP(MPCalculationSetting mpCalculationSetting)
      Returns this entity's sprinting MP, modified according to the given setting. For units that can't sprint, this is equal to the modified run/flank MP.
      Returns:
      This entity's modified sprinting MP
    • getSprintMPwithOneMASC

      public int getSprintMPwithOneMASC()
      Returns sprint MP without considering MASC
    • getSprintMPwithoutMASC

      public int getSprintMPwithoutMASC()
      Returns sprint MP without considering MASC
    • getSprintHeat

      public int getSprintHeat()
      get the heat generated by this Entity when sprinting
    • getRunningGravityLimit

      public int getRunningGravityLimit()
      get the gravity limit for ground movement
    • getOriginalJumpMP

      public int getOriginalJumpMP()
      Returns this entity's original jumping mp.
    • getOriginalJumpMP

      public int getOriginalJumpMP(boolean ignoreModularArmor)
    • setOriginalJumpMP

      public void setOriginalJumpMP(int jumpMP)
      Sets this entity's original jump movement points
    • getAnyTypeMaxJumpMP

      public int getAnyTypeMaxJumpMP()
      Returns:
      In most cases, the same as getJumpMP(). For Meks that have either normal jump MP or mechanical booster jump MP or both, the bigger value is returned.
      See Also:
    • getJumpMP

      public int getJumpMP()
      Returns this entity's current jump jet jumping MP, not affected by terrain, factored for gravity. Note that for Meks, this does not include jumping MP due to mechanical jump boosters. When the difference between the two doesn't matter (Princess or scenario estimations or the like), use getAnyTypeMaxJumpMP() instead.
      See Also:
    • getJumpMP

      public int getJumpMP(MPCalculationSetting mpCalculationSetting)
    • getJumpType

      public int getJumpType()
    • getJumpHeat

      public int getJumpHeat(int movedMP)
      get the heat generated by this Entity when jumping for a certain amount of MP
      Parameters:
      movedMP - the number of movement points spent
    • getJumpMPWithTerrain

      public int getJumpMPWithTerrain()
      Returns this entity's current jumping MP, affected by terrain (like water.)
    • getMechanicalJumpBoosterMP

      public int getMechanicalJumpBoosterMP()
      Returns:
      The jump MP for a Mek's mechanical jump boosters, modified for typical gameplay purposes by damage, other equipment (shields) and other effects. Returns 0 for non-Meks.
    • getMechanicalJumpBoosterMP

      public int getMechanicalJumpBoosterMP(MPCalculationSetting mpCalculationSetting)
      Returns:
      The jump MP for a Mek's mechanical jump boosters, modified as given through the MPCalculationSetting. Returns 0 for non-Meks.
    • isEligibleForPavementOrRoadBonus

      public boolean isEligibleForPavementOrRoadBonus()
      Tanks and certain other units can get a +1 bonus to MP if their move is entirely on pavement.
      Returns:
      true if the Entity gets a movement bonus on pavement
    • elevationOccupied

      public int elevationOccupied(Hex hex)
      Returns the absolute elevation above ground level 0 that this entity would be on if it were placed into the specified hex. Hovercraft, naval vessels, and hydrofoils move on the surface of the water
    • elevationOccupied

      public int elevationOccupied(Hex hex, int elevation)
    • isLocationProhibited

      public final boolean isLocationProhibited(BoardLocation boardLocation)
      Returns true when the given location cannot legally be entered or deployed into by this unit at its present elevation or altitude. Also returns true when the location doesn't exist. Even when this method returns true, the location need not be deadly to the unit.
      Parameters:
      boardLocation - The location to test
      Returns:
      True when the location is illegal to be in for this unit, regardless of elevation
      See Also:
    • isLocationProhibited

      public final boolean isLocationProhibited(BoardLocation boardLocation, int testElevation)
      Returns true when the given location cannot legally be entered or deployed into by this unit at the given elevation or altitude. Also returns true when the location doesn't exist. Even when this method returns true, the location need not be deadly to the unit.
      Parameters:
      boardLocation - The location to test
      testElevation - The elevation or altitude to test
      Returns:
      True when the location is illegal to be in for this unit, regardless of elevation
      See Also:
    • isLocationProhibited

      public boolean isLocationProhibited(Coords testPosition, int testBoardId, int testElevation)
      Returns true when the given location cannot legally be entered or deployed into by this unit at the given elevation or altitude. Also returns true when the location doesn't exist. Even when this method returns true, the location need not be deadly to the unit.
      Parameters:
      testPosition - The position to test
      testBoardId - The board to test
      testElevation - The elevation or altitude to test
      Returns:
      True when the location is illegal to be in for this unit, regardless of elevation
      See Also:
    • isLocationProhibited

      public final boolean isLocationProhibited(Coords c)
      Returns true if the specified hex contains some sort of prohibited terrain. legacy - use the board location/board ID methods instead
    • isLocationProhibited

      public final boolean isLocationProhibited(Coords c, int currElevation)
      Parameters:
      c - Coords Coordinates
      currElevation - Elevation level
      Returns:
      true if the specified hex contains some sort of prohibited terrain if the Entity is at the specified elevation. Elevation generally only matters for units like WiGEs or VTOLs. legacy - use the board location/board ID methods instead
    • isBoardProhibited

      public boolean isBoardProhibited(Board board)
      Returns:
      True if the given board is prohibited to this unit.
    • isBoardProhibited

      public boolean isBoardProhibited(BoardType boardType)
      Returns:
      True if the given board is prohibited to this unit.
    • isLocationDeadly

      public boolean isLocationDeadly(Coords c)
    • isLocationDeadly

      public boolean isLocationDeadly(Coords c, int boardId)
      Returns true if the specified hex exists and has terrain that is deadly to this unit. Note: Currently this is only overridden for meks and is missing elevation information which makes it incomplete.
    • getMovementString

      public abstract String getMovementString(EntityMovementType mtype)
      Returns the name of the type of movement used.
    • getMovementAbbr

      public abstract String getMovementAbbr(EntityMovementType mtype)
      Returns the abbreviation of the name of the type of movement used.
    • getLocationName

      public String getLocationName(HitData hit)
      Returns the name of the location specified.
    • getLocationNames

      public abstract String[] getLocationNames()
    • getLocationName

      public String getLocationName(int loc)
      Returns the name of the location specified.
    • getLocationAbbrs

      public abstract String[] getLocationAbbrs()
    • getLocationAbbr

      public String getLocationAbbr(HitData hit)
      Returns the abbreviated name of the location specified.
    • getLocationAbbr

      public String getLocationAbbr(int loc)
      Returns the abbreviated name of the location specified.
    • getLocationFromAbbr

      public int getLocationFromAbbr(String abbr)
      Returns the location that the specified abbreviation indicates
    • joinLocationAbbr

      public String joinLocationAbbr(List<Integer> locations, int limit)
      Joins the abbreviations for the locations into a String with / as the separator. If the number of locations exceeds the provided limit, the result is abbreviated. By default the abbreviation is simply an asterisk, but Meks have specific abbreviations locations that include all torso or leg positions.
      Parameters:
      locations - A list of location indices
      limit - The maximum number of locations to show in full
      Returns:
      A string formatted for display that shows the locations
    • rollHitLocation

      public abstract HitData rollHitLocation(int table, int side, int aimedLocation, AimingMode aimingMode, int cover)
      Rolls the to-hit number
    • rollHitLocation

      public abstract HitData rollHitLocation(int table, int side)
      Rolls up a hit location
    • getTransferLocation

      public abstract HitData getTransferLocation(HitData hit)
      Gets the location that excess damage transfers to. That is, one location inwards.
    • getTransferLocation

      public int getTransferLocation(int loc)
      int version
    • getDependentLocation

      public int getDependentLocation(int loc)
      Gets the location that is destroyed recursively. That is, one location outwards.
    • hasRearArmor

      public boolean hasRearArmor(int loc)
      Does this location have rear armor?
    • getArmor

      public int getArmor(int loc)
      Returns the amount of armor in the location specified, or ARMOR_NA, or ARMOR_DESTROYED. Only works on front locations.
    • getArmor

      public int getArmor(HitData hit)
      Returns the amount of armor in the location hit, or IArmorState.ARMOR_NA, or IArmorState.ARMOR_DESTROYED.
    • getArmor

      public int getArmor(int loc, boolean rear)
      Returns the amount of armor in the location specified, or IArmorState.ARMOR_NA, or IArmorState.ARMOR_DESTROYED.
    • getArmorForReal

      public int getArmorForReal(int loc, boolean rear)
    • getArmorForReal

      public int getArmorForReal(int loc)
    • getOArmor

      public int getOArmor(int loc)
      Returns the original amount of armor in the location specified. Only works on front locations.
    • getOArmor

      public int getOArmor(HitData hit)
      Returns the original amount of armor in the location hit.
    • getOArmor

      public int getOArmor(int loc, boolean rear)
      Returns the original amount of armor in the location specified, or ARMOR_NA, or ARMOR_DESTROYED.
      Parameters:
      loc - the location to check.
      rear - if true inspect the rear armor, else check the front.
    • setArmor

      public void setArmor(int val, HitData hit)
      Sets the amount of armor in the location specified.
    • setArmor

      public void setArmor(int val, int loc)
      Sets the amount of armor in the front location specified.
    • setArmor

      public void setArmor(int val, int loc, boolean rear)
      Sets the amount of armor in the location specified.
      Parameters:
      val - the value of the armor (eg how many armor points)
      loc - the location of the armor
      rear - true iff the armor is rear mounted.
    • refreshLocations

      public void refreshLocations()
    • firstArmorIndex

      public int firstArmorIndex()
      Returns:
      The index of the first armored location (skipping vehicle body, et. al.)
    • initializeArmor

      public void initializeArmor(int val, int loc)
      Initializes the armor on the unit. Sets the original and starting point of the armor to the same number.
    • getTotalArmor

      public int getTotalArmor()
      Returns the total amount of armor on the entity.
    • getTotalOArmor

      public int getTotalOArmor()
      Returns the total amount of armor on the entity.
    • getArmorRemainingPercent

      public double getArmorRemainingPercent()
      Returns the percent of the armor remaining
    • getInternal

      public int getInternal(HitData hit)
      Returns the amount of internal structure in the location hit.
    • getInternal

      public int getInternal(int loc)
      Returns the amount of internal structure in the location specified, or ARMOR_NA, or ARMOR_DESTROYED.
    • getInternalForReal

      public int getInternalForReal(int loc)
    • getOInternal

      public int getOInternal(HitData hit)
      Returns the original amount of internal structure in the location hit.
    • getOInternal

      public int getOInternal(int loc)
      Returns the original amount of internal structure in the location specified, or ARMOR_NA, or ARMOR_DESTROYED.
    • setInternal

      public void setInternal(int val, HitData hit)
      Sets the amount of armor in the location specified.
    • setInternal

      public void setInternal(int val, int loc)
      Sets the amount of armor in the location specified.
    • initializeInternal

      public void initializeInternal(int val, int loc)
      Initializes the internal structure on the unit. Sets the original and starting point of the internal structure to the same number.
    • autoSetInternal

      public abstract void autoSetInternal()
      Sets the internal structure for every location to appropriate undamaged values for the unit and location.
    • getTotalInternal

      public int getTotalInternal()
      Returns the total amount of internal structure on the entity.
    • getTotalOInternal

      public int getTotalOInternal()
      Returns the total original amount of internal structure on the entity.
    • getInternalRemainingPercent

      public double getInternalRemainingPercent()
      Returns the percent of the armor remaining
    • isLocationBad

      public boolean isLocationBad(int loc)
      Is this location destroyed or breached?
    • isLocationTrulyDestroyed

      public boolean isLocationTrulyDestroyed(int loc)
    • isLocationDoomed

      public boolean isLocationDoomed(int loc)
      Is this location destroyed or breached?
    • getLocationStatus

      public int getLocationStatus(int loc)
      returns exposure or breached flag for location
    • setLocationStatus

      public void setLocationStatus(int loc, int status)
      sets location exposure
      Parameters:
      loc - the location who's exposure is to be set
      status - the status to set
    • setLocationStatus

      public void setLocationStatus(int loc, int status, boolean allowChange)
      sets location exposure
      Parameters:
      loc - the location who's exposure is to be set
      status - the status to set
      allowChange - allow change of breached locations
    • locationIsLeg

      public boolean locationIsLeg(int loc)
      Parameters:
      loc - the location to check.
      Returns:
      True if the given location is a leg location; this can only be true on Meks.
    • getArmorString

      public String getArmorString(int loc)
      Returns a string representing the armor in the location
    • getArmorString

      public String getArmorString(int loc, boolean rear)
      Returns a string representing the armor in the location
    • getInternalString

      public String getInternalString(int loc)
      Returns a string representing the internal structure in the location
    • armorStringFor

      public static String armorStringFor(int value)
      Parses the game's internal armor representation into a human-readable string.
    • getHeatFiringModifier

      public int getHeatFiringModifier()
      Returns the modifier to weapons fire due to heat.
    • addEquipment

      public Mounted<?> addEquipment(EquipmentType equipmentType, int loc) throws LocationFullException
      Creates a new mount for this equipment and adds it in.
      Throws:
      LocationFullException
    • addEquipment

      public Mounted<?> addEquipment(EquipmentType equipmentType, int loc, boolean rearMounted) throws LocationFullException
      Creates a new mount for this equipment and adds it in.
      Throws:
      LocationFullException
    • addEquipment

      public Mounted<?> addEquipment(EquipmentType equipmentType, int loc, boolean rearMounted, int baMountLoc, boolean isArmored, boolean isTurreted) throws LocationFullException
      Creates a new mount for this equipment and adds it in.
      Throws:
      LocationFullException
    • addEquipment

      public Mounted<?> addEquipment(EquipmentType equipmentType, int loc, boolean rearMounted, int baMountLoc, boolean isArmored, boolean isTurreted, boolean isSponsonTurreted) throws LocationFullException
      Throws:
      LocationFullException
    • addEquipment

      public Mounted<?> addEquipment(EquipmentType equipmentType, int loc, boolean rearMounted, int baMountLoc, boolean isArmored, boolean isTurreted, boolean isSponsonTurreted, boolean isPintleTurreted) throws LocationFullException
      Throws:
      LocationFullException
    • addEquipment

      public Mounted<?> addEquipment(EquipmentType equipmentType, int loc, boolean rearMounted, int baMountLoc, boolean isArmored, boolean isTurreted, boolean isSponsonTurreted, boolean isPintleTurreted, boolean isOmniPodded) throws LocationFullException
      Throws:
      LocationFullException
    • addEquipment

      public Mounted<?> addEquipment(EquipmentType equipmentType, int loc, boolean rearMounted, int nAmmo) throws LocationFullException
      mounting weapons needs to take account of ammo
      Parameters:
      equipmentType - EquipmentType
      loc -
      rearMounted -
      nAmmo -
      Returns:
      Throws:
      LocationFullException
    • addBomb

      public Mounted<?> addBomb(EquipmentType equipmentType, int loc) throws LocationFullException
      indicate whether this is a bomb mount
      Throws:
      LocationFullException
    • addBomb

      protected void addBomb(Mounted<?> mounted, int loc) throws LocationFullException
      Throws:
      LocationFullException
    • addWeaponGroup

      public WeaponMounted addWeaponGroup(EquipmentType equipmentType, int loc) throws LocationFullException
      Throws:
      LocationFullException
    • addEquipment

      public Mounted<?> addEquipment(EquipmentType equipmentType, int loc, boolean rearMounted, int baMountLoc, boolean dwpMounted) throws LocationFullException
      indicate whether this is body mounted for BAs
      Throws:
      LocationFullException
    • addEquipment

      protected void addEquipment(Mounted<?> mounted, int loc, boolean rearMounted, int nAmmo) throws LocationFullException
      Throws:
      LocationFullException
    • addEquipment

      protected void addEquipment(Mounted<?> mounted, int loc, boolean rearMounted, boolean isWeaponGroup) throws LocationFullException
      Throws:
      LocationFullException
    • addEquipment

      public void addEquipment(Mounted<?> mounted, int loc, boolean rearMounted) throws LocationFullException
      Throws:
      LocationFullException
    • addFailedEquipment

      public void addFailedEquipment(String s)
    • getEquipmentNum

      public int getEquipmentNum(Mounted<?> mounted)
      Returns the equipment number of the specified equipment, or -1 if equipment is not present.
    • getEquipment

      public List<Mounted<?>> getEquipment()
      Returns an enumeration of all equipment
    • getEquipment

      public Mounted<?> getEquipment(int index)
      Returns the equipment, specified by number
    • getWeapon

      public WeaponMounted getWeapon(int index)
    • getMisc

      public MiscMounted getMisc(int index)
    • getAmmo

      public AmmoMounted getAmmo(int index)
    • getEquipmentType

      public EquipmentType getEquipmentType(CriticalSlot cs)
    • getFailedEquipment

      public Iterator<String> getFailedEquipment()
      Returns an enumeration which contains the name of each piece of equipment that failed to load.
    • getTotalAmmoOfType

      public int getTotalAmmoOfType(EquipmentType et)
    • getTotalMunitionsOfType

      public int getTotalMunitionsOfType(WeaponMounted weapon)
      Determine how much ammunition (of all munition types) remains which is compatible with the given weapon.
      Parameters:
      weapon - The weapon being considered
      Returns:
      the int count of the amount of shots of all munitions available for the given weapon.
    • getWeaponArc

      public abstract int getWeaponArc(int weaponNumber)
      Returns the Rules.ARC that the weapon, specified by number, fires into.
      Parameters:
      weaponNumber - integer equipment number, index from equipment list
      Returns:
      arc the specified weapon is in
    • isSecondaryArcWeapon

      public abstract boolean isSecondaryArcWeapon(int weaponId)
      Returns true if this weapon fires into the secondary facing arc. If false, assume it fires into the primary.
    • getWeapons

      public Iterator<WeaponMounted> getWeapons()
    • getIndividualWeaponList

      public List<WeaponMounted> getIndividualWeaponList()
    • getWeaponList

      public List<WeaponMounted> getWeaponList()
    • getTotalWeaponList

      public List<WeaponMounted> getTotalWeaponList()
    • getWeaponBayList

      public List<WeaponMounted> getWeaponBayList()
    • getWeaponGroupList

      public List<WeaponMounted> getWeaponGroupList()
    • isWeaponValidForPhase

      public boolean isWeaponValidForPhase(@Nullable WeaponMounted mounted)
      Returns true if the given weapon is valid for the current phase.
      Parameters:
      mounted - The WeaponMounted to test
      Returns:
      True if valid, else false
    • loadAllWeapons

      public void loadAllWeapons()
      Attempts to load all weapons with ammo
    • loadWeapon

      public void loadWeapon(WeaponMounted mounted)
      Tries to load the specified weapon with the first available ammo
    • loadWeaponWithSameAmmo

      public void loadWeaponWithSameAmmo(WeaponMounted mounted)
      Tries to load the specified weapon with the first available ammo of the same munition type as currently in use. If this fails, use first ammo.

      If this is a weapon bay, try to load the weapon with ammo in the same bay, and if it fails, load with compatible ammo in the same location.

      If this unit is part of a train, also check the vehicles directly connected to it for compatible ammo

    • loadWeapon

      public boolean loadWeapon(WeaponMounted mounted, AmmoMounted mountedAmmo)
      Tries to load the specified weapon with the specified ammo. Returns true if successful, false otherwise.
    • loadWeaponWithSameAmmo

      public boolean loadWeaponWithSameAmmo(WeaponMounted mounted, AmmoMounted mountedAmmo)
      Tries to load the specified weapon with the specified ammo. Returns true if successful, false otherwise.
    • weaponFired

      public boolean weaponFired()
      Returns:
      True when this unit has fired a weapon has been fired this turn.
    • weaponFiredFrom

      public boolean weaponFiredFrom(int loc)
      Returns:
      True when a weapon has been fired from the specified location this turn.
    • getAmmo

      public List<AmmoMounted> getAmmo()
    • getAmmo

      public List<AmmoMounted> getAmmo(WeaponMounted weapon)
      Parameters:
      weapon - we want to find available ammo for
      Returns:
      an ArrayList containing _one_ Mounted ammo for each viable type
    • getMisc

      public List<MiscMounted> getMisc()
    • getBombs

      public List<BombMounted> getBombs()
    • getBombs

      public List<BombMounted> getBombs(EquipmentFlag flag)
      Returns a list of operable bombs with shots left and with the given flag (e.g. AmmoType.F_SPACE_BOMB)
      Parameters:
      flag - The AmmoType bomb flag to search for
      Returns:
      The list of found bombs
      See Also:
    • resetBombAttacks

      protected void resetBombAttacks()
      Reset bomb attacks according to what bombs are available.
    • removeMisc

      public void removeMisc(String toRemove)
      Removes the first misc eq. whose name equals the specified string. Used for removing broken tree clubs.
    • clearBombs

      public void clearBombs()
      Clear all bombs and bomb attacks
    • getClubs

      public List<MiscMounted> getClubs()
    • hasWorkingMisc

      public boolean hasWorkingMisc(EquipmentFlag flag)
      Check if the entity has an arbitrary type of misc equipment
      Parameters:
      flag - A MiscType.F_XXX
      Returns:
      true if at least one ready item.
    • hasWorkingMisc

      public boolean hasWorkingMisc(EquipmentFlag flag, long secondary)
      Check if the entity has an arbitrary type of misc equipment
      Parameters:
      flag - A MiscType.F_XXX
      secondary - A MiscType.S_XXX or -1 for don't care
      Returns:
      true if at least one ready item.
    • hasMisc

      public boolean hasMisc(EquipmentFlag flag)
      Returns true when the entity has a MiscType equipment with the given MiscTypeFlag, regardless of its state. Note that both the flags given in MiscType as well as the "actual" flags in MiscTypeFlag can be used.
      Parameters:
      flag - The MiscTypeFlag flag to look for, e.g. F_VTOL_EQUIPMENT
      Returns:
      True when the entity has a MiscType equipment with the given flag
      See Also:
    • hasMisc

      public boolean hasMisc(String internalName)
      Returns true when the entity has a MiscType equipment of the given internalName, regardless of its state. When available, use EquipmentTypeLookup internal names (or add one when it is not yet used for a MiscType). Note that any internal name, even of weapons, can be given but this method only searches misc equipment and will not find weapons.
      Parameters:
      internalName - The internal name of the misc, e.g. EquipmentTypeLookup.BA_MYOMER_BOOSTER
      Returns:
      True when the entity has a MiscType equipment of the given internalName
      See Also:
    • countMisc

      public int countMisc(String internalName)
      Returns the number of MiscType equipment of the given internalName, regardless of state. When available, use EquipmentTypeLookup internal names (or add one when it is not yet used for a MiscType). Note that any internal name, even of weapons, can be given but this method only searches misc equipment and will not find weapons.
      Parameters:
      internalName - The internal name of the misc, e.g. EquipmentTypeLookup.BA_MYOMER_BOOSTER
      Returns:
      the number of MiscType equipment of the given internalName on the unit
      See Also:
    • hasMisc

      public boolean hasMisc(String internalName, int location)
      Returns true when the entity has a MiscType equipment of the given internalName, regardless of its state, in the given location. When available, use EquipmentTypeLookup internal names (or add one when it is not yet used for a MiscType). Note that any internal name, even of weapons, can be given but this method only searches misc equipment and will not find weapons.
      Parameters:
      internalName - The internal name of the misc, e.g. EquipmentTypeLookup.BA_MYOMER_BOOSTER
      location - The location, e.g. Mek.LOC_LT
      Returns:
      True when the entity has a MiscType equipment of the given internalName in the given location
      See Also:
    • getMiscEquipment

      public List<MiscMounted> getMiscEquipment(EquipmentFlag flag)
    • countEquipment

      public long countEquipment(String internalName)
      Returns the number of equipment of the given internal name that are mounted on this unit, regardless of their working condition. Ideally use EquipmentTypeLookup for the internal name.
      Parameters:
      internalName - The EquipmentType.internalName of the equipment
      Returns:
      The equipment count on this unit
    • countWorkingMisc

      public int countWorkingMisc(EquipmentFlag flag)
      return how many misc equipments with the specified flag the unit has
      Parameters:
      flag -
      Returns:
    • countWorkingMisc

      public int countWorkingMisc(EquipmentFlag flag, int location)
    • countWorkingMisc

      public int countWorkingMisc(String internalName, int location)
    • hasWorkingMisc

      public boolean hasWorkingMisc(String name)
      Check if the entity has an arbitrary type of misc equipment
      Parameters:
      name - MiscType internal name
      Returns:
      true if at least one ready item.
    • hasWorkingMisc

      public boolean hasWorkingMisc(EquipmentFlag flag, long secondary, int location)
      Check if the entity has an arbitrary type of misc equipment
      Parameters:
      flag - A MiscType.F_XXX
      secondary - A MiscType.S_XXX or -1 for don't care
      location - The location to check e.g. Mek.LOC_LARM
      Returns:
      true if at least one ready item.
    • getCriticalSlots

      public List<CriticalSlot> getCriticalSlots(int location)
      Returns the CriticalSlots in the given location as a list. The returned list can be empty depending on the unit and the chosen slot but not null. The entries are not filtered in any way (could be null although that is probably an error in the internal representation of the unit.)
      Parameters:
      location - The location, e.g. Mek.LOC_HEAD
      Returns:
      A list of CriticalSlots in that location, possibly empty
    • hasUndamagedCriticalSlots

      public boolean hasUndamagedCriticalSlots()
      Returns:
      true if the entity has any critical slot that isn't damaged yet
    • hasSCM

      public boolean hasSCM()
      Returns:
      True when this unit has a RISC Super-Cooled Myomer System (even if the SCM is destroyed).
    • hasWorkingSCM

      public boolean hasWorkingSCM()
      Returns:
      True when this unit has an operable RISC Super-Cooled Myomer System.
    • damagedSCMCritCount

      public int damagedSCMCritCount()
    • scmCritStateCount

      protected int scmCritStateCount(Predicate<CriticalSlot> slotState)
    • getHeatCapacity

      public int getHeatCapacity()
      Returns the amount of heat that the entity can sink each turn.
    • getHeatCapacity

      public int getHeatCapacity(boolean radicalHeatSink)
    • formatHeat

      public String formatHeat()
      Pretty-prints the heat capacity of a unit, including optional heat sinking systems. Typically, this is equivalent to getHeatCapacity(), but in the presence of Radical Heat Sinks, Coolant Pods, or the RISC Emergency Coolant System, produces strings like "24 [36]" or "12 [+MoS]".
      Returns:
      The formatted heat capacity
    • getHeatCapacityWithWater

      public int getHeatCapacityWithWater()
      Returns:
      The amount of heat that the entity can sink each turn, factoring in whether the entity is standing in water.
    • getEngineCritHeat

      public int getEngineCritHeat()
      Returns:
      The extra heat generated by engine crits.
    • getCritical

      @Nullable public CriticalSlot getCritical(int loc, int slot)
      Returns a critical hit slot
    • setCritical

      public void setCritical(int loc, int slot, CriticalSlot cs)
      Sets a critical hit slot
    • addCritical

      public boolean addCritical(int loc, CriticalSlot cs)
      Adds a critical to the first available slot in the location.
      Returns:
      true if there was room for the critical
    • addCritical

      public boolean addCritical(int loc, CriticalSlot cs, int slotNumber)
      Adds a critical to a critical slot, first trying the supplied slot number, and continuing from there if it's full
      Parameters:
      loc - location on Unit.
      cs - CriticalSlot to check
      slotNumber - Slot to apply to.
      Returns:
      true if there was room for the critical
    • addCritical

      public boolean addCritical(int loc, int slot, CriticalSlot cs)
      Attempts to set the given slot to the given critical. If the desired slot is full, adds the critical to the first available slot.
      Returns:
      true if the crit was successfully added to any slot
    • removeCriticals

      public void removeCriticals(int loc, CriticalSlot cs)
      Removes all matching critical slots from the location
    • getEmptyCriticals

      public int getEmptyCriticals(int loc)
      Returns the number of empty critical slots in a location
    • getHittableCriticals

      public int getHittableCriticals(int loc)
      Returns the number of operational critical slots remaining in a location
    • canTransferCriticals

      public boolean canTransferCriticals(int loc)
      Returns true if this location should transfer criticals to the next location inwards. Checks to see that every critical in this location is either already totally destroyed (not just hit) or was never hittable to begin with.
    • getGyroType

      public int getGyroType()
      Only Meks have Gyros but this helps keep the code a bit cleaner.
      Returns:
      -1
    • getAllGyroCodeName

      public static Map<Integer,String> getAllGyroCodeName()
    • isGyroDestroyed

      public boolean isGyroDestroyed()
      Only Meks have gyros, but this helps keep the code a bit cleaner.
      Returns:
      true if the Entity is a Mek and has taken enough gyro hits to destroy it
    • getGoodCriticals

      public int getGoodCriticals(int type, int index, int loc)
      Returns the number of operational critical slots of the specified type in the location
    • getBadCriticals

      public int getBadCriticals(int type, int index, int loc)
      The number of critical slots that are destroyed or breached in the location or missing along with it (if it was blown off).
    • getDamagedCriticals

      public int getDamagedCriticals(int type, int index, int loc)
      Number of slots damaged (but not breached) in a location
    • getHitCriticals

      public int getHitCriticals(int type, int index, int loc)
      Number of slots doomed, missing or destroyed in a location
    • critStateCount

      protected int critStateCount(int type, int index, int loc, Predicate<CriticalSlot> slotState)
      Returns:
      the number of critical slots of the equipment given as index for getEquipment(int) in location loc wherein the type is the critical slot type that fit the slot state given as slotState Predicate such as CriticalSlot.isDestroyed(). The critical slots tested are only those in location loc except for Super-Cooled Myomer where all locations are considered.
    • getNoOfSlots

      protected abstract int[] getNoOfSlots()
    • getNumberOfCriticals

      public int getNumberOfCriticals(int loc)
      Returns the number of total critical slots in a location
    • getNumberOfCriticals

      public int getNumberOfCriticals(int type, int index, int loc)
      Returns the number of critical slots present in the section, destroyed or not.
    • getNumberOfCriticals

      public int getNumberOfCriticals(EquipmentType equipmentType, int loc)
      Returns the number of critical slots present in the section, destroyed or not.
    • getNumberOfCriticals

      public int getNumberOfCriticals(EquipmentType equipmentType)
      Returns the number of critical slots present in the Mek, destroyed or not.
    • hasHipCrit

      public boolean hasHipCrit()
      Returns true if the entity has a hip critical slot. Overridden by sub-classes.
    • hasLegActuatorCrit

      public boolean hasLegActuatorCrit()
      Returns true if the entity has a leg actuator critical slot
    • hasWorkingSystem

      public boolean hasWorkingSystem(int system, int loc)
      Returns true if there is at least 1 functional system of the type specified in the location
    • hasSystem

      public boolean hasSystem(int system, int loc)
      Returns:
      true if the location has a system of the type, whether is destroyed or not
    • hasVibroblades

      public boolean hasVibroblades()
      Returns:
      True if this unit wields vibroblades
    • getActiveVibrobladeHeat

      public int getActiveVibrobladeHeat(int location)
      Parameters:
      location - The location to check
      Returns:
      The heat generated by active vibroblades in the given location if this unit has any
    • getActiveVibrobladeHeat

      public int getActiveVibrobladeHeat(int location, boolean ignoreMode)
    • hasShield

      public boolean hasShield()
      Does the Mek have any shields. a Mek can have up to 2 shields.
      Returns:
      true if shieldCount is greater than 0 else false
    • getNumberOfShields

      public int getNumberOfShields(long size)
      Check to see how many shields of a certain size a mek has. you can have up to shields per Mek. However they can be of different size and each size has its own draw backs. So check each size and add modifiers based on the number shields of that size.
    • hasActiveShield

      public boolean hasActiveShield(int location, boolean rear)
      Does the Mek have an active shield This should only be called after hasShield has been called.
    • hasActiveShield

      public boolean hasActiveShield(int location)
      Does the Mek have an active shield This should only be called by hasActiveShield(location, rear)
    • hasPassiveShield

      public boolean hasPassiveShield(int location, boolean rear)
      Does the Mek have a passive shield This should only be called after hasShield has been called.
    • hasPassiveShield

      public boolean hasPassiveShield(int location)
      Does the Mek have a passive shield This should only be called by hasPassiveShield(location, rear)
    • hasNoDefenseShield

      public boolean hasNoDefenseShield(int location)
      Does the Mek have an shield in no defense mode
    • hasUMU

      public boolean hasUMU()
      This method checks to see if a unit has Underwater Maneuvering Units
      Returns:
      boolean if the entity has usable UMU critical slots.
    • getActiveUMUCount

      public int getActiveUMUCount()
      This counts the number of UMU's a Mek has that are still viable
      Returns:
      number intof usable UMU's
    • getAllUMUCount

      public int getAllUMUCount()
      This returns all UMU a Mek has.
      Returns:
      intTotal number of UMUs a Mek has.
    • hasActiveECM

      public boolean hasActiveECM()
      Does the Mek have a functioning ECM unit?
    • hasActiveECM

      public boolean hasActiveECM(boolean stealth)
      check if we have an active ECM unit for stealth armor purposes
      Parameters:
      stealth -
      Returns:
    • hasECM

      public boolean hasECM()
    • hasGhostTargets

      public boolean hasGhostTargets(boolean active)
      Does the Mek have a functioning ECM unit, tuned to ghost target generation?
    • hasActiveECCM

      public boolean hasActiveECCM()
      Checks to see if this entity has a functional ECM unit that is using ECCM.
      Returns:
      true if the entity has AngeleCM and it is in ECCM mode false if the entity does not have angel ecm or it is not in eccm mode or it is damaged.
    • getECMRange

      public int getECMRange()
      What's the range of the ECM equipment? Infantry can have ECM that just covers their own hex.
      Returns:
      the int range of this unit's ECM. This value will be Entity.NONE if no ECM is active.
    • hasBAP

      public boolean hasBAP()
      Does the Mek have a functioning BAP? This is just for the basic BAP for Beagle BloodHound WatchDog Clan Active or Light.
    • hasBAP

      public boolean hasBAP(boolean checkECM)
    • getBAPRange

      public int getBAPRange()
      What's the range of the BAP equipment?
      Returns:
      the int range of this unit's BAP. This value will be Entity.NONE if no BAP is active.
    • hasDroneOs

      public boolean hasDroneOs()
      Returns whether this entity has a Drone Operating System
    • hasTargComp

      public boolean hasTargComp()
      Returns whether or not this entity has a Targeting Computer.
    • hasAimModeTargComp

      public boolean hasAimModeTargComp()
      Returns whether or not this entity has a Targeting Computer that is in aimed shot mode.
    • hasC3S

      public boolean hasC3S()
      Returns:
      True if this unit has a C3 Slave.
    • hasCASEII

      public boolean hasCASEII()
      True if the unit has CASE II (on any location in the case of Meks). Only Meks and Fighters can have CASE II so all other entities should return false.
      Returns:
      True if the unit has CASE II
    • hasCASEII

      public boolean hasCASEII(int location)
      True if the unit has CASE II in the given location. Only Meks and Fighters can have CASE II so all other entities should return false.
      Parameters:
      location - The location to check
      Returns:
      True if the unit has CASE II in the given location
    • hasHarJelIn

      public boolean hasHarJelIn(int location)
      Does this entity have an undamaged HarJel system in this location? (Type-dependent, defaults to false.) Does not include Harjel II or Harjel III, as they do not prevent breach checks like Harjel does.
      Parameters:
      location - the int location to check
      Returns:
      a boolean value indicating a present HarJel system
    • hasBoostedC3

      public boolean hasBoostedC3()
    • hasC3M

      public boolean hasC3M()
      Checks if the entity has a C3 Master.
      Returns:
      true if it has a working C3M computer and has a master.
    • hasC3MM

      public boolean hasC3MM()
    • hasC3

      public boolean hasC3()
      Returns:
      True if this unit has any type of standard C3 computer (not C3i), TM p.209.
    • hasActiveNovaCEWS

      public boolean hasActiveNovaCEWS()
      Returns:
      True if this unit is not off board nor shutdown and has a Nova CEWS that is not offline.
    • hasNovaCEWS

      public boolean hasNovaCEWS()
      Returns:
      True if this unit is not off board nor shutdown and has a Nova CEWS that is not offline.
    • hasNavalC3

      public boolean hasNavalC3()
    • hasC3i

      public boolean hasC3i()
    • hasNhC3

      public boolean hasNhC3()
      Returns true if the unit has a non hierarchic C3 system (C3i, NC3 or Nova CEWS).
    • hasHierarchicalC3

      public boolean hasHierarchicalC3()
      Checks if the unit has a hierarchic C3 system. (Inverse of hasNhC3()
      Returns:
      true if the unit has a C3 system that is not a C3i, NC3 or Nova CEWS.
    • hasAnyC3System

      public boolean hasAnyC3System()
      Returns true if the unit has a standard C3M/S, a Naval C3 or C3i or a Nova CEWS.
    • getC3NetId

      @Nullable public String getC3NetId()
    • getOriginalNovaC3NetId

      public String getOriginalNovaC3NetId()
    • newRoundNovaNetSwitch

      public void newRoundNovaNetSwitch()
      Switches the C3 network Id to the new network ID.
    • setNewRoundNovaNetworkString

      public void setNewRoundNovaNetworkString(String str)
      Set the C3 network ID to be used on the next turn. Used for reconfiguring a C3 network with Nova CEWS.
      Parameters:
      str -
    • getNewRoundNovaNetworkString

      public String getNewRoundNovaNetworkString()
      Returns:
      C3 network id that will be switched to on the next turn.
    • setC3NetId

      public void setC3NetId(Entity e)
    • setC3NetIdSelf

      public void setC3NetIdSelf()
    • setC3NetId

      public void setC3NetId(@Nullable String c3NetId)
      Explicitly set the C3 Net ID using a string.
      Parameters:
      c3NetId - string value the id should be set to
      See Also:
    • calculateFreeC3MNodes

      public int calculateFreeC3MNodes()
      Determine the remaining number of other C3 Master computers that can connect to this Entity.

      Please note, if this Entity does not have two C3 Master computers, then it must first be identified as a company commander; otherwise the number of free nodes will be zero.

      Returns:
      a non-negative int value.
    • calculateFreeC3Nodes

      public int calculateFreeC3Nodes()
      Determine the remaining number of other C3 computers that can connect to this Entity.

      Please note, if this Entity has two C3 Master computers, then this function only returns the remaining number of C3 Slave computers that can connect.

      Returns:
      a non-negative int value.
    • getC3Top

      public Entity getC3Top()
      Returns:
      the entity "above" this entity in our c3 network, or this entity itself, if none is above this
    • getC3Master

      public Entity getC3Master()
      Return the unit that is current master of this unit's C3 network. If the master unit has been destroyed or had it's C3 master computer damaged, then this unit is out of the C3 network for the rest of the game. If the master unit has shut down, then this unit may return to the C3 network at a later time.
      Returns:
      the Entity that is the master of this unit's C3 network. This value may be null. If the value master unit has shut down, then the value will be non-null after the master unit restarts.
    • getC3MasterId

      public int getC3MasterId()
      Get the ID of the master unit in this unit's C3 network. If the master unit has shut down, then the ID will still be returned. The only times when the value, Entity.NONE is returned is when this unit is permanently out of the C3 network, or when it was never in a C3 network.
      Returns:
      the int ID of the unit that is the master of this unit's C3 network, or Entity.NONE.
    • C3MasterIs

      public boolean C3MasterIs(Entity e)
      Determines if the passed Entity is the C3 Master of this unit.

      Please note, that when an Entity is it's own C3 Master, then it is a company commander.

      Also note that when null is the master for this Entity, then it is an independent master.

      Parameters:
      e - - the Entity that may be this unit's C3 Master.
      Returns:
      a boolean that is true when the passed Entity is this unit's commander. If the passed unit isn't this unit's commander, this routine returns false.
    • setC3Master

      public void setC3Master(Entity e, boolean reset)
      Set another Entity as C3 Master. Pass (null, true) to disconnect the entity from a C3 network that isn't its own (C3 Net id with its own id).
      Parameters:
      e - - the Entity that should be set as our C3 Master.
    • setC3Master

      public void setC3Master(int entityId, boolean reset)
      Parameters:
      entityId -
    • onSameC3NetworkAs

      public boolean onSameC3NetworkAs(Entity e)
    • onSameC3NetworkAs

      public boolean onSameC3NetworkAs(Entity e, boolean ignoreECM)
      Checks if another entity is on the same c3 network as this entity
      Parameters:
      e - The Entity to check against this entity
      ignoreECM - a boolean indicating if ECM should be ignored, we need this for c3i
      Returns:
      a boolean that is true if the given entity is on the same network, false if not.
    • locationHasCase

      public boolean locationHasCase(int loc)
      Returns whether there is CASE protecting the location.
    • hasCase

      public boolean hasCase()
      Returns whether there is CASE anywhere on this Entity.
    • hitAllCriticals

      public void hitAllCriticals(int loc, int slot)
      Hits all critical slots of the system occupying the specified critical slot. Used, for example, in a gauss rifle capacitor discharge. Does not apply any special effect of hitting the critical slots, like ammo explosion.
    • newRound

      public void newRound(int roundNumber)
      Start a new round
      Specified by:
      newRound in interface RoundUpdated
      Parameters:
      roundNumber - the int number of the new round
    • applyDamage

      public void applyDamage()
      Applies any damage that the entity has suffered. When anything gets hit it is simply marked as "hit" but does not stop working until this is called.
    • reloadEmptyWeapons

      public void reloadEmptyWeapons()
      Attempts to reload any empty weapons with the first ammo found
    • getActiveAMS

      public List<WeaponMounted> getActiveAMS()
      Returns:
      currently operable AMS mounted in this Entity.
    • assignTMAMS

      public void assignTMAMS(TeleMissileAttackAction telemissileAttack)
      Assign AMS systems to an incoming telemissile attack. This allows AMS bays to work against these modified physical attacks.
    • assignAMS

      public void assignAMS(List<WeaponHandler> attacks)
      Assign AMS systems to the most dangerous incoming missile attacks. This should only be called once per turn, or AMS will get extra attacks
    • isNarcedBy

      public boolean isNarcedBy(int nTeamID)
      has the team attached a narc pod to me?
    • attachNarcPod

      public void attachNarcPod(NarcPod pod)
      add a narc pod from this team to the Mek. Non-removable
      Parameters:
      pod - The NarcPod to be attached.
    • attachINarcPod

      public void attachINarcPod(INarcPod pod)
      attach an iNarcPod
      Parameters:
      pod - The INarcPod to be attached.
    • isINarcedBy

      public boolean isINarcedBy(int nTeamID)
      Have we been iNarced with a homing pod from that team?
      Parameters:
      nTeamID - The id of the team that we are wondering about.
      Returns:
      true if the Entity is narced by that team.
    • isINarcedWith

      public boolean isINarcedWith(long type)
      Have we been iNarced with the named pod from any team?
      Parameters:
      type - the int type of iNarc pod.
      Returns:
      true if we have.
    • removeAllINarcPods

      public void removeAllINarcPods()
      Remove all attached iNarc Pods
    • hasINarcPodsAttached

      public boolean hasINarcPodsAttached()
      Returns true if any iNarc pods are attached to this unit.
    • hasNarcPodsAttached

      public boolean hasNarcPodsAttached()
      Returns true if any Narc pods are attached to this unit. (Ignores iNarc)
    • hasAnyTypeNarcPodsAttached

      public boolean hasAnyTypeNarcPodsAttached()
      Returns true if any Narc or iNarc pods are attached to this unit.
    • getINarcPodsAttached

      public Iterator<INarcPod> getINarcPodsAttached()
      Get an Enumeration of INarcPods that are attached to this entity.
      Returns:
      an Enumeration of INarcPods.
    • removeINarcPod

      public boolean removeINarcPod(INarcPod pod)
      Remove an INarcPod from this entity.
      Parameters:
      pod - the INarcPod to be removed.
      Returns:
      true if the pod was removed, false if the pod was not attached to this entity.
    • calculateBattleValue

      public final int calculateBattleValue()
      Calculates the Battle Value of this unit. Both C3 and crew skill based changes to the BV are taken into account. Note that when a unit has a manual BV value set in its definition file, this manual BV value is returned instead of a calculated BV value.
      Returns:
      The full Battle Value of this unit including C3 and crew skill modifications or the manual BV in case this unit uses a manual BV value
    • calculateBattleValue

      public final int calculateBattleValue(boolean ignoreC3, boolean ignoreSkill)
      Calculates the Battle Value of this unit. The parameters can be used to control C3 / skill-based changes to the BV. When both are true, the "base" BV of the unit is calculated. Note that when a unit has a manual BV value set in its definition file, this manual BV value is returned instead of a calculated BV value.
      Parameters:
      ignoreC3 - When true, the BV contributions of any C3 computers are not added
      ignoreSkill - When true, the skill of the crew / pilot is not taken into account for BV
      Returns:
      The Battle Value of this unit
    • calculateBattleValue

      public int calculateBattleValue(CalculationReport calculationReport)
      Calculates the Battle Value of this unit. Both C3 and crew skill based changes to the BV are taken into account. Note that when a unit has a manual BV value set in its definition file, this manual BV value is returned instead of a calculated BV value and no calculation report info will be generated.
      Parameters:
      calculationReport - A CalculationReport to write the BV calculation to
      Returns:
      The full Battle Value of this unit including C3 and crew skill modifications or the manual BV in case this unit uses a manual BV value
    • calculateBattleValue

      public int calculateBattleValue(boolean ignoreC3, boolean ignoreSkill, CalculationReport calculationReport)
      Calculates the Battle Value of this unit. The parameters can be used to control C3 / skill-based changes to the BV. When both are true, the "base" BV of the unit is calculated. Note that when a unit has a manual BV value set in its definition file, this manual BV value is returned instead of a calculated BV value and no calculation report info will be generated.
      Parameters:
      ignoreC3 - When true, the BV contributions of any C3 computers are not added
      ignoreSkill - When true, the skill of the crew / pilot is not taken into account for BV
      calculationReport - A CalculationReport to write the BV calculation to
      Returns:
      The Battle Value of this unit
    • doBattleValueCalculation

      protected int doBattleValueCalculation(boolean ignoreC3, boolean ignoreSkill, CalculationReport calculationReport)
      Calculates and returns the Battle Value of this unit taking into account the parameters. This method should be overridden by subclasses of Entity to provide a unit type specific calculation of the Battle Value. A report of the calculation should be written to the given calculationReport.
      Parameters:
      ignoreC3 - When true, the BV contributions of any C3 computers are not added
      ignoreSkill - When true, the skill of the crew / pilot is not taken into account for BV
      calculationReport - A CalculationReport to write the BV calculation to
      Returns:
      The Battle Value of this unit calculated from its current state
    • getGenericBattleValue

      public abstract int getGenericBattleValue()
      Calculates a "generic" Battle Value that is based on the average of all units of this type and tonnage. The purpose of this generic Battle Value is to allow a comparison of this unit's actual BV to that for units of its class. This can be used to balance forces without respect to unit or pilot quality.

      The generic BV values are calculated by a statistical elasticity model based on all data from the MegaMek database.

      Returns:
      The generic Battle value for this unit based on its tonnage and type
    • victoryReport

      public abstract Vector<Report> victoryReport()
      Generates a vector containing reports on all useful information about this entity.
    • equals

      public boolean equals(Object obj)
      Two entities are equal if their ids are equal
      Specified by:
      equals in interface Targetable
      Overrides:
      equals in class Object
    • hashCode

      public int hashCode()
      Specified by:
      hashCode in interface Targetable
      Overrides:
      hashCode in class Object
    • getMovementMode

      public EntityMovementMode getMovementMode()
      Get the movement mode of the entity
    • getMovementModeAsString

      public String getMovementModeAsString()
      Get the movement mode of the entity as a String.
    • setMovementMode

      public void setMovementMode(EntityMovementMode movementMode)
      Set the movement type of the entity
    • entityIsQuad

      public boolean entityIsQuad()
      Helper function to determine if a entity is a quad
    • needsRollToStand

      public boolean needsRollToStand()
      Returns true is the entity needs a roll to stand up
    • getBasePilotingRoll

      public PilotingRollData getBasePilotingRoll()
      Returns an entity's base piloting skill roll needed Only use this version if the entity is through processing movement
    • getBasePilotingRoll

      public PilotingRollData getBasePilotingRoll(EntityMovementType moveType)
      Returns an entity's base piloting skill roll needed
    • addEntityBonuses

      public abstract PilotingRollData addEntityBonuses(PilotingRollData roll)
      Add in any piloting skill mods
    • addConditionBonuses

      public PilotingRollData addConditionBonuses(PilotingRollData roll, EntityMovementType moveType)
      Add in any modifiers due to global conditions like light/weather/etc.
    • checkGetUp

      public PilotingRollData checkGetUp(MoveStep step, EntityMovementType moveType)
      Checks if the entity is getting up. If so, returns the target roll for the piloting skill check.
    • checkRunningWithDamage

      public PilotingRollData checkRunningWithDamage(EntityMovementType overallMoveType)
      Checks if the entity is attempting to run with damage that would force a PSR. If so, returns the target roll for the piloting skill check.
    • checkSprintingWithMASCXorSupercharger

      public PilotingRollData checkSprintingWithMASCXorSupercharger(EntityMovementType overallMoveType, int used)
      Checks if the entity is attempting to sprint with MASC or Supercharger engaged (but not both). If so, returns the target roll for the piloting skill check.
    • checkSprintingWithMASCAndSupercharger

      public PilotingRollData checkSprintingWithMASCAndSupercharger(EntityMovementType overallMoveType, int used)
      Checks if the entity is attempting to sprint with MASC and supercharger engaged. If so, returns the target roll for the piloting skill check.
    • checkUsingOverdrive

      public PilotingRollData checkUsingOverdrive(EntityMovementType overallMoveType)
      Checks if the entity is attempting to sprint with supercharger engaged. If so, returns the target roll for the piloting skill check.
    • checkGunningIt

      public PilotingRollData checkGunningIt(EntityMovementType overallMoveType)
      Checks if the entity is attempting to increase two speed categories. If so, returns the target roll for the piloting skill check.
    • checkRecklessMove

      public PilotingRollData checkRecklessMove(MoveStep step, EntityMovementType moveType, Hex curHex, Coords lastPos, Coords curPos, Hex prevHex)
      Checks if an entity is passing through certain terrain while not moving carefully
    • checkLandingWithDamage

      public PilotingRollData checkLandingWithDamage(EntityMovementType overallMoveType)
      Checks if the entity is landing (from a jump) with damage that would force a PSR. If so, returns the target roll for the piloting skill check.
    • checkLandingWithPrototypeJJ

      public PilotingRollData checkLandingWithPrototypeJJ(EntityMovementType overallMoveType)
      Checks if the entity is landing (from a jump) with a prototype JJ If so, returns the target roll for the piloting skill check.
    • checkLandingInHeavyWoods

      public PilotingRollData checkLandingInHeavyWoods(EntityMovementType overallMoveType, Hex curHex)
      Checks if an entity is landing (from a jump) in heavy woods.
    • checkLandingOnIce

      public PilotingRollData checkLandingOnIce(EntityMovementType overallMoveType, Hex curHex)
      Checks if the entity is landing (from a jump) on ice-covered water.
    • checkLandingOnBlackIce

      public PilotingRollData checkLandingOnBlackIce(EntityMovementType overallMoveType, Hex curHex)
      Checks if the entity is landing (from a jump) on black ice.
    • checkMovedTooFast

      public PilotingRollData checkMovedTooFast(MoveStep step, EntityMovementType moveType)
      Parameters:
      step -
      Returns:
      PilotingRollData checking for whether this Entity moved too fast due to low gravity
    • checkSkid

      public PilotingRollData checkSkid(EntityMovementType moveType, Hex prevHex, EntityMovementType overallMoveType, MoveStep prevStep, MoveStep currStep, int prevFacing, int curFacing, Coords lastPos, Coords curPos, boolean isInfantry, int distance)
      Checks if the entity might skid. If so, returns the target roll for the piloting skill check.
    • checkRubbleMove

      public PilotingRollData checkRubbleMove(MoveStep step, EntityMovementType moveType, Hex curHex, Coords lastPos, Coords curPos, boolean isLastStep, boolean isPavementStep)
      Checks if the entity is moving into rubble. If so, returns the target roll for the piloting skill check.
    • checkBogDown

      public PilotingRollData checkBogDown(MoveStep step, EntityMovementType moveType, Hex curHex, Coords lastPos, Coords curPos, int lastElev, boolean isPavementStep)
      Checks if the entity is moving into a hex that might cause it to bog down. If so, returns the target roll for the piloting skill check.
    • checkWaterMove

      public PilotingRollData checkWaterMove(MoveStep step, EntityMovementType moveType, Hex curHex, Coords lastPos, Coords curPos, boolean isPavementStep)
      Checks if the entity is moving into depth 1+ water. If so, returns the target roll for the piloting skill check.
    • checkWaterMove

      public PilotingRollData checkWaterMove(int waterLevel, EntityMovementType overallMoveType)
      Checks if the entity is moving into depth 1+ water. If so, returns the target roll for the piloting skill check.
    • checkDislodgeSwarmers

      public PilotingRollData checkDislodgeSwarmers(MoveStep step, EntityMovementType moveType)
      Checks if the entity is being swarmed. If so, returns the target roll for the piloting skill check to dislodge them.
    • checkMovementInBuilding

      public int checkMovementInBuilding(MoveStep step, MoveStep prevStep, Coords curPos, Coords prevPos)
      Checks to see if an entity is moving through building walls. Note: this method returns true/false, unlike the other checkStuff() methods above.
      Returns:
      0, no eligible building; 1, exiting; 2, entering; 3, both; 4, stepping on roof, 8 changing elevations within a building
    • rollMovementInBuilding

      public PilotingRollData rollMovementInBuilding(Building bldg, int distance, String why, EntityMovementType overallMoveType)
      Calculates and returns the roll for an entity moving in buildings.
    • usesTurnMode

      public boolean usesTurnMode()
      Only check for satisfied turn mode for Tanks or QuadVees in vehicle mode, or LAMs in AirMek mode. Except for LAMs, check whether advanced vehicle ground movement is enabled.
      Returns:
      True if this Entity must make a driving check for turning too sharply.
    • checkTurnModeFailure

      public PilotingRollData checkTurnModeFailure(EntityMovementType overallMoveType, int straightLineHexes, int mpUsed, Coords currPos)
      If using advanced vehicle ground movement, checks whether the unit is required to make a driving roll for turning, and if so whether it succeeds.
      Parameters:
      overallMoveType - The type move movement used this turn.
      straightLineHexes - The number of hexes that were moved in a straight line before turning.
      mpUsed - The total number of movement points used by the entity during the current turn.
      currPos - The position of the hex where the turn is taking place, which may modify a roll for terrain.
      Returns:
      True if the entity failed a driving check due to turning too sharply.
    • getMovementBeforeSkidPSRModifier

      public int getMovementBeforeSkidPSRModifier(int distance)
      Calculate the piloting skill roll modifier, based upon the number of hexes moved this phase. Used for skidding.
    • getMaxElevationChange

      public abstract int getMaxElevationChange()
      The maximum elevation change the entity can cross
    • getMaxElevationDown

      public int getMaxElevationDown()
      by default, entities can move as far down as they can move up
    • getMaxElevationDown

      public int getMaxElevationDown(int currElevation)
      Returns the maximum number of downward elevation changes a unit can make. For some units (namely, WiGEs), this can depend upon their current elevation (since elevation determines if the WiGEs is using WiGE movement or not).
      Parameters:
      currElevation -
      Returns:
    • addTransporter

      public void addTransporter(Transporter component)
      Add a transportation component to this Entity. Please note, this method should only be called during this entity's construction.
      Parameters:
      component - - One of this new entity's Transporters.
    • addTransporter

      public void addTransporter(Transporter component, boolean isOmniPod)
      Add a transportation component to this Entity. Please note, this method should only be called during this entity's construction.
      Parameters:
      component - - One of this new entity's Transporters.
      isOmniPod - - Whether this is part of an omni unit's pod space.
    • removeTransporter

      public void removeTransporter(Transporter t)
    • removeAllTransporters

      public void removeAllTransporters()
      Remove all transportation components from this Entity. Should probably only be called during construction.
    • canLoad

      public boolean canLoad(Entity unit, boolean checkElev)
      Determines if this object can accept the given unit. The unit may not be of the appropriate type or there may be no room for the unit.
      Parameters:
      unit - - the Entity to be loaded.
      Returns:
      true if the unit can be loaded, false otherwise.
    • canLoad

      public boolean canLoad(Entity unit)
      Description copied from interface: Transporter
      Determines if this object can accept the given unit. The unit may not be of the appropriate type or there may be no room for the unit.
      Specified by:
      canLoad in interface Transporter
      Parameters:
      unit - - the Entity to be loaded.
      Returns:
      true if the unit can be loaded, false otherwise.
    • load

      public void load(Entity unit, boolean checkElev, int bayNumber)
      Load the given unit.
      Parameters:
      unit - - the Entity to be loaded.
      Throws:
      IllegalArgumentException - If the unit can't be loaded
    • load

      public void load(Entity unit, boolean checkElev)
      Load the given unit.
      Parameters:
      unit - the Entity to be loaded.
      checkElev - When true, only allows the load if both units are at the same elevation
      Throws:
      IllegalArgumentException - If the unit can't be loaded
    • load

      public void load(Entity unit, int bayNumber)
      Load the given unit.
      Parameters:
      unit - the Entity to be loaded.
      bayNumber - The bay to load into
      Throws:
      IllegalArgumentException - If the unit can't be loaded
    • load

      public void load(Entity unit)
      Load the given unit, checking if the elevation of both units is the same.
      Specified by:
      load in interface Transporter
      Parameters:
      unit - the Entity to be loaded.
      Throws:
      IllegalArgumentException - If the unit can't be loaded
    • recover

      public void recover(Entity unit)
      Recover the given unit. Only for ASF and Small Craft
      Parameters:
      unit - - the Entity to be loaded.
      Throws:
      IllegalArgumentException - If the unit can't be loaded
    • updateBays

      public void updateBays()
      cycle through and update Bays
    • damageBayDoor

      public String damageBayDoor()
      Damages a randomly determined bay door on the entity, if one exists
    • damageDoorRecovery

      public void damageDoorRecovery(Entity en)
      damage the door of the first bay that can load this unit
    • damageDockCollar

      public boolean damageDockCollar()
      Damages a randomly determined docking collar on the entity, if one exists.
      Returns:
      true if a docking collar was found, false otherwise
    • pickUp

      public void pickUp(MekWarrior mw)
    • getLoadedUnits

      public List<Entity> getLoadedUnits()
      Get a List of the units currently loaded into this payload.
      Specified by:
      getLoadedUnits in interface Transporter
      Returns:
      A List of loaded Entity units. This list will never be null, but it may be empty. The returned List is independent from the under- lying data structure; modifying one does not affect the other.
    • getDocks

      public int getDocks()
      Returns:
      the number of docking collars
    • getDocks

      public int getDocks(boolean forCost)
      Parameters:
      forCost - Whether this value is being used for cost calculations, in which case drop shuttle bays count as two collars.
      Returns:
      The number of docking collars
    • getBayLoadedUnitIds

      public List<Integer> getBayLoadedUnitIds()
      Returns:
      list of the Ids of entities stored in bays. Used by MHQ in cases where we can't get the entities via Game
    • getBay

      public Bay getBay(Entity loaded)
      Parameters:
      loaded -
      Returns:
      bay that the given entity is loaded into
    • getBayById

      public Bay getBayById(int bayNumber)
    • getCollarById

      @Nullable public DockingCollar getCollarById(int collarNumber)
      Returns the DockingCollar with the given ID or null if this unit doesn't have such a Docking Collar.
      Returns:
      the DockingCollar with the given ID or null
    • getLaunchableFighters

      public Vector<Entity> getLaunchableFighters()
      Returns:
      only entities in ASF Bays that can be launched (i.e. not in recovery)
    • getDroppableUnits

      public Vector<Entity> getDroppableUnits()
      Returns:
      only entities in that can be combat dropped
    • getUnitsUnloadableFromBays

      public List<Entity> getUnitsUnloadableFromBays()
      Returns:
      All Entities that can at this point be unloaded from any of the bays of this Entity. This does not include any units that were loaded this turn or any bays where the door capacity has been exceeded this turn. Note that the returned list may be unmodifiable.
      See Also:
    • getUnitsUnloadableFromNonBays

      public List<Entity> getUnitsUnloadableFromNonBays()
      Returns:
      All Entities that can at this point be unloaded from any transports of this Entity which are not Bays. This does not include any units that were loaded this turn. Note that the returned list may be unmodifiable.This shouldn't return towed entities, they're tracked separately.
      See Also:
    • getUnloadableUnits

      public List<Entity> getUnloadableUnits()
      Returns:
      All Entities that can at this point be unloaded from any transports of this Entity. This does not include any units that were loaded this turn nor units from bays where the door capacity has been exceeded this turn.
      See Also:
    • getFighterBays

      public Vector<Bay> getFighterBays()
      Returns:
      get the bays separately
    • getDockingCollars

      public Vector<DockingCollar> getDockingCollars()
      Returns a list of all Docking Collars (Hard points) of this unit.
      Returns:
      a list of all Docking Collars.
    • getTransports

      public Vector<Transporter> getTransports()
      Returns:
      A vector of Transporter objects this unit uses/has
    • isPodMountedTransport

      public boolean isPodMountedTransport(Transporter t)
    • getTransportBays

      public Vector<Bay> getTransportBays()
    • resetBayDoors

      public void resetBayDoors()
      do any damage to bay doors
    • resetBays

      public void resetBays()
    • getLaunchableSmallCraft

      public Vector<Entity> getLaunchableSmallCraft()
    • getLaunchableDropships

      public List<Entity> getLaunchableDropships()
      Returns a list of DropShips launchable from any of the Transport facilities of this unit. The list may be empty but not null.
      Returns:
      A list of launchable DropShips.
    • unload

      public boolean unload(Entity unit)
      Description copied from interface: Transporter
      Unload the given unit.
      Specified by:
      unload in interface Transporter
      Parameters:
      unit - - the Entity to be unloaded.
      Returns:
      true if the unit was contained in this space, false otherwise.
    • resetTransporter

      public void resetTransporter()
      Description copied from interface: Transporter
      clear out all troops listed in the transporter. Used by MHQ to reset units after game
      Specified by:
      resetTransporter in interface Transporter
    • getUnusedString

      public String getUnusedString()
      Description copied from interface: Transporter
      Return a string that identifies the unused capacity of this transporter.
      Specified by:
      getUnusedString in interface Transporter
      Returns:
      A String meant for a human.
    • getUnused

      public double getUnused()
      Specified by:
      getUnused in interface Transporter
      Returns:
      the number of unused spaces in this transporter.
    • getUnused

      public double getUnused(Entity e)
      Returns the current amount of cargo space for an entity of the given type.
      Parameters:
      e - An entity that defines the unit class
      Returns:
      The number of units of the given type that can be loaded in this Entity
    • getUnusedString

      public String getUnusedString(ViewFormatting formatting)
      Return a string that identifies the unused capacity of this transporter.
      Returns:
      A String meant for a human.
    • isWeaponBlockedAt

      public boolean isWeaponBlockedAt(int loc, boolean isRear)
      Description copied from interface: Transporter
      Determine if transported units prevent a weapon in the given location from firing.
      Specified by:
      isWeaponBlockedAt in interface Transporter
      Parameters:
      loc - the location attempting to fire.
      isRear - true if the weapon is rear-facing
      Returns:
      True if a transported unit is in the way, false if the weapon can fire.
    • getExteriorUnitAt

      public Entity getExteriorUnitAt(int loc, boolean isRear)
      Description copied from interface: Transporter
      If a unit is being transported on the outside of the transporter, it can suffer damage when the transporter is hit by an attack. Currently, no more than one unit can be at any single location; that same unit can be "spread" over multiple locations.
      Specified by:
      getExteriorUnitAt in interface Transporter
      Parameters:
      loc - - the int location hit by attack.
      isRear - - a boolean value stating if the given location is rear facing; if false, the location is front facing.
      Returns:
      The Entity being transported on the outside at that location. This value will be null if no unit is transported on the outside at that location.
    • getExternalUnits

      public List<Entity> getExternalUnits()
      Specified by:
      getExternalUnits in interface Transporter
      Returns:
      list of all units carried externally by this transporter
    • getCargoMpReduction

      public int getCargoMpReduction(Entity carrier)
      Specified by:
      getCargoMpReduction in interface Transporter
      Returns:
      the MP reduction due to cargo carried by this transporter
    • getTrooperAtLocation

      public HitData getTrooperAtLocation(HitData hit, Entity transport)
    • setTransportId

      public void setTransportId(int transportId)
      Record the ID of the Entity that has loaded this unit. A unit that is unloaded can neither move nor attack for the rest of the turn.
      Parameters:
      transportId - - the int ID of our transport. The ID is not validated. This value should be Entity.NONE if this unit has been unloaded.
    • getBayPersonnel

      public int getBayPersonnel()
      Returns:
      The number of additional crew capacity provided by quarters in transport bays.
    • getTransportId

      public int getTransportId()
      Get the ID Entity that has loaded this one.
      Returns:
      the int ID of our transport. The ID may be invalid. This value should be Entity.NONE if this unit has not been loaded.
    • isStealthActive

      public boolean isStealthActive()
      Determine if this unit has an active and working stealth system.

      Sub-classes are encouraged to override this method.

      Returns:
      true if this unit has a stealth system that is currently active and it's actually working, false if there is no stealth system or if it is inactive.
    • isStealthOn

      public boolean isStealthOn()
      Determine if this unit has an active and working stealth system.

      Sub-classes are encouraged to override this method.

      Returns:
      true if this unit has a stealth system that is currently active and it's actually working, false if there is no stealth system or if it is inactive.
    • isNullSigActive

      public boolean isNullSigActive()
      Determine if this unit has an active null-signature system.

      Sub-classes are encouraged to override this method.

      Returns:
      true if this unit has a null signature system that is currently active, false if there is no stealth system or if it is inactive.
    • isNullSigOn

      public boolean isNullSigOn()
      Determine if this unit has an active null-signature system.

      Sub-classes are encouraged to override this method.

      Returns:
      true if this unit has a null signature system that is currently active, false if there is no stealth system or if it is inactive.
    • isVoidSigActive

      public boolean isVoidSigActive()
      Determine if this unit has an active void signature system that is providing its benefits.

      Sub-classes are encouraged to override this method.

      Returns:
      true if this unit has a void signature system that is currently active, false if there is no stealth system or if it is inactive.
    • isVoidSigOn

      public boolean isVoidSigOn()
      Determine if this unit has an active void signature system.

      Sub-classes are encouraged to override this method.

      Returns:
      true if this unit has a void signature system that is currently active, false if there is no stealth system or if it is turned off.
    • isChameleonShieldActive

      public boolean isChameleonShieldActive()
      Determine if this unit has an active chameleon light polarization field.

      Sub-classes are encouraged to override this method.

      Returns:
      true if this unit has a void signature system that is currently active, false if there is no stealth system or if it is inactive.
    • isChameleonShieldOn

      public boolean isChameleonShieldOn()
      Determine if this unit has an active chameleon light polarization field.

      Sub-classes are encouraged to override this method.

      Returns:
      true if this unit has a void signature system that is currently active, false if there is no stealth system or if it is inactive.
    • getStealthModifier

      public TargetRoll getStealthModifier(int range, Entity ae)
      Determine the stealth modifier for firing at this unit from the given range. If the value supplied for range is not one of the Entity class range constants, an IllegalArgumentException will be thrown.

      Sub-classes are encouraged to override this method.

      Parameters:
      range - - an int value that must match one of the Compute class range constants.
      ae - - the entity making the attack, who maybe immune to certain kinds of stealth
      Returns:
      a TargetRoll value that contains the stealth modifier for the given range.
    • setSwarmTargetId

      public void setSwarmTargetId(int id)
      Record the ID of the Entity that is the current target of a swarm attack by this unit. A unit that stops swarming can neither move nor attack for the rest of the turn.
      Parameters:
      id - - the int ID of the swarm attack's target. The ID is not validated. This value should be Entity.NONE if this unit has stopped swarming.
    • getSwarmTargetId

      public int getSwarmTargetId()
      Get the ID of the Entity that is the current target of a swarm attack by this unit.
      Returns:
      the int ID of the swarm attack's target The ID may be invalid. This value should be Entity.NONE if this unit is not swarming.
    • setSwarmAttackerId

      public void setSwarmAttackerId(int id)
      Record the ID of the Entity that is attacking this unit with a swarm attack.
      Parameters:
      id - - the int ID of the swarm attack's attacker. The ID is not validated. This value should be Entity.NONE if the swarm attack has ended.
    • getSwarmAttackerId

      public int getSwarmAttackerId()
      Get the ID of the Entity that is attacking this unit with a swarm attack.
      Returns:
      the int ID of the swarm attack's attacker The ID may be invalid. This value should be Entity.NONE if this unit is not being swarmed.
    • hasInfernoAmmo

      public boolean hasInfernoAmmo()
      Scans through the ammo on the unit for any inferno rounds.
      Returns:
      true if the unit is still loaded with Inferno rounds. false if no rounds were ever loaded or if they have all been fired.
    • antiTSMVulnerable

      public boolean antiTSMVulnerable()
      Check for vulnerability to anti-TSM munitions. ATSM affects Meks with prototype TSM and any industrial TSM created before 3050, and conventional infantry with TSM implants.
      Returns:
      Whether the unit is affected by ATSM munitions
    • setSalvage

      public void setSalvage(boolean canSalvage)
      Record if the unit is just combat-lossed or if it has been utterly destroyed.
      Parameters:
      canSalvage - - a boolean that is true if the unit can be repaired (given time and parts); if this value is false, the unit is utterly destroyed.
    • isSalvage

      public boolean isSalvage()
      Determine if the unit is just combat-lossed or if it has been utterly destroyed.
      Returns:
      A boolean that is true if the unit has salvageable components; if this value is false the unit is utterly destroyed.
      See Also:
    • isRepairable

      public boolean isRepairable()
      Determine if the unit can be repaired, or only harvested for spares.
      Returns:
      A boolean that is true if the unit can be repaired (given enough time and parts); if this value is false, the unit is only a source of spares.
      See Also:
    • getRemovalCondition

      public int getRemovalCondition()
      Getter for property removalCondition.
      Returns:
      Value of property removalCondition.
    • setRemovalCondition

      public void setRemovalCondition(int removalCondition)
      Setter for property removalCondition.
      Parameters:
      removalCondition - New value of property removalCondition.
    • isClearingMinefield

      public boolean isClearingMinefield()
      Returns:
      whether this entity is clearing a minefield.
    • setClearingMinefield

      public void setClearingMinefield(boolean clearingMinefield)
    • isSpotting

      public boolean isSpotting()
      Returns:
      True if this entity is spotting this round.
    • setSpotting

      public void setSpotting(boolean spotting)
      Sets if this unit is spotting this round.
      Parameters:
      spotting - True if this unit is to be set as spotting
    • canSpot

      public boolean canSpot()
      Um, basically everything can spot for LRM indirect fire. Except for off-board units, units that sprinted, and units evading.
      Returns:
      true, if the entity is eligible to spot
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • statusToString

      public String statusToString()
      This returns a textual description of the entity for visually impaired users.
    • statusToString

      public String statusToString(int loc)
      This returns a textual description of a specific location of the entity for visually impaired users.
      Parameters:
      loc - the location
      Returns:
      a string describing the status of the location.
    • statusToString

      public String statusToString(String str)
      Parameters:
      str - a string defining the location
      Returns:
      the status of the given location.
    • setDeployRound

      public void setDeployRound(int deployRound)
      The round the unit will be deployed. We will deploy at the end of a round. So if deployRound is set to 5, we will deploy when round 5 is over.
      Parameters:
      deployRound - an int
    • getDeployRound

      public int getDeployRound()
      The round the unit will be deployed
      Specified by:
      getDeployRound in interface Deployable
      Returns:
      an int
    • setDeployed

      public void setDeployed(boolean deployed)
      Toggles if an entity has been deployed
    • isDeployed

      public boolean isDeployed()
      Checks to see if an entity has been deployed
      Specified by:
      isDeployed in interface Deployable
    • wasNeverDeployed

      public boolean wasNeverDeployed()
      Checks to see if entity was never deployed
    • setNeverDeployed

      public void setNeverDeployed(boolean neverDeployed)
      Toggles if an entity has been deployed
    • shouldDeploy

      public boolean shouldDeploy(int round)
      Returns true if the entity should be deployed
    • shouldOffBoardDeploy

      public boolean shouldOffBoardDeploy(int round)
      Returns true if the off board entity should be deployed this round.
      Parameters:
      round - The current round number.
      Returns:
      True if and only if the off board entity should deploy this round, otherwise false.
    • setUnitNumber

      public void setUnitNumber(short unit)
      Set the unit number for this entity.
      Parameters:
      unit - the number for the low-level unit that this entity belongs to. This entity can be removed from its unit by passing the value, BTObject.NONE.
    • getUnitNumber

      public short getUnitNumber()
      Get the unit number of this entity.
      Returns:
      The unit number. If the entity does not belong to a unit, BTObject.NONE will be returned.
    • canFlee

      public final boolean canFlee()
      Returns true when this unit can flee from its current position. This requires the unit to have mobility and be in control as well as its position being eligible for fleeing. When no special flee area is set by a scenario, the latter will typically be true when the unit is at the edge of its board. The position of units with a null position as well as offboard units are considered to be eligible for fleeing.
      Returns:
      True when the unit can flee given its position and status
    • canFlee

      public boolean canFlee(@Nullable Coords position)
      Returns true when this unit can flee from the given position. This requires the unit to have mobility and be in control as well as the position being eligible for fleeing. When no special flee area is set by a scenario, the latter will typically be true when the position is at the edge of its board. A null position as well as offboard units are considered to be eligible for fleeing.
      Returns:
      True when the unit can flee from the given position, given its current status
    • setEverSeenByEnemy

      public void setEverSeenByEnemy(boolean b)
    • isEverSeenByEnemy

      public boolean isEverSeenByEnemy()
    • setVisibleToEnemy

      public void setVisibleToEnemy(boolean b)
    • isVisibleToEnemy

      public boolean isVisibleToEnemy()
    • setDetectedByEnemy

      public void setDetectedByEnemy(boolean b)
    • isDetectedByEnemy

      public boolean isDetectedByEnemy()
    • addBeenSeenBy

      public void addBeenSeenBy(Player p)
    • getWhoCanSee

      public Vector<Player> getWhoCanSee()
    • setWhoCanSee

      public void setWhoCanSee(Vector<Player> entitySeenBy)
    • clearSeenBy

      public void clearSeenBy()
    • hasSeenEntity

      public boolean hasSeenEntity(Player p)
      Returns true if the given player can see this Entity, including teammates if team_vision is on.
    • addBeenDetectedBy

      public void addBeenDetectedBy(Player p)
    • getWhoCanDetect

      public Vector<Player> getWhoCanDetect()
    • setWhoCanDetect

      public void setWhoCanDetect(Vector<Player> entityDetectedBy)
    • clearDetectedBy

      public void clearDetectedBy()
    • hasDetectedEntity

      public boolean hasDetectedEntity(Player p)
      Returns:
      true if the given player can see this Entity, including teammates if team_vision is on.
    • isSensorReturn

      public boolean isSensorReturn(Player spotter)
      Returns whether this Entity is a sensor return to the given player.
      Parameters:
      spotter - The player trying to view this unit
      Returns:
      True if the given player can only see this Entity as a sensor return
    • applyGravityEffectsOnMP

      protected int applyGravityEffectsOnMP(int MP)
    • canCharge

      public boolean canCharge()
      Returns:
      Whether this type of unit can perform charges
    • canDFA

      public boolean canDFA()
      Returns:
      Whether this type of unit can perform DFA attacks
    • canRam

      public boolean canRam()
      Returns:
      Whether this type of unit can perform Ramming attacks
    • isUsingManAce

      public boolean isUsingManAce()
    • getKills

      public Enumeration<Entity> getKills()
    • getKillNumber

      public int getKillNumber()
    • addKill

      public void addKill(Entity kill)
    • getGaveKillCredit

      public boolean getGaveKillCredit()
    • getKillerId

      public int getKillerId()
    • isEligibleFor

      public boolean isEligibleFor(GamePhase phase)
      Determines if an entity is eligible for a phase.
    • canAssist

      public boolean canAssist(GamePhase phase)
      Determines if an entity is eligible for a phase. Called only if at least one entity returned true to isEligibleFor() This is for using searchlights in physical and off board phase, without forcing the phase to be played when not needed. However, it could be used for other things in the future
    • isEligibleForFiring

      public boolean isEligibleForFiring()
      An entity is eligible for firing if it's not taking some kind of action that prevents it from firing, such as a full-round physical attack or sprinting.
    • isEligibleForMovement

      public boolean isEligibleForMovement()
      Pretty much anybody's eligible for movement. If the game option is toggled on, inactive and immobile entities are not eligible. OffBoard units are always ineligible
      Returns:
      whether or not the entity is allowed to move
    • isEligibleForOffboard

      public boolean isEligibleForOffboard()
    • isAttackingThisTurn

      public boolean isAttackingThisTurn()
    • isEligibleForPhysical

      public boolean isEligibleForPhysical()
      Check if the entity has any valid targets for physical attacks.
    • isEligibleForArtyAutoHitHexes

      public boolean isEligibleForArtyAutoHitHexes()
      Returns:
      True if this Entity is eligible to pre-designate hexes as auto-hits. Per TacOps pg 180, if a player has off board artillery they get 5 pre-designated hexes per map sheet.
    • isEligibleForTargetingPhase

      public boolean isEligibleForTargetingPhase()
    • getTroopCarryingSpace

      public double getTroopCarryingSpace()
    • getPodMountedTroopCarryingSpace

      public double getPodMountedTroopCarryingSpace()
    • hasBattleArmorHandles

      public boolean hasBattleArmorHandles()
    • isOffBoard

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

      public void setOffBoard(int distance, OffBoardDirection direction)
      Set the unit as an off board deployment. If a non-zero distance is chosen, the direction must not be Entity.NONE. If a direction other than Entity.NONE is chosen, the distance must not be zero (0).
      Parameters:
      distance - the int distance in hexes that the unit will be deployed from the board; this value must not be negative.
      direction - the int direction from the board that the unit will be deployed; a valid value must be selected from: NONE, NORTH, SOUTH, EAST, or WEST.
      Throws:
      IllegalArgumentException - if a negative distance, an invalid direction is selected, or the distance does not match the direction.
    • getOffBoardDistance

      public int getOffBoardDistance()
      Get the distance in hexes from the board that the unit will be deployed. If the unit is to be deployed onboard, the distance will be zero (0).
      Returns:
      the int distance from the board the unit will be deployed (in hexes); this value will never be negative.
    • getOffBoardDirection

      public OffBoardDirection getOffBoardDirection()
      Returns the direction off the board that the unit will be deployed. If the unit is deployed onboard, IOffBoardDirections.NONE is returned, otherwise one of the values:
      • IOffBoardDirections.NORTH
      • IOffBoardDirections.SOUTH
      • IOffBoardDirections.EAST
      • IOffBoardDirections.WEST
    • deployOffBoard

      public void deployOffBoard(int round)
      Deploy this offboard entity at the previously specified distance and direction. This should only be invoked by the Server after the board has been selected and all the players are ready to start. The side effects of this methods set the unit's position and facing as appropriate (as well as deploying the unit).

      Onboard units (units with an offboard distance of zero and a direction of Entity.NONE) will be unaffected by this method.

      Parameters:
      round - The current round number.
    • getPickedUpMekWarriors

      public Vector<Integer> getPickedUpMekWarriors()
    • isCaptured

      public boolean isCaptured()
      Has this entity been captured?
      Returns:
      true if it has.
    • setCaptured

      public void setCaptured(boolean arg)
      Specify that this entity has been captured.
      Parameters:
      arg - the boolean value to assign.
    • setExternalSearchlight

      public void setExternalSearchlight(boolean arg)
    • hasExternalSearchlight

      public boolean hasExternalSearchlight()
      Returns:
      True if this unit has an external searchlight (does not consider mounted ones).
    • hasSearchlight

      public boolean hasSearchlight()
      Returns:
      True if the unit has a usable searchlight. It considers both externally mounted searchlights and internally mounted ones.
    • destroyOneSearchlight

      public void destroyOneSearchlight()
      Method to destroy a single searchlight on an entity. Searchlights can be destroyed on a roll of 7+ on a torso hit on a mek or on a front/side hit on a combat vehicle.
    • setSearchlightState

      public void setSearchlightState(boolean arg)
    • isIlluminated

      public boolean isIlluminated()
    • setIlluminated

      public void setIlluminated(boolean arg)
    • isUsingSearchlight

      public boolean isUsingSearchlight()
    • setUsedSearchlight

      public void setUsedSearchlight(boolean arg)
    • usedSearchlight

      public boolean usedSearchlight()
    • isStuck

      public boolean isStuck()
      Is the Entity stuck in a swamp?
    • setStuck

      public void setStuck(boolean arg)
      Set weather this Entity is stuck in a swamp or not
      Parameters:
      arg - the boolean value to assign
    • canUnstickByJumping

      public boolean canUnstickByJumping()
      Is the Entity stuck in a swamp?
    • setCanUnstickByJumping

      public void setCanUnstickByJumping(boolean arg)
      Set whether this Entity is stuck in a swamp or not
      Parameters:
      arg - the boolean value to assign
    • destroy

      public String destroy(String reason, boolean survivable, boolean canSalvage)
    • addTargetedBySwarm

      public void addTargetedBySwarm(int entityId, int weaponId)
      Add a targeting by a swarm volley from a specified entity
      Parameters:
      entityId - The int id of the shooting entity
      weaponId - The int id of the shooting lrm launcher
    • getTargetedBySwarm

      public boolean getTargetedBySwarm(int entityId, int weaponId)
      Were we targeted by a certain swarm/swarm-i volley this turn?
      Parameters:
      entityId - The int id of the shooting entity we are checking
      weaponId - The int id of the launcher to check
      Returns:
      a fitting boolean value
    • getShortRangeModifier

      public int getShortRangeModifier()
    • getMediumRangeModifier

      public int getMediumRangeModifier()
    • getLongRangeModifier

      public int getLongRangeModifier()
    • getExtremeRangeModifier

      public int getExtremeRangeModifier()
    • getLOSRangeModifier

      public int getLOSRangeModifier()
    • setArmorType

      public void setArmorType(int armType)
    • setArmorType

      public void setArmorType(int armType, int loc)
    • setStructureType

      public void setStructureType(int structureType)
    • setStructureTechLevel

      public void setStructureTechLevel(int level)
    • setArmorType

      public void setArmorType(String armType)
    • setArmorType

      public void setArmorType(String armType, int loc)
    • setStructureType

      public void setStructureType(String structureType)
    • getArmorType

      public int getArmorType(int loc)
    • setArmorTechLevel

      public void setArmorTechLevel(int newTL)
    • setArmorTechLevel

      public void setArmorTechLevel(int newTL, int loc)
    • getArmorTechLevel

      public int getArmorTechLevel(int loc)
    • getStructureType

      public int getStructureType()
    • getStructureTechLevel

      public int getStructureTechLevel()
    • setWeaponHit

      public void setWeaponHit(WeaponMounted which)
    • setTaggedBy

      public void setTaggedBy(int tagger)
    • getTaggedBy

      public int getTaggedBy()
    • getCost

      public final double getCost(boolean ignoreAmmo)
      Calculates and returns the C-bill cost of the unit. The parameter can be used to include or exclude ("dry cost") the cost of ammunition on the unit.
      Parameters:
      ignoreAmmo - When true, the cost of ammo on the unit will be excluded from the cost
      Returns:
      The cost in C-Bills of the 'Mek in question.
    • getCost

      public abstract double getCost(CalculationReport calcReport, boolean ignoreAmmo)
      Calculates and returns the C-bill cost of the unit. The parameter ignoreAmmo can be used to include or exclude ("dry cost") the cost of ammunition on the unit. A report for the cost calculation will be written to the given calcReport.
      Parameters:
      calcReport - A CalculationReport to write the report for the cost calculation to
      ignoreAmmo - When true, the cost of ammo on the unit will be excluded from the cost
      Returns:
      The cost in C-Bills of the 'Mek in question.
    • getPriceMultiplier

      public double getPriceMultiplier()
      Returns a multiplier that combines multiplicative construction cost modifiers for this Entity.

      This includes only modifiers that apply to an Entity's final, total cost (e.g. - the 1.25x modifier for being an omni-unit, or the 32.0x for being an aerodyne DropShip). It does NOT include multipliers that only apply to a sub-part of the unit (e.g. the weight based multiplier that applies to a vehicle's internal structure cost).

      This allows MekHQ to scale the price of a Unit's Parts in a more appropriate manner.

      Defaults to 1.0

    • implicitClanCASE

      public int implicitClanCASE()
      Used to for cost calculations. Though the TM rules allow a Clan unit to be designed without CASE, MM assumes that CASE is present in any location that has explosive equipment.
      Returns:
      The number of locations protected by Clan CASE beyond what is explicitly mounted.
    • removePartialCoverHits

      public boolean removePartialCoverHits(int location, int cover, int side)
    • doomedInExtremeTemp

      public boolean doomedInExtremeTemp()
      Returns:
      True when this unit will not survive temperatures outside of -30 to +50 C.
    • doomedInVacuum

      public boolean doomedInVacuum()
      Returns:
      True when this unit will not survive vacuum conditions.
    • doomedOnGround

      public boolean doomedOnGround()
      Returns:
      True when this unit is not allowed to be or will not survive in any hex of a ground map (unless it is being transported).
    • doomedInAtmosphere

      public boolean doomedInAtmosphere()
      Returns:
      True when this unit is not allowed to be or will not survive in any hex of a low altitude a.k.a. atmospheric map (unless it is being transported). Note that this has nothing to do with the atmosphere (or lack of it, depending on planetary conditions), only the map type and scale.
    • doomedInSpace

      public boolean doomedInSpace()
      Returns:
      True when this unit is not allowed to be or will not survive in any hex of a space map (unless it is being transported).
    • getArmorWeight

      public double getArmorWeight(int loc)
      Prior to TacOps errata 3.3, armor was rounded up to the nearest half ton As of TacOps errata 3.3, patchwork armor is not rounded by location. Previous editions of the rules required it to be rounded up to the nearest half ton by location. Note: Unless overridden, this should only be called on units with patchwork armor, as rounding behavior is not guaranteed to be correct or even the same for others and units with a single overall armor type have no real reason to specifically care about weight per location anyway.
      Parameters:
      loc - The code value for the location in question (unit type-specific).
      Returns:
      The weight of the armor in the location in tons.
    • getArmorWeight

      public double getArmorWeight()
      The total weight of the armor on this unit. This is guaranteed to be rounded properly for both single-type and patchwork armor.
      Returns:
      The armor weight in tons.
    • hasTAG

      public boolean hasTAG()
    • isCanon

      public boolean isCanon()
    • setCanon

      public void setCanon(boolean canon)
    • climbMode

      public boolean climbMode()
      Get the entity's "climbing mode"
      Returns:
      True or false, where true = climb up and false = go through
    • setClimbMode

      public void setClimbMode(boolean state)
    • usedTag

      public boolean usedTag()
    • hasEiCockpit

      public boolean hasEiCockpit()
    • hasActiveEiCockpit

      public boolean hasActiveEiCockpit()
    • isLayingMines

      public boolean isLayingMines()
    • setLayingMines

      public void setLayingMines(boolean laying)
    • canLayMine

      public boolean canLayMine()
    • 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
    • sideTable

      public int sideTable(Coords src, boolean usePrior, int face)
    • sideTable

      public int sideTable(Coords src, boolean usePrior, int face, Coords effectivePos)
    • canGoHullDown

      public boolean canGoHullDown()
      Method to determine if an entity is currently capable of going hull-down. Note, this is *not* whether the entity can ever go hull-down.
      Returns:
      True if the entity is able to go hull-down, else false.
    • canAssaultDrop

      public boolean canAssaultDrop()
    • setAssaultDropInProgress

      public void setAssaultDropInProgress(boolean flag)
    • setLandedAssaultDrop

      public void setLandedAssaultDrop()
    • isAssaultDropInProgress

      public boolean isAssaultDropInProgress()
    • addPilotingModifierForTerrain

      public void addPilotingModifierForTerrain(PilotingRollData roll, Coords c, int boardId)
      Apply PSR modifier for difficult terrain at the specified coordinates.
      Parameters:
      roll - the PSR to modify
      c - the coordinates where the PSR happens
      boardId - the board ID where the PSR happens
    • addPilotingModifierForTerrain

      public void addPilotingModifierForTerrain(PilotingRollData roll, Coords c, int boardId, boolean enteringRubble)
      Apply PSR modifier for difficult terrain at the specified coordinates
      Parameters:
      roll - the PSR to modify
      c - the coordinates where the PSR happens
      boardId - the board ID where the PSR happens
      enteringRubble - True if entering rubble
    • addPilotingModifierForTerrain

      public void addPilotingModifierForTerrain(PilotingRollData roll, MoveStep step)
      Apply PSR modifier for difficult terrain at the move step position
      Parameters:
      roll - the PSR to modify
      step - the move step the PSR occurs at
    • addPilotingModifierForTerrain

      public void addPilotingModifierForTerrain(PilotingRollData roll)
      Apply PSR modifier for difficult terrain in the current position
      Parameters:
      roll - the PSR to modify
    • fixElevation

      public boolean fixElevation()
      defensively check and correct elevation
    • getEngine

      @Nullable public Engine getEngine()
    • getEngineType

      public int getEngineType()
      Returns:
      The type of engine if it has an engine, or Engine.NONE, if it has no engine.
    • hasEngine

      public boolean hasEngine()
    • setEngine

      public void setEngine(Engine e)
    • itemOppositeTech

      public boolean itemOppositeTech(String s)
    • getRetreatedDirection

      public OffBoardDirection getRetreatedDirection()
      Returns:
      Returns the retreatedDirection.
    • setRetreatedDirection

      public void setRetreatedDirection(OffBoardDirection retreatedDirection)
      Parameters:
      retreatedDirection - The retreatedDirection to set.
    • setLastTarget

      public void setLastTarget(int id)
    • getLastTarget

      public int getLastTarget()
    • setLastTargetDisplayName

      public void setLastTargetDisplayName(String name)
    • getLastTargetDisplayName

      public String getLastTargetDisplayName()
    • isSufferingEMI

      public boolean isSufferingEMI()
      Returns:
      whether the unit is suffering from Electromagnetic Interference
    • setEMI

      public void setEMI(boolean inVal)
    • getMotiveSideMod

      public int getMotiveSideMod(int side)
      The attack direction modifier for rolls on the motive system hits table for the given side (as defined in ToHitData). This will return 0 if Tactical Operations vehicle effectiveness rules are in effect or if the side parameter falls outside ToHitData's range of "fixed" side values; in particular, it will return 0 if handed ToHitData.SIDE_RANDOM.
      Parameters:
      side - The attack direction as specified above.
      Returns:
      The appropriate directional roll modifier.
    • isNuclearHardened

      public abstract boolean isNuclearHardened()
      Checks if the unit is hardened against nuclear strikes.
      Returns:
      true if this is a hardened unit.
    • setHidden

      public void setHidden(boolean inVal)
      Set the hidden state of this entity (used for hidden units rules, TW pg 259).
    • setMadePointblankShot

      public void setMadePointblankShot(boolean inVal)
    • setHiddenActivationPhase

      public void setHiddenActivationPhase(GamePhase phase)
      Parameters:
      phase - the phase for this hidden unit to become active in.
    • isHidden

      public boolean isHidden()
      Returns true if this unit is currently hidden (hidden units, TW pg 259).
    • madePointblankShot

      public boolean madePointblankShot()
      Returns:
      True if this unit has already made a pointblank shot this round.
    • getHiddenActivationPhase

      public GamePhase getHiddenActivationPhase()
      Returns:
      the phase that this hidden unit will activate in (generally this will be Game.Phase.UNKNOWN, indicating that the unit isn't activating).
    • isCarcass

      public boolean isCarcass()
      Is this unit a carcass, a carcass can take no action
    • setCarcass

      public void setCarcass(boolean carcass)
      Sets if this unit is a carcass.
      Parameters:
      carcass - true if this unit should be a carcass, false otherwise.
      See Also:
    • destroyLocation

      public void destroyLocation(int loc)
      Marks all equipment in a location on this entity as destroyed.
      Parameters:
      loc - The location that is destroyed.
    • destroyLocation

      public void destroyLocation(int loc, boolean blownOff)
      Marks all equipment in a location on this entity as destroyed.
      Parameters:
      loc - The location that is destroyed.
      blownOff - true if the location was blown off
    • clearDestroyedNarcPods

      public void clearDestroyedNarcPods()
      Iterates over all Narc and iNarc pods attached to this entity and removes those still 'stuck' to destroyed or missing locations.
    • clearNarcAndiNarcPods

      public void clearNarcAndiNarcPods()
      This clears all Narc and iNarc Pods from an Entity. It is used in MekHQ to clear this transient data.
    • checkSideSlip

      public PilotingRollData checkSideSlip(EntityMovementType moveType, Hex prevHex, EntityMovementType overallMoveType, MoveStep prevStep, int prevFacing, int curFacing, Coords lastPos, Coords curPos, int distance, boolean speedBooster)
    • isAirborneVTOLorWIGE

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

      public void setSpotTargetId(int targetId)
    • getSpotTargetId

      public int getSpotTargetId()
    • setCommander

      public void setCommander(boolean arg)
    • isCommander

      public boolean isCommander()
    • hasLinkedMGA

      public boolean hasLinkedMGA(WeaponMounted mounted)
    • setReckless

      public void setReckless(boolean b)
    • isReckless

      public boolean isReckless()
    • isCapitalFighter

      public boolean isCapitalFighter()
    • isCapitalFighter

      public boolean isCapitalFighter(boolean lounge)
    • isCapitalScale

      public boolean isCapitalScale()
      Returns:
      True when this unit has capital-scale armor.
    • usesWeaponBays

      public boolean usesWeaponBays()
      Returns:
      True if this unit is using weapons bays
    • whichBay

      public WeaponMounted whichBay(int equipmentId)
      return the bay of the current weapon or ammo
      Parameters:
      equipmentId - The equipment index
      Returns:
      The bay mount, or null if the equipment is not in a bay
    • getHeatInArc

      public int getHeatInArc(int location, boolean rearMount)
    • getVectors

      public int[] getVectors()
    • setVectors

      public void setVectors(int[] v)
    • getVector

      public int getVector(int vectorFacing)
    • getVelocity

      public int getVelocity()
    • chooseSide

      public int chooseSide(Coords attackPos, boolean usePrior)
    • getHeading

      public Vector<Integer> getHeading()
      return the heading of the unit based on its active vectors if vectors are tied then return two headings
    • setPlayerPickedPassThrough

      public void setPlayerPickedPassThrough(int attackerId, Coords c)
    • getPlayerPickedPassThrough

      @Nullable public Coords getPlayerPickedPassThrough(int attackerId)
    • setPassedThrough

      public void setPassedThrough(Vector<Coords> pass)
    • getPassedThrough

      public Vector<Coords> getPassedThrough()
    • setPassedThroughFacing

      public void setPassedThroughFacing(List<Integer> passFacing)
    • getPassedThroughFacing

      public List<Integer> getPassedThroughFacing()
    • getPassedThroughBoardId

      public int getPassedThroughBoardId()
    • setPassedThroughBoardId

      public void setPassedThroughBoardId(int passedThroughBoardId)
    • addPassedThrough

      public void addPassedThrough(Coords c)
    • passedOver

      public boolean passedOver(Targetable target)
      Returns true if this Entity passed over the given target during its current path.
      Parameters:
      target - The target
      Returns:
      True if this unit passed over the target this turn
    • passedThrough

      public boolean passedThrough(Coords c)
    • passedWithin

      public boolean passedWithin(Coords c, int dist)
      Did the entity pass within a certain number of hexes of these coords?
    • passedThroughPrevious

      public Coords passedThroughPrevious(Coords c)
      What coords were passed through previous to the given one
    • setRamming

      public void setRamming(boolean b)
    • isRamming

      public boolean isRamming()
    • resetFiringArcs

      public void resetFiringArcs()
    • hasArcFired

      public boolean hasArcFired(int location, boolean rearMount)
    • setArcFired

      public void setArcFired(int location, boolean rearMount)
    • setRapidFire

      public void setRapidFire()
      Force rapid fire mode to the highest level on RAC and UAC - this is for aerospace
    • extendBlade

      public void extendBlade(int loc)
      Set the retractable blade in the given location as extended Takes the first piece of appropriate equipment
    • destroyRetractableBlade

      public void destroyRetractableBlade(int loc)
      destroys the first retractable blade critical slot found
    • getTMTracker

      public TeleMissileTracker getTMTracker()
    • setGrappled

      public void setGrappled(int id, boolean attacker)
    • isGrappleAttacker

      public boolean isGrappleAttacker()
    • getGrappled

      public int getGrappled()
    • isChainWhipGrappled

      public boolean isChainWhipGrappled()
    • isGrappledThisRound

      public boolean isGrappledThisRound()
    • setGrappledThisRound

      public void setGrappledThisRound(boolean grappled)
    • setGameOptions

      public void setGameOptions()
    • setGrappleSide

      public void setGrappleSide(int side)
    • getGrappleSide

      public int getGrappleSide()
    • hasFunctionalArmAES

      public boolean hasFunctionalArmAES(int location)
    • hasFunctionalLegAES

      public boolean hasFunctionalLegAES()
    • isEvading

      public boolean isEvading()
    • setEvading

      public void setEvading(boolean evasion)
    • getEvasionBonus

      public int getEvasionBonus()
    • setCarefulStand

      public void setCarefulStand(boolean stand)
    • isCarefulStand

      public boolean isCarefulStand()
    • setTurnInterrupted

      public void setTurnInterrupted(boolean interrupted)
    • turnWasInterrupted

      public boolean turnWasInterrupted()
      This should eventually be true for any situation where the entity's turn was interrupted, e.g. walking over a minefield
    • endOfTurnCargoInteraction

      public boolean endOfTurnCargoInteraction()
    • getSensors

      public Vector<Sensor> getSensors()
    • getActiveSensor

      public Sensor getActiveSensor()
    • getNextSensor

      public Sensor getNextSensor()
    • setNextSensor

      public void setNextSensor(Sensor s)
    • getSensorCheck

      public int getSensorCheck()
    • isAeroSensorDestroyed

      public boolean isAeroSensorDestroyed()
      A method to determine if an aero has suffered 3 sensor hits. When double-blind is on, this affects both standard visibility and sensor rolls
    • hasModularArmor

      public boolean hasModularArmor()
    • hasModularArmor

      public boolean hasModularArmor(int loc)
    • getDamageReductionFromModularArmor

      public int getDamageReductionFromModularArmor(HitData hit, int damage, Vector<Report> vDesc)
    • getGhostTargetRoll

      public Roll getGhostTargetRoll()
    • getGhostTargetRollMoS

      public int getGhostTargetRollMoS()
    • getGhostTargetOverride

      public int getGhostTargetOverride()
    • getCoolantFailureAmount

      public int getCoolantFailureAmount()
    • addCoolantFailureAmount

      public void addCoolantFailureAmount(int amount)
      This is implemented in subclasses, do nothing in general
      Parameters:
      amount - Amount of Coolant to add
    • resetCoolantFailureAmount

      public void resetCoolantFailureAmount()
      This is implemented in subclasses, do nothing in general

      Resets the coolant failure amount

    • getExtraCommGearTons

      public int getExtraCommGearTons()
      Returns:
      the tonnage of additional mounted communications equipment
    • isTransported

      public boolean isTransported()
      Returns:
      True if this unit is being transported by another.
    • getECMInfo

      @Nullable public ECMInfo getECMInfo()
      Returns:
      Information (range, location, strength) about ECM if the unit has active ECM or null if it doesn't. In the case of multiple ECCM systems, the best one takes precedence, as a unit can only have one active ECCM at a time.
    • getECCMInfo

      @Nullable public ECMInfo getECCMInfo()
      Returns:
      Information (range, location, strength) about ECCM if the unit has active ECCM or null if it doesn't. In the case of multiple ECCM system, the best one takes precedence, as a unit can only have one active ECCM at a time.
    • getECMStrength

      public double getECMStrength()
      Returns:
      the strength of the ECM field this unit emits
    • getECCMStrength

      public double getECCMStrength()
      Returns:
      the strength of the ECCM field this unit emits
    • getTotalCommGearTons

      public abstract int getTotalCommGearTons()
      Returns:
      the total tonnage of communications gear in this entity
    • getHQIniBonus

      public int getHQIniBonus()
      Returns:
      the initiative bonus this Entity grants for HQ
    • getQuirkIniBonus

      public int getQuirkIniBonus()
      Returns:
      the initiative bonus this Entity grants for quirks
    • getBayByAmmo

      public WeaponMounted getBayByAmmo(AmmoMounted ammoMounted)
      Returns the Bay that the given ammo is associated with.
      Parameters:
      ammoMounted - an AmmoMounted to search for
      Returns:
      The bay (WeaponMounted) that the ammo works with
    • getVibroClaws

      public int getVibroClaws()
      Return how many BA vibroclaws this Entity is equipped with
    • taserShutdown

      public void taserShutdown(int turns, boolean baTaser)
      shut this unit down due to a Taser attack
      Parameters:
      turns - - the amount of rounds for which this Entity should be shutdown
      baTaser - - was this due to a BA taser?
    • getTaserShutdownRounds

      public int getTaserShutdownRounds()
      Returns:
      the number of rounds for which this unit should be shutdown by taser
    • setTaserShutdownRounds

      public void setTaserShutdownRounds(int rounds)
    • isBATaserShutdown

      public boolean isBATaserShutdown()
    • setBATaserShutdown

      public void setBATaserShutdown(boolean value)
    • getTaserInterferenceHeat

      public boolean getTaserInterferenceHeat()
    • setTaserFeedback

      public void setTaserFeedback(int rounds)
      set this entity to suffer from taser feedback
      Parameters:
      rounds - - the number of rounds to suffer from taser feedback
    • getTaserFeedBackRounds

      public int getTaserFeedBackRounds()
      Returns:
      The rounds for which this entity suffers from taser feedback.
    • setTaserInterference

      public void setTaserInterference(int value, int rounds, boolean heat)
    • getTaserInterference

      public int getTaserInterference()
    • getTaserInterferenceRounds

      public int getTaserInterferenceRounds()
    • addIMPHits

      public void addIMPHits(int missiles)
    • isMilitary

      public boolean isMilitary()
      returns whether the unit is a military unit (as opposed to a civilian unit).
    • isLargeCraft

      public boolean isLargeCraft()
      is this entity a large craft? (dropship, jumpship, warship, or space station, see TW p.20)
    • loadedUnitsHaveActiveECM

      public boolean loadedUnitsHaveActiveECM()
      Do units loaded onto this entity still have active ECM/ECCM/etc.?
    • isPartOfFighterSquadron

      public boolean isPartOfFighterSquadron()
      is this entity loaded into a fighter squadron?
    • getBARRating

      public int getBARRating(int loc)
      Return the BAR-rating of this Entity's armor
      Returns:
      the BAR rating
    • hasBARArmor

      public boolean hasBARArmor(int loc)
      Returns:
      True if this unit has BAR armor of a rating of less than 10 in the given location.
    • setBARRating

      public void setBARRating(int rating)
      Sets the barrier armor rating for support vehicles. Has no effect on other unit types.
      Parameters:
      rating - The BAR
    • setBARRating

      public void setBARRating(int rating, int loc)
      Sets the barrier armor rating in a specific location for support vehicles. Has no effect on other unit types.
      Parameters:
      rating - The BAR
      loc - The location index
    • hasArmoredChassis

      public boolean hasArmoredChassis()
      Returns:
      True if this entity has an armored chassis.
    • hasEnvironmentalSealing

      public boolean hasEnvironmentalSealing()
      Returns:
      True if this unit has Environmental Sealing
    • doCheckEngineStallRoll

      public Vector<Report> doCheckEngineStallRoll(Vector<Report> vPhaseReport)
      Possibly do a ICE-Engine stall PSR (only intended for Meks, both Industrial and Battle).
      Parameters:
      vPhaseReport - the Report Vector containing the phase reports
      Returns:
      a Report Vector containing the passed in reports, and any additional ones
    • checkUnstall

      public void checkUnstall(Vector<Report> vPhaseReport)
      Check for uninstalling of this Entity's engine (only used for ICE-powered 'Meks).
      Parameters:
      vPhaseReport - the Report Vector containing the phase reports
    • hasArmoredEngine

      public boolean hasArmoredEngine()
    • isStalled

      public boolean isStalled()
      Is this Entity's ICE Engine stalled?
      Returns:
      if this Entity's ICE engine is stalled
    • isSurfaceNaval

      public boolean isSurfaceNaval()
      is this a naval vessel on the surface of the water?
    • isNaval

      public boolean isNaval()
      Is this a naval vessel?
      Returns:
      Whether it is or not.
    • isNightwalker

      public boolean isNightwalker()
      Determines if the pilot has the Nightwalker SPA
      Returns:
      true when pilots have the SPA and are not in a flying vehicle.
    • setSource

      public void setSource(String source)
      Sets the source (TRO or other) of the creation of this entity.
      Parameters:
      source - The source name
    • getSource

      public String getSource()
    • setQuirks

      public void setQuirks(Quirks quirks)
    • getQuirks

      public Quirks getQuirks()
      Retrieves the quirks object for entity. DO NOT USE this to check boolean options, as it will not check game options for quirks. Use hasQuirk(String) instead!
      Returns:
      This unit's quirks, independently of the game's settings
      See Also:
    • hasQuirk

      public boolean hasQuirk(String name)
    • getPartialRepairs

      public PartialRepairs getPartialRepairs()
    • clearPartialRepairs

      public void clearPartialRepairs()
    • countQuirks

      public int countQuirks()
      count all the quirks for this unit, positive and negative
    • countWeaponQuirks

      public int countWeaponQuirks()
    • countPartialRepairs

      public int countPartialRepairs()
    • countQuirks

      public int countQuirks(String grpKey)
      count the quirks for this unit, for a given group name
    • getQuirkList

      public String getQuirkList(String sep)
      Returns a string of all the quirk "codes" for this entity, using sep as the separator
    • getForwardArc

      public int getForwardArc()
      Returns the forward firing arc for this entity - overrided by some units
    • getRearArc

      public int getRearArc()
      Returns the rear firing arc for this entity - overrided by some units
    • 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.isAirborneVTOLorWIGE()
    • isSpaceborne

      public boolean isSpaceborne()
      Returns true when this unit is currently on a space board, either close to a planet ("high altitude") or in deep space but only if its position is valid, i.e. not when it is transported or otherwise has a null position or is off board or undeployed. On a high altitude board, a unit is spaceborne even if it happens to be in an atmosphere hex.

      This method is safe to call when game is null.

      Returns:
      True when in space
    • isNOE

      public final boolean isNOE()
      Returns:
      True if this unit is flying at the Nap of the Earth (NOE), i.e. one altitude above ground.
    • getStartingPos

      public int getStartingPos()
    • getStartingPos

      public int getStartingPos(boolean inheritFromOwner)
    • setStartingPos

      public void setStartingPos(int i)
    • getAltitude

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

      public void setAltitude(int a)
    • getUseManualBV

      public boolean getUseManualBV()
    • setUseManualBV

      public void setUseManualBV(boolean bv)
    • getManualBV

      public int getManualBV()
    • setManualBV

      public void setManualBV(int bv)
    • getInitialBV

      public int getInitialBV()
      Gets the initial BV of a unit.

      Useful for comparisons with the current BV.

      Returns:
      The initial BV of a unit.
    • setInitialBV

      public void setInitialBV(int bv)
      Sets the initial BV for a unit.

      Called when the game is initialized.

      Parameters:
      bv - The initial BV of a unit.
    • getBombLoadout

      public BombLoadout getBombLoadout()
      Returns:
      an int array of the number of bombs of each type based on the current bomb list
    • getBombLoadout

      public BombLoadout getBombLoadout(boolean internalOnly)
    • getInternalBombLoadout

      public BombLoadout getInternalBombLoadout()
    • getExternalBombLoadout

      public BombLoadout getExternalBombLoadout()
    • getSecondaryPositions

      public Map<Integer,Coords> getSecondaryPositions()
      Specified by:
      getSecondaryPositions in interface Targetable
    • hasActiveBlueShield

      public boolean hasActiveBlueShield()
      Checks to see if this unit has a functional Blue Shield Particle Field Damper that is turned on
      Returns:
      true if the entity has a working, switched on blue field false otherwise
    • getBlueShieldRounds

      public int getBlueShieldRounds()
    • isDropping

      public boolean isDropping()
    • hasStealth

      public boolean hasStealth()
      Returns:
      True if this unit has working stealth armor (not patchwork armor).
    • getPowerAmplifierWeight

      public double getPowerAmplifierWeight()
      Computes and returns the power amplifier weight for this entity, if any. Returns 0.0 if the entity needs no amplifiers due to engine type or not carrying any weapons requiring them.
      Returns:
      the power amplifier weight in tons.
    • getLoadedKeepers

      public Vector<Integer> getLoadedKeepers()
    • setLoadedKeepers

      public void setLoadedKeepers(Vector<Integer> v)
    • getExtraC3BV

      public int getExtraC3BV(int baseBV)
    • hasUnloadedUnitsFromBays

      public boolean hasUnloadedUnitsFromBays()
    • getMovedBackwards

      public boolean getMovedBackwards()
    • setMovedBackwards

      public void setMovedBackwards(boolean back)
    • isPowerReverse

      public boolean isPowerReverse()
    • setPowerReverse

      public void setPowerReverse(boolean isPowerReverse)
    • wigeLiftoffHover

      public boolean wigeLiftoffHover()
      Tracks whether a WiGE lifted off this turn (or a LAM hovered). Needed to track state in case movement is continued from an interruption, so that the unit does not have a minimum movement for the turn.
      Returns:
      whether a WiGE lifted off during this turn's movement
    • setWigeLiftoffHover

      public void setWigeLiftoffHover(boolean lifted)
    • setHardenedArmorDamaged

      public void setHardenedArmorDamaged(HitData hit, boolean damaged)
    • isHardenedArmorDamaged

      public boolean isHardenedArmorDamaged(HitData hit)
      do we have a half-hit hardened armor point in the location struck by this?
      Parameters:
      hit -
      Returns:
    • setLocationBlownOff

      public void setLocationBlownOff(int loc, boolean damaged)
    • isLocationBlownOff

      public boolean isLocationBlownOff(int loc)
    • setLocationBlownOffThisPhase

      public void setLocationBlownOffThisPhase(int loc, boolean damaged)
      Marks the location as blown off in the current phase. This should be called together with setLocationBlownOff(int, boolean) whenever a location gets blown off during play, to allow relevant methods (notably isLocationBad(int)) to distinguish between fresh and preexisting damage. A location's "newly blown off" status resets with the next call to applyDamage().
      Parameters:
      loc - Subclass-dependent code for the location.
      damaged - The location's "recently blown off" status.
    • isLocationBlownOffThisPhase

      public boolean isLocationBlownOffThisPhase(int loc)
      Has the indicated location been blown off this phase (as opposed to either earlier or not at all)?
      Parameters:
      loc - Subclass-dependent code for the location.
      Returns:
      The locations "recently blown off" status.
    • hasPatchworkArmor

      public boolean hasPatchworkArmor()
      Returns:
      True if this unit has patchwork armor.
    • hasHardenedArmor

      public boolean hasHardenedArmor()
    • getMASCTurns

      public int getMASCTurns()
      Get the number of turns MASC has been used continuously.

      This method should only be used during serialization.

      Returns:
      the int number of turns MASC has been used.
    • isMASCUsed

      public boolean isMASCUsed()
      Determine if MASC has been used this turn.
      Returns:
      true if MASC has been used.
    • getSuperchargerTurns

      public int getSuperchargerTurns()
      Get the number of turns Supercharger has been used continuously.

      This method should only be used during serialization.

      Returns:
      the int number of turns Supercharger has been used.
    • isSuperchargerUsed

      public boolean isSuperchargerUsed()
      Determine if Supercharger has been used this turn.
      Returns:
      true if Supercharger has been used.
    • incrementMASCAndSuperchargerLevels

      protected void incrementMASCAndSuperchargerLevels()
    • setMASCUsed

      public void setMASCUsed(boolean used)
      Set whether MASC has been used.

      This method should only be used during deserialization.

      Parameters:
      used - The boolean whether MASC has been used.
    • getMASCTarget

      public int getMASCTarget()
    • setSuperchargerUsed

      public void setSuperchargerUsed(boolean used)
      Set whether Supercharger has been used.

      This method should only be used during deserialization.

      Parameters:
      used - The boolean whether Supercharger has been used.
    • getSuperchargerTarget

      public int getSuperchargerTarget()
    • checkForMASCFailure

      public boolean checkForMASCFailure(MovePath md, Vector<Report> vDesc, HashMap<Integer,List<CriticalSlot>> vCriticalSlots)
      This function checks for masc failure.
      Parameters:
      md - the movement path.
      vDesc - the description off the masc failure. used as output.
      vCriticalSlots - contains tuple of integer and critical slot. used as output.
      Returns:
      true if there was a masc failure.
    • checkForSuperchargerFailure

      public boolean checkForSuperchargerFailure(MovePath md, Vector<Report> vDesc, HashMap<Integer,List<CriticalSlot>> vCriticalSlots)
      This function checks for Supercharger failure.
      Parameters:
      md - the movement path.
      vDesc - the description off the Supercharger failure. used as output.
      vCriticalSlots - contains tuple of integer and critical slot. used as output.
      Returns:
      true if there was a Supercharger failure.
    • getMASC

      @Nullable public MiscMounted getMASC()
      Returns:
      non-supercharger MASC mounted on this entity
    • getSuperCharger

      public MiscMounted getSuperCharger()
      Returns:
      An operable Supercharger if there is one on this unit.
    • getBoobyTrap

      @Nullable public MiscMounted getBoobyTrap()
      Returns:
      an operable Booby Trap if there is one on this unit.
    • hasBoobyTrap

      public boolean hasBoobyTrap()
    • getBoobyTrapDamage

      public int getBoobyTrapDamage()
    • getEngineHits

      public abstract int getEngineHits()
    • damagedJumpJets

      public int damagedJumpJets()
      Returns the number of destroyed jump jets.
    • getLocationDamage

      public abstract String getLocationDamage(int loc)
    • canEscape

      public boolean canEscape()
      Returns:
      true if this unit can reasonably escape from the board. It can be used to determine whether some non-destroyed units should be considered possible salvage.
    • isCrippled

      public abstract boolean isCrippled()
      Returns TRUE if the entity meets the requirements for crippling damage as detailed in TW pg 258.
      Returns:
      boolean
    • isCrippled

      public abstract boolean isCrippled(boolean checkCrew)
      Returns TRUE if the entity meets the requirements for crippling damage as detailed in TW pg 258. Excepting dead or non-existing crew issues
      Returns:
      boolean
    • isDmgHeavy

      public abstract boolean isDmgHeavy()
      Returns TRUE if the entity has been heavily damaged.
      Returns:
      boolean
    • isDmgModerate

      public abstract boolean isDmgModerate()
      Returns TRUE if the entity has been moderately damaged.
      Returns:
      boolean
    • isDmgLight

      public abstract boolean isDmgLight()
      Returns TRUE if the entity has been lightly damaged.
      Returns:
      boolean
    • getDamageLevel

      public int getDamageLevel()
      Returns the entity's current damage level.
      Returns:
      DMG_CRIPPLED, DMG_HEAVY, DMG_MODERATE, DMG_LIGHT or DMG_NONE.
    • getDamageLevel

      public int getDamageLevel(boolean checkCrew)
      Returns the entity's current damage level.
      Returns:
      DMG_CRIPPLED, DMG_HEAVY, DMG_MODERATE, DMG_LIGHT or DMG_NONE.
    • setC3UUID

      public void setC3UUID()
    • setC3UUIDAsString

      public void setC3UUIDAsString(String c3id)
    • getC3UUIDAsString

      public String getC3UUIDAsString()
    • setC3MasterIsUUIDAsString

      public void setC3MasterIsUUIDAsString(String c3id)
    • getC3MasterIsUUIDAsString

      public String getC3MasterIsUUIDAsString()
    • setC3iNextUUIDAsString

      public void setC3iNextUUIDAsString(int pos, String c3id)
    • getC3iNextUUIDAsString

      public String getC3iNextUUIDAsString(int pos)
    • getFreeC3iUUID

      public int getFreeC3iUUID()
    • setNC3NextUUIDAsString

      public void setNC3NextUUIDAsString(int pos, String c3id)
    • getNC3NextUUIDAsString

      public String getNC3NextUUIDAsString(int pos)
    • getFreeNC3UUID

      public int getFreeNC3UUID()
    • isC3CompanyCommander

      public boolean isC3CompanyCommander()
    • isC3IndependentMaster

      public boolean isC3IndependentMaster()
    • wasStruck

      public boolean wasStruck()
      Returns:
      True if a unit was physically struck (punch, kick, DFA, etc).
    • setStruck

      public void setStruck(boolean struck)
      Sets if a unit was physically struck (punch, kick, DFA, etc).
    • hasFallen

      public boolean hasFallen()
      Returns:
      True if a unit has fallen in the current phase.
    • setFallen

      public void setFallen(boolean fell)
      Sets if the unit has fallen in the current phase.
      Parameters:
      fell - True if the unit should be considered to have fallen this phase
    • getAlternateCost

      public double getAlternateCost()
      Returns:
      An alternative cost that will be added to the MekSummaryCache - at the moment it is primarily used to rework infantry costs for MekHQ, but it could be applied to other unit types as well - defaults to -1, so there is no confusion.
    • isTrapped

      public boolean isTrapped()
      Are we trapped inside of a destroyed transport? If so we shouldn't count for BV, which is why we have this check.
    • getCamouflage

      public Camouflage getCamouflage()
    • getCamouflageOrElseOwners

      public Camouflage getCamouflageOrElseOwners()
    • getCamouflageOrElse

      public Camouflage getCamouflageOrElse(Camouflage camouflage)
    • getCamouflageOrElse

      public Camouflage getCamouflageOrElse(Camouflage camouflage, boolean checkForces)
    • setCamouflage

      public void setCamouflage(Camouflage camouflage)
    • isBoobyTrapInitiated

      public boolean isBoobyTrapInitiated()
    • setBoobyTrapInitiated

      public void setBoobyTrapInitiated(boolean boobyTrapInitiated)
    • getSelfDestructing

      public boolean getSelfDestructing()
    • setSelfDestructing

      public void setSelfDestructing(boolean selfDestructing)
    • getSelfDestructInitiated

      public boolean getSelfDestructInitiated()
    • setSelfDestructInitiated

      public void setSelfDestructInitiated(boolean tf)
    • getSelfDestructedThisTurn

      public boolean getSelfDestructedThisTurn()
    • setSelfDestructedThisTurn

      public void setSelfDestructedThisTurn(boolean tf)
    • setIsJumpingNow

      public void setIsJumpingNow(boolean jumped)
    • getIsJumpingNow

      public boolean getIsJumpingNow()
    • setConvertingNow

      public void setConvertingNow(boolean converting)
    • isConvertingNow

      public boolean isConvertingNow()
    • getConversionMode

      public int getConversionMode()
    • setConversionMode

      public void setConversionMode(int mode)
      Sets the unit to be in the given mode.
      Parameters:
      mode - The new mode
    • nextConversionMode

      public EntityMovementMode nextConversionMode(EntityMovementMode afterMode)
      Entities that can convert movement modes (LAMs, QuadVees) report the next mode to assume when a convert movement command is processed. This provides a set order for cycling through available modes.
      Parameters:
      afterMode - The movement mode to convert from.
      Returns:
      The next movement mode in the sequence.
    • toggleConversionMode

      public void toggleConversionMode()
      Sets the movement mode to the next in the conversion sequence for QuadVees, LAMs, and Meks with tracks. In most cases this switches between two available modes, but LAMs that start the turn in AirMek mode have three available.
    • canFall

      public boolean canFall(boolean gyroLegDamage)
      Only applicable to Meks, but here for convenience. Meks that are already prone, or QuadVees and LAMs in non-leg mode are not subject to PSRs for falling. Note that PSRs are sometimes required for other reasons.
      Parameters:
      gyroLegDamage - Whether the potential fall is due to damage to gyro or leg actuators, in which case Meks using tracks are not subject to falls.
      Returns:
      Whether the Entity is required to make PSRs to avoid falling.
    • canFall

      public boolean canFall()
      Only applicable to Meks, but here for convenience. Meks that are already prone, or QuadVees and LAMs in fighter mode are not subject to PSRs for falling. Note that PSRs are sometimes required for other reasons.
      Returns:
      Whether the Entity is required to make PSRs to avoid falling.
    • setTraitorId

      public void setTraitorId(int id)
    • getTraitorId

      public int getTraitorId()
    • sideTableRam

      public int sideTableRam(Coords src)
      Used to determine net velocity of ramming attack
    • sideTableRam

      public int sideTableRam(Coords src, int facing)
    • setArmorTonnage

      public void setArmorTonnage(double ton)
    • getLabArmorTonnage

      public double getLabArmorTonnage()
    • getLabTotalArmorPoints

      public int getLabTotalArmorPoints()
    • loadDefaultCustomWeaponOrder

      public void loadDefaultCustomWeaponOrder()
    • loadQuirks

      public void loadQuirks(List<QuirkEntry> quirks)
    • getEquipmentForWeaponQuirk

      protected Mounted<?> getEquipmentForWeaponQuirk(QuirkEntry quirkEntry)
      Returns the Mounted that is referred to by the quirkEntry (which must be a weapon quirk). FIXME: This is very specialized code that is only needed because we need to identify a weapon in the blk/mtf file. It might be better to write the weapon quirk directly to the weapon, removing the need to find it. Note the override in ProtoMek that doesnt use critical slots. For meks, this is challenge as the specific weapon in a location must still be addressed.
      Parameters:
      quirkEntry - The weapon quirk entry
      Returns:
      The Mounted at the specified location
    • assignWeaponQuirk

      protected void assignWeaponQuirk(QuirkEntry quirkEntry)
    • newPhase

      public void newPhase(GamePhase phase)
      Specified by:
      newPhase in interface PhaseUpdated
    • isUnderwater

      public boolean isUnderwater()
      Returns:
      True if this entity is completely submerged.
    • hasOccupiedHex

      public boolean hasOccupiedHex()
      Returns:
      True if this entity has a non-null occupied hex, i.e. it has a game, a position, a board etc.
    • getTechLevelYear

      public int getTechLevelYear()
    • getTargetBay

      public int getTargetBay()
    • setTargetBay

      public void setTargetBay(int tb)
    • getEntityType

      public abstract long getEntityType()
    • hasETypeFlag

      public boolean hasETypeFlag(long flag)
      Convenience method that checks whether a bit is set in the entity type field.
      Parameters:
      flag - An ETYPE_* value
      Returns:
      true if getEntityType() has the flag set
    • getEntityMajorTypeName

      public static String getEntityMajorTypeName(long typeId)
      Given an Entity type, return the name of the major class it belongs to (eg: Mek, Aero, Tank, Infantry).
      Parameters:
      typeId - The type Id to get a major name for
      Returns:
      The major class name for the given type id
    • getEntityTypeName

      public static String getEntityTypeName(long typeId)
      Returns the specific entity type name for the given type id (eg: Biped Mek, Conventional Fighter, VTOL).
      Parameters:
      typeId - The ETYPE_* type
      Returns:
      A String representation of the given type
    • damageSystem

      public void damageSystem(int type, int slot, int hits)
    • damageSystem

      public int damageSystem(int type, int slot, int loc, int hits)
    • isEjectionPossible

      public boolean isEjectionPossible()
    • getAllowedPhysicalAttacks

      public int getAllowedPhysicalAttacks()
    • getMaxWeaponRange

      public int getMaxWeaponRange()
      The max weapons range of this entity, taking into account whether we're on an air/space map, using extreme range. Assumes target is not airborne if we are on a ground map.
      Returns:
      The maximum weapon range of weapons on this unit
    • getMaxWeaponRange

      public int getMaxWeaponRange(boolean targetIsAirborne)
      The max weapons range of this entity, taking into account whether we're on an air/space map, using extreme range, and whether the target is airborne.
      Parameters:
      targetIsAirborne - True to assume the target is airborne
      Returns:
      The maximum weapon range of weapons on this unit
    • getHeat

      public int getHeat()
    • getTsempHitsThisTurn

      public int getTsempHitsThisTurn()
    • addTsempHitThisTurn

      public void addTsempHitThisTurn()
    • getTsempEffect

      public int getTsempEffect()
    • setTsempEffect

      public void setTsempEffect(int tsempEffect)
    • isFiredTsempThisTurn

      public boolean isFiredTsempThisTurn()
    • setFiredTsempThisTurn

      public void setFiredTsempThisTurn(boolean firedTsempThisTurn)
    • hasFiredTsemp

      public boolean hasFiredTsemp()
    • setHasFiredTsemp

      public void setHasFiredTsemp(boolean hasFiredTSEMP)
    • setASEWAffected

      public void setASEWAffected(int turns)
      Sets the number of rounds that the entity is affected by an ASEW missile
      Parameters:
      turns - - integer specifying the number of end phases that the effects last through Technically, about 1.5 turns elapse per the rules for ASEW missiles in TO
    • getASEWAffected

      public int getASEWAffected()
      Returns:
      the number of rounds that the entity is affected by an ASEW missile
    • hasActivatedRadicalHS

      public boolean hasActivatedRadicalHS()
    • deactivateRadicalHS

      public void deactivateRadicalHS()
    • getConsecutiveRHSUses

      public int getConsecutiveRHSUses()
    • setConsecutiveRHSUses

      public void setConsecutiveRHSUses(int consecutiveRHSUses)
    • hasDamagedRHS

      public boolean hasDamagedRHS()
    • setHasDamagedRHS

      public void setHasDamagedRHS(boolean hasDamagedRHS)
    • addAttackedByThisTurn

      public void addAttackedByThisTurn(int entityId)
    • addGroundAttackedByThisTurn

      public void addGroundAttackedByThisTurn(int entityId)
    • clearAttackedByThisTurn

      public void clearAttackedByThisTurn()
    • getAttackedByThisTurn

      public Collection<Integer> getAttackedByThisTurn()
    • getGroundAttackedByThisTurn

      public Collection<Integer> getGroundAttackedByThisTurn()
    • getWeaponSortOrder

      public WeaponSortOrder getWeaponSortOrder()
    • setWeaponSortOrder

      public void setWeaponSortOrder(WeaponSortOrder weaponSortOrder)
    • getCustomWeaponOrder

      public Map<Integer,Integer> getCustomWeaponOrder()
    • setCustomWeaponOrder

      public void setCustomWeaponOrder(Map<Integer,Integer> customWeaponOrder)
    • getCustomWeaponOrder

      public int getCustomWeaponOrder(WeaponMounted weapon)
    • setCustomWeaponOrder

      public void setCustomWeaponOrder(WeaponMounted weapon, int order)
    • isWeapOrderChanged

      public boolean isWeapOrderChanged()
    • setWeapOrderChanged

      public void setWeapOrderChanged(boolean weaponOrderChanged)
    • getMpUsedLastRound

      public int getMpUsedLastRound()
    • isPrimitive

      public boolean isPrimitive()
      Returns:
      Whether the unit uses primitive or retro tech construction rules
    • getStructuralTechRating

      public ITechnology.TechRating getStructuralTechRating()
    • setStructuralTechRating

      public void setStructuralTechRating(ITechnology.TechRating structuralTechRating)
    • setStructuralTechRating

      public void setStructuralTechRating(int structuralTechRating)
    • getBaseEngineValue

      public double getBaseEngineValue()
      Returns:
      the base engine value for support vehicles, see TM pg 120. Non-support vehicle entities will return 0.
    • getBaseChassisValue

      public double getBaseChassisValue()
      Returns:
      the base chassis value for support vehicles, see TM pg 120. Non-support vehicle entities will return 0.
    • getArmorTechRating

      public ITechnology.TechRating getArmorTechRating()
    • setArmorTechRating

      public void setArmorTechRating(ITechnology.TechRating armorTechRating)
    • setArmorTechRating

      public void setArmorTechRating(int armorTechRating)
    • getEngineTechRating

      public ITechnology.TechRating getEngineTechRating()
    • setEngineTechRating

      public void setEngineTechRating(ITechnology.TechRating engineTechRating)
    • setEngineTechRating

      public void setEngineTechRating(int engineTechRating)
    • getBaseChassisFireConWeight

      public double getBaseChassisFireConWeight()
      Used by omni support vehicles to track the weight of fire control systems. This limits the tonnage that can be devoted to weapons in pods.
      Returns:
      The fixed weight of fire control systems.
    • setBaseChassisFireConWeight

      public void setBaseChassisFireConWeight(double weight)
      Used by omni support vehicles to set the weight of fixed fire control systems in the base chassis.
      Parameters:
      weight - The weight of fixed fire control systems.
    • getOriginalBuildYear

      public int getOriginalBuildYear()
      Units with construction data that varies by year (such as engine and control system weight for some primitive aerospace units) require tracking the original build year separately from the intro year for the model to account for refits that don't affect the core components.
      Returns:
      The year to use for core component construction data.
    • setOriginalBuildYear

      public void setOriginalBuildYear(int year)
    • getSubEntities

      public List<Entity> getSubEntities()
      This method (and getActiveSubEntities()) is meant for groups of entities handled as a singular one. Examples include fighter squadrons on space maps or lances in BattleForce game modes.

      To check if a given entity consists of multiple sub-entities, use

       if (entity.getSubEntities().isPresent()) {
           ...
       }
       

      To iterate over entities (if present), use:

       entity.getSubEntities().ifPresent(entities -> entities.forEach(
           subEntity -> {
               ...
           });
       
      Returns:
      an optional collection of sub-entities, if this entity is considered a grouping of them.
    • getActiveSubEntities

      public List<Entity> getActiveSubEntities()
      A list of all active sub-entities. In most cases, this is simply an empty list.
      Returns:
      an optional collection of sub-entities, if this entity is considered a grouping of them, pre-filtered to only contain active (non-destroyed and non-doomed) entities.
    • getSpriteDrawPriority

      public int getSpriteDrawPriority()
      Used to determine the draw priority of different Entity subclasses. This allows different unit types to always be draw above/below other types.
    • getTilesetModeString

      public String getTilesetModeString()
      Entities that use different sprites for different modes should override this
      Returns:
      a code identifying the mode, or an empty string for the default sprite
    • isTrailer

      public boolean isTrailer()
      Used to determine if this vehicle can be towed by a tractor
    • isTractor

      public boolean isTractor()
      Used to determine if this vehicle can be the engine/tractor for a bunch of trailers
    • getHitchLocations

      public Set<Coords> getHitchLocations()
      Returns:
      A Set of Coords that need to be checked for entities that can be towed. This accounts for the hexes occupied by each entity in the 'train', plus hexes in front of or behind each trailer hitch.
    • getHitchCarrying

      public TankTrailerHitch getHitchCarrying(int id)
      Finds the trailer hitch transporter that is carrying a given entityId Hitches move around in Transports on loading a saved game
      Parameters:
      id - - the id of the loaded Entity we're trying to find
      Returns:
      the TankTrailerHitch corresponding to the passed-in value
    • canTow

      public boolean canTow(int trailerId)
      Determines if this vehicle is currently able to tow designated trailer.
      Parameters:
      trailerId - - the ID of the Entity to be towed.
      Returns:
      true if the trailer can be towed, false otherwise.
    • getTowing

      public int getTowing()
      Returns:
      the entity to be towed
    • setTowing

      public void setTowing(int id)
      Change the towed status of this entity
      Parameters:
      id - - the ID of the entity being towed
    • getTractor

      public int getTractor()
      Returns:
      the tractor towing the train this entity is part of
    • setTractor

      public void setTractor(int id)
      Sets the tractor towing the train this entity is part of
      Parameters:
      id - - id of the tractor towing this train
    • getTowedBy

      public int getTowedBy()
      Returns:
      the Entity that is directly towing this one
    • setTowedBy

      public void setTowedBy(int id)
      Sets the Entity that is directly towing this one
      Parameters:
      id - - the id of the Entity towing this trailer
    • getConnectedUnits

      public List<Integer> getConnectedUnits()
      Returns:
      the entities towed behind this entity
    • towUnit

      public void towUnit(int id)
      Attaches a trailer to this train
      Parameters:
      id - - if of the entity to be added to this train
    • disconnectUnit

      public void disconnectUnit(int id)
      Detaches an entity from this entity's towing mechanism also detaches all trailers behind this one from the whole train
      Parameters:
      id - - the id of entity to be detached
    • getAllTowedUnits

      public List<Integer> getAllTowedUnits()
      Returns:
      a list of all entities towed behind this tractor.
    • addTowedUnit

      public void addTowedUnit(int id)
      Adds an entity to this tractor's train
    • removeTowedUnit

      public void removeTowedUnit(int id)
      Removes an entity from this tractor's train
    • getLoadedTrailers

      public List<Entity> getLoadedTrailers()
      Get a List of the trailers currently loaded into this payload.
      Returns:
      A List of loaded Entity units. This list will never be null, but it may be empty. The returned List is independent from the under- lying data structure; modifying one does not affect the other.

      This will only return loaded trailers

    • isWeaponBlockedByTowing

      public boolean isWeaponBlockedByTowing(int loc, int secondaryFacing, boolean isRear)
      Determine if a connected tractor/trailer prevents a weapon in the given location from firing.
      Parameters:
      loc - - the int location attempting to fire.
      secondaryFacing - - the int direction the turret is facing if the weapon is mounted there.
      isRear - - a boolean value stating if the given location is rear facing; if false, the location is front facing.
      Returns:
      true if a tractor/trailer unit is in the way, false if the weapon can fire.
    • hasAbility

      public boolean hasAbility(String name)
      determine if an entity has an ability that is identified by its presence or absence only. The entity may gain this ability from different places, not exclusively the crew.
      Parameters:
      name - - name of the ability as recorded in the options
      Returns:
      true if the entity has this ability from some source
    • hasAbility

      public boolean hasAbility(String name, String choice)
      determine if an entity has an ability at a given level. The entity may gain this ability from different places, not exclusively the crew.
      Parameters:
      name - - name of the ability as recorded in the options me
      choice - - A string indicating the given level being asked about
      Returns:
      true if the entity has this ability at the given choice from some source
    • modifyPhysicalDamageForMeleeSpecialist

      public int modifyPhysicalDamageForMeleeSpecialist()
    • getSensorContacts

      public Set<Integer> getSensorContacts()
      Retrieves the IDs of all entities that this entity has detected with sensors
      Returns:
      the contents of this entity's sensorContacts set
    • hasSensorContactFor

      public boolean hasSensorContactFor(int targetId)
      Checks the sensorContacts set for a specific target's ID number
      Parameters:
      targetId - the ID number of the target entity to check for
      Returns:
      true if the entity's sensorContacts set contains the passed-in target ID
    • addSensorContact

      public void addSensorContact(int targetId)
      Adds the specified target entity's ID to this entity's sensorContacts
      Parameters:
      targetId - the ID number of the target entity to add
    • removeSensorContact

      public void removeSensorContact(Collection<Integer> targetIds)
      Removes the specified target entity's ID from this entity's sensorContacts
      Parameters:
      targetIds - the ID number of the target entity to remove
    • clearSensorContacts

      public void clearSensorContacts()
      Empties this entity's sensorContacts Used when it dies or moves offboard
    • getFiringSolutions

      public Set<Integer> getFiringSolutions()
      Retrieves the IDs of all entities that this entity has established firing solutions on
      Returns:
      the contents of this entity's firingSolutions set
    • hasFiringSolutionFor

      public boolean hasFiringSolutionFor(int targetId)
      Checks the firingSolutions set for a specific target's ID number
      Parameters:
      targetId - the ID number of the target entity to check for
      Returns:
      true if the entity's firingSolutions set contains the passed-in target ID
    • addFiringSolution

      public void addFiringSolution(int targetId)
      Adds the specified target entity's ID to this entity's firingSolutions
      Parameters:
      targetId - the ID number of the target entity to add
    • removeFiringSolution

      public void removeFiringSolution(Collection<Integer> targetIds)
      Removes the specified target entity's ID from this entity's firingSolutions
      Parameters:
      targetIds - the ID number of the target entity to remove
    • clearFiringSolutions

      public void clearFiringSolutions()
      Empties this entity's firingSolutions Used when it dies or moves offboard
    • addOffBoardObserver

      public void addOffBoardObserver(int teamID)
      Indicate that an off-board artillery attack by this entity has been observed by a particular team
    • isOffBoardObserved

      public boolean isOffBoardObserved(int teamID)
      Has the given team observed an off-board artillery attack by this entity?
    • getForceString

      public String getForceString()
      Description copied from interface: ForceAssignable
      Returns a String representation of the force hierarchy this entity belongs to. The String contains all forces from top to bottom separated by backslash with no backslash at beginning or end. Each force is followed by a unique id separated by the vertical bar. E.g.

      Regiment|1||Battalion B|11||Alpha Company|18||Battle Lance II|112

      If this is not empty, the server will attempt to reconstruct the force hierarchy when it receives this entity and will empty the string. This should be used for loading/saving MULs or transfer from other sources that don't have access to the current MM game's forces, such as MekHQ or the Force Generators. At all other times, forceId should be used instead and this should return an empty string.
      Specified by:
      getForceString in interface ForceAssignable
      Returns:
      The string representation of this ForceAssignable's force
    • setForceString

      public void setForceString(String f)
      Description copied from interface: ForceAssignable
      Sets the force string, see ForceAssignable.getForceString().
      Specified by:
      setForceString in interface ForceAssignable
      Parameters:
      f - The new force string
    • getForceId

      public int getForceId()
      Specified by:
      getForceId in interface ForceAssignable
      Returns:
      The unique id of the force this ForceAssignable belongs to.
    • setForceId

      public void setForceId(int newId)
      Description copied from interface: ForceAssignable
      Sets the unique id of the force this ForceAssignable belongs to.
      Specified by:
      setForceId in interface ForceAssignable
      Parameters:
      newId - the id of the new force to assign this ForceAssignable to.
    • setBloodStalkerTarget

      public void setBloodStalkerTarget(int value)
    • getStartingOffset

      public int getStartingOffset()
    • getStartingOffset

      public int getStartingOffset(boolean inheritFromOwner)
    • setStartingOffset

      public void setStartingOffset(int startingOffset)
    • getStartingWidth

      public int getStartingWidth()
    • getStartingWidth

      public int getStartingWidth(boolean inheritFromOwner)
    • setStartingWidth

      public void setStartingWidth(int startingWidth)
    • getStartingAnyNWx

      public int getStartingAnyNWx()
    • getStartingAnyNWx

      public int getStartingAnyNWx(boolean inheritFromOwner)
    • setStartingAnyNWx

      public void setStartingAnyNWx(int i)
    • getStartingAnyNWy

      public int getStartingAnyNWy()
    • getStartingAnyNWy

      public int getStartingAnyNWy(boolean inheritFromOwner)
    • setStartingAnyNWy

      public void setStartingAnyNWy(int i)
    • getStartingAnySEx

      public int getStartingAnySEx()
    • getStartingAnySEx

      public int getStartingAnySEx(boolean inheritFromOwner)
    • setStartingAnySEx

      public void setStartingAnySEx(int i)
    • getStartingAnySEy

      public int getStartingAnySEy()
    • getStartingAnySEy

      public int getStartingAnySEy(boolean inheritFromOwner)
    • setStartingAnySEy

      public void setStartingAnySEy(int i)
    • getBloodStalkerTarget

      public int getBloodStalkerTarget()
    • canActivateBloodStalker

      public boolean canActivateBloodStalker()
      Whether this entity can activate the "blood stalker" ability
    • braceLocation

      public int braceLocation()
    • setBraceLocation

      public void setBraceLocation(int location)
    • isBracing

      public boolean isBracing()
      Specified by:
      isBracing in interface Targetable
    • canBrace

      public boolean canBrace()
    • getBraceMPCost

      public int getBraceMPCost()
    • getValidBraceLocations

      public List<Integer> getValidBraceLocations()
    • getMPBoosters

      public MPBoosters getMPBoosters()
      Returns:
      does this Mek have MASC, Supercharger or both?
    • getArmedMPBoosters

      public MPBoosters getArmedMPBoosters()
      Returns:
      does this Mek have Armed MASC, Supercharger or both?
    • getMPBoosters

      public MPBoosters getMPBoosters(boolean onlyArmed)
      Returns:
      if this Mek has MASC, Supercharger or both?
    • getMulId

      public int getMulId()
      Returns this entity's MUL ID linking it to a unit on the online Master Unit List. Use hasMulID() to check if the entity has a valid MUL ID.
    • setMulId

      public void setMulId(int newId)
    • hasMulId

      public boolean hasMulId()
      Returns true when this entity has a useful MUL ID, meaning it is a unit from an official source and can be linked to a unit on the online Master Unit List.
    • addClanCase

      public void addClanCase()
      For clan units that get automatic Clan CASE, adds clan CASE in every location that has potentially explosive equipment (this includes uncharged PPC Capacitors).

      As clan CASE does not need critical slots, this method does not perform checks whether other CASE types are already present on a location.

      This method does nothing by default and must be overridden for unit types that get Clan CASE.

    • getsAutoExternalSearchlight

      public boolean getsAutoExternalSearchlight()
      Returns:
      True for unit types that have an automatic external searchlight (Meks and Tanks).
    • getStrength

      public int getStrength()
      Description copied from interface: InGameObject
      Returns the current (remaining) battle strength of this unit or object. For combat units, this is the battle value (BV) or the point value (PV).
      Specified by:
      getStrength in interface InGameObject
      Returns:
      The current battle strength (BV/PV)
    • getBvCalculator

      public BVCalculator getBvCalculator()
      Returns:
      The persistent BV Calculator object for this entity.
    • gameOptions

      protected final IGameOptions gameOptions()
      Returns the GameOptions of this Entity's game if it has one. If game is null (happens in unit construction in MML), a new (default) options object is returned. Prefer this method over directly calling game.getOptions() to avoid NPEs in places where game is null.
      Returns:
      The GameOptions of this Entity's game if it has one, otherwise a default options object.
    • setUnitRole

      public void setUnitRole(UnitRole role)
    • getRole

      public UnitRole getRole()
      Specified by:
      getRole in interface CombatRole
      Returns:
      The battlefield role (UnitRole) of this combat unit.
    • slotNumber

      public int slotNumber(Mounted<?> mounted)
      Returns the slot in which the given mounted equipment is in its main location. Returns -1 when the mounted is not in a valid location or cannot be found.
      Parameters:
      mounted - the equipment to look for
      Returns:
      the (first) slot number that holds the mounted or -1 if none can be found
    • getFluffImage

      @Nullable public Image getFluffImage()
      Description copied from interface: BTObject
      Returns a fluff image for this unit or object to be shown e.g. in the unit summary. Important: This method returns only a fluff image that is stored in the object itself, e.g. if it was part of the unit's file or is created by the unit itself. It does not search for fluff images in the fluff images directories. For GUI, use FluffImageHelper.getFluffImage(BTObject) instead; that method will retrieve either a unit's own fluff image or an image from the fluff images directories (if there is one). The default implementation returns null. For canon units, this will return null, as they do not store fluff images in the unit files.
      Specified by:
      getFluffImage in interface BTObject
      Returns:
      A fluff image for this object/unit if it contains one as part of the object/unit
    • generalName

      public String generalName()
      Description copied from interface: BTObject
      Returns the general name or type name of this unit/object. For standard individual units, this is the chassis. For other types of units or objects this can be the full designation or a general part of the designation. Much like the chassis, this can be much more narrow than the general type of unit ("Mek"). The general name should not be empty and not return null. Return the chassis in Entity and AlphaStrikeElement.
      Specified by:
      generalName in interface BTObject
      Returns:
      The general name / chassis
    • specificName

      public String specificName()
      Description copied from interface: BTObject
      Returns the specific name or type name of this unit/object. For standard individual units, this is the model. For other types of units or objects this can be a part of the designation, or empty. The specific name should not return null. Return the model in Entity and AlphaStrikeElement.
      Specified by:
      specificName in interface BTObject
      Returns:
      The specific name / model
    • getIcon

      public Image getIcon()
      Description copied from interface: BTObject
      Returns an icon for this unit or object for the game board. Note that this is the 84 x 72 standard size icon; icons for landed large craft are not handled by this method. Important: This method returns only an icon that is stored in the object itself, e.g. if it was part of the unit's file or is created by the unit itself. It does not search for the icon through the mekset. The default implementation returns null. For canon units, this will return null, as they do not store icon images in the unit files.
      Specified by:
      getIcon in interface BTObject
      Returns:
      An icon for this object/unit if it contains one as part of the object/unit
    • setIcon

      public void setIcon(String icon64)
      Sets the embedded icon for this unit to the given base64 string.
    • hasEmbeddedIcon

      public boolean hasEmbeddedIcon()
      Returns true when this unit has an embedded icon, i.e. an icon stored in the unit file rather than found by the MekSet. Currently, returns false when a mode-specific icon is needed (LAMs/QVs)
      Returns:
      True when this unit has an embedded icon
    • getBase64Icon

      public Base64Image getBase64Icon()
      Returns:
      The embedded icon of this unit in the full Base64Image form.
    • countForStrengthSum

      public boolean countForStrengthSum()
      Description copied from interface: InGameObject
      Returns true when the current (remaining) battle strength of this unit/object should be counted for a strength sum, e.g. if it should count for the summed battle value of a player or team. This may be false when the unit is destroyed or trapped or otherwise permanently kept from acting or when it is part of a unit group and its strength will be counted through that unit group (e.g. FighterSquadrons). See InGameObject.getStrength().
      Specified by:
      countForStrengthSum in interface InGameObject
      Returns:
      True when the strength of this should be counted in a strength sum
    • shouldUseEdge

      public boolean shouldUseEdge(String option)
      Returns:
      True if the unit should use Edge based on the current options and assigned Edge points
    • hasFlotationHull

      public boolean hasFlotationHull()
    • hasFleeZone

      public boolean hasFleeZone()
      Specified by:
      hasFleeZone in interface Deployable
      Returns:
      True if this unit has its own area it is allowed to flee the board(s) from; false if the unit's owner should be asked instead.
    • getFleeZone

      public HexArea getFleeZone()
      Specified by:
      getFleeZone in interface Deployable
      Returns:
      The area of the board(s) this unit is allowed to flee from; the return value is only valid when Deployable.hasFleeZone() returns true. Normally this method should not be called, use AbstractGame.canFleeFrom(Deployable, Coords) instead.
      See Also:
    • setFleeZone

      public void setFleeZone(HexArea fleeZone)
      Sets the board area this unit may flee from. The area may be empty, in which case the unit may not flee. Also sets this unit to know that it has a flee zone and the owning player should not be asked to provide this information.
      Parameters:
      fleeZone - The new flee zone
    • setInvalidSourceBuildReasons

      public void setInvalidSourceBuildReasons(List<Entity.InvalidSourceBuildReason> invalidSourceBuildReasons)
    • getInvalidSourceBuildReasons

      public List<Entity.InvalidSourceBuildReason> getInvalidSourceBuildReasons()
    • canonUnitWithInvalidBuild

      public boolean canonUnitWithInvalidBuild()
    • isJumpingWithMechanicalBoosters

      public boolean isJumpingWithMechanicalBoosters()
    • setJumpingWithMechanicalBoosters

      public void setJumpingWithMechanicalBoosters(boolean jumpingWithMechanicalBoosters)
    • getBoardId

      public int getBoardId()
      Specified by:
      getBoardId in interface Deployable
      Specified by:
      getBoardId in interface Targetable
      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
    • setBoardId

      public void setBoardId(int boardId)
    • isInBuilding

      public boolean isInBuilding()
      Returns:
      True when this unit is inside of a building. Returns false when it does not have a game, is not on a board, its hex has no building or its elevation is below the basement or on or above the building.
    • isActiveOption

      protected boolean isActiveOption(String optionName)
      Returns true when this Entity's game is not null and the given boolean game option is active in the game. This is a convenience method to avoid NPEs.
      Parameters:
      optionName - The name of the game option, e.g. OptionsConstants.ADVAERORULES_STRATOPS_ECM
      Returns:
      True when the Entity is part of a game and the option is active in that game