Examples of WeaponType


Examples of megamek.common.WeaponType

    }

    private String getWeapons(boolean showDetail) {
        StringBuffer sWeapons = new StringBuffer();
        for (Mounted mounted : entity.getWeaponList()) {
            WeaponType wtype = (WeaponType) mounted.getType();

            sWeapons.append(mounted.getDesc()).append("  [") //$NON-NLS-1$
                    .append(entity.getLocationAbbr(mounted.getLocation()));
            if (mounted.isSplit()) {
                sWeapons.append("/") // $NON-NLS-1$
                        .append(
                                entity.getLocationAbbr(mounted
                                        .getSecondLocation()));
            }
            sWeapons.append("]"); //$NON-NLS-1$
            if (entity.isClan()
                    && mounted.getType().getInternalName().substring(0, 2)
                            .equals("IS")) { //$NON-NLS-1$
                sWeapons.append(Messages.getString("MechView.IS")); //$NON-NLS-1$
            }
            if (!entity.isClan()
                    && mounted.getType().getInternalName().substring(0, 2)
                            .equals("CL")) { //$NON-NLS-1$
                sWeapons.append(Messages.getString("MechView.Clan")); //$NON-NLS-1$
            }
            if (wtype.hasFlag(WeaponType.F_ONESHOT)) {
                sWeapons.append(" <") //$NON-NLS-1$
                        .append(mounted.getLinked().getDesc()).append(">"); //$NON-NLS-1$
            }

            if(wtype instanceof BayWeapon) {
                //loop through weapons in bay and add up heat
                int heat = 0;
                for(int wId : mounted.getBayWeapons()) {
                    Mounted m = entity.getEquipment(wId);
                    if(null == m) {
                        continue;
                    }
                    heat = heat + ((WeaponType)m.getType()).getHeat();
                }
                sWeapons.append(" ").append(heat).append(Messages.getString("MechView.Heat")); //$NON-NLS-1$ //$NON-NLS-2$
            } else {
                sWeapons.append(" ").append(wtype.getHeat()).append(Messages.getString("MechView.Heat")); //$NON-NLS-1$ //$NON-NLS-2$
            }

            sWeapons.append("\n"); //$NON-NLS-1$

//          if this is a weapon bay, then cycle through weapons and ammo
            if((wtype instanceof BayWeapon) && showDetail) {
                for(int wId : mounted.getBayWeapons()) {
                    Mounted m = entity.getEquipment(wId);
                    if(null == m) {
                        continue;
                    }

                    WeaponType newwtype = (WeaponType)m.getType();

                    sWeapons.append("  ")
                        .append( m.getDesc() );

                    if (entity.isClan() &&
                        m.getType().getInternalName().substring(0,2).equals("IS")) { //$NON-NLS-1$
                        sWeapons.append(Messages.getString("MechView.IS")); //$NON-NLS-1$
                    }
                    if (!entity.isClan() &&
                        m.getType().getInternalName().substring(0,2).equals("CL")) { //$NON-NLS-1$
                        sWeapons.append(Messages.getString("MechView.Clan")); //$NON-NLS-1$
                    }
                    if (newwtype.hasFlag(WeaponType.F_ONESHOT)) {
                        sWeapons.append(" <") //$NON-NLS-1$
                            .append(mounted.getLinked().getDesc())
                            .append(">"); //$NON-NLS-1$
                    }
View Full Code Here

Examples of megamek.common.WeaponType

        // Offensive characterization - damage potentials
        for (Mounted m : entity.getWeaponList()) {

            int arc = entity.getWeaponArc(entity.getEquipmentNum(m));

            WeaponType weapon = (WeaponType) m.getType();

            // Don't count weapons that don't have ammo, are destroyed/jammed
            if (m.isDestroyed()) {
                continue;
            }
            if (m.isJammed()) {
                continue;
            }
            if (weapon.getName() == "Stop Swarm Attack") {
                // attack
                continue;
            }

            if ((m.getLinked() == null)
                    & (weapon.getAmmoType() != AmmoType.T_NA)) {
                continue;
            }

            num_weapons++;
            heat_total += weapon.getHeat();

            int min = weapon.getMinimumRange();
            int lr = weapon.getExtremeRange();

            double ed;
            int gunnery = entity.getCrew().getGunnery();
            if (entity.getTaserFeedBackRounds() > 0) {
                gunnery += 1;
            }
            // Range used to start at 1; updated to account for stacking
            for (int curRange = 0; (curRange <= lr) && (curRange <= MAX_RANGE); curRange++) {

                ed = CEntity.getExpectedDamage(entity, m, curRange, gunnery);
                if ((curRange <= min) & (curRange <= MIN_BRACKET)) {
                    minRangeMods[curRange] += 1 + min - curRange;
                }

                // Weapons that generate heat are derated based on the
                // units current heat level, 'cause building more heat is bad
                addDamage(arc, entity.isSecondaryArcWeapon(entity
                        .getEquipmentNum(m)), curRange, ed
                        * ((weapon.getHeat() > 0) ? heat_mod : 1));
            }
            long_range = Math
                    .max(long_range, Math.min(lr, MAX_RANGE));
        }

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.