Package megamek.common.verifier
Class TestProtoMek
java.lang.Object
megamek.common.verifier.TestEntity
megamek.common.verifier.TestProtoMek
- All Implemented Interfaces:
TestEntityOption
-
Nested Class Summary
Nested classes/interfaces inherited from class megamek.common.verifier.TestEntity
TestEntity.Ceil
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final int
Minimum walk MP for glider ProtoMekstatic final double
Any ProtoMek with a larger mass than this is ultra-heavystatic final double
Maximum weight for a ProtoMekstatic final double
Minimum tonnage for a ProtoMekstatic final int
Minimum walk MP for a quad ProtoMekFields inherited from class megamek.common.verifier.TestEntity
engine, structure
Fields inherited from interface megamek.common.verifier.TestEntityOption
CEIL_TARGCOMP_CRITS, FLOOR_TARGCOMP_CRITS, ROUND_TARGCOMP_CRITS
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic int
calcEngineRating
(int walkMP, double tonnage, boolean quadOrGlider) Computes the required engine ratingstatic int
calcEngineRating
(ProtoMek proto) Computes the required engine ratingdouble
According to TM, unit weights are to be rounded up to the nearest half ton or kilo.boolean
correctArmor
(StringBuffer buffer) Checks for exceeding the maximum number of armor points by location for the tonnage.boolean
correctEntity
(StringBuffer buff, int ammoTechLvl) boolean
correctMovement
(StringBuffer buffer) Checks whether the protoMek meets the minimum MP requirements for the configuration.boolean
correctWeight
(StringBuffer buff) int
int
getMinimumWalkMP
(ProtoMek proto) Determine the minimum walk MP for the ProtoMek based on configurationgetName()
double
double
double
double
double
double
double
double
double
boolean
boolean
Check if the unit has combinations of equipment which are not allowed in the construction rules.boolean
boolean
isAero()
boolean
isMek()
boolean
boolean
boolean
isTank()
static boolean
isValidProtoMekLocation
(ProtoMek protoMek, EquipmentType eq, int location, StringBuffer buffer) static int
maxArmorFactor
(double weight, boolean mainGun) Calculate the maximum armor factor based on weight and whether there is a main gun locationstatic int
maxArmorFactor
(ProtoMek proto) Calculate the maximum armor factor based on weight and whether there is a main gun locationstatic int
maxArmorFactor
(ProtoMek proto, int location) Determine the maximum amount of armor in a location based on unit weight.static int
static int
maxSlotsByLocation
(int loc, boolean quad, boolean ultra) Equipment slot limit by locationstatic int
maxSlotsByLocation
(int loc, ProtoMek proto) Equipment slot limit by locationstatic double
maxWeightByLocation
(int loc, boolean quad, boolean ultra) The maximum total weight that can be mounted in a given location.static double
maxWeightByLocation
(int loc, ProtoMek proto) The maximum total weight that can be mounted in a given location.printAmmo
(StringBuffer buff, int posLoc, int posWeight) printMiscEquip
(StringBuffer buff, int posLoc, int posWeight) printWeapon
(StringBuffer buff, int posLoc, int posWeight) static boolean
requiresSlot
(EquipmentType etype) Determines whether a piece of equipment counts toward the slot and weight limits of a location.Methods inherited from class megamek.common.verifier.TestEntity
calcHeatNeutralHSRequirement, calcMiscCrits, calculateWeightExact, ceil, ceilMaxHalf, correctArmorOverAllocation, correctEntity, correctWeight, eqRequiresLocation, equipmentCrewRequirements, floor, getArmoredComponentWeight, getArmorPoints, getArmorPoints, getArmorPointsPerTon, getEntityVerifier, getIntroYearMargin, getLocationAbbr, getMaximumArmorPoints, getMaxOverweight, getMinUnderweight, getMPBoosters, getPrintSize, getRawArmorPoints, getRawWeightArmor, getSIBonusArmorPoints, getSystemWideLocation, getTargCompCrits, getTotalOArmor, getWeight, getWeightArmor, getWeightArmor, getWeightCeilingArmor, getWeightCeilingControls, getWeightCeilingEngine, getWeightCeilingGyro, getWeightCeilingLifting, getWeightCeilingPowerAmp, getWeightCeilingStructure, getWeightCeilingTargComp, getWeightCeilingTurret, getWeightCeilingWeapons, getWeightMiscEquip, getWeightWeapon, hasFailedEquipment, hasIllegalTechLevels, hasIllegalTechLevels, hasIncorrectIntroYear, heatNeutralHSRequirement, ignoreFailedEquip, includeMiscEquip, isClan, isClanArmor, isValidLocation, legalArmorsFor, printAmmo, printAmmo, printArmorLocation, printArmorPlacement, printFailedEquipment, printLocations, printMiscEquip, printMiscEquip, printShortMovement, printSource, printTechLevel, printWeapon, printWeapon, printWeightArmor, printWeightCalculation, printWeightCarryingSpace, printWeightEngine, printWeightHeatSinks, round, setPrecision, showCorrectArmor, showCorrectCritical, showFailedEquip, showIncorrectIntroYear, showOverweightedEntity, showUnderweightedEntity, skip, totalCritSlotCount, usesKgStandard, validJumpJets
-
Field Details
-
MIN_TONNAGE
public static final double MIN_TONNAGEMinimum tonnage for a ProtoMek- See Also:
-
MAX_STD_TONNAGE
public static final double MAX_STD_TONNAGEAny ProtoMek with a larger mass than this is ultra-heavy- See Also:
-
MAX_TONNAGE
public static final double MAX_TONNAGEMaximum weight for a ProtoMek- See Also:
-
GLIDER_MIN_MP
public static final int GLIDER_MIN_MPMinimum walk MP for glider ProtoMek- See Also:
-
QUAD_MIN_MP
public static final int QUAD_MIN_MPMinimum walk MP for a quad ProtoMek- See Also:
-
-
Constructor Details
-
TestProtoMek
-
-
Method Details
-
maxJumpMP
-
getEntity
- Specified by:
getEntity
in classTestEntity
-
isTank
public boolean isTank()- Specified by:
isTank
in classTestEntity
-
isMek
public boolean isMek()- Specified by:
isMek
in classTestEntity
-
isAero
public boolean isAero()- Specified by:
isAero
in classTestEntity
-
isSmallCraft
public boolean isSmallCraft()- Specified by:
isSmallCraft
in classTestEntity
-
isAdvancedAerospace
public boolean isAdvancedAerospace()- Specified by:
isAdvancedAerospace
in classTestEntity
-
isProtoMek
public boolean isProtoMek()- Specified by:
isProtoMek
in classTestEntity
-
getWeightStructure
public double getWeightStructure()- Overrides:
getWeightStructure
in classTestEntity
-
getWeightEngine
public double getWeightEngine()- Overrides:
getWeightEngine
in classTestEntity
-
getWeightControls
public double getWeightControls()- Specified by:
getWeightControls
in classTestEntity
-
getWeightMisc
public double getWeightMisc()- Specified by:
getWeightMisc
in classTestEntity
-
getWeightHeatSinks
public double getWeightHeatSinks()- Specified by:
getWeightHeatSinks
in classTestEntity
-
hasDoubleHeatSinks
public boolean hasDoubleHeatSinks()- Specified by:
hasDoubleHeatSinks
in classTestEntity
-
getCountHeatSinks
public int getCountHeatSinks()- Specified by:
getCountHeatSinks
in classTestEntity
-
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 classTestEntity
- Returns:
- The weight of the unit, rounded up according to TM, p.22.
-
getWeightAllocatedArmor
public double getWeightAllocatedArmor()- Overrides:
getWeightAllocatedArmor
in classTestEntity
-
printWeightStructure
- Overrides:
printWeightStructure
in classTestEntity
-
printWeightMisc
- Specified by:
printWeightMisc
in classTestEntity
-
printWeightControls
- Specified by:
printWeightControls
in classTestEntity
-
printMiscEquip
- Overrides:
printMiscEquip
in classTestEntity
-
printWeapon
- Overrides:
printWeapon
in classTestEntity
-
printAmmo
- Overrides:
printAmmo
in classTestEntity
-
getWeightCarryingSpace
public double getWeightCarryingSpace()- Overrides:
getWeightCarryingSpace
in classTestEntity
-
correctEntity
- Specified by:
correctEntity
in classTestEntity
-
correctWeight
- Overrides:
correctWeight
in classTestEntity
-
hasIllegalEquipmentCombinations
Description copied from class:TestEntity
Check if the unit has combinations of equipment which are not allowed in the construction rules.- Overrides:
hasIllegalEquipmentCombinations
in classTestEntity
- 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 ProtoMekeq
- The equipmentlocation
- A location index on the Entitybuffer
- 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
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
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
- Specified by:
printEntity
in classTestEntity
-
getName
- Specified by:
getName
in classTestEntity
-
getWeightAmmo
public double getWeightAmmo()- Overrides:
getWeightAmmo
in classTestEntity
-
getWeightPowerAmp
public double getWeightPowerAmp()- Specified by:
getWeightPowerAmp
in classTestEntity
-
getMinimumWalkMP
Determine the minimum walk MP for the ProtoMek based on configuration- Parameters:
proto
- The ProtoMek- Returns:
- The minimum walk MP
-
calcEngineRating
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 MPtonnage
- The weight of the ProtoMek in tonsquadOrGlider
- Whether the ProtoMek is a quad or glider configuration- Returns:
- The engine rating required for the weight, speed, and configuration
-
requiresSlot
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
Equipment slot limit by location- Parameters:
loc
- The ProtoMek locationproto
- 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 locationquad
- Whether the ProtoMek is a quadultra
- Whether the ProtoMek is ultraheavy- Returns:
- The number of equipment slots in the location
-
maxWeightByLocation
The maximum total weight that can be mounted in a given location.- Parameters:
loc
- The Protomek locationproto
- 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 locationquad
- Whether the protoMek is a quadultra
- Whether the protoMek is ultraheavy- Returns:
- The weight limit for that location, in tons.
-
maxArmorFactor
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 tonsmainGun
- Whether the protoMek has a main gun location- Returns:
- The maximum total number of armor points
-
maxArmorFactor
Determine the maximum amount of armor in a location based on unit weight.- Parameters:
proto
- The protoMeklocation
- The location index- Returns:
- The maximum total number of armor points
-