/** * For ammo weapons, this number can be less than the full number if the * amount of ammo is not high enough * * @return the number of weapons of this type firing (for squadron weapon * groups) */ @Override protected int getNumberWeapons() { if (ammo == null) { // shouldn't happen return weapon.getNWeapons(); } int totalShots = ae.getTotalAmmoOfType(ammo.getType()); return Math.min( weapon.getNWeapons(), (int) Math.floor((double) totalShots / (double) weapon.getCurrentShots())); }
@Override protected void useAmmo() { getMountedAmmo(); Mounted bayW = bayWAmmo.getLinkedBy(); int shots = (bayW.getCurrentShots() * weapon.getBayWeapons().size()); for (int i = 0; i < shots; i++) { if (null == bayWAmmo || bayWAmmo.getUsableShotsLeft() < 1) { // try loading something else ae.loadWeaponWithSameAmmo(bayW); bayWAmmo = bayW.getLinked(); } if (null != bayWAmmo) { bayWAmmo.setShotsLeft(bayWAmmo.getBaseShotsLeft() - 1); } } }
@Override protected int calcHits(Vector<Report> vPhaseReport) { // conventional infantry gets hit in one lump // BAs do one lump of damage per BA suit if ((target instanceof Infantry) && !(target instanceof BattleArmor)) { if (ae instanceof BattleArmor) { bSalvo = true; return ((BattleArmor) ae).getShootingStrength(); } return 1; } int hits = weapon.getCurrentShots(); if (!allShotsHit()) { hits = Compute.missilesHit(hits); } bSalvo = true; Report r = new Report(3325); r.subject = subjectId; r.add(hits); r.add(sSalvoType); r.add(toHit.getTableDesc()); r.newlines = 0; vPhaseReport.addElement(r); r = new Report(3345); r.subject = subjectId; vPhaseReport.addElement(r); return hits; }
Mounted bayW = ae.getEquipment(wId); WeaponType bayWType = ((WeaponType) bayW.getType()); int ammoUsed = bayW.getCurrentShots(); if (bayWType.getAmmoType() == AmmoType.T_AC_ROTARY) { boolean jams = false;
@Override protected void useAmmo() { setDone(); checkAmmo(); // how many shots are we firing? int nShots = weapon.getCurrentShots(); // do we need to revert to single shot? if (nShots > 1) { int nAvail = ae.getTotalAmmoOfType(ammo.getType()); while (nAvail < nShots) { nShots--; } } // use up ammo for (int i = 0; i < nShots; i++) { if (ammo.getUsableShotsLeft() <= 0) { ae.loadWeaponWithSameAmmo(weapon); ammo = weapon.getLinked(); } ammo.setShotsLeft(ammo.getBaseShotsLeft() - 1); } } }
&& bayWAmmo != null && ae.getTotalAmmoOfType(bayWAmmo.getType()) >= bayW .getCurrentShots()) { WeaponType bayWType = ((WeaponType) bayW.getType()); int shots = bayW.getCurrentShots(); for (int i = 0; i < shots; i++) { if (null == bayWAmmo
@Override protected void useAmmo() { final String METHOD_NAME = "useAmmo()"; for (int wId : weapon.getBayWeapons()) { Mounted bayW = ae.getEquipment(wId); // check the currently loaded ammo Mounted bayWAmmo = bayW.getLinked(); if (bayWAmmo == null) {// Can't happen. w/o legal ammo, the weapon // *shouldn't* fire. logDebug(METHOD_NAME, "Handler can't find any ammo! Oh no!"); } int shots = bayW.getCurrentShots(); for (int i = 0; i < shots; i++) { if (null == bayWAmmo || bayWAmmo.getUsableShotsLeft() < 1) { // try loading something else ae.loadWeaponWithSameAmmo(bayW); bayWAmmo = bayW.getLinked(); } if (null != bayWAmmo) { bayWAmmo.setShotsLeft(bayWAmmo.getBaseShotsLeft() - 1); } } } }
@Override protected void useAmmo() { final String METHOD_NAME = "useAmmo()"; for (int wId : weapon.getBayWeapons()) { Mounted bayW = ae.getEquipment(wId); // check the currently loaded ammo Mounted bayWAmmo = bayW.getLinked(); if (bayWAmmo == null) {// Can't happen. w/o legal ammo, the weapon // *shouldn't* fire. logDebug(METHOD_NAME, "Handler can't find any ammo! Oh no!"); } int shots = bayW.getCurrentShots(); for (int i = 0; i < shots; i++) { if (null == bayWAmmo || bayWAmmo.getUsableShotsLeft() < 1) { // try loading something else ae.loadWeaponWithSameAmmo(bayW); bayWAmmo = bayW.getLinked(); } if (null != bayWAmmo) { bayWAmmo.setShotsLeft(bayWAmmo.getBaseShotsLeft() - 1); } } } }
&& bayWAmmo != null && ae.getTotalAmmoOfType(bayWAmmo.getType()) >= bayW .getCurrentShots()) { WeaponType bayWType = ((WeaponType) bayW.getType()); int shots = bayW.getCurrentShots(); for (int i = 0; i < shots; i++) { if (null == bayWAmmo
return false; case (IAimingModes.AIM_MODE_IMMOBILE): if (weapon.getCurrentShots() > 1) { return false; return false; if (weapon.getCurrentShots() > 1) { return false;
@Override protected void useAmmo() { int shotsNeedFiring; setDone(); checkAmmo(); howManyShots = weapon.getCurrentShots(); int total = ae.getTotalAmmoOfType(ammo.getType()); if (total <= howManyShots) { howManyShots = total; } shotsNeedFiring = howManyShots; if (ammo.getUsableShotsLeft() == 0) { ae.loadWeapon(weapon); ammo = weapon.getLinked(); // there will be some ammo somewhere, otherwise shot will not have // been fired. } while (shotsNeedFiring > ammo.getUsableShotsLeft()) { shotsNeedFiring -= ammo.getBaseShotsLeft(); ammo.setShotsLeft(0); ae.loadWeapon(weapon); ammo = weapon.getLinked(); } ammo.setShotsLeft(ammo.getBaseShotsLeft() - shotsNeedFiring); }
&& bayWAmmo != null && ae.getTotalAmmoOfType(bayWAmmo.getType()) >= bayW .getCurrentShots()) { WeaponType bayWType = ((WeaponType) bayW.getType()); int shots = bayW.getCurrentShots(); for (int i = 0; i < shots; i++) { if (null == bayWAmmo
&& bayWAmmo != null && ae.getTotalAmmoOfType(bayWAmmo.getType()) >= bayW .getCurrentShots()) { WeaponType bayWType = ((WeaponType) bayW.getType());
heat = heat * getCurrentShots() * getNWeapons(); if (hasQuirk(OptionsConstants.QUIRK_WEAP_POS_IMP_COOLING)) { heat = Math.max(1, heat - 1);
if (test_weapon.getCurrentShots() > 1) { direct_fire = false;
&& (ae.getTotalAmmoOfType(ammo.getType()) < weapon.getCurrentShots())) { return "weapon does not have enough ammo."; if (wtype.hasFlag(WeaponType.F_MGA) && (weapon.getCurrentShots() == 0)) { return "no working MGs remaining";