Class BuildingEntity

All Implemented Interfaces:
Serializable, ICarryable, Transporter, InGameObject, CombatRole, ForceAssignable, ITechnology, ITurnOrdered, PhaseUpdated, RoundUpdated, BTObject, Deployable, IBuilding, Targetable

public class BuildingEntity extends AbstractBuildingEntity
Implementation of TO:AR's Advanced Buildings.
Extends AbstractBuildingEntity
See Also:
  • Constructor Details

    • BuildingEntity

      public BuildingEntity(BuildingType type, int bldgClass)
  • Method Details

    • getUnitType

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

      public boolean isImmobile()
      Description copied from class: Entity
      Returns true if the target is considered immobile (-4 to hit) as a target and also if it is considered immobile or temporarily or permanently immbolized for active movement. Overriding methods should check the status of the unit (shutdown, damage) and also the status of the crew (unconscious).
      Specified by:
      isImmobile in interface Targetable
      Overrides:
      isImmobile in class Entity
      Returns:
      True if the target is considered immobile as a target and unable to move actively.
    • isEligibleForMovement

      public boolean isEligibleForMovement()
      Description copied from class: Entity
      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
      Overrides:
      isEligibleForMovement in class Entity
      Returns:
      whether the entity is allowed to move
    • getWalkMP

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

      public int getRunMP(MPCalculationSetting mpCalculationSetting)
      Overrides:
      getRunMP in class Entity
    • 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
    • getJumpMP

      public int getJumpMP(MPCalculationSetting mpCalculationSetting)
      Overrides:
      getJumpMP in class Entity
    • getConstructionTechAdvancement

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

      public String getMovementString(EntityMovementType movementType)
      Returns the name of the type of movement used.
      Specified by:
      getMovementString in class Entity
    • getMovementAbbr

      public String getMovementAbbr(EntityMovementType movementType)
      Returns the abbreviation of the name of the type of movement used.
      Specified by:
      getMovementAbbr in class Entity
    • getWeaponArc

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

      public int getWeaponFiringHeight(WeaponMounted weapon)
      What height is this weapon physically firing from?
      Overrides:
      getWeaponFiringHeight in class AbstractBuildingEntity
      Parameters:
      weapon - WeaponMounted
      Returns:
      int
    • getGenericBattleValue

      public 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.

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

      public int getMaxElevationChange()
      The maximum elevation change the entity can cross
      Overrides:
      getMaxElevationChange in class Entity
    • performManualStartup

      public void performManualStartup()
      Overrides:
      performManualStartup in class Entity
    • 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.
      Overrides:
      applyDamage in class Entity
    • hasPower

      public boolean hasPower()
      A BuildingEntity needs power to function.
      Returns:
      true if the unit has power, otherwise false
    • isBuildingEntityOrGunEmplacement

      public boolean isBuildingEntityOrGunEmplacement()
      Description copied from interface: Targetable
      Replaced most instances of `instanceof GunEmplacement` to support BuildingEntity
      Returns:
      true if this unit is a BuildingEntity or GunEmplacement, false otherwise
    • getWeight

      public double getWeight()
      Calculates the internal weight capacity for this building.

      For each hex of area covered, advanced buildings may internally carry a total tonnage of equipment equal to their Construction Factor times the number of levels of structure height.

      Hangar-type structures may triple this capacity, but are limited to a maximum of 600 tons per hex for every 4 levels of structural height (or fraction thereof).

      Overrides:
      getWeight in class Entity
      Returns:
      The total internal weight capacity in tons
    • addDemolitionCharge

      public void addDemolitionCharge(int playerId, int damage, Coords pos)
      Places a demolition charge on this building (TO:AUE p.152). Demolition charges anchor to an absolute board hex, which is only valid for structures that cannot move; this is why the implementation lives here rather than in AbstractBuildingEntity, where MobileStructure would inherit it.
      Specified by:
      addDemolitionCharge in interface IBuilding
      Overrides:
      addDemolitionCharge in class AbstractBuildingEntity
      Parameters:
      playerId - the ID of the player who placed the charge
      damage - the damage the charge will deal when detonated
      pos - the absolute board coordinates of the charge; see Building.addDemolitionCharge(int, int, megamek.common.board.Coords)