/** * Returns how many of the given equipment are present in the mech, * destroyed or not. */ public int getNumberOf(EquipmentType etype) { int total = 0; for (Mounted m : equipmentList) { if (m.getType().equals(etype)) { total++; } } return total; }
/** * @return The <code>MiscType</code> for this armor. */ public EquipmentType getArmorEqType() { String name = EquipmentType.getArmorTypeName(type, isClan); return EquipmentType.get(name); } }
/** * Creates collections for all of the possible <code>WeaponType</code>s and * <code>EquipmentType</code>s. These are used to populate the weapons * and equipment tables. */ private void populateWeaponsAndEquipmentChoices() { Vector<WeaponType> weapons = new Vector<WeaponType>(); Vector<EquipmentType> equipment = new Vector<EquipmentType>(); for (Enumeration<EquipmentType> e = EquipmentType.getAllTypes(); e.hasMoreElements();) { EquipmentType et = e.nextElement(); if ((et instanceof WeaponType)) { weapons.add((WeaponType)et); //Check for C3+Tag and C3 Master Booster if (et.hasFlag(WeaponType.F_C3M) || et.hasFlag(WeaponType.F_C3MBS)) { equipment.add(et); } } if ((et instanceof MiscType)) { equipment.add(et); } } weaponsModel.setData(weapons); equipmentModel.setData(equipment); }
public static TechAdvancement getStructureTechAdvancement(int at, boolean clan) { if (at == T_STRUCTURE_STANDARD) { return TA_STANDARD_STRUCTURE; } String structureName = EquipmentType.getStructureTypeName(at, clan); EquipmentType structure = EquipmentType.get(structureName); if (structure != null) { return structure.getTechAdvancement(); } return TA_NONE; }
w.write("Type,Name,Tech Base,Rules,Tech Rating,Introduction Date,Extinction Date,Re-Introduction Date,Tonnage,Crits,Cost,BV,Alias"); w.newLine(); for (Enumeration<EquipmentType> e = EquipmentType.getAllTypes(); e .hasMoreElements();) { EquipmentType type = e.nextElement(); w.write(type.getName()); w.write(","); for (int year : type.getTechLevels().keySet()) { w.write(year + "-" + TechConstants.getTechName(type.getTechLevel(year))); for (int year : type.getTechLevels().keySet()) { w.write(year + "-" + TechConstants.getLevelName(type .getTechLevel(year))); w.write(type.getFullRatingName()); w.write(","); w.write(getEquipDateAsString(type.getIntroductionDate())); w.write(","); w.write(getEquipDateAsString(type.getExtinctionDate())); w.write(","); w.write(getEquipDateAsString(type.getReintroductionDate())); w.write(","); if (type.tonnage == EquipmentType.TONNAGE_VARIABLE) {
private int addBAEquipment() { final List<Map<String, Object>> equipment = new ArrayList<>(); final List<Map<String, Object>> modularEquipment = new ArrayList<>(); final String at = EquipmentType.getBaArmorTypeName(ba.getArmorType(BattleArmor.LOC_TROOPER_1), TechConstants.isClan(ba.getArmorTechLevel(BattleArmor.LOC_TROOPER_1))); final EquipmentType armor = EquipmentType.get(at); Map<String, Object> row = null; int nameWidth = 30; continue; if ((m.getType() instanceof MiscType) && m.getType().hasFlag(MiscType.F_BA_MANIPULATOR)) { continue; nameWidth = name.length() + 1; row.put("slots", m.getType().getCriticals(ba)); if (m.getType() instanceof AmmoType) { row.put("mass", ((AmmoType) m.getType()).getKgPerShot() * m.getOriginalShots()); } else { row.put("mass", m.getType().getTonnage(ba) * 1000);
private void stockWeaponsAmmoAndEquipment(Campaign c) { for (Enumeration<EquipmentType> e = EquipmentType.getAllTypes(); e.hasMoreElements();) { EquipmentType et = e.nextElement(); if(!et.isHittable() && !(et instanceof MiscType && ((MiscType)et).hasFlag(MiscType.F_BA_MANIPULATOR))) { continue; Part p = new JumpJet(ton, et, -1, false, c); parts.add(p); if (!et.hasFlag(MiscType.F_BA_EQUIPMENT)) { parts.add(new OmniPod(p, c)); parts.add(new JumpJet(ton, et, -1, true, c)); continue; } else if(et instanceof MiscType && ((MiscType)et).hasFlag(MiscType.F_MASC)) { if(et.hasSubType(MiscType.S_SUPERCHARGER)) { for(int rating = 10; rating <= 400; rating += 5) { for(double eton = 0.5; eton <= 10.5; eton += 0.5) { boolean poddable = !et.isOmniFixedOnly(); if (et instanceof MiscType) { poddable &= et.hasFlag(MiscType.F_MECH_EQUIPMENT) || et.hasFlag(MiscType.F_TANK_EQUIPMENT) || et.hasFlag(MiscType.F_FIGHTER_EQUIPMENT); } else if (et instanceof WeaponType) { poddable &= (et.hasFlag(WeaponType.F_MECH_WEAPON) || et.hasFlag(Weapon.F_TANK_WEAPON) || et.hasFlag(WeaponType.F_AERO_WEAPON)) && !((WeaponType) et).isCapital();
private void stockArmor(Campaign c) { int amount; for (int at = 0; at < EquipmentType.armorNames.length; at++) { String name = EquipmentType.getArmorTypeName(at, false); EquipmentType is = EquipmentType.get(name); if (null != is) { if (is.hasFlag(MiscType.F_BA_EQUIPMENT)) { amount = (int)(5 * BaArmor.getPointsPerTon(at, false)); parts.add(new BaArmor(0, amount, at, -1, false, c)); } else { amount = (int)(5.0 * 16.0 * EquipmentType.getArmorPointMultiplier(at, false)); parts.add(new Armor(0, at, amount, -1, false, false, c)); name = EquipmentType.getArmorTypeName(at, true); EquipmentType clan = EquipmentType.get(name); if ((null != clan) && (is != clan)) { if (clan.hasFlag(MiscType.F_BA_EQUIPMENT)) { amount = (int)(5 * BaArmor.getPointsPerTon(at, true)); parts.add(new BaArmor(0, amount, at, -1, true, c)); } else { amount = (int)(5.0 * 16.0 * EquipmentType.getArmorPointMultiplier(at, true)); parts.add(new Armor(0, at, amount, -1, false, true, c));
continue; String name = EquipmentType.getArmorTypeName(at, techManager.useClanTechBase()); EquipmentType eq = EquipmentType.get(name); if ((null != eq) && eq.hasFlag(MiscType.F_MECH_EQUIPMENT) && techManager.isLegal(eq) && (!isLam || (eq.getCriticals(null) == 0)) && (!industrialOnly || ((MiscType)eq).isIndustrial())) { retVal.add(eq); name = EquipmentType.getArmorTypeName(at, !techManager.useClanTechBase()); EquipmentType eq2 = EquipmentType.get(name); if ((null != eq2) && (eq != eq2) && eq2.hasFlag(MiscType.F_MECH_EQUIPMENT) && techManager.isLegal(eq2) && (!isLam || (eq2.getCriticals(null) == 0)) && (!industrialOnly || ((null != eq) && ((MiscType)eq).isIndustrial()))) { retVal.add(eq2);
public void setStructureType(String strucType) { if (!(strucType.startsWith("Clan ") || strucType.startsWith("IS "))) { strucType = isClan() ? "Clan " + strucType : "IS " + strucType; } EquipmentType et = EquipmentType.get(strucType); setStructureType(EquipmentType.getStructureType(et)); if (et == null) { structureTechLevel = TechConstants.T_TECH_UNKNOWN; } else { structureTechLevel = et.getTechLevel(year); // TODO: Is this needed? WTF is the point of it? if (et.getCriticals(this) == 0) { try { this.addEquipment(et, LOC_NONE); } catch (LocationFullException e) { // can't happen e.printStackTrace(); } } } recalculateTechAdvancement(); }
manipulators.add(formatManipulatorRow(BattleArmor.MOUNT_LOC_RARM, ba.getRightManipulator())); setModelData("manipulators", manipulators); final String armorName = EquipmentType.getArmorTypeName(ba.getArmorType(BattleArmor.LOC_TROOPER_1), TechConstants.isClan(ba.getArmorTechLevel(BattleArmor.LOC_TROOPER_1))); final EquipmentType armor = EquipmentType.get(armorName); setModelData("armorType", armor.getName().replaceAll("^BA\\s+", "")); setModelData("armorSlots", armor.getCriticals(ba)); setModelData("armorMass", testBA.getWeightArmor() * 1000); setModelData("armorValue", ba.getOArmor(BattleArmor.LOC_TROOPER_1));
public static List<EquipmentType> allJJs(boolean industrialOnly) { List<EquipmentType> retVal = new ArrayList<>(); for (MechJumpJets jj : values()) { if (jj.industrial || !industrialOnly) { retVal.add(EquipmentType.get(jj.internalName)); } } return retVal; }
public void setArmorType(String armType, int loc) { if (!(armType.startsWith("Clan ") || armType.startsWith("IS "))) { armType = TechConstants.isClan(getArmorTechLevel(0)) ? "Clan " + armType : "IS " + armType; } EquipmentType et = EquipmentType.get(armType); if (et == null) { setArmorType(EquipmentType.T_ARMOR_UNKNOWN, loc); } else { setArmorType(EquipmentType.getArmorType(et), loc); // TODO: Is this needed? WTF is the point of it? if (et.getCriticals(this) == 0) { try { this.addEquipment(et, LOC_NONE); } catch (LocationFullException e) { // can't happen e.printStackTrace(); } } } recalculateTechAdvancement(); }
w.write("Type,Tech Base,Rules,Name,Aliases"); w.newLine(); for (Enumeration<EquipmentType> e = EquipmentType.getAllTypes(); e .hasMoreElements();) { EquipmentType type = e.nextElement(); w.write("M,"); for (int year : type.getTechLevels().keySet()) { w.write(year + "-" + TechConstants.getTechName(type.getTechLevel(year))); for (int year : type.getTechLevels().keySet()) { w.write(year + "-" + TechConstants.getLevelName(type .getTechLevel(year))); for (Enumeration<String> names = type.getNames(); names .hasMoreElements();) { String name = names.nextElement();
varCost = type.getCost(en, isArmored, getLocation()); } else if (type instanceof MiscType) { if (type.hasFlag(MiscType.F_DRONE_CARRIER_CONTROL)) { varCost = getTonnage() * 10000; } else if (type.hasFlag(MiscType.F_OFF_ROAD)) { varCost = 10 * getTonnage() * getTonnage(); } else if (type.hasFlag(MiscType.F_FLOTATION_HULL) || type.hasFlag(MiscType.F_VACUUM_PROTECTION) || type.hasFlag(MiscType.F_ENVIRONMENTAL_SEALING) || type.hasFlag(MiscType.F_OFF_ROAD)) { } else if (type.hasFlag(MiscType.F_LIMITED_AMPHIBIOUS) || type.hasFlag((MiscType.F_FULLY_AMPHIBIOUS))) { varCost = getTonnage() * 10000; } else if (type.hasFlag(MiscType.F_DUNE_BUGGY)) { varCost = 10 * getTonnage() * getTonnage(); } else if (type.hasFlag(MiscType.F_MASC) && type.hasFlag(MiscType.F_BA_EQUIPMENT)) { } else if (type.hasFlag(MiscType.F_HEAD_TURRET) || type.hasFlag(MiscType.F_SHOULDER_TURRET) || type.hasFlag(MiscType.F_QUAD_TURRET)) { varCost = getTonnage() * 10000; } else if (type.hasFlag(MiscType.F_SPONSON_TURRET)) { varCost = getTonnage() * 4000; } else if (type.hasFlag(MiscType.F_PINTLE_TURRET)) { varCost = getTonnage() * 1000; } else if (type.hasFlag(MiscType.F_ARMORED_MOTIVE_SYSTEM)) { } else if (type.hasFlag(MiscType.F_JET_BOOSTER)) { } else if (type.hasFlag(MiscType.F_DRONE_OPERATING_SYSTEM)) { varCost = (getTonnage() * 10000) + 5000; } else if (type.hasFlag(MiscType.F_TARGCOMP)) { varCost = getTonnage() * 10000; } else if (type.hasFlag(MiscType.F_CLUB) && (type.hasSubType(MiscType.S_HATCHET) || type.hasSubType(MiscType.S_MACE_THB))) {
@Override public long getStickerPrice() { //always in 5-ton increments return (long)(5 * EquipmentType.getArmorCost(type)); }
public double getArmorPointsPerTon() { //if(null != unit) { // armor is checked for in 5-ton increments //int armorType = unit.getEntity().getArmorType(location); double armorPerTon = 16.0 * EquipmentType.getArmorPointMultiplier(type, clan); if (type == EquipmentType.T_ARMOR_HARDENED) { armorPerTon = 8.0; } return armorPerTon; //} //return 0.0; }
public static String getBaArmorTypeName(int armorType, boolean clan) { return getArmorTypeName(armorType, clan); }
&& (m.getLinkedBy() != null) && m.getLinkedBy().getType() .hasFlag(WeaponType.F_ONESHOT)) { continue; if ((m.getType().getCriticals(entity) == 0) && !((m.getType() instanceof InfantryWeapon) && !m.isAPMMounted())) { .hasFlag(MiscType.F_DETACHABLE_WEAPON_PACK)) || ((m.getLinkedBy() != null) && m.getLinkedBy() .getType() .hasFlag(MiscType.F_DETACHABLE_WEAPON_PACK))) { continue;
public static String chooseWeaponSpecialization(int type, boolean isClan, int techLvl, int year) { ArrayList<String> candidates = new ArrayList<String>(); for (Enumeration<EquipmentType> e = EquipmentType.getAllTypes(); e.hasMoreElements();) { EquipmentType et = e.nextElement(); if(!(et instanceof WeaponType)) { candidates.add(et.getName()); ntimes--;