Package megamek.common.verifier
Class TestProtoMek
java.lang.Object
megamek.common.verifier.TestEntity
megamek.common.verifier.TestProtoMek
- All Implemented Interfaces:
TestEntityOption
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final intMinimum walk MP for glider ProtoMekstatic final doubleAny ProtoMek with a larger mass than this is ultra-heavystatic final doubleMaximum weight for a ProtoMekstatic final doubleMinimum tonnage for a ProtoMekstatic final intMinimum walk MP for a quad ProtoMekFields inherited from class megamek.common.verifier.TestEntity
engine, structureFields inherited from interface megamek.common.verifier.TestEntityOption
CEIL_TARGETING_COMPUTER_CRITS, FLOOR_TARGETING_COMPUTER_CRITS, ROUND_TARGETING_COMPUTER_CRITS -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic intcalcEngineRating(int walkMP, double tonnage, boolean quadOrGlider) Computes the required engine ratingstatic intcalcEngineRating(ProtoMek proto) Computes the required engine ratingdoubleAccording to TM, unit weights are to be rounded up to the nearest half ton or kilo.booleancorrectArmor(StringBuffer buffer) Checks for exceeding the maximum number of armor points by location for the tonnage.booleancorrectEntity(StringBuffer buff, int ammoTechLvl) booleancorrectMovement(StringBuffer buffer) Checks whether the protoMek meets the minimum MP requirements for the configuration.booleancorrectWeight(StringBuffer buff) intintgetMinimumWalkMP(ProtoMek proto) Determine the minimum walk MP for the ProtoMek based on configurationgetName()doubledoubledoubledoubledoubledoubledoubledoubledoublebooleanbooleanCheck if the unit has combinations of equipment which are not allowed in the construction rules.booleanbooleanisAero()booleanisMek()booleanbooleanbooleanisTank()static booleanisValidProtoMekLocation(ProtoMek protoMek, EquipmentType eq, int location, StringBuffer buffer) static intmaxArmorFactor(double weight, boolean mainGun) Calculate the maximum armor factor based on weight and whether there is a main gun locationstatic intmaxArmorFactor(ProtoMek proto) Calculate the maximum armor factor based on weight and whether there is a main gun locationstatic intmaxArmorFactor(ProtoMek proto, int location) Determine the maximum amount of armor in a location based on unit weight.static intstatic intmaxSlotsByLocation(int loc, boolean quad, boolean ultra) Equipment slot limit by locationstatic intmaxSlotsByLocation(int loc, ProtoMek proto) Equipment slot limit by locationstatic doublemaxWeightByLocation(int loc, boolean quad, boolean ultra) The maximum total weight that can be mounted in a given location.static doublemaxWeightByLocation(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 booleanrequiresSlot(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, getTargetingComputerCrits, 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, showUnderweightEntity, 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:
getEntityin classTestEntity
-
isTank
public boolean isTank()- Specified by:
isTankin classTestEntity
-
isMek
public boolean isMek()- Specified by:
isMekin classTestEntity
-
isAero
public boolean isAero()- Specified by:
isAeroin classTestEntity
-
isSmallCraft
public boolean isSmallCraft()- Specified by:
isSmallCraftin classTestEntity
-
isAdvancedAerospace
public boolean isAdvancedAerospace()- Specified by:
isAdvancedAerospacein classTestEntity
-
isProtoMek
public boolean isProtoMek()- Specified by:
isProtoMekin classTestEntity
-
getWeightStructure
public double getWeightStructure()- Overrides:
getWeightStructurein classTestEntity
-
getWeightEngine
public double getWeightEngine()- Overrides:
getWeightEnginein classTestEntity
-
getWeightControls
public double getWeightControls()- Specified by:
getWeightControlsin classTestEntity
-
getWeightMisc
public double getWeightMisc()- Specified by:
getWeightMiscin classTestEntity
-
getWeightHeatSinks
public double getWeightHeatSinks()- Specified by:
getWeightHeatSinksin classTestEntity
-
hasDoubleHeatSinks
public boolean hasDoubleHeatSinks()- Specified by:
hasDoubleHeatSinksin classTestEntity
-
getCountHeatSinks
public int getCountHeatSinks()- Specified by:
getCountHeatSinksin classTestEntity
-
calculateWeight
public double calculateWeight()Description copied from class:TestEntityAccording to TM, unit weights are to be rounded up to the nearest half ton or kilo. This method returns the rounded weight.- Overrides:
calculateWeightin classTestEntity- Returns:
- The weight of the unit, rounded up according to TM, p.22.
-
getWeightAllocatedArmor
public double getWeightAllocatedArmor()- Overrides:
getWeightAllocatedArmorin classTestEntity
-
printWeightStructure
- Overrides:
printWeightStructurein classTestEntity
-
printWeightMisc
- Specified by:
printWeightMiscin classTestEntity
-
printWeightControls
- Specified by:
printWeightControlsin classTestEntity
-
printMiscEquip
- Overrides:
printMiscEquipin classTestEntity
-
printWeapon
- Overrides:
printWeaponin classTestEntity
-
printAmmo
- Overrides:
printAmmoin classTestEntity
-
getWeightCarryingSpace
public double getWeightCarryingSpace()- Overrides:
getWeightCarryingSpacein classTestEntity
-
correctEntity
- Specified by:
correctEntityin classTestEntity
-
correctWeight
- Overrides:
correctWeightin classTestEntity
-
hasIllegalEquipmentCombinations
Description copied from class:TestEntityCheck if the unit has combinations of equipment which are not allowed in the construction rules.- Overrides:
hasIllegalEquipmentCombinationsin 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:
printEntityin classTestEntity
-
getName
- Specified by:
getNamein classTestEntity
-
getWeightAmmo
public double getWeightAmmo()- Overrides:
getWeightAmmoin classTestEntity
-
getWeightPowerAmp
public double getWeightPowerAmp()- Specified by:
getWeightPowerAmpin 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
-