Class TestProtoMek

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

public class TestProtoMek extends TestEntity
  • Field Details

    • MIN_TONNAGE

      public static final double MIN_TONNAGE
      Minimum tonnage for a ProtoMek
      See Also:
    • MAX_STD_TONNAGE

      public static final double MAX_STD_TONNAGE
      Any ProtoMek with a larger mass than this is ultra-heavy
      See Also:
    • MAX_TONNAGE

      public static final double MAX_TONNAGE
      Maximum weight for a ProtoMek
      See Also:
    • GLIDER_MIN_MP

      public static final int GLIDER_MIN_MP
      Minimum walk MP for glider ProtoMek
      See Also:
    • QUAD_MIN_MP

      public static final int QUAD_MIN_MP
      Minimum walk MP for a quad ProtoMek
      See Also:
  • Constructor Details

  • Method Details

    • maxJumpMP

      public static int maxJumpMP(ProtoMek proto)
    • 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
    • getWeightStructure

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

      public double getWeightEngine()
      Overrides:
      getWeightEngine 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
    • hasDoubleHeatSinks

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

      public int getCountHeatSinks()
      Specified by:
      getCountHeatSinks 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.
    • getWeightAllocatedArmor

      public double getWeightAllocatedArmor()
      Overrides:
      getWeightAllocatedArmor in class TestEntity
    • printWeightStructure

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

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

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

      public StringBuffer printMiscEquip(StringBuffer buff, int posLoc, int posWeight)
      Overrides:
      printMiscEquip in class TestEntity
    • printWeapon

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

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

      public double getWeightCarryingSpace()
      Overrides:
      getWeightCarryingSpace in class TestEntity
    • correctEntity

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

      public boolean correctWeight(StringBuffer buff)
      Overrides:
      correctWeight in class TestEntity
    • hasIllegalEquipmentCombinations

      public boolean hasIllegalEquipmentCombinations(StringBuffer buff)
      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:
      buff - diagnostics are appended to this
      Returns:
      true if the entity is illegal
    • isValidProtoMekLocation

      public static boolean isValidProtoMekLocation(ProtoMek protoMek, EquipmentType eq, int location, @Nullable StringBuffer buffer)
      Parameters:
      protoMek - The ProtoMek
      eq - The equipment
      location - A location index on the Entity
      buffer - If non-null and the location is invalid, will be appended with an explanation
      Returns:
      Whether the equipment can be mounted in the location on the ProtoMek
    • correctArmor

      public boolean correctArmor(StringBuffer buffer)
      Checks for exceeding the maximum number of armor points by location for the tonnage.
      Parameters:
      buffer - A string buffer for appending error messages.
      Returns:
      Whether the number of armor points is legal
    • correctMovement

      public boolean correctMovement(StringBuffer buffer)
      Checks whether the protoMek meets the minimum MP requirements for the configuration.
      Parameters:
      buffer - A buffer for error messages
      Returns:
      Whether the MP is legal.
    • printEntity

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

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

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

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

      public int getMinimumWalkMP(ProtoMek proto)
      Determine the minimum walk MP for the ProtoMek based on configuration
      Parameters:
      proto - The ProtoMek
      Returns:
      The minimum walk MP
    • calcEngineRating

      public static int calcEngineRating(ProtoMek proto)
      Computes the required engine rating
      Parameters:
      proto - The ProtoMek
      Returns:
      The engine rating required for the weight, speed, and configuration
    • calcEngineRating

      public static int calcEngineRating(int walkMP, double tonnage, boolean quadOrGlider)
      Computes the required engine rating
      Parameters:
      walkMP - The base walking MP
      tonnage - The weight of the ProtoMek in tons
      quadOrGlider - Whether the ProtoMek is a quad or glider configuration
      Returns:
      The engine rating required for the weight, speed, and configuration
    • requiresSlot

      public static boolean requiresSlot(EquipmentType etype)
      Determines whether a piece of equipment counts toward the slot and weight limits of a location.
      Parameters:
      etype - The equipment
      Returns:
      Whether the equipment takes a slot.
    • maxSlotsByLocation

      public static int maxSlotsByLocation(int loc, ProtoMek proto)
      Equipment slot limit by location
      Parameters:
      loc - The ProtoMek location
      proto - The ProtoMek
      Returns:
      The number of equipment slots in the location
    • maxSlotsByLocation

      public static int maxSlotsByLocation(int loc, boolean quad, boolean ultra)
      Equipment slot limit by location
      Parameters:
      loc - The ProtoMek location
      quad - Whether the ProtoMek is a quad
      ultra - Whether the ProtoMek is ultraheavy
      Returns:
      The number of equipment slots in the location
    • maxWeightByLocation

      public static double maxWeightByLocation(int loc, ProtoMek proto)
      The maximum total weight that can be mounted in a given location.
      Parameters:
      loc - The Protomek location
      proto - The Protomek
      Returns:
      The weight limit for that location, in tons.
    • maxWeightByLocation

      public static double maxWeightByLocation(int loc, boolean quad, boolean ultra)
      The maximum total weight that can be mounted in a given location.
      Parameters:
      loc - The Protomek location
      quad - Whether the protoMek is a quad
      ultra - Whether the protoMek is ultraheavy
      Returns:
      The weight limit for that location, in tons.
    • maxArmorFactor

      public static int maxArmorFactor(ProtoMek proto)
      Calculate the maximum armor factor based on weight and whether there is a main gun location
      Parameters:
      proto - The protoMek
      Returns:
      The maximum total number of armor points
    • maxArmorFactor

      public static int maxArmorFactor(double weight, boolean mainGun)
      Calculate the maximum armor factor based on weight and whether there is a main gun location
      Parameters:
      weight - The weight of the protoMek in tons
      mainGun - Whether the protoMek has a main gun location
      Returns:
      The maximum total number of armor points
    • maxArmorFactor

      public static int maxArmorFactor(ProtoMek proto, int location)
      Determine the maximum amount of armor in a location based on unit weight.
      Parameters:
      proto - The protoMek
      location - The location index
      Returns:
      The maximum total number of armor points