private static void createMediumBattleLance() { FormationType ft = new FormationType("Medium Battle", "Battle"); ft.allowedUnitTypes = FLAG_GROUND_NO_LIGHT; ft.maxWeightClass = EntityWeightClass.WEIGHT_HEAVY; ft.otherCriteria.add(new PercentConstraint(0.5, ms -> ms.getWeightClass() == EntityWeightClass.WEIGHT_MEDIUM, "Medium")); ft.groupingCriteria = new GroupingConstraint(FLAG_VEHICLE, 2, 2, ms -> ms.getWeightClass() == EntityWeightClass.WEIGHT_MEDIUM, FormationType::checkUnitMatch, "Same model, Medium"); allFormationTypes.put(ft.name, ft); }
private static void createHeavyBattleLance() { FormationType ft = new FormationType("Heavy Battle", "Battle"); ft.allowedUnitTypes = FLAG_GROUND_NO_LIGHT; ft.minWeightClass = EntityWeightClass.WEIGHT_MEDIUM; ft.otherCriteria.add(new PercentConstraint(0.5, ms -> ms.getWeightClass() >= EntityWeightClass.WEIGHT_HEAVY, "Heavy+")); ft.groupingCriteria = new GroupingConstraint(FLAG_VEHICLE, 2, 2, ms -> ms.getWeightClass() >= EntityWeightClass.WEIGHT_HEAVY, FormationType::checkUnitMatch, "Same model, Heavy+"); allFormationTypes.put(ft.name, ft); }
private static void createBerserkerLance() { FormationType ft = new FormationType("Berserker/Close", "Battle"); ft.allowedUnitTypes = FLAG_MEK | FLAG_PROTOMEK; ft.idealRole = UnitRole.BRAWLER; ft.otherCriteria.add(new PercentConstraint(0.5, ms -> ms.getWeightClass() >= EntityWeightClass.WEIGHT_HEAVY, "Heavy+")); ft.otherCriteria.add(new CountConstraint(3, ms -> EnumSet.of(UnitRole.BRAWLER, UnitRole.SNIPER, UnitRole.SKIRMISHER) .contains(UnitRoleHandler.getRoleFor(ms)), "Brawler, Sniper, Skirmisher")); allFormationTypes.put(ft.name, ft); }
private static void createDirectFireLance() { FormationType ft = new FormationType("Direct Fire", "Fire"); ft.allowedUnitTypes = FLAG_GROUND_NO_LIGHT; ft.mainCriteria = ms -> getDamageAtRange(ms, 18) >= 10; ft.mainDescription = "Damage 10 at range 18"; ft.otherCriteria.add(new CountConstraint(2, ms -> ms.getWeightClass() >= EntityWeightClass.WEIGHT_HEAVY, "Heavy+")); ft.reportMetrics.put("Damage @ 18", ms -> getDamageAtRange(ms, 18)); allFormationTypes.put(ft.name, ft); }
private static void createBattleLance() { FormationType ft = new FormationType("Battle"); ft.allowedUnitTypes = FLAG_GROUND_NO_LIGHT; ft.idealRole = UnitRole.BRAWLER; ft.otherCriteria.add(new PercentConstraint(0.5, ms -> ms.getWeightClass() >= EntityWeightClass.WEIGHT_HEAVY, "Heavy+")); ft.otherCriteria.add(new CountConstraint(3, ms -> EnumSet.of(UnitRole.BRAWLER, UnitRole.SNIPER, UnitRole.SKIRMISHER) .contains(UnitRoleHandler.getRoleFor(ms)), "Brawler, Sniper, Skirmisher")); ft.groupingCriteria = new GroupingConstraint(FLAG_VEHICLE, 2, 2, ms -> ms.getWeightClass() == EntityWeightClass.WEIGHT_HEAVY, FormationType::checkUnitMatch, "Same model, Heavy"); allFormationTypes.put(ft.name, ft); }
private static void createSecurityLance() { FormationType ft = new FormationType("Security"); ft.allowedUnitTypes = FLAG_GROUND; ft.otherCriteria.add(new CountConstraint(1, ms -> EnumSet.of(UnitRole.SCOUT, UnitRole.STRIKER).contains(UnitRoleHandler.getRoleFor(ms)), "Scout, Striker")); ft.otherCriteria.add(new CountConstraint(1, ms -> EnumSet.of(UnitRole.SNIPER, UnitRole.MISSILE_BOAT).contains(UnitRoleHandler.getRoleFor(ms)), "Sniper, Missile Boat")); ft.otherCriteria.add(new MaxCountConstraint(1, ms -> ms.getWeightClass() >= EntityWeightClass.WEIGHT_ASSAULT, "Not assault")); allFormationTypes.put(ft.name, ft); }
private static void createLightBattleLance() { FormationType ft = new FormationType("Light Battle", "Battle"); ft.allowedUnitTypes = FLAG_GROUND; ft.maxWeightClass = EntityWeightClass.WEIGHT_HEAVY; ft.otherCriteria.add(new PercentConstraint(0.75, ms -> ms.getWeightClass() == EntityWeightClass.WEIGHT_LIGHT, "Light")); ft.otherCriteria.add(new CountConstraint(1, ms -> UnitRoleHandler.getRoleFor(ms).equals(UnitRole.SCOUT), "Scout")); ft.groupingCriteria = new GroupingConstraint(FLAG_VEHICLE, 2, 2, ms -> ms.getWeightClass() == EntityWeightClass.WEIGHT_LIGHT, FormationType::checkUnitMatch, "Same model, Light"); allFormationTypes.put(ft.name, ft); }
private static void createRifleLance() { FormationType ft = new FormationType("Rifle", "Battle"); ft.allowedUnitTypes = FLAG_GROUND_NO_LIGHT; ft.exclusiveFaction = "FS"; ft.minWeightClass = EntityWeightClass.WEIGHT_MEDIUM; ft.mainCriteria = ms -> ms.getWalkMp() >= 4; ft.mainDescription = "Walk/Cruise 4+"; ft.otherCriteria.add(new PercentConstraint(0.75, ms -> ms.getWeightClass() <= EntityWeightClass.WEIGHT_HEAVY, "Medium, Heavy")); ft.otherCriteria.add(new PercentConstraint(0.5, ms -> ms.getEquipmentNames().stream().map(name -> EquipmentType.get(name)) .anyMatch(eq -> eq instanceof ACWeapon || eq instanceof LBXACWeapon || eq instanceof UACWeapon), //UAC includes RAC "AC weapon")); ft.reportMetrics.put("AC", ms -> ft.otherCriteria.get(1).criterion.test(ms)); allFormationTypes.put(ft.name, ft); }
private static void createHeavyStrikerCavalryLance() { FormationType ft = new FormationType("Heavy Striker/Cavalry", "Striker/Cavalry"); ft.allowedUnitTypes = FLAG_GROUND_NO_LIGHT; ft.minWeightClass = EntityWeightClass.WEIGHT_MEDIUM; ft.mainCriteria = ms -> ms.getWalkMp() >= 4; ft.mainDescription = "Walk/Cruise 4+"; ft.otherCriteria.add(new CountConstraint(3, ms -> ms.getWeightClass() >= EntityWeightClass.WEIGHT_HEAVY, "Heavy+")); ft.otherCriteria.add(new CountConstraint(2, ms -> EnumSet.of(UnitRole.STRIKER, UnitRole.SKIRMISHER).contains(UnitRoleHandler.getRoleFor(ms)), "Striker, Skirmisher")); ft.otherCriteria.add(new CountConstraint(1, ms -> getSingleWeaponDamageAtRange(ms, 18) >= 5, "Weapon with damage 5+ at range 18")); ft.reportMetrics.put("Damage @ 18", ms -> getSingleWeaponDamageAtRange(ms, 18)); allFormationTypes.put(ft.name, ft); }
private static void createHeavyReconLance() { FormationType ft = new FormationType("Heavy Recon", "Recon"); ft.allowedUnitTypes = FLAG_GROUND_NO_LIGHT; ft.mainCriteria = ms -> ms.getWalkMp() >= 4; ft.mainDescription = "Walk/Cruise 4+"; ft.otherCriteria.add(new CountConstraint(2, ms -> ms.getWalkMp() >= 5, "Walk/Cruise 5+")); ft.otherCriteria.add(new CountConstraint(2, ms -> UnitRoleHandler.getRoleFor(ms).equals(UnitRole.SCOUT), "Scout")); ft.otherCriteria.add(new CountConstraint(1, ms -> ms.getWeightClass() >= EntityWeightClass.WEIGHT_HEAVY, "Heavy+")); allFormationTypes.put(ft.name, ft); }
private static void createFastAssaultLance() { FormationType ft = new FormationType("Fast Assault", "Assault"); ft.allowedUnitTypes = FLAG_GROUND_NO_LIGHT; ft.minWeightClass = EntityWeightClass.WEIGHT_MEDIUM; ft.mainCriteria = ms -> ms.getTotalArmor() >= 135 && (ms.getWalkMp() >= 5 || ms.getJumpMp() > 0); ft.mainDescription = "Walk 5+ or Jump 1+"; ft.otherCriteria.add(new PercentConstraint(0.75, ms -> getDamageAtRange(ms, 7) >= 25, "Damage 25+ at range 7")); ft.otherCriteria.add(new CountConstraint(3, ms -> ms.getWeightClass() >= EntityWeightClass.WEIGHT_HEAVY, "Heavy+")); //FIXME: The actual requirement is one juggernaut or two snipers; there needs to be // a way to combine constraints with ||. ft.otherCriteria.add(new CountConstraint(2, ms -> EnumSet.of(UnitRole.JUGGERNAUT, UnitRole.SNIPER).contains(UnitRoleHandler.getRoleFor(ms)), "Juggernaut or Sniper")); ft.reportMetrics.put("Damage @ 7", ms -> getDamageAtRange(ms, 7)); allFormationTypes.put(ft.name, ft); }
|| ms.getWeightClass() < minWeightClass || ms.getWeightClass() > maxWeightClass) { return false;
ideal.add(ms); if (ms.getWeightClass() >= minWeightClass && ms.getWeightClass() <= maxWeightClass) { weight.add(ms); + EntityWeightClass.getClassName(ms.getWeightClass())) .collect(Collectors.joining("<br/>\n "))).append("<br/><br/>\n"); } else {
private static void createAssaultLance() { FormationType ft = new FormationType("Assault"); ft.allowedUnitTypes = FLAG_GROUND_NO_LIGHT; ft.idealRole = UnitRole.JUGGERNAUT; ft.minWeightClass = EntityWeightClass.WEIGHT_MEDIUM; ft.mainCriteria = ms -> ms.getTotalArmor() >= 135; ft.mainDescription = "Armor 135+"; ft.otherCriteria.add(new PercentConstraint(0.75, ms -> getDamageAtRange(ms, 7) >= 25, "25 damage at range 7")); ft.otherCriteria.add(new CountConstraint(3, ms -> ms.getWeightClass() >= EntityWeightClass.WEIGHT_HEAVY, "Heavy+")); Constraint c = new CountConstraint(1, ms -> UnitRoleHandler.getRoleFor(ms).equals(UnitRole.JUGGERNAUT), "Juggernaut"); c.setPairedWithNext(true); ft.otherCriteria.add(c); c = new CountConstraint(2, ms -> UnitRoleHandler.getRoleFor(ms).equals(UnitRole.SNIPER), "Sniper"); c.setPairedWithPrevious(true); ft.otherCriteria.add(c); ft.reportMetrics.put("Armor", ms -> ms.getTotalArmor()); ft.reportMetrics.put("Damage @ 7", ms -> getDamageAtRange(ms, 7)); allFormationTypes.put(ft.name, ft); }
((nClass == EntityWeightClass.SIZE) || (mech.getWeightClass() == nClass)) &&
@Override public boolean include(Entry<? extends MechTableModel, ? extends Integer> entry) { MechTableModel mechModel = entry.getModel(); MechSummary mech = mechModel.getMechSummary(entry.getIdentifier()); ITechnology tech = UnitTechProgression.getProgression(mech, campaign.getTechFaction(), true); if ( /*year limits*/ (!campaign.getCampaignOptions().limitByYear() || mech.getYear() <= year) && /*Clan/IS limits*/ (campaign.getCampaignOptions().allowClanPurchases() || !TechConstants.isClan(mech.getType())) && (campaign.getCampaignOptions().allowISPurchases() || TechConstants.isClan(mech.getType())) && /* Canon */ (mech.isCanon() || !campaign.getCampaignOptions().allowCanonOnly()) && /* Weight */ (mech.getWeightClass() == nClass || nClass == EntityWeightClass.SIZE) && /* Technology Level */ (null != tech) && campaign.isLegal(tech) && /*Unit type*/ (nUnit == UnitType.SIZE || mech.getUnitType().equals(UnitType.getTypeName(nUnit))) && (searchFilter==null || MechSearchFilter.isMatch(mech, searchFilter))) { if(txtFilter.getText().length() > 0) { String text = txtFilter.getText(); return mech.getName().toLowerCase().contains(text.toLowerCase()); } return true; } return false; } };
private void stockBattleArmorSuits(Campaign c) { //this is just a test for(MechSummary summary : MechSummaryCache.getInstance().getAllMechs()) { if(!summary.getUnitType().equals("BattleArmor")) { continue; } //FIXME: I can't pull entity movement mode and quad shape off of mechsummary //try loading the full entity, but this might take too long if(null != summary) { Entity newEntity = null; try { newEntity = new MechFileParser(summary.getSourceFile(), summary.getEntryName()).getEntity(); } catch (EntityLoadingException e) { e.printStackTrace(); } if(null != newEntity) { BattleArmorSuit ba = new BattleArmorSuit(summary.getChassis(), summary.getModel(), (int)summary.getTons(), 1, summary.getWeightClass(), summary.getWalkMp(), summary.getJumpMp(), newEntity.entityIsQuad(), summary.isClan(), newEntity.getMovementMode(), c); parts.add(ba); } } } }
ammoRequirement = ammoBV / totalBV; weightClass = ms.getWeightClass(); if (weightClass >= EntityWeightClass.WEIGHT_SMALL_SUPPORT) { if (ms.getTons() <= 39) {
MechSummary ms = MechSummaryCache.getInstance().getMech(mech); if (null != ms && (p.isFounder() || ms.getWeightClass() < megamek.common.EntityWeightClass.WEIGHT_ASSAULT)) { p.setOriginalUnitWeight(ms.getWeightClass()); if (ms.isClan()) { p.setOriginalUnitTech(2);
offers.add(new MarketOffer(market, unitType, ms.getWeightClass(), ms, pct));