&& (m.getType() instanceof AmmoType)){ m.setShotsLeft(numShots); m.setOriginalShots(numShots); m.setAmmoCapacity(numShots * ((AmmoType) m.getType()).getKgPerShot() / 1000.0);
mounted.setOriginalShots(slots * row.munitions.get(i).getShots()); mounted.setAmmoCapacity(slots * row.munitions.get(i).getTonnage(entity)); remainingWeight -= mounted.getAmmoCapacity(); Mounted mount = row.ammoMounts.get(mountIndex); mount.setAmmoCapacity(0); mount.setOriginalShots(0); mount.setShotsLeft(0); mountIndex++; AmmoType at = (AmmoType) m.getType(); m.setAmmoCapacity(m.getAmmoCapacity() + remainingWeight); m.setOriginalShots((int) Math.floor(m.getAmmoCapacity() / (at.getShots() * at.getTonnage(entity))));
protected void addEquipment(Mounted mounted, int loc, boolean rearMounted, int nAmmo) throws LocationFullException { if ((mounted.getType() instanceof AmmoType) && (nAmmo > 1)) { mounted.setByShot(true); mounted.setShotsLeft(nAmmo); mounted.setOriginalShots(nAmmo); double tonnage = Math.max(1, nAmmo / ((AmmoType) mounted.getType()).getShots()) * ((AmmoType) mounted.getType()).getTonnage(this); mounted.setAmmoCapacity(tonnage); } addEquipment(mounted, loc, rearMounted); }
mounted.setOriginalShots(shots); mounted.setAmmoCapacity(shots * ((AmmoType) mounted.getType()).getKgPerShot() / 1000); super.addEquipment(mounted, loc, rearMounted);