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 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 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(Integer.toString(unit.getRunMp())); w.write(","); w.write(Integer.toString(unit.getJumpMp())); } else { w.write(unit.getChassis()
@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); } } } }
if (ms.getJumpMp() > 0) { speed++;