Class Tank

All Implemented Interfaces:
Serializable, BTObject, CombatRole, Deployable, ForceAssignable, InGameObject, ITechnology, ITurnOrdered, PhaseUpdated, RoundUpdated, Targetable, Transporter
Direct Known Subclasses:
GunEmplacement, SuperHeavyTank, SupportTank, VTOL

public class Tank extends Entity
You know what tanks are, silly.
See Also:
  • Field Details

    • m_bHasNoTurret

      protected boolean m_bHasNoTurret
    • m_bTurretLocked

      protected boolean m_bTurretLocked
    • m_bTurretJammed

      protected boolean m_bTurretJammed
    • m_bTurretEverJammed

      protected boolean m_bTurretEverJammed
    • m_bHasNoDualTurret

      protected boolean m_bHasNoDualTurret
    • m_bDualTurretLocked

      protected boolean m_bDualTurretLocked
    • m_bDualTurretJammed

      protected boolean m_bDualTurretJammed
    • m_bDualTurretEverJammed

      protected boolean m_bDualTurretEverJammed
    • motivePenalty

      protected int motivePenalty
    • motiveDamage

      protected int motiveDamage
    • engineHit

      protected boolean engineHit
    • LOC_BODY

      public static final int LOC_BODY
      See Also:
    • LOC_FRONT

      public static final int LOC_FRONT
      See Also:
    • LOC_RIGHT

      public static final int LOC_RIGHT
      See Also:
    • LOC_LEFT

      public static final int LOC_LEFT
      See Also:
    • LOC_REAR

      public static final int LOC_REAR
      See Also:
    • LOC_TURRET

      public static final int LOC_TURRET
      for dual turret tanks, this is the rear turret
      See Also:
    • LOC_TURRET_2

      public static final int LOC_TURRET_2
      for dual turret tanks, this is the front turret
      See Also:
    • CRIT_NONE

      public static final int CRIT_NONE
      See Also:
    • CRIT_DRIVER

      public static final int CRIT_DRIVER
      See Also:
    • CRIT_WEAPON_JAM

      public static final int CRIT_WEAPON_JAM
      See Also:
    • CRIT_WEAPON_DESTROYED

      public static final int CRIT_WEAPON_DESTROYED
      See Also:
    • CRIT_STABILIZER

      public static final int CRIT_STABILIZER
      See Also:
    • CRIT_SENSOR

      public static final int CRIT_SENSOR
      See Also:
    • CRIT_COMMANDER

      public static final int CRIT_COMMANDER
      See Also:
    • CRIT_CREW_KILLED

      public static final int CRIT_CREW_KILLED
      See Also:
    • CRIT_CREW_STUNNED

      public static final int CRIT_CREW_STUNNED
      See Also:
    • CRIT_CARGO

      public static final int CRIT_CARGO
      See Also:
    • CRIT_ENGINE

      public static final int CRIT_ENGINE
      See Also:
    • CRIT_FUEL_TANK

      public static final int CRIT_FUEL_TANK
      See Also:
    • CRIT_AMMO

      public static final int CRIT_AMMO
      See Also:
    • CRIT_TURRET_JAM

      public static final int CRIT_TURRET_JAM
      See Also:
    • CRIT_TURRET_LOCK

      public static final int CRIT_TURRET_LOCK
      See Also:
    • CRIT_TURRET_DESTROYED

      public static final int CRIT_TURRET_DESTROYED
      See Also:
    • CRIT_SENSOR_MAX

      public static final int CRIT_SENSOR_MAX
      See Also:
    • DUG_IN_NONE

      public static final int DUG_IN_NONE
      See Also:
    • DUG_IN_FORTIFYING1

      public static final int DUG_IN_FORTIFYING1
      See Also:
    • DUG_IN_FORTIFYING2

      public static final int DUG_IN_FORTIFYING2
      See Also:
    • DUG_IN_FORTIFYING3

      public static final int DUG_IN_FORTIFYING3
      See Also:
    • SIDE_LOC_MAPPING

      protected static final Map<Integer,Integer> SIDE_LOC_MAPPING
    • hasSponsons

      protected boolean hasSponsons
    • hasPintle

      protected boolean hasPintle
    • BASE_CHASSIS_TURRET_WT_UNASSIGNED

      public static final int BASE_CHASSIS_TURRET_WT_UNASSIGNED
      Keeps track of the base weight of the turret for omni tanks.
      See Also:
  • Constructor Details

    • Tank

      public Tank()
  • Method Details

    • getUnitType

      public int getUnitType()
      Specified by:
      getUnitType in class Entity
      See Also:
    • getLocationAbbrs

      public String[] getLocationAbbrs()
      Specified by:
      getLocationAbbrs in class Entity
    • getLocationNames

      public String[] getLocationNames()
      Specified by:
      getLocationNames in class Entity
    • getLocTurret

      public int getLocTurret()
    • getLocTurret2

      public int getLocTurret2()
    • defaultCrewType

      public CrewType defaultCrewType()
      Overrides:
      defaultCrewType in class Entity
    • getPotCrit

      public int getPotCrit()
    • setPotCrit

      public void setPotCrit(int crit)
    • getOverThresh

      public boolean getOverThresh()
    • setOverThresh

      public void setOverThresh(boolean tf)
    • hasNoTurret

      public boolean hasNoTurret()
    • hasNoDualTurret

      public boolean hasNoDualTurret()
    • getTurretCount

      public int getTurretCount()
    • setHasNoTurret

      public void setHasNoTurret(boolean b)
    • setHasNoDualTurret

      public void setHasNoDualTurret(boolean b)
    • getMotiveDamage

      public int getMotiveDamage()
    • setMotiveDamage

      public void setMotiveDamage(int d)
    • getMotivePenalty

      public int getMotivePenalty()
    • setMotivePenalty

      public void setMotivePenalty(int p)
    • getConstructionTechAdvancement

      public TechAdvancement getConstructionTechAdvancement()
      Description copied from class: Entity
      return - the base construction option tech advancement
      Specified by:
      getConstructionTechAdvancement in class Entity
    • getDualTurretTA

      public static TechAdvancement getDualTurretTA()
    • addSystemTechAdvancement

      protected void addSystemTechAdvancement(CompositeTechLevel ctl)
      Description copied from class: Entity
      Incorporate dates for components that are not in the equipment list, such as engines and structure.
      Overrides:
      addSystemTechAdvancement in class Entity
    • getWalkMP

      public int getWalkMP(MPCalculationSetting mpCalculationSetting)
      Overrides:
      getWalkMP in class Entity
    • isEligibleForPavementOrRoadBonus

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

      public boolean isTurretLocked(int turret)
    • isTurretJammed

      public boolean isTurretJammed(int turret)
    • locations

      public int locations()
      Returns the number of locations in the entity
      Specified by:
      locations in class Entity
    • getBodyLocation

      public int getBodyLocation()
      Description copied from class: Entity
      Determines where to place equipment that does not require a specific location. What this means varies by Entity type.
      Overrides:
      getBodyLocation in class Entity
      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.
    • canChangeSecondaryFacing

      public boolean canChangeSecondaryFacing()
      Description copied from class: Entity
      Can this entity change secondary facing at all?
      Specified by:
      canChangeSecondaryFacing in class Entity
    • isValidSecondaryFacing

      public boolean isValidSecondaryFacing(int n)
      Description copied from class: Entity
      Can this entity torso/turret twist the given direction?
      Specified by:
      isValidSecondaryFacing in class Entity
    • clipSecondaryFacing

      public int clipSecondaryFacing(int n)
      Description copied from class: Entity
      Returns the closest valid secondary facing to the given direction.
      Specified by:
      clipSecondaryFacing in class Entity
      Returns:
      the closest valid secondary facing.
    • setSecondaryFacing

      public void setSecondaryFacing(int sec_facing)
      Overrides:
      setSecondaryFacing in class Entity
    • setFacing

      public void setFacing(int facing)
      Description copied from class: Entity
      Sets the primary facing.
      Overrides:
      setFacing in class Entity
    • getDualTurretFacing

      public int getDualTurretFacing()
    • setDualTurretOffset

      public void setDualTurretOffset(int offset)
    • isStabiliserHit

      public boolean isStabiliserHit(int loc)
    • setStabiliserHit

      public void setStabiliserHit(int loc)
    • clearStabiliserHit

      public void clearStabiliserHit(int loc)
    • getSensorHits

      public int getSensorHits()
    • setSensorHits

      public void setSensorHits(int hits)
    • isDriverHit

      public boolean isDriverHit()
    • setDriverHit

      public void setDriverHit(boolean hit)
    • isCommanderHit

      public boolean isCommanderHit()
    • setCommanderHit

      public void setCommanderHit(boolean hit)
    • isUsingConsoleCommander

      public boolean isUsingConsoleCommander()
    • setUsingConsoleCommander

      public void setUsingConsoleCommander(boolean b)
    • getExtraCrewSeats

      public int getExtraCrewSeats()
      Returns:
      Additional seats beyond the minimum crew requirements
    • setExtraCrewSeats

      public void setExtraCrewSeats(int seats)
    • isDriverHitPS

      public boolean isDriverHitPS()
    • setDriverHitPS

      public void setDriverHitPS(boolean hit)
    • isCommanderHitPS

      public boolean isCommanderHitPS()
    • setCommanderHitPS

      public void setCommanderHitPS(boolean hit)
    • isCrewHitPS

      public boolean isCrewHitPS()
    • setCrewHitPS

      public void setCrewHitPS(boolean hit)
    • isMovementHit

      public boolean isMovementHit()
      Determines whether the unit is considered to have suffered a movement hit.

      A unit is considered to have a movement hit if:

      • It is not a trailer (its original walking movement points is greater than 0), and
      • It is flagged as immobile, or
      • It is a VTOL unit and its rotor is destroyed, or
      • Its motive damage is greater than or equal to its original walking movement points.
      Returns:
      true if the unit qualifies as having a movement hit according to these criteria; false otherwise.
      See Also:
    • isMovementHitPending

      public boolean isMovementHitPending()
    • immobilize

      public void immobilize()
      Marks this tank for immobilization, most likely from a related motive system hit. To actually immobilize it, applyDamage() must also be invoked; until then, isMovementHitPending() will return true after this but neither isMovementHit() nor Entity.isImmobile() will have been updated yet (because the tank is technically not immobile just yet until damage is actually resolved).
    • isImmobile

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

      public boolean isPermanentlyImmobilized(boolean checkCrew)
      Whether this unit is irreversibly immobilized for the rest of the game. Tanks have some additional criteria.
      Overrides:
      isPermanentlyImmobilized in class Entity
      Returns:
      true if unit is permanently immobile
    • isImmobileForJump

      public boolean isImmobileForJump()
      Per https://bg.battletech.com/forums/index.php/topic,78336.msg1869386.html#msg1869386 CVs with working engines and Jump Jets should still have the option to jump during the movement phase, even if reduced to 0 MP by motive hits, or rolling 12 on the Motive System Damage table.
      Overrides:
      isImmobileForJump in class Entity
    • hasCommandConsoleBonus

      public boolean hasCommandConsoleBonus()
      Description copied from class: Entity
      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.
      Overrides:
      hasCommandConsoleBonus in class Entity
      Returns:
      Whether the Entity qualifies for initiative bonus from cockpit command console.
    • isLocationProhibited

      public boolean isLocationProhibited(Coords c, int testBoardId, int currElevation)
      Tanks have all sorts of prohibited terrain.
      Overrides:
      isLocationProhibited in class Entity
      Parameters:
      c - The position to test
      testBoardId - The board to test
      currElevation - The elevation or altitude to test
      Returns:
      True when the location is illegal to be in for this unit, regardless of elevation
      See Also:
    • isLocationProhibitedWiGE

      public boolean isLocationProhibitedWiGE(Coords c, int currElevation)
    • lockTurret

      public void lockTurret(int turret)
    • jamTurret

      public void jamTurret(int turret)
    • unjamTurret

      public void unjamTurret(int turret)
    • isTurretEverJammed

      public boolean isTurretEverJammed(int turret)
    • getStunnedTurns

      public int getStunnedTurns()
    • setStunnedTurns

      public void setStunnedTurns(int turns)
    • stunCrew

      public void stunCrew()
    • applyDamage

      public void applyDamage()
      Description copied from class: Entity
      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.
      Overrides:
      applyDamage in class Entity
    • applyMovementDamage

      public void applyMovementDamage()
      Applies movement damage to the Tank.
    • isEligibleFor

      public boolean isEligibleFor(GamePhase phase)
      Description copied from class: Entity
      Determines if an entity is eligible for a phase.
      Overrides:
      isEligibleFor in class Entity
    • newRound

      public void newRound(int roundNumber)
      Description copied from class: Entity
      Start a new round
      Specified by:
      newRound in interface RoundUpdated
      Overrides:
      newRound in class Entity
      Parameters:
      roundNumber - the int number of the new round
    • setDugIn

      public void setDugIn(int i)
    • getDugIn

      public int getDugIn()
    • getMovementString

      public String getMovementString(EntityMovementType mtype)
      Returns the name of the type of movement used. This is tank-specific.
      Specified by:
      getMovementString in class Entity
    • getMovementAbbr

      public String getMovementAbbr(EntityMovementType mtype)
      Returns the name of the type of movement used. This is tank-specific.
      Specified by:
      getMovementAbbr in class Entity
    • firstArmorIndex

      public int firstArmorIndex()
      Overrides:
      firstArmorIndex in class Entity
      Returns:
      The index of the first armored location (skipping vehicle body, et. al.)
    • getWeaponArc

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

      public boolean isSecondaryArcWeapon(int weaponId)
      Returns true if this weapon fires into the secondary facing arc. If false, assume it fires into the primary.
      Specified by:
      isSecondaryArcWeapon in class Entity
    • rollHitLocation

      public HitData rollHitLocation(int table, int side, int aimedLocation, AimingMode aimingMode, int cover)
      Rolls up a hit location
      Specified by:
      rollHitLocation in class Entity
    • rollHitLocation

      public HitData rollHitLocation(int table, int side)
      Description copied from class: Entity
      Rolls up a hit location
      Specified by:
      rollHitLocation in class Entity
    • getTransferLocation

      public HitData getTransferLocation(HitData hit)
      Gets the location that excess damage transfers to
      Specified by:
      getTransferLocation in class Entity
    • addEntityBonuses

      public PilotingRollData addEntityBonuses(PilotingRollData prd)
      Description copied from class: Entity
      Add in any piloting skill mods
      Specified by:
      addEntityBonuses in class Entity
    • usesTurnMode

      public boolean usesTurnMode()
      Description copied from class: Entity
      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.
      Overrides:
      usesTurnMode in class Entity
      Returns:
      True if this Entity must make a driving check for turning too sharply.
    • victoryReport

      public Vector<Report> victoryReport()
      Description copied from class: Entity
      Generates a vector containing reports on all useful information about this entity.
      Specified by:
      victoryReport in class Entity
    • getNoOfSlots

      public int[] getNoOfSlots()
      Specified by:
      getNoOfSlots in class Entity
    • getRunMP

      public int getRunMP(MPCalculationSetting mpCalculationSetting)
      Overrides:
      getRunMP in class Entity
    • getSprintMP

      public int getSprintMP()
      Description copied from class: Entity
      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.
      Overrides:
      getSprintMP in class Entity
      Returns:
      This entity's modified sprinting MP
    • getSprintMP

      public int getSprintMP(MPCalculationSetting mpCalculationSetting)
      Description copied from class: Entity
      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.
      Overrides:
      getSprintMP in class Entity
      Returns:
      This entity's modified sprinting MP
    • getRunningGravityLimit

      public int getRunningGravityLimit()
      Description copied from class: Entity
      get the gravity limit for ground movement
      Overrides:
      getRunningGravityLimit in class Entity
    • autoSetInternal

      public void autoSetInternal()
      Description copied from class: Entity
      Sets the internal structure for every location to appropriate undamaged values for the unit and location.
      Specified by:
      autoSetInternal in class Entity
    • getMaxElevationChange

      public int getMaxElevationChange()
      Description copied from class: Entity
      The maximum elevation change the entity can cross
      Specified by:
      getMaxElevationChange in class Entity
    • getMaxElevationDown

      public int getMaxElevationDown(int currElevation)
      Description copied from class: Entity
      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).
      Overrides:
      getMaxElevationDown in class Entity
      Returns:
    • isRepairable

      public boolean isRepairable()
      Determine if the unit can be repaired, or only harvested for spares.
      Overrides:
      isRepairable in class Entity
      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:
    • canCharge

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

      public boolean canDFA()
      Overrides:
      canDFA in class Entity
      Returns:
      Whether this type of unit can perform DFA attacks
    • getSuspensionFactor

      public int getSuspensionFactor()
      Returns:
      suspension factor of vehicle
    • getSuspensionFactor

      public static int getSuspensionFactor(EntityMovementMode movementMode, double weight)
      Static method to calculate suspension factor without needing a vehicle
    • getCost

      public double getCost(CalculationReport calcReport, boolean ignoreAmmo)
      Description copied from class: Entity
      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.
      Specified by:
      getCost in class Entity
      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()
      Description copied from class: Entity
      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

      Overrides:
      getPriceMultiplier in class Entity
    • implicitClanCASE

      public int implicitClanCASE()
      Description copied from class: Entity
      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.
      Overrides:
      implicitClanCASE in class Entity
      Returns:
      The number of locations protected by Clan CASE beyond what is explicitly mounted.
    • doomedInVacuum

      public boolean doomedInVacuum()
      Overrides:
      doomedInVacuum in class Entity
      Returns:
      True when this unit will not survive vacuum conditions.
    • hasEnvironmentalSealing

      public boolean hasEnvironmentalSealing()
      Overrides:
      hasEnvironmentalSealing in class Entity
      Returns:
      True if this unit has Environmental Sealing
    • canGoHullDown

      public boolean canGoHullDown()
      Checks to see if a Tank is capable of going hull-down. This is true if hull-down rules are enabled and the Tank is in a fortified hex.
      Overrides:
      canGoHullDown in class Entity
      Returns:
      True if hull-down is enabled and the Tank is in a fortified hex.
    • setOnFire

      public void setOnFire(boolean inferno)
    • isOnFire

      public boolean isOnFire()
    • isInfernoFire

      public boolean isInfernoFire()
    • isLocationBurning

      public boolean isLocationBurning(int location)
    • extinguishLocation

      public void extinguishLocation(int location)
    • extinguishAll

      public void extinguishAll()
      extinguish all inferno fire on this Tank
    • addMovementDamage

      public void addMovementDamage(int level)
      adds minor, moderate or heavy movement system damage
      Parameters:
      level - a int representing minor damage (1), moderate damage (2), heavy damage (3), or immobilized (4)
    • hasMinorMovementDamage

      public boolean hasMinorMovementDamage()
    • hasModerateMovementDamage

      public boolean hasModerateMovementDamage()
    • hasHeavyMovementDamage

      public boolean hasHeavyMovementDamage()
    • isNuclearHardened

      public boolean isNuclearHardened()
      Description copied from class: Entity
      Checks if the unit is hardened against nuclear strikes.
      Specified by:
      isNuclearHardened in class Entity
      Returns:
      true if this is a hardened unit.
    • addEquipment

      public void addEquipment(Mounted<?> mounted, int loc, boolean rearMounted) throws LocationFullException
      Overrides:
      addEquipment in class Entity
      Throws:
      LocationFullException
    • getCriticalEffect

      public int getCriticalEffect(int roll, int loc, boolean damagedByFire)
      get the type of critical caused by a critical roll, taking account of existing damage
      Parameters:
      roll - the final dice roll
      loc - the hit location
      damagedByFire - whether or not the critical was caused by fire, which is distinct from damage for unofficial thresholding purposes.
      Returns:
      a critical type
    • setOmni

      public void setOmni(boolean omni)
      OmniVehicles have handles for Battle Armor squads to latch onto. Please note, this method should only be called during this Tank's construction.

      Overrides Entity#setOmni(boolean)

      Overrides:
      setOmni in class Entity
    • setBAGrabBars

      public void setBAGrabBars()
    • setTrailerHitches

      public void setTrailerHitches()
      Add a transporter for each trailer hitch the unit is equipped with, with a maximum of one each in the front and the rear. Any tractor that does not have an explicit hitch installed as equipment will get a rear-facing transporter.
    • hasTrailerHitchTransporter

      protected boolean hasTrailerHitchTransporter()
      Check to see if the unit has a trailer hitch transporter already We need this to prevent duplicate transporters being created
    • canSpot

      public boolean canSpot()
      Tanks can't spot when stunned.
      Overrides:
      canSpot in class Entity
      Returns:
      true, if the entity is eligible to spot
    • canUnjamWeapon

      public boolean canUnjamWeapon()
      Convenience function that determines if this tank can issue an "unjam weapon" command.
      Returns:
      True if there are any jammed weapons and the crew isn't stunned
    • canClearTurret

      public boolean canClearTurret()
      Convenience function that determines if this tank can issue a "clear turret" command.
      Returns:
      True if there are any jammed turrets and the crew isn't stunned
    • addJammedWeapon

      public void addJammedWeapon(Mounted<?> weapon)
      Adds the provided weapon as a weapon that is jammed via the vehicle "weapon malfunction" critical hit
      Parameters:
      weapon - Weapon that suffered a "Weapon Malfunction" crit and should be jammed
    • getJammedWeapons

      public ArrayList<Mounted<?>> getJammedWeapons()
      All weapons that a vehicle could use "unjam weapon" for
      Returns:
      all weapons that are jammed via the vehicle "weapon malfunction" critical hit
    • resetJammedWeapons

      public void resetJammedWeapons()
      Resets the list of weapons a vehicle has jammed via "weapon malfunction" crits to empty
    • engineHit

      public void engineHit()
      apply the effects of an "engine hit" crit
    • engineFix

      public void engineFix()
    • isEngineHit

      public boolean isEngineHit()
    • getTotalCommGearTons

      public int getTotalCommGearTons()
      Specified by:
      getTotalCommGearTons in class Entity
      Returns:
      the total tonnage of communications gear in this entity
    • getHQIniBonus

      public int getHQIniBonus()
      Overrides:
      getHQIniBonus in class Entity
      Returns:
      the initiative bonus this Entity grants for HQ
    • hasArmoredEngine

      public boolean hasArmoredEngine()
      Overrides:
      hasArmoredEngine in class Entity
    • getForwardArc

      public int getForwardArc()
      Overrides:
      getForwardArc in class Entity
    • getRearArc

      public int getRearArc()
      Overrides:
      getRearArc in class Entity
    • hasMovementDamage

      public boolean hasMovementDamage()
    • resetMovementDamage

      public void resetMovementDamage()
    • unlockTurret

      public void unlockTurret()
    • isStealthActive

      public boolean isStealthActive()
      Determine if this unit has an active and working stealth system. (stealth can be active and not working when under ECCM)

      Sub-classes are encouraged to override this method.

      Overrides:
      isStealthActive in class Entity
      Returns:
      true if this unit has a stealth system that is currently active, 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. (stealth can be active and not working when under ECCM)

      Sub-classes are encouraged to override this method.

      Overrides:
      isStealthOn in class Entity
      Returns:
      true if this unit has a stealth system that is currently active, false if there is no stealth system or if it is inactive.
    • getTotalSlots

      public int getTotalSlots()
      get the total amount of item slots available for this tank
      Returns:
    • getFreeSlots

      public int getFreeSlots()
      get the free item slots for this tank
      Returns:
    • setArmorType

      public void setArmorType(int armType)
      Overrides:
      setArmorType in class Entity
    • setArmorType

      public void setArmorType(int armType, boolean addMount)
    • hasArmedMASC

      public boolean hasArmedMASC()
      Checks if a mek has an armed MASC system. Note that the mek will have to exceed its normal run to actually engage the MASC system
    • getRunMPasString

      public String getRunMPasString(boolean gameState)
      Returns this entity's running/flank mp as a string.
      Overrides:
      getRunMPasString in class Entity
      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.
    • 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.

      Overrides:
      getStealthModifier in class Entity
      Parameters:
      range - - an int value that must match one of the Compute class range constants.
      ae - - entity making the attack
      Returns:
      a TargetRoll value that contains the stealth modifier for the given range.
    • getEngineHits

      public int getEngineHits()
      Specified by:
      getEngineHits in class Entity
    • getLocationDamage

      public String getLocationDamage(int loc)
      Specified by:
      getLocationDamage in class Entity
    • isCrippled

      public boolean isCrippled()
      Description copied from class: Entity
      Returns TRUE if the entity meets the requirements for crippling damage as detailed in TW pg 258.
      Specified by:
      isCrippled in class Entity
      Returns:
      boolean
    • isCrippled

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

      public boolean isDmgHeavy()
      Description copied from class: Entity
      Returns TRUE if the entity has been heavily damaged.
      Specified by:
      isDmgHeavy in class Entity
      Returns:
      boolean
    • isDmgModerate

      public boolean isDmgModerate()
      Description copied from class: Entity
      Returns TRUE if the entity has been moderately damaged.
      Specified by:
      isDmgModerate in class Entity
      Returns:
      boolean
    • isDmgLight

      public boolean isDmgLight()
      Description copied from class: Entity
      Returns TRUE if the entity has been lightly damaged.
      Specified by:
      isDmgLight in class Entity
      Returns:
      boolean
    • getFuelTonnage

      public double getFuelTonnage()
      Returns the mass of the fuel, which is used for calculating operating range. For combat vehicles this is considered part of the engine weight. For support vehicles it is in addition to the engine weight.
      Returns:
      fuel tonnage
    • setFuelTonnage

      public void setFuelTonnage(double fuel)
      Sets the fuel mass for support vehicles. Has no effect on combat vehicles.
      Parameters:
      fuel - The mass of the fuel in tons
    • operatingRange

      public int operatingRange()
      Calculates the operating range of the vehicle based on engine type and fuel mass. Vehicles that do not require fuel report an operating range of Integer.MAX_VALUE.
      Returns:
      The vehicle's operating range in km
    • fuelTonnagePer100km

      public double fuelTonnagePer100km()
      Calculates fuel mass based on engine type and mass. Engines that do not require allocating fuel mass return a value of 0.0.
      Returns:
      The fuel mass required for every 100 km of vehicle range.
    • getICEFuelType

      public FuelType getICEFuelType()
      The type of fuel for internal combustion engines. This has no meaning for other engine types.
      Returns:
      The ICE fuel type
    • setICEFuelType

      public void setICEFuelType(FuelType fuelType)
    • setHullDown

      public void setHullDown(boolean down)
      Tanks go Hull Down slightly differently, this method accounts for this
      Overrides:
      setHullDown in class Entity
      See Also:
    • isBackedIntoHullDown

      public boolean isBackedIntoHullDown()
      Returns True if this tank moved backwards before going Hull Down
      Returns:
    • getEntityType

      public long getEntityType()
      Specified by:
      getEntityType in class Entity
    • isEjectionPossible

      public boolean isEjectionPossible()
      Overrides:
      isEjectionPossible in class Entity
    • getBaseChassisTurretWeight

      public double getBaseChassisTurretWeight()
      Used for omni vehicles, which must set the weight of turrets the base chassis, limiting the amount of pod space in the turret.
      Returns:
      The weight of the primary turret
    • setBaseChassisTurretWeight

      public void setBaseChassisTurretWeight(double baseChassisTurretWeight)
      Sets the fixed weight of the primary turret on a dual-turret omnivehicle.
      Parameters:
      baseChassisTurretWeight - The weight of the turret
    • getBaseChassisTurret2Weight

      public double getBaseChassisTurret2Weight()
      Used for omni vehicles, which must set the weight of turrets the base chassis, limiting the amount of pod space in the turret.
      Returns:
      The weight of the second turret
    • setBaseChassisTurret2Weight

      public void setBaseChassisTurret2Weight(double baseChassisTurret2Weight)
      Sets the fixed weight of the second turret on a dual-turret omnivehicle.
      Parameters:
      baseChassisTurret2Weight - The weight of the turret
    • getBaseChassisSponsonPintleWeight

      public double getBaseChassisSponsonPintleWeight()
      Used for omni vehicles, which must set the weight of sponson or pintle mounts in the base chassis, limiting the amount of pod space in the turret(s).
      Returns:
      The weight of any pintle mounts (small support vee) or sponson mounts (combat vee and M/L support vee)
    • setBaseChassisSponsonPintleWeight

      public void setBaseChassisSponsonPintleWeight(double baseChassisSponsonPintleWeight)
      Sets the fixed weight of any pintle (small SV) or sponson (CV, M/L SV) turrets on an omnivehicle.
      Parameters:
      baseChassisSponsonPintleWeight - The weight of the sponson/pintle turrets.
    • hasNoControlSystems

      public boolean hasNoControlSystems()
    • setHasNoControlSystems

      public void setHasNoControlSystems(boolean hasNoControlSystems)
    • 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.
      Overrides:
      getSpriteDrawPriority in class Entity
      Returns:
    • isTrailer

      public boolean isTrailer()
      Used to determine if this vehicle can be towed by a tractor
      Overrides:
      isTrailer in class Entity
      Returns:
      Whether the unit is constructed as a trailer
    • setTrailer

      public void setTrailer(boolean trailer)
      Marks whether the tank is constructed as a trailer. This has no effect on support vehicles, which determine trailer status by the trailer chassis modification.
      Parameters:
      trailer - Whether the tank is constructed as a trailer.
    • isTractor

      public boolean isTractor()
      Used to determine if this vehicle can be the engine/tractor for a bunch of trailers
      Overrides:
      isTractor in class Entity
      Returns:
    • isCombatVehicle

      public boolean isCombatVehicle()
      Description copied from interface: BTObject
      Returns true when this object is a ground Combat Vehicle, including VTOL but not including Support Vehicles, or of type CV for Alpha Strike. Returns false for any type of unit group even if it is of the right type.
      Returns:
      True when this is a ground Combat Vehicle (not including Support Vehicle)
    • getsAutoExternalSearchlight

      public boolean getsAutoExternalSearchlight()
      Overrides:
      getsAutoExternalSearchlight in class Entity
      Returns:
      True for unit types that have an automatic external searchlight (Meks and Tanks).
    • getGenericBattleValue

      public int getGenericBattleValue()
      Description copied from class: Entity
      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.

      Specified by:
      getGenericBattleValue in class Entity
      Returns:
      The generic Battle value for this unit based on its tonnage and type
    • isSideLocation

      public boolean isSideLocation(int location)
      Parameters:
      location - The location to check
      Returns:
      True when the given location is a side location, i.e. left, right or, on superheavy units, front or rear left/right.