m.setShotsLeft(numShots); m.setOriginalShots(numShots); m.setAmmoCapacity(numShots * ((AmmoType) m.getType()).getKgPerShot() / 1000.0);
mounted.setAmmoCapacity(capVal); } catch (NumberFormatException excep) { if (entity.hasETypeFlag(Entity.ETYPE_BATTLEARMOR) || entity.hasETypeFlag(Entity.ETYPE_PROTOMECH)) { mounted.setAmmoCapacity(mounted.getOriginalShots() * ((AmmoType) mounted.getType()).getKgPerShot() * 1000); } else { mounted.setAmmoCapacity(mounted.getOriginalShots()
int slots = (int) Math.ceil((double) shots / row.munitions.get(i).getShots()); mounted.setOriginalShots(slots * row.munitions.get(i).getShots()); mounted.setAmmoCapacity(slots * row.munitions.get(i).getTonnage(entity)); remainingWeight -= mounted.getAmmoCapacity(); mountIndex++; mount.setAmmoCapacity(0); mount.setOriginalShots(0); mount.setShotsLeft(0); Mounted m = row.ammoMounts.get(0); 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); }
@Override public void updateConditionFromPart() { if(null != unit) { Mounted mounted = unit.getEntity().getEquipment(equipmentNum); if(null != mounted) { mounted.setHit(false); mounted.setDestroyed(false); mounted.setRepairable(true); mounted.changeAmmoType((AmmoType) type); unit.repairSystem(CriticalSlot.TYPE_EQUIPMENT, equipmentNum); mounted.setShotsLeft(getFullShots() - shotsNeeded); mounted.setAmmoCapacity(capacity); } } }
mounted.setShotsLeft(shots); mounted.setOriginalShots(shots); mounted.setAmmoCapacity(shots * ((AmmoType) mounted.getType()).getKgPerShot() / 1000); super.addEquipment(mounted, loc, rearMounted); return;