Examples of EquipmentType


Examples of megamek.common.EquipmentType

                    if (temp[1] != null) {
                        nAmmo = Integer.parseInt(temp[1]);
                    }
                }

                EquipmentType etype = EquipmentType.get(equipName);

                if (etype == null) {
                    // try w/ prefix
                    etype = EquipmentType.get(prefix + equipName);
                }
View Full Code Here

Examples of megamek.common.EquipmentType

                    mech.setCritical(loc, c, new CriticalSlot(
                            CriticalSlot.TYPE_SYSTEM, Mech.SYSTEM_GYRO));
                    continue;
                }

                EquipmentType etype = EquipmentType.get(critName);
                if (etype == null) {
                    // try w/ prefix
                    etype = EquipmentType.get(prefix + critName);
                }
                if (etype != null) {
View Full Code Here

Examples of megamek.common.EquipmentType

                if (equipName.startsWith("(R) ")) {
                    rearMount = true;
                    equipName = equipName.substring(4);
                }

                EquipmentType etype = EquipmentType.get(equipName);

                if (etype == null) {
                    // try w/ prefix
                    etype = EquipmentType.get(prefix + equipName);
                }
View Full Code Here

Examples of megamek.common.EquipmentType

    public void actionPerformed(ActionEvent actionEvent) {
        if (actionEvent.getSource() == butOffBoardDistance) {
            int maxDistance = 19 * 17; // Long Tom
            for (Mounted wep : entity.getWeaponList()) {
                EquipmentType e = wep.getType();
                WeaponType w = (WeaponType) e;
                if (w.hasFlag(WeaponType.F_ARTILLERY)) {
                    int nDistance = (w.getLongRange() - 1) * 17;
                    if (nDistance < maxDistance) {
                        maxDistance = nDistance;
View Full Code Here

Examples of megamek.common.EquipmentType

                    if (temp[1] != null) {
                        nAmmo = Integer.parseInt(temp[1]);
                    }
                }

                EquipmentType etype = EquipmentType.get(equipName);

                if (etype == null) {
                    // try w/ prefix
                    etype = EquipmentType.get(prefix + equipName);
                }
View Full Code Here

Examples of megamek.common.EquipmentType

    public void actionPerformed(ActionEvent actionEvent) {
        if (actionEvent.getSource().equals(butOffBoardDistance)) {
            int maxDistance = 19 * 17; // Long Tom
            for (Mounted wep : entity.getWeaponList()) {
                EquipmentType e = wep.getType();
                WeaponType w = (WeaponType) e;
                if (w.hasFlag(WeaponType.F_ARTILLERY)) {
                    int nDistance = (w.getLongRange() - 1) * 17;
                    if (nDistance < maxDistance) {
                        maxDistance = nDistance;
View Full Code Here

Examples of megamek.common.EquipmentType

                    hasTurret = true;
                }

                int weaponAmmo = readUnsignedShort(dis);

                EquipmentType equipmentType = getEquipmentType(weaponType,
                        techType);
                if (equipmentType != null) {
                    addEquipmentType(equipmentType, weaponCount, weaponLocation);

                    if (weaponAmmo > 0) {
View Full Code Here

Examples of megamek.common.EquipmentType

        Hashtable<EquipmentType, Integer> equipmentAtLocation = equipment
                .get(weaponLocation);
        if (equipmentAtLocation != null) {
            for (Enumeration<EquipmentType> e = equipmentAtLocation.keys(); e
                    .hasMoreElements();) {
                EquipmentType equipmentType = e.nextElement();
                Integer count = equipmentAtLocation.get(equipmentType);

                for (int i = 0; i < count.intValue(); i++) {
                    // for experimental or unofficial equipment, we need
                    // to adjust the mech's techlevel, because HMV only
                    // knows lvl1/2/3
                    if ((equipmentType.getTechLevel() > tank.getTechLevel())
                            && (tank.getTechLevel() >= TechConstants.T_IS_ADVANCED)) {
                        boolean isClan = tank.isClan();
                        if ((equipmentType.getTechLevel() == TechConstants.T_IS_EXPERIMENTAL) ||
                                (equipmentType.getTechLevel() == TechConstants.T_CLAN_EXPERIMENTAL)) {
                            tank.setTechLevel(isClan?TechConstants.T_CLAN_EXPERIMENTAL:TechConstants.T_IS_EXPERIMENTAL);
                        } else if ((equipmentType.getTechLevel() == TechConstants.T_IS_UNOFFICIAL) ||
                                (equipmentType.getTechLevel() == TechConstants.T_CLAN_UNOFFICIAL)) {
                            tank.setTechLevel(isClan?TechConstants.T_CLAN_UNOFFICIAL:TechConstants.T_IS_UNOFFICIAL);
                        }
                    }
                    Mounted weapon = tank.addEquipment(equipmentType, location);

                    // Add artemis?
                    // Note this is done here because SRM without artemis and
                    // LRM with artemis
                    // can be in the same location on a tank. (and might be
                    // mislinked)
                    if ((artemisType != 0) && (equipmentType instanceof WeaponType)) {
                        String artemis = null;
                        int ammoType = ((WeaponType) equipmentType)
                                .getAmmoType();
                        if (ammoType == AmmoType.T_LRM) {
                            if ((artemisType & 2) == 2) {
                                artemis = "ArtemisIV";
                            } else if ((artemisType & 8) == 8) {
                                artemis = "ArtemisV";
                            }
                        } else if (ammoType == AmmoType.T_SRM) {
                            if ((artemisType & 1) == 1) {
                                artemis = "ArtemisIV";
                            } else if ((artemisType & 4) == 4) {
                                artemis = "ArtemisV";
                            }
                        }
                        if (artemis != null) {
                            EquipmentType artEq;
                            if ((equipmentType.getTechLevel() == TechConstants.T_CLAN_TW)
                                    || (equipmentType.getTechLevel() == TechConstants.T_CLAN_ADVANCED)) {
                                artEq = EquipmentType.get("CL" + artemis);
                            } else {
                                artEq = EquipmentType.get("IS" + artemis);
View Full Code Here

Examples of megamek.common.EquipmentType

        return equipName;
    }

    private EquipmentType getEquipmentType(long equipment, HMVTechType techType) {
        EquipmentType equipmentType = null;

        String equipmentName = getEquipmentName(equipment, techType);
        if (equipmentName != null) {
            equipmentType = EquipmentType.get(equipmentName);
View Full Code Here

Examples of megamek.common.EquipmentType

                    hashPrefix = "Clan ";
                } else {
                    // assume equipment is inner sphere
                    hashPrefix = "IS ";
                }
                EquipmentType etype = EquipmentType.get(hashPrefix + critName);
                if (etype == null) {
                    // try without prefix
                    etype = EquipmentType.get(critName);
                }
                if (etype != null) {
                    if (etype.isSpreadable()) {
                        // do we already have one of these? Key on Type
                        Mounted m = hSharedEquip.get(etype);
                        if (m != null) {
                            // use the existing one
                            mech.addCritical(loc, new CriticalSlot(
                                    CriticalSlot.TYPE_EQUIPMENT, mech
                                            .getEquipmentNum(m), etype
                                            .isHittable(), m));
                            continue;
                        }
                        m = mech.addEquipment(etype, loc, rearMounted);
                        hSharedEquip.put(etype, m);
                    } else if ((etype instanceof WeaponType)
                            && etype.hasFlag(WeaponType.F_SPLITABLE)) {
                        // do we already have this one in this or an outer
                        // location?
                        Mounted m = null;
                        boolean bFound = false;
                        for (int x = 0, n = vSplitWeapons.size(); x < n; x++) {
                            m = vSplitWeapons.elementAt(x);
                            int nLoc = m.getLocation();
                            if (((nLoc == loc) || (loc == Mech
                                    .getInnerLocation(nLoc)))
                                    && (m.getType() == etype)) {
                                bFound = true;
                                break;
                            }
                        }
                        if (bFound) {
                            m.setFoundCrits(m.getFoundCrits() + 1);
                            if (m.getFoundCrits() >= etype.getCriticals(mech)) {
                                vSplitWeapons.removeElement(m);
                            }
                            // if we're in a new location, set the
                            // weapon as split
                            if (loc != m.getLocation()) {
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.