/** * get bv for protomech loads */ public double getProtoBV(int shots) { if ((getAmmoType() == AmmoType.T_SRM) || (getAmmoType() == AmmoType.T_SRM_STREAK) || (getAmmoType() == AmmoType.T_LRM) || (getAmmoType() == AmmoType.T_SRM_TORPEDO) || (getAmmoType() == AmmoType.T_LRM_TORPEDO)) { return ((kgPerShot * rackSize * shots) / 1000) * bv; } return ((kgPerShot * shots) / 1000) * bv; }
protected int getCritMod(AmmoType atype) { if (atype == null || atype.getAmmoType() == AmmoType.T_PIRANHA) { return 0; } if (atype.getAmmoType() == AmmoType.T_WHITE_SHARK || atype.getAmmoType() == AmmoType.T_WHITE_SHARK_T || atype.hasFlag(AmmoType.F_AR10_WHITE_SHARK) // Santa Anna, per IO rules || atype.hasFlag(AmmoType.F_SANTA_ANNA)) { return 9; } else if (atype.getAmmoType() == AmmoType.T_KRAKEN_T || atype.getAmmoType() == AmmoType.T_KRAKENM // Peacemaker, per IO rules || atype.hasFlag(AmmoType.F_PEACEMAKER)) { return 8; } else if (atype.getAmmoType() == AmmoType.T_KILLER_WHALE || atype.getAmmoType() == AmmoType.T_KILLER_WHALE_T || atype.hasFlag(AmmoType.F_AR10_KILLER_WHALE) || atype.getAmmoType() == AmmoType.T_MANTA_RAY || atype.getAmmoType() == AmmoType.T_ALAMO) { return 10; } else if (atype.getAmmoType() == AmmoType.T_STINGRAY) { return 12; } else { return 11; } }
protected int getCritMod(AmmoType atype) { if (atype == null || atype.getAmmoType() == AmmoType.T_PIRANHA) { return 0; } if (atype.getAmmoType() == AmmoType.T_WHITE_SHARK || atype.hasFlag(AmmoType.F_AR10_WHITE_SHARK) // Santa Anna, per IO rules || atype.hasFlag(AmmoType.F_SANTA_ANNA)) { return 9; } else if (atype.getAmmoType() == AmmoType.T_KRAKEN_T || atype.getAmmoType() == AmmoType.T_KRAKENM // Peacemaker, per IO rules || atype.hasFlag(AmmoType.F_PEACEMAKER)) { return 8; } else if (atype.getAmmoType() == AmmoType.T_KILLER_WHALE || atype.hasFlag(AmmoType.F_AR10_KILLER_WHALE) || atype.getAmmoType() == AmmoType.T_MANTA_RAY || atype.getAmmoType() == AmmoType.T_ALAMO) { return 10; } else if (atype.getAmmoType() == AmmoType.T_STINGRAY) { return 12; } else { return 11; } }
public static boolean canDeliverMinefield(AmmoType at) { if ((at != null) && ((at.getAmmoType() == T_LRM) || (at.getAmmoType() == AmmoType.T_LRM_IMP) || (at.getAmmoType() == AmmoType.T_MML)) && ((at.getMunitionType() == M_THUNDER) || (at.getMunitionType() == M_THUNDER_INFERNO) || (at.getMunitionType() == M_THUNDER_AUGMENTED) || (at.getMunitionType() == M_THUNDER_VIBRABOMB) || (at.getMunitionType() == M_THUNDER_ACTIVE))) { return true; } return false; }
/** * Scans through the ammo on the unit for any inferno rounds. * * @return <code>true</code> if the unit is still loaded with Inferno * rounds. <code>false</code> if no rounds were ever loaded or if * they have all been fired. */ public boolean hasInfernoAmmo() { boolean found = false; // Walk through the unit's ammo, stop when we find a match. for (Mounted amounted : getAmmo()) { AmmoType atype = (AmmoType) amounted.getType(); if (((atype.getAmmoType() == AmmoType.T_SRM) || (atype.getAmmoType() == AmmoType.T_SRM_IMP) || (atype.getAmmoType() == AmmoType.T_MML)) && (atype.getMunitionType() == AmmoType.M_INFERNO) && (amounted.getHittableShotsLeft() > 0)) { found = true; } if ((atype.getAmmoType() == AmmoType.T_IATM) && (atype.getMunitionType() == AmmoType.M_IATM_IIW) && (amounted.getHittableShotsLeft() > 0)) { found = true; } } return found; }
private boolean hasAmmoType(int ammoType) { if (myEntity.getAmmo().size() < 1) { return false; } for (Mounted ammo : myEntity.getAmmo()) { if (((AmmoType) ammo.getType()).getAmmoType() == ammoType) { return true; } } return false; }
@Override public boolean loadWeapon(Mounted mounted, Mounted mountedAmmo) { // BA must carry the ammo in same location as the weapon. // except for mine launcher mines // This allows for squad weapons and individual trooper weapons // such as NARC and the support weapons in TW/TO AmmoType at = (AmmoType) mountedAmmo.getType(); if (!(at.getAmmoType() == AmmoType.T_MINE) && (mounted.getLocation() != mountedAmmo.getLocation())) { return false; } return super.loadWeapon(mounted, mountedAmmo); }
@Override public boolean loadWeaponWithSameAmmo(Mounted mounted, Mounted mountedAmmo) { // BA must carry the ammo in same location as the weapon. // except for mine launcher mines // This allows for squad weapons and individual trooper weapons // such as NARC and the support weapons in TW/TO AmmoType at = (AmmoType) mountedAmmo.getType(); if (!(at.getAmmoType() == AmmoType.T_MINE) && (mounted.getLocation() != mountedAmmo.getLocation())) { return false; } return super.loadWeaponWithSameAmmo(mounted, mountedAmmo); }
/** * Checks to ensure that the given ammunition type is compatible with the given weapon type. Performs the following * tests:<br/> * {@code ammoType} != null<br/> * {@link AmmoType#getAmmoType()} == {@link WeaponType#getAmmoType()}<br/> * {@link AmmoType#getRackSize()} == {@link WeaponType#getRackSize()} * * @param ammoType The type of ammo to be tested. * @param weaponType The type of weapon the ammo is to be used with. * @return TRUE if the ammo type and weapon type are compatible. */ public static boolean isAmmoValid(AmmoType ammoType, WeaponType weaponType) { if (ammoType == null) { return false; } if (ammoType.getAmmoType() != weaponType.getAmmoType()) { return false; } if (ammoType.getRackSize() != weaponType.getRackSize()) { return false; } return true; } }
@Override protected int calcDamagePerHit() { AmmoType atype = (AmmoType) ammo.getType(); double toReturn; if (atype.getAmmoType() == AmmoType.T_INARC) { toReturn = 6; } else { toReturn = 4; } if ((target instanceof Infantry) && !(target instanceof BattleArmor)) { toReturn = Compute.directBlowInfantryDamage(toReturn, bDirect ? toHit.getMoS() / 3 : 0, WeaponType.WEAPON_DIRECT_FIRE, ((Infantry) target).isMechanized(), toHit.getThruBldg() != null, ae.getId(), calcDmgPerHitReport); toReturn = Math.ceil(toReturn); } if (bGlancing) { return (int) Math.floor(toReturn / 2.0); } return (int) toReturn; } }
/** * Check all the bins in the same bay that feed the same weapon(s) to determine whether there is * sufficient capacity to load more ammo into this bin. In the case of an ammo swap some ammo * may need to be removed from another bin in this bay before more can be loaded. * * @return The amount of unused capacity that can be used to reload ammo. */ private double bayAvailableCapacity() { if (null != unit) { double space = 0.0; for (Part p : unit.getParts()) { if (p instanceof LargeCraftAmmoBin) { final LargeCraftAmmoBin bin = (LargeCraftAmmoBin) p; if ((bin.getBayEqNum() == bayEqNum) && (((AmmoType) bin.getType()).getAmmoType() == ((AmmoType) type).getAmmoType()) && (((AmmoType) bin.getType()).getRackSize() == ((AmmoType) type).getRackSize())) { space += bin.getCapacity() - bin.getTonnage(); } } } return space; } return 0.0; }
public int getMaxRange(Mounted weapon) { if(null != weapon) { if (getAmmoType() == AmmoType.T_ATM) { AmmoType atype = (AmmoType) weapon.getLinked().getType(); if ((atype.getAmmoType() == AmmoType.T_ATM) && (atype.getMunitionType() == AmmoType.M_EXTENDED_RANGE)) { return RANGE_EXT; } else if ((atype.getAmmoType() == AmmoType.T_ATM) && (atype.getMunitionType() == AmmoType.M_HIGH_EXPLOSIVE)) { return RANGE_SHORT; } } if (getAmmoType() == AmmoType.T_MML) { AmmoType atype = (AmmoType) weapon.getLinked().getType(); if (atype.hasFlag(AmmoType.F_MML_LRM) || (getAmmoType() == AmmoType.T_LRM_TORPEDO)) { return RANGE_LONG; } else { return RANGE_SHORT; } } } return maxRange; }
public int calcHeatCapacity(Entity en) { int capacity = en.getHeatCapacity(); for (Mounted mounted : en.getEquipment()) { if (mounted.getType() instanceof AmmoType && ((AmmoType)mounted.getType()).getAmmoType() == AmmoType.T_COOLANT_POD) { capacity++; } else if (mounted.getType() instanceof MiscType && mounted.getType().hasFlag(MiscType.F_EMERGENCY_COOLANT_SYSTEM)) { capacity += 1; } } return capacity; }
@Override protected double updateAVforAmmo(double current_av, AmmoType atype, WeaponType bayWType, int range, int wId) { //AR10 munitions if (atype.getAmmoType() == AmmoType.T_AR10) { if (atype.hasFlag(AmmoType.F_AR10_KILLER_WHALE)) { current_av = 4; } else if (atype.hasFlag(AmmoType.F_AR10_WHITE_SHARK)) { current_av = 3; } else if (atype.hasFlag(AmmoType.F_PEACEMAKER)) { current_av = 1000; } else if (atype.hasFlag(AmmoType.F_SANTA_ANNA)) { current_av = 100; } else { current_av = 2; } } //Nuclear Warheads for non-AR10 missiles if (atype.hasFlag(AmmoType.F_SANTA_ANNA)) { current_av = 100; } else if (atype.hasFlag(AmmoType.F_PEACEMAKER)) { current_av = 1000; } return current_av; }
@Override protected double updateAVforAmmo(double current_av, AmmoType atype, WeaponType bayWType, int range, int wId) { //AR10 munitions if (atype.getAmmoType() == AmmoType.T_AR10) { if (atype.hasFlag(AmmoType.F_AR10_KILLER_WHALE)) { current_av = 4; } else if (atype.hasFlag(AmmoType.F_AR10_WHITE_SHARK)) { current_av = 3; } else if (atype.hasFlag(AmmoType.F_PEACEMAKER)) { current_av = 1000; } else if (atype.hasFlag(AmmoType.F_SANTA_ANNA)) { current_av = 100; } else { current_av = 2; } } //Nuclear Warheads for non-AR10 missiles if (atype.hasFlag(AmmoType.F_SANTA_ANNA)) { current_av = 100; } else if (atype.hasFlag(AmmoType.F_PEACEMAKER)) { current_av = 1000; } return current_av; } /**
/** * need to check bay location before loading ammo */ @Override public boolean loadWeapon(Mounted mounted, Mounted mountedAmmo) { boolean success = false; WeaponType wtype = (WeaponType) mounted.getType(); AmmoType atype = (AmmoType) mountedAmmo.getType(); if (mounted.getLocation() != mountedAmmo.getLocation()) { return success; } if (mountedAmmo.isAmmoUsable() && !wtype.hasFlag(WeaponType.F_ONESHOT) && (atype.getAmmoType() == wtype.getAmmoType()) && (atype.getRackSize() == wtype.getRackSize())) { mounted.setLinked(mountedAmmo); success = true; } return success; }
public void setArmored(boolean armored) { // Ammobins cannot be armored. if ((getType() instanceof AmmoType) && (((AmmoType) getType()).getAmmoType() != AmmoType.T_COOLANT_POD)) { armoredComponent = false; } else if ((getType() instanceof MiscType) && (getType().hasFlag(MiscType.F_SPIKES) || getType().hasFlag(MiscType.F_REACTIVE) || getType().hasFlag(MiscType.F_MODULAR_ARMOR) || ((MiscType) getType()) .isShield())) { armoredComponent = false; } else { armoredComponent = armored; } }
/** * need to check bay location before loading ammo */ @Override public boolean loadWeapon(Mounted mounted, Mounted mountedAmmo) { boolean success = false; WeaponType wtype = (WeaponType) mounted.getType(); AmmoType atype = (AmmoType) mountedAmmo.getType(); if (mounted.getLocation() != mountedAmmo.getLocation()) { return success; } // for large craft, ammo must be in the same ba Mounted bay = whichBay(getEquipmentNum(mounted)); if ((bay != null) && !bay.ammoInBay(getEquipmentNum(mountedAmmo))) { return success; } if (mountedAmmo.isAmmoUsable() && !wtype.hasFlag(WeaponType.F_ONESHOT) && (atype.getAmmoType() == wtype.getAmmoType()) && (atype.getRackSize() == wtype.getRackSize())) { mounted.setLinked(mountedAmmo); success = true; } return success; }
/** * need to check bay location before loading ammo */ @Override public boolean loadWeapon(Mounted mounted, Mounted mountedAmmo) { boolean success = false; WeaponType wtype = (WeaponType) mounted.getType(); AmmoType atype = (AmmoType) mountedAmmo.getType(); if (mounted.getLocation() != mountedAmmo.getLocation()) { return success; } // for large craft, ammo must be in the same bay Mounted bay = whichBay(getEquipmentNum(mounted)); if ((bay != null) && !bay.ammoInBay(getEquipmentNum(mountedAmmo))) { return success; } if (mountedAmmo.isAmmoUsable() && !wtype.hasFlag(WeaponType.F_ONESHOT) && (atype.getAmmoType() == wtype.getAmmoType()) && (atype.getRackSize() == wtype.getRackSize())) { mounted.setLinked(mountedAmmo); success = true; } return success; }
private boolean includeMunition(AmmoType atype) { if (!atype.canAeroUse() || (atype.getAmmoType() != at) || (atype.getRackSize() != rackSize) || ((atype.getTechBase() != techBase) && (atype.getTechBase() != AmmoType.TECH_BASE_ALL) && (techBase != AmmoType.TECH_BASE_ALL)) || !atype.isLegal(game.getOptions().intOption(OptionsConstants.ALLOWED_YEAR), SimpleTechLevel.getGameTechLevel(game), techBase == AmmoType.TECH_BASE_CLAN, false)) { return false; } if (atype.hasFlag(AmmoType.F_NUCLEAR) && !game.getOptions().booleanOption( OptionsConstants.ADVAERORULES_AT2_NUKES)) { return false; } if ((atype.getMunitionType() & AmmoType.M_ARTEMIS_CAPABLE) != 0) { return entity.hasWorkingMisc(MiscType.F_ARTEMIS) || entity.hasWorkingMisc(MiscType.F_ARTEMIS_PROTO); } if ((atype.getMunitionType() & AmmoType.M_ARTEMIS_V_CAPABLE) != 0) { return entity.hasWorkingMisc(MiscType.F_ARTEMIS_V); } return true; }