Examples of AmmoType


Examples of megamek.common.AmmoType

                    && bayWAmmo != null
                    && ae.getTotalAmmoOfType(bayWAmmo.getType()) >= bayW.getCurrentShots()) {
                WeaponType bayWType = ((WeaponType)bayW.getType());
                //need to cycle through weapons and add av
                double current_av = 0;                            
                AmmoType atype = (AmmoType)bayWAmmo.getType();             
               
                if(range == WeaponType.RANGE_SHORT) {
                    current_av =  bayWType.getShortAV();
                } else if(range == WeaponType.RANGE_MED) {
                    current_av = bayWType.getMedAV();
                } else if (range == WeaponType.RANGE_LONG) {
                    current_av = bayWType.getLongAV();
                } else if (range == WeaponType.RANGE_EXT) {
                    current_av = bayWType.getExtAV();
                }
                current_av = updateAVforAmmo(current_av, atype,
                                             bayWType, range, wId);              
                av = av + current_av;
                //now use the ammo that we had loaded
                if(current_av > 0) {
                    int shots = bayW.getCurrentShots();
                    for(int i = 0; i < shots; i++) {
                        if(null == bayWAmmo || bayWAmmo.getShotsLeft() < 1) {
                            //try loadinsg something else
                            ae.loadWeaponWithSameAmmo(bayW);
                            bayWAmmo = bayW.getLinked();
                        }
                        if(null != bayWAmmo) {
                            bayWAmmo.setShotsLeft(bayWAmmo.getShotsLeft() - 1);
                        }
                    }
                }
               
                //check for nukes and tele-missiles and if they are there then I will need to
                //add them to an inserted attack list and reset the av
                if(atype.hasFlag(AmmoType.F_NUCLEAR) || atype.hasFlag(AmmoType.F_TELE_MISSILE)) {
                    insertedAttacks.addElement(wId);
                    av = av - current_av;
                }
            }
        }      
View Full Code Here

