@Override public double getCost(boolean ignoreAmmo) { return fighters.stream() .mapToDouble(fid -> game.getEntity(fid).getCost(ignoreAmmo)) .sum(); }
public long getBuyCost() { long cost = (long) Math.round(getEntity().getCost(false)); if(entity instanceof Infantry) { cost = (long) Math.round(getEntity().getAlternateCost()); } if(entity.isClan()) { cost *= campaign.getCampaignOptions().getClanPriceModifier(); } return cost; }
protected void addBasicData(Entity entity) { model.put("formatBasicDataRow", new FormatTableRowMethod(new int[] { 30, 20, 5 }, new Justification[] { Justification.LEFT, Justification.LEFT, Justification.RIGHT })); model.put("fullName", entity.getShortNameRaw()); model.put("chassis", entity.getChassis()); model.put("techBase", formatTechBase(entity)); model.put("tonnage", NumberFormat.getInstance().format(entity.getWeight())); model.put("battleValue", NumberFormat.getInstance().format(entity.calculateBattleValue())); model.put("cost", NumberFormat.getInstance().format(entity.getCost(false))); final StringJoiner quirksList = new StringJoiner(", "); final Quirks quirks = entity.getQuirks(); for (final Enumeration<IOptionGroup> optionGroups = quirks.getGroups(); optionGroups.hasMoreElements();) { final IOptionGroup group = optionGroups.nextElement(); if (quirks.count(group.getKey()) > 0) { for (final Enumeration<IOption> options = group.getOptions(); options.hasMoreElements();) { final IOption option = options.nextElement(); if ((option != null) && option.booleanValue()) { quirksList.add(option.getDisplayableNameWithValue()); } } } } if (quirksList.length() > 0) { model.put("quirks", quirksList.toString()); } }
public void addPlayer(IPlayer player) { players.add(player); int bv = 0; int cost = 0; double ton = 0; for (Entity entity : clientgui.getClient().getEntitiesVector()) { if (entity.getOwner().equals(player)) { bv += entity.calculateBattleValue(); cost += entity.getCost(false); ton += entity.getWeight(); } } bvs.add(bv); costs.add(cost); tons.add(ton); fireTableDataChanged(); }
Person p = u.getCommander(); bv += u.getEntity().calculateBattleValue(true, !u.hasPilot()); cost += u.getEntity().getCost(true); ton += u.getEntity().getWeight(); String utype = UnitType.getTypeDisplayableName(u.getEntity().getUnitType());
private void personChanged(javax.swing.event.ListSelectionEvent evt) { int view = tablePersonnel.getSelectedRow(); if(view < 0) { //selection got filtered away selectedPerson = null; refreshPersonView(); return; } selectedPerson = personnelModel.getPerson(tablePersonnel.convertRowIndexToModel(view)); Entity en = personnelMarket.getAttachedEntity(selectedPerson); if (null == en) { unitCost = 0; } else { if (!campaign.getCampaignOptions().getUseShareSystem() && (en instanceof megamek.common.Mech || en instanceof megamek.common.Tank || en instanceof megamek.common.Aero)) { unitCost = (long)Math.ceil(en.getCost(false) / 2); } else { unitCost = 0; } } refreshPersonView(); }
bv += u.getEntity().calculateBattleValue(true, true); cost += u.getEntity().getCost(true); ton += u.getEntity().getWeight(); if(null != p) {
sHead.append("\n"); //$NON-NLS-1$ sHead.append("Cost: "); sHead.append(dFormatter.format(entity.getCost(false))); sHead.append(" C-bills"); sHead.append("\n"); //$NON-NLS-1$
dFormatter.format(entity.calculateBattleValue(false, null == entity.getCrew())))); double cost = entity.getCost(false); if(useAlternateCost && entity.getAlternateCost() > 0) { cost = entity.getAlternateCost();