private static void createHammerLance() { FormationType ft = new FormationType("Hammer", "Striker/Cavalry"); ft.allowedUnitTypes = FLAG_GROUND; ft.exclusiveFaction = "FWL"; ft.idealRole = UnitRole.STRIKER; ft.mainCriteria = ms -> ms.getWalkMp() >= 5; ft.mainDescription = "Walk/Cruise 5+"; allFormationTypes.put(ft.name, ft); }
private static void createReconLance() { FormationType ft = new FormationType("Recon"); ft.allowedUnitTypes = FLAG_GROUND; ft.idealRole = UnitRole.SCOUT; ft.mainCriteria = ms -> ms.getWalkMp() >= 5; ft.mainDescription = "Walk/Cruise 5+"; ft.otherCriteria.add(new CountConstraint(2, ms -> EnumSet.of(UnitRole.SCOUT, UnitRole.STRIKER).contains(UnitRoleHandler.getRoleFor(ms)), "Scout, Striker")); allFormationTypes.put(ft.name, ft); }
private static void createSweepLance() { FormationType ft = new FormationType("Sweep", "Pursuit"); ft.allowedUnitTypes = FLAG_GROUND; ft.maxWeightClass = EntityWeightClass.WEIGHT_MEDIUM; ft.mainCriteria = ms -> ms.getWalkMp() >= 5 && getDamageAtRange(ms, 6) >= 10; ft.mainDescription = "Walk/Cruise 5+, Damage 10+ at range 6"; ft.reportMetrics.put("Damage @ 6", ms -> getDamageAtRange(ms, 6)); allFormationTypes.put(ft.name, ft); }
private static void createStrikerCavalryLance() { FormationType ft = new FormationType("Striker/Cavalry"); ft.allowedUnitTypes = FLAG_GROUND; ft.idealRole = UnitRole.STRIKER; ft.maxWeightClass = EntityWeightClass.WEIGHT_HEAVY; ft.mainCriteria = ms -> ms.getWalkMp() >= 5 || ms.getJumpMp() >= 4; ft.mainDescription = "Walk/Cruise 5+ or Jump 4+"; ft.otherCriteria.add(new PercentConstraint(0.5, ms -> EnumSet.of(UnitRole.STRIKER, UnitRole.SKIRMISHER).contains(UnitRoleHandler.getRoleFor(ms)), "Striker, Skirmisher")); allFormationTypes.put(ft.name, ft); }
private static void createProbeLance() { FormationType ft = new FormationType("Probe", "Pursuit"); ft.allowedUnitTypes = FLAG_GROUND; ft.maxWeightClass = EntityWeightClass.WEIGHT_HEAVY; ft.mainCriteria = ms -> getDamageAtRange(ms, 9) >= 10; ft.mainDescription = "Damage 10+ at range 9"; ft.otherCriteria.add(new PercentConstraint(0.75, ms -> ms.getWalkMp() >= 6, "Walk/Cruise 6+")); ft.reportMetrics.put("Damage @ 9", ms -> getDamageAtRange(ms, 9)); allFormationTypes.put(ft.name, ft); }
private static void createLightReconLance() { FormationType ft = new FormationType("Light Recon", "Recon"); ft.allowedUnitTypes = FLAG_GROUND; ft.maxWeightClass = EntityWeightClass.WEIGHT_LIGHT; ft.mainCriteria = ms -> ms.getWalkMp() >= 6 && UnitRoleHandler.getRoleFor(ms).equals(UnitRole.SCOUT); ft.mainDescription = "Walk/Cruise 6+, Scout"; allFormationTypes.put(ft.name, ft); }
private static void createLightStrikerCavalryLance() { FormationType ft = new FormationType("Light Striker/Cavalry", "Striker/Cavalry"); ft.allowedUnitTypes = FLAG_GROUND; ft.maxWeightClass = EntityWeightClass.WEIGHT_MEDIUM; ft.mainCriteria = ms -> ms.getWalkMp() >= 5; ft.mainDescription = "Walk/Cruise 5+"; ft.otherCriteria.add(new CountConstraint(2, ms -> getSingleWeaponDamageAtRange(ms, 18) >= 5, "Weapon with damage 5+ at range 18")); ft.otherCriteria.add(new CountConstraint(2, ms -> EnumSet.of(UnitRole.STRIKER, UnitRole.SKIRMISHER).contains(UnitRoleHandler.getRoleFor(ms)), "Striker, Skirmisher")); ft.reportMetrics.put("Damage @ 18", ms -> getSingleWeaponDamageAtRange(ms, 18)); allFormationTypes.put(ft.name, ft); }
private static void createPursuitLance() { FormationType ft = new FormationType("Pursuit"); ft.allowedUnitTypes = FLAG_GROUND; ft.maxWeightClass = EntityWeightClass.WEIGHT_MEDIUM; ft.otherCriteria.add(new PercentConstraint(0.75, ms -> ms.getWalkMp() >= 6, "Walk/Cruise 6+")); ft.otherCriteria.add(new CountConstraint(1, ms -> getSingleWeaponDamageAtRange(ms, 15) >= 5, "Weapon with damage 5+ at range 15")); ft.reportMetrics.put("Damage @ 15", ms -> getSingleWeaponDamageAtRange(ms, 15)); 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 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 createUrbanLance() { FormationType ft = new FormationType("Urban"); ft.allowedUnitTypes = FLAG_GROUND; ft.idealRole = UnitRole.AMBUSHER; ft.otherCriteria.add(new PercentConstraint(0.5, ms -> ms.getJumpMp() > 0 || ms.getUnitType().equals(UnitType.getTypeName(UnitType.INFANTRY)) || ms.getUnitType().equals(UnitType.getTypeName(UnitType.BATTLE_ARMOR)), "Jump 1+ or Infantry/BA")); ft.otherCriteria.add(new PercentConstraint(0.5, ms -> ms.getWalkMp() <= 4, "Walk/Cruise <= 4")); 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 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); }
w.write("Non-Canon,"); w.write(Integer.toString(unit.getWalkMp())); w.write(","); w.write(Integer.toString(unit.getRunMp()));
@Override public Object getValueAt(int rowIndex, int columnIndex) { MechSummary ms = units.get(rowIndex); switch(columnIndex) { case COL_NAME: return ms.getName(); case COL_WEIGHT_CLASS: return EntityWeightClass.getClassName(EntityWeightClass.getWeightClass(ms.getTons(), ms.getUnitType())); case COL_MOVEMENT: StringBuilder sb = new StringBuilder(); sb.append(String.valueOf(ms.getWalkMp())).append("/") .append(String.valueOf(ms.getRunMp())); if (formationType.isGround()) { sb.append("/").append(String.valueOf(ms.getJumpMp())); } return sb.toString(); case COL_ROLE: ModelRecord mr = RATGenerator.getInstance().getModelRecord(ms.getName()); if (null == mr) { return UnitRole.UNDETERMINED.toString(); } else { return UnitRoleHandler.getRoleFor(mr.getKey()).toString(); } default: Function<MechSummary,?> metric = formationType.getReportMetric(colNames.get(columnIndex)); return metric == null? "?" : metric.apply(ms); } } }
public Object getValueAt(int row, int col) { MechSummary m = getUnitAt(row); String value = ""; if (col == COL_BV) { value += m.getBV(); } else if (col == COL_MOVE) { value += m.getWalkMp() + "/" + m.getRunMp() + "/" + m.getJumpMp(); } else { return m.getName(); } return value; }
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); } } } }
speed = ms.getWalkMp(); if (ms.getJumpMp() > 0) { speed++;