Examples of megamek.common.AmmoType

        boolean bMekStealthActive = false;
        if (ae instanceof Mech) {
            bMekStealthActive = ae.isStealthActive();
        }
        Mounted mLinker = weapon.getLinkedBy();
        AmmoType atype = (AmmoType) ammo.getType();
        // is any hex in the flight path of the missile ECM affected?
        boolean bECMAffected = false;
        // if the attacker is affected by ECM or the target is protected by ECM
        // then
        // act as if effected.
        if (Compute.isAffectedByECM(ae, ae.getPosition(), target.getPosition())) {
            bECMAffected = true;
        }

        if (((mLinker != null) && (mLinker.getType() instanceof MiscType)
                && !mLinker.isDestroyed() && !mLinker.isMissing()
                && !mLinker.isBreached() && mLinker.getType().hasFlag(
                MiscType.F_ARTEMIS))
                && (atype.getMunitionType() == AmmoType.M_ARTEMIS_CAPABLE)) {
            if (bECMAffected) {
                // ECM prevents bonus
                r = new Report(3330);
                r.subject = subjectId;
                r.newlines = 0;
                vPhaseReport.addElement(r);
            } else if (bMekStealthActive) {
                // stealth prevents bonus
                r = new Report(3335);
                r.subject = subjectId;
                r.newlines = 0;
                vPhaseReport.addElement(r);
            } else {
                nMissilesModifier += 2;
            }
        } else if (((mLinker != null) && (mLinker.getType() instanceof MiscType)
                && !mLinker.isDestroyed() && !mLinker.isMissing()
                && !mLinker.isBreached() && mLinker.getType().hasFlag(
                MiscType.F_APOLLO))
                && (atype.getAmmoType() == AmmoType.T_MRM)) {
            nMissilesModifier -= 1;
        } else if (atype.getAmmoType() == AmmoType.T_ATM) {
            if (bECMAffected) {
                // ECM prevents bonus
                r = new Report(3330);
                r.subject = subjectId;
                r.newlines = 0;
                vPhaseReport.addElement(r);
            } else if (bMekStealthActive) {
                // stealth prevents bonus
                r = new Report(3335);
                r.subject = subjectId;
                r.newlines = 0;
                vPhaseReport.addElement(r);
            } else {
                nMissilesModifier += 2;
            }
        } else if ((entityTarget != null)
                && (entityTarget.isNarcedBy(ae.getOwner().getTeam()) || entityTarget
                        .isINarcedBy(ae.getOwner().getTeam()))) {
            // only apply Narc bonus if we're not suffering ECM effect
            // and we are using narc ammo, and we're not firing indirectly.
            // narc capable missiles are only affected if the narc pod, which
            // sits on the target, is ECM affected
            boolean bTargetECMAffected = false;
            bTargetECMAffected = Compute.isAffectedByECM(ae,
                    target.getPosition(), target.getPosition());
            if (((atype.getAmmoType() == AmmoType.T_LRM) ||
                    (atype.getAmmoType() == AmmoType.T_SRM) ||
                    (atype.getAmmoType() == AmmoType.T_MML))
                       && (atype.getMunitionType() == AmmoType.M_NARC_CAPABLE)
                       && ((weapon.curMode() == null) || !weapon.curMode().equals(
                               "Indirect"))) {
                if (bTargetECMAffected) {
                    // ECM prevents bonus
                    r = new Report(3330);
View Full Code Here

Examples of megamek.common.AmmoType

            av = wtype.getRoundLongAV();
        } else if (range == WeaponType.RANGE_EXT) {
            av = wtype.getRoundExtAV();
        }
        Mounted mLinker = weapon.getLinkedBy();
        AmmoType atype = (AmmoType) ammo.getType();
        int bonus = 0;
        if (((mLinker != null) && (mLinker.getType() instanceof MiscType)
                && !mLinker.isDestroyed() && !mLinker.isMissing()
                && !mLinker.isBreached() && mLinker.getType().hasFlag(
                MiscType.F_ARTEMIS))
                && (atype.getMunitionType() == AmmoType.M_ARTEMIS_CAPABLE)) {
            bonus = (int)Math.ceil(atype.getRackSize() / 5.0);
            if(atype.getAmmoType() == AmmoType.T_SRM) {
                bonus = 2;
            }
        }
        av = av + bonus;
        if ((atype.getAmmoType() == AmmoType.T_MML) && !atype.hasFlag(AmmoType.F_MML_LRM)) {
            av = av * 2;
        }
        return (av);
    }
View Full Code Here

Examples of megamek.common.AmmoType

    }

    protected boolean isNemesisConfusable() {
        // Are we iNarc Nemesis Confusable?
        boolean isNemesisConfusable = false;
        AmmoType atype = (AmmoType) ammo.getType();
        Mounted mLinker = weapon.getLinkedBy();
        if ((wtype.getAmmoType() == AmmoType.T_ATM)
                || ((mLinker != null) && (mLinker.getType() instanceof MiscType)
                        && !mLinker.isDestroyed() && !mLinker.isMissing()
                        && !mLinker.isBreached() && mLinker.getType().hasFlag(
                        MiscType.F_ARTEMIS))) {
            if ((!weapon.getType().hasModes() || !weapon.curMode().equals(
                    "Indirect"))
                    && (((atype.getAmmoType() == AmmoType.T_ATM) && ((atype
                            .getMunitionType() == AmmoType.M_STANDARD)
                            || (atype.getMunitionType() == AmmoType.M_EXTENDED_RANGE) || (atype
                            .getMunitionType() == AmmoType.M_HIGH_EXPLOSIVE))) || (((atype
                            .getAmmoType() == AmmoType.T_LRM) || (atype
                            .getAmmoType() == AmmoType.T_SRM)) && (atype
                            .getMunitionType() == AmmoType.M_ARTEMIS_CAPABLE)))) {
                isNemesisConfusable = true;
            }
        } else if ((wtype.getAmmoType() == AmmoType.T_LRM)
                || (wtype.getAmmoType() == AmmoType.T_SRM)) {
            if ((atype.getMunitionType() == AmmoType.M_NARC_CAPABLE)
                    || (atype.getMunitionType() == AmmoType.M_LISTEN_KILL)) {
                isNemesisConfusable = true;
            }
        }
        return isNemesisConfusable;
    }
View Full Code Here

