Class TestSupportVehicle

java.lang.Object
megamek.common.verifier.TestEntity
megamek.common.verifier.TestSupportVehicle
All Implemented Interfaces:
TestEntityOption

public class TestSupportVehicle extends TestEntity
Author: arlith
  • Field Details

    • TECH_LEVEL_TA

      public static final TechAdvancement[] TECH_LEVEL_TA
      Tech advancement data for structural components with variable tech levels (structure, armor, engine). This is assembled from the table on TM, p. 122 and IO, p. 49, primitive construction rules (IO, p. 120-121) and a pending proposal to the rules committee for E.
    • INDEX_FIRST_CLASS

      public static final int INDEX_FIRST_CLASS
      See Also:
    • INDEX_SECOND_CLASS

      public static final int INDEX_SECOND_CLASS
      See Also:
    • INDEX_STD_CREW

      public static final int INDEX_STD_CREW
      See Also:
    • INDEX_STEERAGE

      public static final int INDEX_STEERAGE
      See Also:
  • Constructor Details

  • Method Details

    • legalArmorsFor

      public static List<ArmorType> legalArmorsFor(ITechManager techManager)
      Filters all vehicle armor according to given tech constraints. Standard armor is treated as basic support vehicle armor.
      Parameters:
      techManager - Applies the filtering criteria
      Returns:
      A list of armor equipment that meets the tech constraints
    • maxArmorFactor

      public static int maxArmorFactor(Entity vee)
      The maximum number of armor points a support vehicle is computed by multiplying the total tonnage by a factor determined by the vehicle type and adding four.
      Parameters:
      vee - The support vehicle
      Returns:
      The maximum number of armor points. If the entity cannot be identified as a support vehicle, returns 0.
    • armorWeightPerPoint

      public static double armorWeightPerPoint(Entity vee)
      Calculates the weight of each point of armor. For standard SV armor this is based on the tech and BAR ratings. For advanced armors this is the reciprocal of the number of points per ton.
      Parameters:
      vee - The support vehicle
      Returns:
      The weight of each armor point in tons, rounded to the kilogram.
    • sponsonLegal

      public static boolean sponsonLegal(TestSupportVehicle.SVType type, boolean small)
      Checks whether the support vehicle can mount sponson turrets (TO, p. 348)
      Parameters:
      type - The support vehicle type
      small - Whether the Entity is a small support vehicle
      Returns:
      Whether the vehicle can use sponson turrets.
    • pintleLegal

      public static boolean pintleLegal(TestSupportVehicle.SVType type, boolean small)
      Checks whether the support vehicle can mount pintle turrets (TM, p. 348)
      Parameters:
      type - The support vehicle type
      small - Whether the Entity is a small support vehicle
      Returns:
      Whether the vehicle can use pintle turrets.
    • printWeightStructure

      public String printWeightStructure()
      Overrides:
      printWeightStructure in class TestEntity
    • printWeightEngine

      public String printWeightEngine()
      Overrides:
      printWeightEngine in class TestEntity
    • printWeightArmor

      public String printWeightArmor()
      Overrides:
      printWeightArmor in class TestEntity
    • getEntity

      public Entity getEntity()
      Specified by:
      getEntity in class TestEntity
    • isTank

      public boolean isTank()
      Specified by:
      isTank in class TestEntity
    • isMek

      public boolean isMek()
      Specified by:
      isMek in class TestEntity
    • isAero

      public boolean isAero()
      Specified by:
      isAero in class TestEntity
    • isSmallCraft

      public boolean isSmallCraft()
      Specified by:
      isSmallCraft in class TestEntity
    • isAdvancedAerospace

      public boolean isAdvancedAerospace()
      Specified by:
      isAdvancedAerospace in class TestEntity
    • isProtoMek

      public boolean isProtoMek()
      Specified by:
      isProtoMek in class TestEntity
    • calculateWeight

      public double calculateWeight()
      Description copied from class: TestEntity
      According to TM, unit weights are to be rounded up to the nearest half ton or kilo. This method returns the rounded weight.
      Overrides:
      calculateWeight in class TestEntity
      Returns:
      The weight of the unit, rounded up according to TM, p.22.
    • calculateWeightExact

      public double calculateWeightExact()
      Description copied from class: TestEntity
      According to TM p.22, unit weights are to be rounded up to the nearest half ton or kilo, but in MML for construction at least we should be able to show the exact weight. This method returns the unrounded weight.
      Overrides:
      calculateWeightExact in class TestEntity
      Returns:
      The unrounded weight of the unit.
    • getWeightStructure

      public double getWeightStructure()
      Overrides:
      getWeightStructure in class TestEntity
    • getFuelTonnage

      public double getFuelTonnage()
    • getWeightControls

      public double getWeightControls()
      Specified by:
      getWeightControls in class TestEntity
    • getWeightMisc

      public double getWeightMisc()
      Specified by:
      getWeightMisc in class TestEntity
    • getTankWeightTurret

      public double getTankWeightTurret()
    • getTankWeightDualTurret

      public double getTankWeightDualTurret()
    • getWeightAmmo

      public double getWeightAmmo()
      Overrides:
      getWeightAmmo in class TestEntity
    • getWeightPowerAmp

      public double getWeightPowerAmp()
      Specified by:
      getWeightPowerAmp in class TestEntity
    • includeMiscEquip

      protected boolean includeMiscEquip(MiscType eq)
      Description copied from class: TestEntity
      Gives subclasses a chance to exclude certain misc equipment if it is accounted for in a different category.
      Overrides:
      includeMiscEquip in class TestEntity
      Parameters:
      eq - The misc equipment type
      Returns:
      Whether to include the equipment in the misc equipment category
      See Also:
    • getWeightHeatSinks

      public double getWeightHeatSinks()
      Specified by:
      getWeightHeatSinks in class TestEntity
    • hasDoubleHeatSinks

      public boolean hasDoubleHeatSinks()
      Specified by:
      hasDoubleHeatSinks in class TestEntity
    • getCountHeatSinks

      public int getCountHeatSinks()
      Specified by:
      getCountHeatSinks in class TestEntity
    • printWeightMisc

      public String printWeightMisc()
      Specified by:
      printWeightMisc in class TestEntity
    • printWeightControls

      public String printWeightControls()
      Specified by:
      printWeightControls in class TestEntity
    • printAmmo

      public StringBuffer printAmmo(StringBuffer buff, int posLoc, int posWeight)
      Overrides:
      printAmmo in class TestEntity
    • getSmallSVAmmoWeight

      public static double getSmallSVAmmoWeight(Mounted<?> mounted)
    • canUseSponsonTurret

      public boolean canUseSponsonTurret()
    • canUsePintleTurret

      public boolean canUsePintleTurret()
    • correctEntity

      public boolean correctEntity(StringBuffer buff, int ammoTechLvl)
      Specified by:
      correctEntity in class TestEntity
    • isSmallSupportVehicle

      public static boolean isSmallSupportVehicle(Entity entity)
    • isSmallSupportVehicleWeapon

      public static boolean isSmallSupportVehicleWeapon(EquipmentType type)
    • hasIllegalEquipmentCombinations

      public boolean hasIllegalEquipmentCombinations(StringBuffer buffer)
      Description copied from class: TestEntity
      Check if the unit has combinations of equipment which are not allowed in the construction rules.
      Overrides:
      hasIllegalEquipmentCombinations in class TestEntity
      Parameters:
      buffer - diagnostics are appended to this
      Returns:
      true if the entity is illegal
    • correctCriticalSlots

      public boolean correctCriticalSlots(StringBuffer buff)
    • printEntity

      public StringBuffer printEntity()
      Specified by:
      printEntity in class TestEntity
    • printSlotCalculation

      public StringBuffer printSlotCalculation()
    • getName

      public String getName()
      Specified by:
      getName in class TestEntity
    • getWeightArmor

      public double getWeightArmor()
      Overrides:
      getWeightArmor in class TestEntity
    • totalSlotCount

      public int totalSlotCount()
      Returns:
      The total slot space
    • occupiedSlotCount

      public int occupiedSlotCount()
      Returns:
      The number of slots taken up by installed equipment
    • getArmorSlots

      public int getArmorSlots()
      Returns:
      The number of slots taken up by armor
    • getWeaponSlots

      public int getWeaponSlots()
      Returns:
      The number of slots taken up by weapons
    • getAmmoSlots

      public int getAmmoSlots()
      Returns:
      The number of slots taken up by ammo.
    • getMiscEquipSlots

      public int getMiscEquipSlots()
      Returns:
      The number of slots taken by miscellaneous equipment.
    • extraCrewQuartersCount

      public static int[] extraCrewQuartersCount(Entity supportVehicle)
      Calculates capacity of quarters above the minimum crew requirement. Only quarters above the minimum crew requirement take up equipment slots. Second class quarters are considered passenger accommodations and always count toward slots. Others are assigned to the least bulky type first.
      Parameters:
      supportVehicle - A support vehicle
      Returns:
      An array of the count of each type of quarters that require slots. See INDEX_* constants for indices.
    • getCrewSlots

      public int getCrewSlots()
      Calculates the number of equipment slots taken up by crew quarters. Quarters for minimum crew do not take up slots.
      Returns:
      The number of equipment slots required by crew quarters.
    • getTransportSlots

      public int getTransportSlots()
      Each distinct bay requires a slot, regardless of size. All InfantryCompartment is treated as a single bay.
      Returns:
      The number of slots required by transporters.