Class TestInfantry

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

public class TestInfantry extends TestEntity
  • Constructor Details

  • Method Details

    • 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
    • getWeightControls

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

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

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

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

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

      public double getWeightArmor()
      Overrides:
      getWeightArmor 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
    • printWeightStructure

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

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

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

      public static int maxSecondaryWeapons(Infantry inf)
    • maxSquadSize

      public static int maxSquadSize(EntityMovementMode movementMode, boolean alt, @Nullable InfantryMount mount)
      Maximum squad size based on motive type
      Parameters:
      movementMode - The platoon's movement mode
      alt - True indicates that VTOL is microlite and INF_UMU is motorized.
      mount - The mount if the unit is beast-mounted, otherwise null.
      Returns:
      The maximum size of a squad.
    • maxUnitSize

      public static int maxUnitSize(EntityMovementMode movementMode, boolean alt, boolean engOrMountain, InfantryMount mount)
    • printEntity

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

      public String printWeightCalculation()
      Overrides:
      printWeightCalculation in class TestEntity
    • getName

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

      public double getWeightPowerAmp()
      Specified by:
      getWeightPowerAmp in class TestEntity
    • 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.
    • getWeight

      public static double getWeight(Infantry infantry)
      Calculates the weight of the given Conventional Infantry unit. Infantry weight is not fixed as in Meks and Vehicles but calculated from the infantry configuration.
      Parameters:
      infantry - The conventional infantry
      Returns:
      The rounded weight in tons
    • getWeightExact

      public static double getWeightExact(Infantry infantry, CalculationReport report)
      Calculates the weight of the given Conventional Infantry unit. Infantry weight is not fixed as in Meks and Vehicles but calculated from the infantry configuration. The given CalculationReport will be filled in with the weight calculation (the report includes the final rounding step but the returned result does not).
      Parameters:
      infantry - The conventional infantry
      report - A CalculationReport to fill in
      Returns:
      The exact weight in tons
    • adaptAntiMekAttacks

      public static void adaptAntiMekAttacks(Infantry infantry)
    • removeAntiMekAttacks

      public static void removeAntiMekAttacks(Infantry unit)
    • removeAntiMekAttack

      public static void removeAntiMekAttack(Infantry unit, EquipmentType antiMekType)