public boolean isReady(boolean isStrafing) { return (!usedThisRound || isStrafing) && !destroyed && !missing && !jammed && !useless && !fired && (!isDWPMounted || (isDWPMounted && (getLinkedBy() != null))); }
/** * Check for whether this mount is linked by a one-shot weapon * * @return {@code true} if this is one-shot ammo */ public boolean isOneShotAmmo() { return (getType() instanceof AmmoType) && (getLinkedBy() != null) && getLinkedBy().isOneShot(); }
/** * Checks whether this mount is either one a one-shot weapon or ammo for a one-shot weapon. * @return */ public boolean isOneShot(){ if (isOneShotWeapon()) { return true; } else if ((getType() instanceof AmmoType) && getLinkedBy() != null) { // There should not be any circular references, but we should track where we've been just in case. // Do a couple checks first to avoid instantiating a set unnecessarily. Set<Mounted> checked = new HashSet<>(); for (Mounted current = getLinkedBy(); current != null; current = current.getLinkedBy()) { if (checked.contains(current)) { return false; } if (current.isOneShotWeapon()) { return true; } checked.add(current); } } return false; }
/** * does this <code>Mounted</code> have a linked and charged PPC Capacitor? */ public int hasChargedCapacitor() { if ((getCrossLinkedBy() != null) && (getCrossLinkedBy().getType() instanceof MiscType) && !getCrossLinkedBy().isDestroyed()) { MiscType cap = (MiscType) getCrossLinkedBy().getType(); if (cap.hasFlag(MiscType.F_PPC_CAPACITOR) && getCrossLinkedBy().curMode().equals("Charge")) { return 2; } } if ((getLinkedBy() != null) && (getLinkedBy().getType() instanceof MiscType) && !getLinkedBy().isDestroyed()) { MiscType cap = (MiscType) getLinkedBy().getType(); if (cap.hasFlag(MiscType.F_PPC_CAPACITOR) && getLinkedBy().curMode().equals("Charge")) { return 1; } } return 0; }
&& (m.getLinkedBy() != null) && m.getLinkedBy().getType() .hasFlag(WeaponType.F_ONESHOT)) { continue; || ((m.getLinkedBy() != null) && m.getLinkedBy() .getType() .hasFlag(MiscType.F_DETACHABLE_WEAPON_PACK))) { && (m.getLinkedBy() != null) && m.getLinkedBy().isDWPMounted() ) { continue;
@Override public double getWeightPowerAmp() { if (mech.isIndustrial() && (!mech.hasEngine() || (mech.getEngine().getEngineType() == Engine.COMBUSTION_ENGINE) || (mech.getEngine().getEngineType() == Engine.FUEL_CELL))) { double powerAmpWeight = 0; for (Mounted m : mech.getWeaponList()) { WeaponType wt = (WeaponType) m.getType(); if (wt instanceof EnergyWeapon) { powerAmpWeight += wt.getTonnage(mech); } if ((m.getLinkedBy() != null) && (m.getLinkedBy().getType() instanceof MiscType) && m.getLinkedBy().getType().hasFlag(MiscType.F_PPC_CAPACITOR)) { powerAmpWeight += ((MiscType) m.getLinkedBy().getType()) .getTonnage(mech); } } return TestEntity.ceil(powerAmpWeight / 10f, getWeightCeilingPowerAmp()); } return 0; }
@Override public double getWeightPowerAmp() { if (getEntity().isSupportVehicle() && (getEntity().getWeight() < 5)) { return 0; } if (!engine.isFusion() && (engine.getEngineType() != Engine.FISSION)) { double weight = 0; for (Mounted m : tank.getWeaponList()) { WeaponType wt = (WeaponType) m.getType(); if (wt.hasFlag(WeaponType.F_ENERGY) && !(wt instanceof CLChemicalLaserWeapon) && !(wt instanceof VehicleFlamerWeapon)) { weight += wt.getTonnage(tank); } if ((m.getLinkedBy() != null) && (m.getLinkedBy().getType() instanceof MiscType) && m.getLinkedBy().getType(). hasFlag(MiscType.F_PPC_CAPACITOR)) { weight += ((MiscType)m.getLinkedBy().getType()).getTonnage(tank); } } return TestEntity.ceil(weight / 10, getWeightCeilingPowerAmp()); } return 0; }
if (isDWPMounted && (getLinkedBy() != null)) { return true;
@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 AttackHandler getCorrectHandler(ToHitData toHit, WeaponAttackAction waa, IGame game, Server server) { Mounted linkedBy = waa.getEntity(game).getEquipment(waa.getWeaponId()) .getLinkedBy(); if ((linkedBy != null) && !linkedBy.isInoperable() && linkedBy.getType().hasFlag(MiscType.F_LASER_INSULATOR)) { return new InsulatedLaserWeaponHandler(toHit, waa, game, server); } return new EnergyWeaponHandler(toHit, waa, game, server); } }
/** * @param t * @param w * @param g * @param s */ public PPCHandler(ToHitData t, WeaponAttackAction w, IGame g, Server s) { super(t, w, g, s); // remember capacitor state and turn it off here, // so a crit in the firing phase does not cause an explosion, per the // rules in TO if (weapon.hasChargedCapacitor() != 0) { if (weapon.hasChargedCapacitor() == 2) { chargedCapacitor = 2; weapon.getCrossLinkedBy().setMode("Off"); } if (weapon.hasChargedCapacitor() == 1) { chargedCapacitor = 1; weapon.getLinkedBy().setMode("Off"); } } }
Mounted weapon = mounted.getLinkedBy(); if ((weapon != null) && weapon.isBodyMounted() && weapon.getType().hasFlag(WeaponType.F_MISSILE)) {
if (m.getLinkedBy() != null && m.getLinkedBy().isDWPMounted()){ modifier = 0.75f; } else if (m.isSquadSupportWeapon()) {
@Override public double getWeightPowerAmp() { // Conventional Fighters with ICE engines may need a power amp if ((aero.hasETypeFlag(Entity.ETYPE_CONV_FIGHTER)) && aero.hasEngine() && (aero.getEngine().getEngineType() == Engine.COMBUSTION_ENGINE)) { double weight = 0; for (Mounted m : aero.getWeaponList()) { WeaponType wt = (WeaponType) m.getType(); if (wt.hasFlag(WeaponType.F_ENERGY) && !(wt instanceof CLChemicalLaserWeapon) && !(wt instanceof VehicleFlamerWeapon)) { weight += wt.getTonnage(aero); } Mounted linkedBy = m.getLinkedBy(); if ((linkedBy != null) && (linkedBy.getType() instanceof MiscType) && linkedBy.getType().hasFlag(MiscType.F_PPC_CAPACITOR)){ weight += ((MiscType)linkedBy.getType()).getTonnage(aero); } } // Power amp weighs: // energy weapon tonnage * 0.1 rounded to nearest half ton return Math.ceil(0.1 * weight*2) / 2.0; } return 0; }
public double getBV(Entity entity, Mounted linkedTo) { if (hasFlag(F_PPC_CAPACITOR) && (linkedTo != null) && (linkedTo.getLinkedBy() != null)) { if (linkedTo.getType() instanceof ISLightPPC) { return 44; } if (linkedTo.getType() instanceof ISPPC) { return 88; } if (linkedTo.getType() instanceof ISHeavyPPC) { return 53; } if (linkedTo.getType() instanceof ISSnubNosePPC) { return 87; } if (linkedTo.getType() instanceof ISERPPC) { return 114; } if (linkedTo.getType() instanceof CLERPPC) { return 136; } } if (linkedTo != null) { return this.getBV(entity, linkedTo.getLocation()); } else { return this.getBV(entity); } }
if ((mounted.getLinkedBy() != null) && mounted.getLinkedBy().isOneShot()){ continue;
&& (mount.getLinkedBy() != null)) { mountBv += ((MiscType) mount.getLinkedBy().getType()).getBV( this, mount); bv += mountBv * 0.05 * (mount.getType().getCriticals(this) + 1);
protected double updateAVforAmmo(double current_av, AmmoType atype, WeaponType bayWType, int range, int wId) { Mounted bayW = ae.getEquipment(wId); Mounted mLinker = bayW.getLinkedBy(); int bonus = 0; if ((mLinker != null && mLinker.getType() instanceof MiscType
/** * Tries to load the specified weapon with the specified ammo. Returns true * if successful, false otherwise. */ public boolean loadWeapon(Mounted mounted, Mounted mountedAmmo) { boolean success = false; WeaponType wtype = (WeaponType) mounted.getType(); AmmoType atype = (AmmoType) mountedAmmo.getType(); if (mountedAmmo.isAmmoUsable() && !wtype.hasFlag(WeaponType.F_ONESHOT) && (atype.getAmmoType() == wtype.getAmmoType()) && (atype.getRackSize() == wtype.getRackSize())) { mounted.setLinked(mountedAmmo); success = true; } else if (wtype.hasFlag(WeaponType.F_DOUBLE_ONESHOT) && (mountedAmmo.getLocation() == Entity.LOC_NONE)) { // Make sure this ammo is in the chain, then move it to the head. for (Mounted current = mounted; current != null; current = current.getLinked()) { if (current == mountedAmmo) { current.getLinkedBy().setLinked(current.getLinked()); current.setLinked(mounted.getLinked()); mounted.setLinked(current); return true; } } } return success; }
Mounted mLinker = weapon.getLinkedBy(); if ((wtype.getAmmoType() == AmmoType.T_ATM) || ((mLinker != null)