Package megamek.common.verifier
Class TestInfantry
java.lang.Object
megamek.common.verifier.TestEntity
megamek.common.verifier.TestInfantry
- All Implemented Interfaces:
TestEntityOption
-
Field Summary
Fields inherited from class megamek.common.verifier.TestEntity
engine, fileString, structureFields inherited from interface megamek.common.verifier.TestEntityOption
CEIL_TARGETING_COMPUTER_CRITS, FLOOR_TARGETING_COMPUTER_CRITS, ROUND_TARGETING_COMPUTER_CRITS -
Constructor Summary
ConstructorsConstructorDescriptionTestInfantry(ConvInfantry infantry, TestEntityOption option, String fileString) -
Method Summary
Modifier and TypeMethodDescriptionstatic voidadaptAntiMekAttacks(ConvInfantry infantry) doubleAccording 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.booleancorrectEntity(StringBuffer buff, int ammoTechLvl) static intfieldGunCrewRequirement(EquipmentType equip, Infantry infantry) Returns the number of troopers of the given infantry required to operate each of the given field gun equipment.intgetName()static doublegetWeight(ConvInfantry infantry) Calculates the weight of the given Conventional Infantry unit.doubledoubledoublestatic doublegetWeightExact(ConvInfantry infantry, CalculationReport report) Calculates the weight of the given Conventional Infantry unit.doubledoubledoubledoublebooleanstatic booleanReturns true if glider wings are installed on non-foot infantry.static booleanhasInvalidWingsConfiguration(ConvInfantry infantry) Returns true if both glider wings and powered flight wings are enabled.booleanReturns true if powered flight wings are installed on non-foot infantry.booleanbooleanisAero()static booleanisFieldArtilleryType(EquipmentType equipmentType) static booleanisFieldArtilleryWeapon(Mounted<?> mounted) booleanisMek()booleanbooleanbooleanisTank()static intstatic intmaxSquadCount(EntityMovementMode movementMode, boolean alt, int specialization, InfantryMount mount) The maximum number of squads in a platoon based on its movement mode.static intmaxSquadSize(EntityMovementMode movementMode, boolean alt, InfantryMount mount) Maximum squad size based on motive typestatic intmaxUnitSize(EntityMovementMode movementMode, boolean alt, boolean engOrMountain, InfantryMount mount) static voidremoveAntiMekAttack(Infantry unit, EquipmentType antiMekType) static voidremoveAntiMekAttacks(Infantry unit) Methods inherited from class megamek.common.verifier.TestEntity
calcHeatNeutralHSRequirement, calcMiscCrits, calculateWeight, ceil, ceilMaxHalf, correctArmorOverAllocation, correctEntity, correctWeight, correctWeight, eqRequiresLocation, equipmentCrewRequirements, floor, getArmoredComponentWeight, getArmorPoints, getArmorPoints, getArmorPointsPerTon, getEntityVerifier, getGameYear, getIntroYearMargin, getLocationAbbr, getMaximumArmorPoints, getMaxOverweight, getMinUnderweight, getMPBoosters, getPrintSize, getRawArmorPoints, getRawWeightArmor, getSIBonusArmorPoints, getSystemWideLocation, getTargetingComputerCrits, getTotalOArmor, getWeight, getWeightAllocatedArmor, getWeightAmmo, getWeightArmor, getWeightCarryingSpace, getWeightCeilingArmor, getWeightCeilingControls, getWeightCeilingEngine, getWeightCeilingGyro, getWeightCeilingLifting, getWeightCeilingPowerAmp, getWeightCeilingStructure, getWeightCeilingTargComp, getWeightCeilingTurret, getWeightCeilingWeapons, getWeightMiscEquip, getWeightWeapon, hasFailedEquipment, hasIllegalEquipmentCombinations, hasIllegalTechLevels, hasIllegalTechLevels, hasIncorrectIntroYear, heatNeutralHSRequirement, ignoreFailedEquip, includeMiscEquip, isClan, isClanArmor, isValidLocation, isWeightCorrect, legalArmorsFor, printAmmo, printAmmo, printAmmo, printArmorLocation, printArmorPlacement, printFailedEquipment, printLocations, printMiscEquip, printMiscEquip, printMiscEquip, printShortMovement, printSource, printTechLevel, printWeapon, printWeapon, printWeapon, printWeightCarryingSpace, printWeightEngine, printWeightHeatSinks, round, setGameYear, setPrecision, showCorrectArmor, showCorrectCritical, showFailedEquip, showIncorrectIntroYear, showOverweightedEntity, showUnderweightEntity, skip, totalCritSlotCount, usesKgStandard, validJumpJets
-
Constructor Details
-
TestInfantry
-
-
Method Details
-
hasInvalidWingsConfiguration
Returns true if both glider wings and powered flight wings are enabled. Per IO:AE 3rd p.79, these are mutually exclusive - a trooper cannot have both.- Parameters:
infantry- The conventional infantry to check- Returns:
- true if invalid configuration (both wing types enabled)
-
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
-
getWeightControls
public double getWeightControls()- Specified by:
getWeightControlsin classTestEntity
-
getWeightMisc
public double getWeightMisc()- Specified by:
getWeightMiscin classTestEntity
-
getWeightHeatSinks
public double getWeightHeatSinks()- Specified by:
getWeightHeatSinksin classTestEntity
-
getWeightEngine
public double getWeightEngine()- Overrides:
getWeightEnginein classTestEntity
-
getWeightStructure
public double getWeightStructure()- Overrides:
getWeightStructurein classTestEntity
-
getWeightArmor
public double getWeightArmor()- Overrides:
getWeightArmorin classTestEntity
-
hasDoubleHeatSinks
public boolean hasDoubleHeatSinks()- Specified by:
hasDoubleHeatSinksin classTestEntity
-
getCountHeatSinks
public int getCountHeatSinks()- Specified by:
getCountHeatSinksin classTestEntity
-
printWeightMisc
- Specified by:
printWeightMiscin classTestEntity
-
printWeightControls
- Specified by:
printWeightControlsin classTestEntity
-
printWeightStructure
- Overrides:
printWeightStructurein classTestEntity
-
printWeightArmor
- Overrides:
printWeightArmorin classTestEntity
-
correctEntity
- Specified by:
correctEntityin classTestEntity
-
isFieldArtilleryType
- Returns:
- True if the given equipment type is suitable as a field artillery weapon for a conventional infantry unit; false for a null equipment type.
-
isFieldArtilleryWeapon
- Returns:
- True if the given equipment is suitable as a field artillery weapon for a conventional infantry unit; false for a null equipment.
-
hasGliderWingsOnInvalidInfantryType
Returns true if glider wings are installed on non-foot infantry. Per IO p.85 and confirmed by the rules team, glider wings can only be used by foot infantry - motorized, mechanized, and beast-mounted infantry cannot use them.- Returns:
- true if invalid configuration (glider wings on non-foot infantry)
-
hasPoweredFlightWingsOnInvalidInfantryType
Returns true if powered flight wings are installed on non-foot infantry. Per IO p.85, powered flight wings can only be used by foot infantry - motorized, mechanized, and beast-mounted infantry cannot use them.- Returns:
- true if invalid configuration (powered flight wings on non-foot infantry)
-
fieldGunCrewRequirement
Returns the number of troopers of the given infantry required to operate each of the given field gun equipment. Neither parameter is checked for correctness. The returned result is never 0.- Parameters:
equip- The weapon type to be used as a field guninfantry- The infantry unit- Returns:
- The troopers required to operate the field gun
-
maxSecondaryWeapons
-
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 modealt- 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.
-
maxSquadCount
public static int maxSquadCount(EntityMovementMode movementMode, boolean alt, int specialization, @Nullable InfantryMount mount) The maximum number of squads in a platoon based on its movement mode.- Parameters:
movementMode- The platoon's movement modealt- True indicates that VTOL is microlite and INF_UMU is motorized.specialization- The infantry's specialization, if any.mount- The mount if the unit is beast-mounted, otherwise null.- Returns:
- The maximum number of squads/creatures per platoon.
-
maxUnitSize
public static int maxUnitSize(EntityMovementMode movementMode, boolean alt, boolean engOrMountain, InfantryMount mount) -
printEntity
- Specified by:
printEntityin classTestEntity
-
printWeightCalculation
- Overrides:
printWeightCalculationin classTestEntity
-
getName
- Specified by:
getNamein classTestEntity
-
getWeightPowerAmp
public double getWeightPowerAmp()- Specified by:
getWeightPowerAmpin classTestEntity
-
calculateWeightExact
public double calculateWeightExact()Description copied from class:TestEntityAccording 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:
calculateWeightExactin classTestEntity- Returns:
- The unrounded weight of the unit.
-
getWeight
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
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 infantryreport- A CalculationReport to fill in- Returns:
- The exact weight in tons
-
adaptAntiMekAttacks
-
removeAntiMekAttacks
-
removeAntiMekAttack
-