Examples of megamek.common.AmmoType

     * @return a <code>boolean</code> value indicating wether this should be
     *         kept or not
     */
    public boolean handle(IGame.Phase phase, Vector<Report> vPhaseReport) {
       
        AmmoType atype = (AmmoType)ammo.getType();
        //just launch the tele-missile
        server.deployTeleMissile(ae, atype, ae.getEquipmentNum(weapon), getCapMisMod(), vPhaseReport);     
       
        return false;
       
View Full Code Here

Examples of megamek.common.AmmoType

        }

        if ((mounted.getLinked() != null)
                && (((WeaponType) mounted.getType()).getAmmoType() != AmmoType.T_NA)) {
            Mounted ammoMount = mounted.getLinked();
            AmmoType ammoType = (AmmoType) ammoMount.getType();
            waa.setAmmoId(ce().getEquipmentNum(ammoMount));
            if (((ammoType.getMunitionType() == AmmoType.M_THUNDER_VIBRABOMB) && ((ammoType
                    .getAmmoType() == AmmoType.T_LRM) || (ammoType.getAmmoType() == AmmoType.T_MML)))
                    || (ammoType.getMunitionType() == AmmoType.M_VIBRABOMB_IV)) {
                VibrabombSettingDialog vsd = new VibrabombSettingDialog(
                        clientgui.frame);
                vsd.setVisible(true);
                waa.setOtherAttackInfo(vsd.getSetting());
            }
View Full Code Here

Examples of megamek.common.AmmoType

            WeaponType wtype = (WeaponType) weapon.getType();
            boolean isWeaponInfantry = wtype.hasFlag(WeaponType.F_INFANTRY);
            boolean usesAmmo = (wtype.getAmmoType() != AmmoType.T_NA)
                    && !isWeaponInfantry;
            Mounted ammo = usesAmmo ? weapon.getLinked() : null;
            AmmoType atype = ammo == null ? null : (AmmoType) ammo.getType();

            // Leg and swarm attacks can't be aimed.
            if ((wtype.getInternalName() == Infantry.LEG_ATTACK)
                    || (wtype.getInternalName() == Infantry.SWARM_MEK)) {
                return false;
            }
            switch (aimingMode) {
            case (IAimingModes.AIM_MODE_NONE):
                return false;
            case (IAimingModes.AIM_MODE_IMMOBILE):
                if (atype != null) {
                    switch (atype.getAmmoType()) {
                    case AmmoType.T_SRM_STREAK:
                    case AmmoType.T_LRM_STREAK:
                    case AmmoType.T_LRM:
                    case AmmoType.T_LRM_TORPEDO:
                    case AmmoType.T_SRM:
                    case AmmoType.T_SRM_TORPEDO:
                    case AmmoType.T_MRM:
                    case AmmoType.T_NARC:
                    case AmmoType.T_AMS:
                    case AmmoType.T_ARROW_IV:
                    case AmmoType.T_LONG_TOM:
                    case AmmoType.T_SNIPER:
                    case AmmoType.T_THUMPER:
                    case AmmoType.T_SRM_ADVANCED:
                    case AmmoType.T_LRM_TORPEDO_COMBO:
                    case AmmoType.T_ATM:
                    case AmmoType.T_MML:
                    case AmmoType.T_EXLRM:
                    case AmmoType.T_TBOLT_5:
                    case AmmoType.T_TBOLT_10:
                    case AmmoType.T_TBOLT_15:
                    case AmmoType.T_TBOLT_20:
                    case AmmoType.T_PXLRM:
                    case AmmoType.T_HSRM:
                    case AmmoType.T_MRM_STREAK:
                        return false;
                    }
                    if (((atype.getAmmoType() == AmmoType.T_AC_LBX) || (atype
                            .getAmmoType() == AmmoType.T_AC_LBX_THB))
                            && (atype.getMunitionType() == AmmoType.M_CLUSTER)) {
                        return false;
                    }
                }
                break;
            case (IAimingModes.AIM_MODE_TARG_COMP):
                if (!wtype.hasFlag(WeaponType.F_DIRECT_FIRE)
                        || wtype.hasFlag(WeaponType.F_PULSE)) {
                    return false;
                }
                if (weapon.getCurrentShots() > 1) {
                    return false;
                }
                if ((wtype.hasFlag(WeaponType.F_NO_AIM))
                        || ((atype != null)
                                && ((atype.getAmmoType() == AmmoType.T_AC_LBX) || (atype
                                        .getAmmoType() == AmmoType.T_AC_LBX_THB)) && (atype
                                .getMunitionType() == AmmoType.M_CLUSTER))) {
                    return false;
                }
                break;
            }
View Full Code Here

Examples of megamek.common.AmmoType

            WeaponType wtype = (WeaponType) weapon.getType();
            boolean isWeaponInfantry = wtype.hasFlag(WeaponType.F_INFANTRY);
            boolean usesAmmo = (wtype.getAmmoType() != AmmoType.T_NA)
                    && !isWeaponInfantry;
            Mounted ammo = usesAmmo ? weapon.getLinked() : null;
            AmmoType atype = ammo == null ? null : (AmmoType) ammo.getType();

            // Leg and swarm attacks can't be aimed.
            if (wtype.getInternalName().equals(Infantry.LEG_ATTACK)
                    || wtype.getInternalName().equals(Infantry.SWARM_MEK)) {
                return false;
            }
            switch (aimingMode) {
            case (IAimingModes.AIM_MODE_NONE):
                return false;
            case (IAimingModes.AIM_MODE_IMMOBILE):
                if (atype != null) {
                    switch (atype.getAmmoType()) {
                    case (AmmoType.T_SRM_STREAK):
                    case (AmmoType.T_LRM_STREAK):
                    case (AmmoType.T_LRM):
                    case (AmmoType.T_LRM_TORPEDO):
                    case (AmmoType.T_SRM):
                    case (AmmoType.T_SRM_TORPEDO):
                    case (AmmoType.T_MRM):
                    case (AmmoType.T_NARC):
                    case (AmmoType.T_AMS):
                    case (AmmoType.T_ARROW_IV):
                    case (AmmoType.T_LONG_TOM):
                    case (AmmoType.T_SNIPER):
                    case (AmmoType.T_THUMPER):
                    case (AmmoType.T_SRM_ADVANCED):
                    case (AmmoType.T_LRM_TORPEDO_COMBO):
                    case (AmmoType.T_ATM):
                    case (AmmoType.T_MML):
                    case (AmmoType.T_EXLRM):
                    case AmmoType.T_TBOLT_5:
                    case AmmoType.T_TBOLT_10:
                    case AmmoType.T_TBOLT_15:
                    case AmmoType.T_TBOLT_20:
                    case AmmoType.T_PXLRM:
                    case AmmoType.T_HSRM:
                    case AmmoType.T_MRM_STREAK:
                        return false;
                    }
                    if (((atype.getAmmoType() == AmmoType.T_AC_LBX) || (atype
                            .getAmmoType() == AmmoType.T_AC_LBX_THB))
                            && (atype.getMunitionType() == AmmoType.M_CLUSTER)) {
                        return false;
                    }
                }
                break;
            case (IAimingModes.AIM_MODE_TARG_COMP):
                if (!wtype.hasFlag(WeaponType.F_DIRECT_FIRE)
                        || wtype.hasFlag(WeaponType.F_PULSE)) {
                    return false;
                }
                if (weapon.getCurrentShots() > 1) {
                    return false;
                }
                if ((atype != null)
                        && ((atype.getAmmoType() == AmmoType.T_AC_LBX) || (atype
                                .getAmmoType() == AmmoType.T_AC_LBX_THB))
                        && (atype.getMunitionType() == AmmoType.M_CLUSTER)) {
                    return false;
                }
                break;
            }
            return true;
View Full Code Here

Examples of megamek.common.AmmoType

        }

        if ((null != mounted.getLinked())
                && (((WeaponType) mounted.getType()).getAmmoType() != AmmoType.T_NA)) {
            Mounted ammoMount = mounted.getLinked();
            AmmoType ammoType = (AmmoType) ammoMount.getType();
            waa.setAmmoId(ce().getEquipmentNum(ammoMount));
            if (((ammoType.getMunitionType() == AmmoType.M_THUNDER_VIBRABOMB) && ((ammoType
                    .getAmmoType() == AmmoType.T_LRM) || (ammoType.getAmmoType() == AmmoType.T_MML)))
                    || (ammoType.getMunitionType() == AmmoType.M_VIBRABOMB_IV))

            {
                VibrabombSettingDialog vsd = new VibrabombSettingDialog(
                        clientgui.frame);
                vsd.setVisible(true);
View Full Code Here

Examples of megamek.common.AmmoType

     * @see megamek.common.weapons.WeaponHandler#calcDamagePerHit()
     */
    @Override
    protected int calcDamagePerHit() {
        double toReturn;
        AmmoType atype = (AmmoType) ammo.getType();
        if (atype.getMunitionType() == AmmoType.M_HIGH_EXPLOSIVE) {
            sSalvoType = " high-explosive missile(s) ";
            toReturn = 3;
        } else if (atype.getMunitionType() == AmmoType.M_EXTENDED_RANGE) {
            sSalvoType = " extended-range missile(s) ";
            toReturn = 1;
        } else {
            toReturn = 2;
        }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.