public String getArmorDesc() { StringBuffer sArmor = new StringBuffer(); double divisor = getDamageDivisor(); if (getCrew() != null) { if (hasAbility(OptionsConstants.MD_TSM_IMPLANT)) { if (getArmorKit() == null) { divisor = 0.5; if (hasAbility(OptionsConstants.MD_DERMAL_ARMOR)) { divisor++; if(isArmorEncumbering()) { sArmor.append("E"); if (hasSpaceSuit()) { sArmor.append(" (Spacesuit) "); if(hasDEST()) { sArmor.append(" (DEST) "); if(hasSneakCamo() || (getCrew() != null && hasAbility(OptionsConstants.MD_DERMAL_CAMO_ARMOR))) { sArmor.append(" (Camo) "); if(hasSneakIR()) { sArmor.append(" (IR) "); if(hasSneakECM()) {
if (inf.getSecondaryN() > max) { buff.append("Number of secondary weapons exceeds maximum of " + max).append("\n\n"); correct = false; if (inf.getSecondaryWeapon() != null) { int secondaryCrew = inf.getSecondaryWeapon().getCrew(); if (inf.getCrew() != null) { if (inf.hasAbility(OptionsConstants.MD_TSM_IMPLANT)) { secondaryCrew--; if (inf.hasAbility(OptionsConstants.MD_DERMAL_ARMOR)) { secondaryCrew--; if (secondaryCrew * inf.getSecondaryN() > inf.getSquadSize()) { buff.append("Secondary weapon crew requirement exceeds squad size.").append("\n\n"); correct = false; max = maxSquadSize(inf.getMovementMode(), inf.hasMicrolite() || (inf.getAllUMUCount() > 1)); if (inf.getSquadSize() > max) { buff.append("Maximum squad size is " + max + "\n\n"); correct = false; max = maxUnitSize(inf.getMovementMode(), inf.hasMicrolite() || (inf.getAllUMUCount() > 1), inf.hasSpecialization(Infantry.COMBAT_ENGINEERS | Infantry.MOUNTAIN_TROOPS)); if (inf.getShootingStrength() > max) { buff.append("Maximum platoon size is " + max + "\n\n"); correct = false;
/** * Returns true if this unit has anti-mek training. According to TM pg 155, * any unit that has less than 8 anti-mek skill is assumed to have anti-mek * training. This implies that the unit carries the requisite equipment for * properly performing anti-mek attacks (and the weight and cost that goes * along with that). * @return */ public boolean isAntiMekTrained() { // Anything below the antimech skill default is considered to be AM // trained. See TM pg 155 return getAntiMekSkill() < ANTI_MECH_SKILL_UNTRAINED; }
@Override public boolean doomedInVacuum() { if (getMovementMode() == EntityMovementMode.VTOL) { return true; } else { return !hasSpaceSuit(); } }
@Override public boolean isDmgHeavy() { return (((double)getInternal(LOC_INFANTRY) / getOInternal(LOC_INFANTRY)) < 0.5); }
public static int maxSecondaryWeapons(Infantry inf) { int max = 2; if (inf.getMovementMode() == EntityMovementMode.VTOL) { max = inf.hasMicrolite()?0 : 1; } else if (inf.getMovementMode() == EntityMovementMode.INF_UMU) { max = inf.getAllUMUCount(); } if (inf.hasSpecialization(Infantry.COMBAT_ENGINEERS)) { max = 0; } if (inf.hasSpecialization(Infantry.MOUNTAIN_TROOPS | Infantry.PARAMEDICS)) { max = 1; } if (inf.getCrew() != null) { if (inf.hasAbility(OptionsConstants.MD_DERMAL_ARMOR)) { max++; } if (inf.hasAbility(OptionsConstants.MD_TSM_IMPLANT)) { max++; } } return max; }
Infantry t = new Infantry(); t.setChassis(dataFile.getDataAsString("Name")[0]); t.setModel(dataFile.getDataAsString("Model")[0]); t.setSource(dataFile.getDataAsString("source")[0]); t.setSquadSize(dataFile.getDataAsInt("squad_size")[0]); if (!dataFile.exists("squadn")) { throw new EntityLoadingException("Could not find number of squads."); t.setSquadN(dataFile.getDataAsInt("squadn")[0]); t.autoSetInternal(); t.setDamageDivisor(dataFile.getDataAsInt("InfantryArmor")[0]); t.setMicrolite(sMotion.equalsIgnoreCase("microlite")); EntityMovementMode nMotion = EntityMovementMode.getMode(sMotion); if (nMotion == EntityMovementMode.NONE) { t.setMotorizedScuba(); } else { t.setMovementMode(nMotion); t.setSecondaryN(dataFile.getDataAsInt("secondn")[0]); t.setPrimaryWeapon((InfantryWeapon) ptype);
} else if (t instanceof Infantry) { Infantry infantry = (Infantry) t; blk.writeBlockData("squad_size", infantry.getSquadSize()); blk.writeBlockData("squadn", infantry.getSquadN()); if (infantry.getSecondaryN() > 0) { blk.writeBlockData("secondn", infantry.getSecondaryN()); if (null != infantry.getPrimaryWeapon()) { blk.writeBlockData("Primary", infantry.getPrimaryWeapon() .getInternalName()); if (null != infantry.getSecondaryWeapon()) { blk.writeBlockData("Secondary", infantry.getSecondaryWeapon() .getInternalName()); if (infantry.canMakeAntiMekAttacks()) { blk.writeBlockData("antimek", (infantry.getAntiMekSkill() + "")); EquipmentType et = infantry.getArmorKit(); if (et != null) { blk.writeBlockData("armorKit", et.getInternalName()); if (infantry.getDamageDivisor() != 1) { blk.writeBlockData("armordivisor", Double.toString(infantry.getDamageDivisor())); if (infantry.isArmorEncumbering()) { blk.writeBlockData("encumberingarmor", "true");
int number = ((Infantry)entity).getOInternal(Infantry.LOC_INFANTRY); if(((Infantry)entity).isMechanized()) { number = ((Infantry)entity).getSquadN(); EquipmentType eq = ((Infantry)entity).getArmorKit(); if (null != eq) { infantryArmor = new EquipmentPart(0, eq, 0, false, campaign); } else { infantryArmor = new InfantryArmorPart(0, campaign, ((Infantry)entity).getDamageDivisor(), ((Infantry)entity).isArmorEncumbering(), ((Infantry)entity).hasDEST(), ((Infantry)entity).hasSneakCamo(), ((Infantry)entity).hasSneakECM(), ((Infantry)entity).hasSneakIR(), ((Infantry)entity).hasSpaceSuit()); int number = ((Infantry)entity).getOInternal(Infantry.LOC_INFANTRY); while(number > 0) { infantryArmor = new InfantryArmorPart(0, campaign, ((Infantry)entity).getDamageDivisor(), ((Infantry)entity).isArmorEncumbering(), ((Infantry)entity).hasDEST(), ((Infantry)entity).hasSneakCamo(), ((Infantry)entity).hasSneakECM(), ((Infantry)entity).hasSneakIR(), ((Infantry)entity).hasSpaceSuit()); addPart(infantryArmor); partsToAdd.add(infantryArmor); InfantryWeapon primaryType = ((Infantry)entity).getPrimaryWeapon(); InfantryWeapon secondaryType = ((Infantry)entity).getSecondaryWeapon(); if(null == primaryW && null != primaryType) { int number = (((Infantry)entity).getSquadSize() - ((Infantry)entity).getSecondaryN()) * ((Infantry)entity).getSquadN(); while(number > 0) { primaryW = new InfantryWeaponPart((int)entity.getWeight(), primaryType, -1, campaign, true); int number = ((Infantry)entity).getSecondaryN() * ((Infantry)entity).getSquadN(); while(number > 0) { secondaryW = new InfantryWeaponPart((int)entity.getWeight(), secondaryType, -1, campaign, false);
addBasicData(inf); addEntityFluff(inf); setModelData("transportWeight", inf.getWeight()); setModelData("weaponPrimary", String.format("%d %s", (inf.getSquadSize() - inf.getSecondaryN()) * inf.getSquadN(), inf.getPrimaryWeapon().getName())); if (inf.getSecondaryWeapon() != null) { setModelData("weaponSecondary", String.format("%d %s", inf.getSecondaryN() * inf.getSquadN(), inf.getPrimaryWeapon().getName())); } else { setModelData("weaponSecondary", Messages.getString("TROView.None")); final EquipmentType armorKit = inf.getArmorKit(); if (null != armorKit) { setModelData("armorKit", armorKit.getName()); switch (inf.getMovementMode()) { case INF_LEG: setModelData("motiveType", Messages.getString("TROView.Foot")); case WHEELED: setModelData("motiveType", Messages.getString("TROView.Mechanized") + "/" + inf.getMovementModeAsString()); break; case SUBMARINE: break; default: setModelData("motiveType", inf.getMovementModeAsString()); break;
bvText.append(getChassis()); bvText.append(" "); bvText.append(getModel()); bvText.append("</b></CENTER>"); bvText.append(nl); dbr = men * 1.5 * getDamageDivisor(); int tmmRan = Compute.getTargetMovementModifier(getRunMP(false, true, true), false, false, game) .getValue(); final int jumpMP = getJumpMP(false); final int tmmJumped = (jumpMP > 0) ? Compute. getTargetMovementModifier(jumpMP, true, false, game).getValue() : 0; final int umuMP = getActiveUMUCount(); final int tmmUMU = (umuMP > 0) ? Compute. getTargetMovementModifier(umuMP, false, false, game).getValue() if(hasDEST()) { tmmFactor += 0.1; bvText.append(startRow); if(hasSneakCamo()) { tmmFactor += 0.2; bvText.append(startRow); if(hasSneakIR()) { tmmFactor += 0.2;
EquipmentType armor = getArmorKit(); if (armor != null) { armorcost = armor.getCost(this, false, LOC_INFANTRY); if(isArmorEncumbering()) { armorcost += 1600; } else { if(hasSneakCamo()) { nSneak++; if(hasSneakECM()) { nSneak++; if(hasSneakIR()) { nSneak++; if(hasDEST()) { armorcost += 50000; if(hasSpaceSuit()) { armorcost += 5000; if (isAntiMekTrained()) { multiplier = 1; switch (getMovementMode()){ case INF_UMU: multiplier *= getAllUMUCount() > 1? 2.5 : 2;
EquipmentType kit = inf.getArmorKit(); if (kit == null) { cbArmorKit.setSelectedIndex(0); cbArmorKit.setSelectedIndex(armorKits.indexOf(kit) + 1); fldDivisor.setText(Double.toString(inf.getDamageDivisor())); chEncumber.setSelected(inf.isArmorEncumbering()); chSpaceSuit.setSelected(inf.hasSpaceSuit()); chDEST.setSelected(inf.hasDEST()); chSneakCamo.setSelected(inf.hasSneakCamo()); chSneakIR.setSelected(inf.hasSneakIR()); chSneakECM.setSelected(inf.hasSneakECM()); armorStateChanged(); cbArmorKit.addActionListener(e -> { chSpecs.get(i).setSelected(inf.hasSpecialization(spec));
&& !(entity instanceof BattleArmor)) { Infantry inf = (Infantry) entity; if (inf.getDamageDivisor() != 1) { output.write("\" " + MULParser.ARMOR_DIVISOR + "=\""); output.write(inf.getDamageDivisor() + ""); if (inf.isArmorEncumbering()) { output.write("\" " + MULParser.ARMOR_ENC + "=\"1"); if (inf.hasSpaceSuit()) { output.write("\" " + MULParser.SPACESUIT + "=\"1"); if (inf.hasDEST()) { output.write("\" " + MULParser.DEST_ARMOR + "=\"1"); if (inf.hasSneakCamo()) { output.write("\" " + MULParser.SNEAK_CAMO + "=\"1"); if (inf.hasSneakIR()) { output.write("\" " + MULParser.SNEAK_IR + "=\"1"); if (inf.hasSneakECM()) { output.write("\" " + MULParser.SNEAK_ECM + "=\"1"); if (inf.getSpecializations() > 0) { output.write("\" " + MULParser.INF_SPEC + "=\""); output.write(inf.getSpecializations() + "");
int mp = getOriginalWalkMP(); if((getSecondaryN() > 1) && ((null == getCrew()) || !hasAbility(OptionsConstants.MD_TSM_IMPLANT)) && ((null == getCrew()) || !hasAbility(OptionsConstants.MD_DERMAL_ARMOR)) && (null != secondW) && secondW.hasFlag(WeaponType.F_INF_SUPPORT) && (getMovementMode() != EntityMovementMode.TRACKED) && (getMovementMode() != EntityMovementMode.INF_JUMP)) { mp = Math.max(mp - 1, 0); if((null != getCrew()) && hasAbility(OptionsConstants.MD_PL_MASC) && ((getMovementMode() == EntityMovementMode.INF_LEG) || (getMovementMode() == EntityMovementMode.INF_JUMP))) { mp += 1; if ((null != getCrew()) && hasAbility(OptionsConstants.INFANTRY_FOOT_CAV) && ((getMovementMode() == EntityMovementMode.INF_LEG) || (getMovementMode() == EntityMovementMode.INF_JUMP))) { mp += 1; if(hasActiveFieldArtillery()) { mp = applyGravityEffectsOnMP(mp);
@Override protected void addSystemTechAdvancement(CompositeTechLevel ctl) { super.addSystemTechAdvancement(ctl); ctl.addComponent(Infantry.getMotiveTechAdvancement(movementMode)); if (hasSpecialization(COMBAT_ENGINEERS)) { ctl.addComponent(Infantry.getCombatEngineerTA()); } if (hasSpecialization(MARINES)) { ctl.addComponent(Infantry.getMarineTA()); } if (hasSpecialization(MOUNTAIN_TROOPS)) { ctl.addComponent(Infantry.getMountainTA()); } if (hasSpecialization(PARATROOPS)) { ctl.addComponent(Infantry.getParatrooperTA()); } if (hasSpecialization(PARAMEDICS)) { ctl.addComponent(Infantry.getParamedicTA()); } if (hasSpecialization(TAG_TROOPS)) { ctl.addComponent(Infantry.getTAGTroopsTA()); } if (isAntiMekTrained()) { ctl.addComponent(Infantry.getAntiMekTA()); } }
setOriginalJumpMP(0); switch (getMovementMode()) { case INF_MOTORIZED: setOriginalWalkMP(3); break; case HOVER: setOriginalWalkMP(5); break; case TRACKED: setOriginalWalkMP(3); break; case WHEELED: setOriginalWalkMP(4); break; case SUBMARINE: setOriginalJumpMP(3); setOriginalWalkMP(0); setSpecializations(getSpecializations() | SCUBA); break; case VTOL: if (hasMicrolite()) { setOriginalJumpMP(6); } else { setOriginalJumpMP(5); setOriginalWalkMP(1); break; case INF_UMU: setOriginalJumpMP(1);
@Override public int getJumpMP(boolean gravity) { int mp = 0; if (getMovementMode() != EntityMovementMode.INF_UMU && getMovementMode() != EntityMovementMode.SUBMARINE) { mp = getOriginalJumpMP(); if ((getSecondaryN() > 1) && ((null == getCrew()) || !hasAbility(OptionsConstants.MD_TSM_IMPLANT)) && ((null == getCrew()) || !hasAbility(OptionsConstants.MD_DERMAL_ARMOR)) && (getMovementMode() != EntityMovementMode.SUBMARINE) && (null != secondW) && secondW.hasFlag(WeaponType.F_INF_SUPPORT)) { mp = Math.max(mp - 1, 0); } else if (movementMode.equals(EntityMovementMode.VTOL) && getSecondaryN() > 0) { mp = Math.max(mp - 1, 0); mp = applyGravityEffectsOnMP(mp);
Infantry infantry = (Infantry)newEntity; String chassis = "?"; switch (infantry.getMovementMode()) { case INF_UMU: chassis = "Scuba "; chassis = "Foot "; if(infantry.isSquad()) { chassis += "Squad"; } else { if(infantry.getSecondaryN() > 1 && null != infantry.getSecondaryWeapon()) { model = "(" + infantry.getSecondaryWeapon().getInternalName() + ")"; } else if(null != infantry.getPrimaryWeapon()) { model = "(" + infantry.getPrimaryWeapon().getInternalName() + ")";
astechs += 6; when(mockLaserPlatoon.getEntityType()).thenReturn(Entity.ETYPE_INFANTRY); when(mockLaserPlatoon.getUnitType()).thenCallRealMethod(); when(mockLaserPlatoon.getSquadSize()).thenReturn(7); when(mockLaserPlatoon.getSquadN()).thenReturn(4); when(mockLaserPlatoonUnit.getEntity()).thenReturn(mockLaserPlatoon); crew = new ArrayList<>(28); Crew mockLaserPlatoonCrew = mock(Crew.class); doReturn(mockInfantryGunnery.getLevel()).when(mockLaserPlatoonCrew).getGunnery(); when(mockLaserPlatoon.getCrew()).thenReturn(mockLaserPlatoonCrew); personnelList.addAll(infantryPersonnel);