Class SmallCraft

All Implemented Interfaces:
Serializable, ICarryable, Transporter, InGameObject, CombatRole, ForceAssignable, ITechnology, ITurnOrdered, PhaseUpdated, RoundUpdated, ActiveHeatSinkController, BTObject, Deployable, IAero, IBomber, Targetable
Direct Known Subclasses:
Dropship, EscapePods

public class SmallCraft extends Aero
Since:
Jun 17, 2007
See Also:
  • Field Details

  • Constructor Details

    • SmallCraft

      public SmallCraft()
  • Method Details

    • getUnitType

      public int getUnitType()
      Overrides:
      getUnitType in class Aero
      See Also:
    • getConstructionTechAdvancement

      public TechAdvancement getConstructionTechAdvancement()
      Description copied from class: Entity
      return - the base construction option tech advancement
      Overrides:
      getConstructionTechAdvancement in class Aero
    • isAutoEject

      public boolean isAutoEject()
      Overrides:
      isAutoEject in class Aero
      Returns:
      Returns the autoEject.
    • isPrimitive

      public boolean isPrimitive()
      Overrides:
      isPrimitive in class Aero
      Returns:
      Whether the unit uses primitive or retro tech construction rules
    • isSmallCraft

      public boolean isSmallCraft()
      Description copied from interface: BTObject
      Returns true when this object is a SmallCraft (not a DropShip). Returns false for any type of unit group.
      Returns:
      True when this is a SmallCraft
    • setNCrew

      public void setNCrew(int crew)
      Overrides:
      setNCrew in class Entity
    • setNOfficers

      public void setNOfficers(int officer)
    • setNGunners

      public void setNGunners(int gunners)
    • setNPassenger

      public void setNPassenger(int pass)
      Overrides:
      setNPassenger in class Entity
    • setNBattleArmor

      public void setNBattleArmor(int ba)
    • setNMarines

      public void setNMarines(int marines)
      Description copied from class: Entity
      Updates the number of marines aboard
      Overrides:
      setNMarines in class Entity
      Parameters:
      marines - The number of marines to add/subtract
    • setNOtherPassenger

      public void setNOtherPassenger(int other)
    • getNCrew

      public int getNCrew()
      Overrides:
      getNCrew in class Aero
      Returns:
      The total number of crew available to supplement marines onboarding actions. Includes officers, enlisted, and bay personnel, but not marines/ba or passengers.
    • getNPassenger

      public int getNPassenger()
      Overrides:
      getNPassenger in class Aero
      Returns:
      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
    • getNOfficers

      public int getNOfficers()
      Overrides:
      getNOfficers in class Aero
      Returns:
      The total number of officers for vessels.
    • getNGunners

      public int getNGunners()
      Overrides:
      getNGunners in class Aero
      Returns:
      The total number of gunners for vessels.
    • getNBattleArmor

      public int getNBattleArmor()
      Overrides:
      getNBattleArmor in class Aero
      Returns:
      The number battle armored marines available to vessels for boarding actions.
    • getNMarines

      public int getNMarines()
      Overrides:
      getNMarines in class Aero
      Returns:
      The number conventional marines available to vessels for boarding actions.
    • getNOtherPassenger

      public int getNOtherPassenger()
    • getNOtherCrew

      public Map<String,Integer> getNOtherCrew()
      Returns a mapping of how many crewmembers from other units this unit is carrying and what ship they're from by external ID
    • getTotalOtherCrew

      public int getTotalOtherCrew()
      Convenience method to return all crew from other craft aboard from the above Map
    • addNOtherCrew

      public void addNOtherCrew(String id, int n)
      Adds a number of crewmembers from another ship keyed by that ship's external ID
      Parameters:
      id - The external ID of the ship these crew came from
      n - The number to add
    • getPassengers

      public Map<String,Integer> getPassengers()
      Returns a mapping of how many passengers from other units this unit is carrying and what ship they're from by external ID
    • getTotalPassengers

      public int getTotalPassengers()
      Convenience method to return all passengers aboard from the above Map
    • addPassengers

      public void addPassengers(String id, int n)
      Adds a number of passengers from another ship keyed by that ship's external ID
      Parameters:
      id - The external ID of the ship these passengers came from
      n - The number to add
    • setEscapePods

      public void setEscapePods(int n)
    • getEscapePods

      public int getEscapePods()
      Overrides:
      getEscapePods in class Aero
      Returns:
      The number of escape pods carried by the unit
    • getLaunchedEscapePods

      public int getLaunchedEscapePods()
      Returns the total number of escape pods launched so far
      Overrides:
      getLaunchedEscapePods in class Aero
    • setLaunchedEscapePods

      public void setLaunchedEscapePods(int n)
      Updates the total number of escape pods launched so far
      Overrides:
      setLaunchedEscapePods in class Aero
      Parameters:
      n - The number to change
    • setLifeBoats

      public void setLifeBoats(int n)
    • getLifeBoats

      public int getLifeBoats()
      Overrides:
      getLifeBoats in class Aero
      Returns:
      The number of lifeboats carried by the unit
    • getLaunchedLifeBoats

      public int getLaunchedLifeBoats()
      Returns the total number of lifeboats launched so far
      Overrides:
      getLaunchedLifeBoats in class Aero
    • setLaunchedLifeBoats

      public void setLaunchedLifeBoats(int n)
      Updates the total number of lifeboats launched so far
      Overrides:
      setLaunchedLifeBoats in class Aero
      Parameters:
      n - The number to change
    • getStrategicFuelUse

      public double getStrategicFuelUse()
      Description copied from class: Aero
      Used by SmallCraft and Jumpship and their child classes.
      Overrides:
      getStrategicFuelUse in class Aero
      Returns:
      The tons of fuel burned in a day at 1G using strategic movement.
    • primitiveFuelFactor

      public double primitiveFuelFactor()
      Description copied from class: Aero
      Some primitive aerospace units have their fuel efficiency reduced by a factor based on construction year.
      Overrides:
      primitiveFuelFactor in class Aero
      Returns:
      The primitive fuel factor for the build year.
    • getLocationAbbreviations

      public String[] getLocationAbbreviations()
      Overrides:
      getLocationAbbreviations in class Aero
    • getLocationNames

      public String[] getLocationNames()
      Overrides:
      getLocationNames in class Aero
    • locations

      public int locations()
      Description copied from class: Aero
      Returns the number of locations in the entity
      Overrides:
      locations in class Aero
    • 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 Aero
      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.
    • rollHitLocation

      public HitData rollHitLocation(int table, int side)
      Description copied from class: Entity
      Rolls up a hit location
      Overrides:
      rollHitLocation in class Aero
    • getWeaponArc

      public int getWeaponArc(int weaponNumber)
      Description copied from class: Aero
      Returns the Compute.ARC that the weapon fires into.
      Overrides:
      getWeaponArc in class Aero
      Parameters:
      weaponNumber - integer equipment number, index from equipment list
      Returns:
      arc the specified weapon is in
    • getArcsWithGuns

      public int getArcsWithGuns()
    • hasWeaponInArc

      public boolean hasWeaponInArc(int loc, boolean rearMount)
    • getArmorWeight

      public double getArmorWeight()
      Description copied from class: Entity
      The total weight of the armor on this unit. This is guaranteed to be rounded properly for both single-type and patchwork armor.
      Overrides:
      getArmorWeight in class Entity
      Returns:
      The armor weight in tons.
    • 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.
      Overrides:
      getCost in class Aero
      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 Aero
    • getMaxEngineHits

      public int getMaxEngineHits()
      Overrides:
      getMaxEngineHits in class Aero
    • getBVTypeModifier

      public double getBVTypeModifier()
      Description copied from class: Aero
      Not used directly but is overwritten in 5 other classes.
      Overrides:
      getBVTypeModifier in class Aero
      Returns:
      BV Type Modifier.
    • loadWeapon

      public boolean loadWeapon(WeaponMounted mounted, AmmoMounted mountedAmmo)
      need to check bay location before loading ammo
      Overrides:
      loadWeapon in class Entity
    • getTotalCommGearTons

      public int getTotalCommGearTons()
      Overrides:
      getTotalCommGearTons in class Aero
      Returns:
      the total tonnage of communications gear in this entity
    • hasActiveECM

      public boolean hasActiveECM()
      Description copied from class: Entity
      Does the Mek have a functioning ECM unit?
      Overrides:
      hasActiveECM in class Entity
    • getECMRange

      public int getECMRange()
      What's the range of the ECM equipment?
      Overrides:
      getECMRange in class Aero
      Returns:
      the int range of this unit's ECM. This value will be Entity.NONE if no ECM is active.
    • isCrewProtected

      public boolean isCrewProtected()
      Overrides:
      isCrewProtected in class Aero
      Returns:
      is the crew of this vessel protected from gravitational effects, see StratOps, pg. 36
    • height

      public int height()
      Description copied from class: Entity
      Returns the height of the unit, that is, how many levels above its elevation it is for LOS purposes. Default is 0.
      Specified by:
      height in interface IAero
      Overrides:
      height in class Entity
    • getEntityType

      public long getEntityType()
      Overrides:
      getEntityType in class Aero
    • isBomber

      public boolean isBomber()
      Fighters may carry external ordnance; Other Aerospace units with cargo bays and the Internal Bomb Bay quirk may carry bombs internally.
      Specified by:
      isBomber in interface Targetable
      Overrides:
      isBomber in class Aero
      Returns:
      boolean
    • calculateWalk

      protected int calculateWalk()
      Do not recalculate walkMP when adding engine.
      Overrides:
      calculateWalk in class Aero
    • isLargeAerospace

      public boolean isLargeAerospace()
      Description copied from interface: BTObject
      Returns true when this object is a large aerospace unit (SmallCraft, DropShip, JumpShip, WarShip, Space Station). Returns false for any type of unit group even if it is of the right type.
      Returns:
      True when this is a large aerospace unit
    • getLandingLength

      public int getLandingLength()
    • autoSetMaxBombPoints

      public void autoSetMaxBombPoints()
      Description copied from class: Aero
      Recalculates the internal and external hardpoints that this aero unit has. TM p.217, TW p.245
      Overrides:
      autoSetMaxBombPoints in class Aero
    • 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
    • hasPatchworkArmor

      public boolean hasPatchworkArmor()
      Overrides:
      hasPatchworkArmor in class Entity
      Returns:
      True if this unit has patchwork armor. Note that this is checked by comparing actual armor types (and tech level) across the locations - in other words, it is *not* a simple boolean flag; instead, the result will always correspond to the unit's armoring.
    • getRecoveryTime

      public int getRecoveryTime()
      Description copied from class: Entity
      Returns the recovery time for this entity in minutes.

      This method provides the base recovery time required for this entity type. The recovery time represents the duration needed to recover, repair, or prepare the entity after deployment or damage.

      Subclasses should override this method to provide entity-specific recovery times based on their type, weight class, or other relevant characteristics.

      Manual Reference: CamOps pg 214

      Overrides:
      getRecoveryTime in class Entity
      Returns:
      The recovery time in minutes. The default implementation returns 60 minutes.
    • isChassisFamiliarityEligible

      public boolean isChassisFamiliarityEligible()
      Description copied from class: Entity
      Returns whether this unit is a chassis-familiarity-eligible type for MekHQ's Familiarity system
      Overrides:
      isChassisFamiliarityEligible in class Entity
      Returns:
      true if familiarity is tracked for this unit