private int calculateShots() { int shots = (int) Math.floor(1000/((AmmoType)type).getKgPerShot()); if(shots <= 0) { //FIXME: no idea what to do here, these really should be fixed on the MM side //because presumably this is happening because KgperShot is -1 or 0 shots = 20; } return shots; }
@Override public double getTonnage() { if(((AmmoType)type).getKgPerShot() > 0) { return ((AmmoType)type).getKgPerShot() * shots/1000.0; } return ((double)shots / ((AmmoType)type).getShots()); }
protected int getShotsPerTon() { AmmoType atype = (AmmoType)type; if(atype.getKgPerShot() > 0) { return (int)Math.floor(1000.0/atype.getKgPerShot()); } //if not listed by kg per shot, we assume this is a single ton increment return ((AmmoType)type).getShots(); }
@Override public IAcquisitionWork getAcquisitionWork() { int shots = (int) Math.floor(1000/((AmmoType)type).getKgPerShot()); if(shots <= 0) { //FIXME: no idea what to do here, these really should be fixed on the MM side //because presumably this is happening because KgperShot is -1 or 0 shots = 20; } return new AmmoStorage(1,type,shots,campaign); }
@Override public Part getNewPart() { int shots = (int) Math.floor(1000/((AmmoType)type).getKgPerShot()); if(shots <= 0) { //FIXME: no idea what to do here, these really should be fixed on the MM side //because presumably this is happening because KgperShot is -1 or 0 shots = 20; } return new AmmoStorage(1,type,shots,campaign); }
@Override public StringBuffer printAmmo(StringBuffer buff, int posLoc, int posWeight) { for (Mounted m : getEntity().getAmmo()) { AmmoType mt = (AmmoType) m.getType(); buff.append(StringUtil.makeLength(mt.getName(), 20)); buff.append(" ").append( StringUtil.makeLength(getLocationAbbr(m.getLocation()), getPrintSize() - 5 - 20)) .append(TestEntity.makeWeightString( Math.ceil(mt.getKgPerShot() * m.getBaseShotsLeft()) / 1000.0)).append("\n"); } return buff; }
fields.put("mass", Math.round((((AmmoType) eq).getKgPerShot()) * count)); } else { fields.put("mass", Math.round(eq.getTonnage(entity) * 1000 * count));
m.setShotsLeft(numShots); m.setOriginalShots(numShots); m.setAmmoCapacity(numShots * ((AmmoType) m.getType()).getKgPerShot() / 1000.0);
@Override public double getWeightAmmo() { double weight = 0.0; for (Mounted m : getEntity().getAmmo()) { if (!m.isOneShotAmmo()) { AmmoType mt = (AmmoType) m.getType(); weight += ceil(mt.getKgPerShot() * m.getBaseShotsLeft() / 1000, Ceil.KILO); } } return weight; }
|| entity.hasETypeFlag(Entity.ETYPE_PROTOMECH)) { mounted.setAmmoCapacity(mounted.getOriginalShots() * ((AmmoType) mounted.getType()).getKgPerShot() * 1000); } else { mounted.setAmmoCapacity(mounted.getOriginalShots()
this.description = sb.toString(); AmmoType ammoType = (AmmoType) ((AmmoStorage) partToBuy).getType(); if(ammoType.getKgPerShot() > 0) { this.tonnagePerItem = ammoType.getKgPerShot() / 1000.0; } else { this.tonnagePerItem = 1.0 / ammoType.getShots();
row.put("mass", ((AmmoType) m.getType()).getKgPerShot() * m.getOriginalShots()); } else { row.put("mass", m.getType().getTonnage(ba) * 1000);
if(((AmmoType)et).hasFlag(AmmoType.F_BATTLEARMOR)) { int shots = (int) Math.floor(1000/((AmmoType)et).getKgPerShot()); if(shots <= 0) {
weight += (mt.getKgPerShot() * m.getBaseShotsLeft()) / 1000.0
mounted.setShotsLeft(shots); mounted.setOriginalShots(shots); mounted.setAmmoCapacity(shots * ((AmmoType) mounted.getType()).getKgPerShot() / 1000); super.addEquipment(mounted, loc, rearMounted); return;