Package megamek.common

Examples of megamek.common.WeaponType


                    if (newmount.getType() instanceof WeaponType) {
                        // if so then I need to find out if it is the same class
                        // as the current weapon bay
                        // If the current bay is null, then it needs to be
                        // initialized
                        WeaponType weap = (WeaponType) newmount.getType();
                        if (bayMount == null) {
                            if (subCap) {
                                try {
                                    bayMount = a.addEquipment(WeaponType.getSubCapBayType(weap.getAtClass()), nLoc, rearMount);
                                    newBay = false;
                                } catch (LocationFullException ex) {
                                    throw new EntityLoadingException(ex.getMessage());
                                }
                            } else {
                                try {
                                    bayMount = a.addEquipment(WeaponType.getBayType(weap.getAtClass()), nLoc, rearMount);
                                    newBay = false;
                                } catch (LocationFullException ex) {
                                    throw new EntityLoadingException(ex.getMessage());
                                }
                            }
                        }

                        int damage = weap.getRoundShortAV();
                        if (weap.isCapital()) {
                            damage *= 10;
                        }
                        if (!newBay && (bayDamage + damage) <= 700 && bayMount.isRearMounted() == rearMount && weap.getAtClass() == ((WeaponType) bayMount.getType()).getAtClass() && !(((WeaponType) bayMount.getType()).isSubCapital() && !weap.isSubCapital())) {
                            // then we should add this weapon to the current bay
                            bayMount.addWeaponToBay(a.getEquipmentNum(newmount));
                            bayDamage += damage;
                        } else {
                            if (subCap) {
                                try {
                                    bayMount = a.addEquipment(WeaponType.getSubCapBayType(weap.getAtClass()), nLoc, rearMount);
                                } catch (LocationFullException ex) {
                                    throw new EntityLoadingException(ex.getMessage());
                                }
                            } else {
                                try {
                                    bayMount = a.addEquipment(WeaponType.getBayType(weap.getAtClass()), nLoc, rearMount);
                                } catch (LocationFullException ex) {
                                    throw new EntityLoadingException(ex.getMessage());
                                }
                            }
                            bayMount.addWeaponToBay(a.getEquipmentNum(newmount));
View Full Code Here


                    if (newmount.getType() instanceof WeaponType) {
                        // if so then I need to find out if it is the same class
                        // as the current weapon bay
                        // If the current bay is null, then it needs to be
                        // initialized
                        WeaponType weap = (WeaponType) newmount.getType();
                        if (bayMount == null) {
                            if (subCap) {
                                try {
                                    bayMount = a.addEquipment(WeaponType.getSubCapBayType(weap.getAtClass()), nLoc, rearMount);
                                    newBay = false;
                                } catch (LocationFullException ex) {
                                    throw new EntityLoadingException(ex.getMessage());
                                }
                            } else {
                                try {
                                    bayMount = a.addEquipment(WeaponType.getBayType(weap.getAtClass()), nLoc, rearMount);
                                    newBay = false;
                                } catch (LocationFullException ex) {
                                    throw new EntityLoadingException(ex.getMessage());
                                }
                            }
                        }

                        int damage = weap.getRoundShortAV();
                        if (weap.isCapital()) {
                            damage *= 10;
                        }
                        if (!newBay && (bayDamage + damage) <= 700 && bayMount.isRearMounted() == rearMount && weap.getAtClass() == ((WeaponType) bayMount.getType()).getAtClass() && !(((WeaponType) bayMount.getType()).isSubCapital() && !weap.isSubCapital())) {
                            // then we should add this weapon to the current bay
                            bayMount.addWeaponToBay(a.getEquipmentNum(newmount));
                            bayDamage += damage;
                        } else {
                            if (subCap) {
                                try {
                                    bayMount = a.addEquipment(WeaponType.getSubCapBayType(weap.getAtClass()), nLoc, rearMount);
                                } catch (LocationFullException ex) {
                                    throw new EntityLoadingException(ex.getMessage());
                                }
                            } else {
                                try {
                                    bayMount = a.addEquipment(WeaponType.getBayType(weap.getAtClass()), nLoc, rearMount);
                                } catch (LocationFullException ex) {
                                    throw new EntityLoadingException(ex.getMessage());
                                }
                            }
                            bayMount.addWeaponToBay(a.getEquipmentNum(newmount));
View Full Code Here

                    if (newmount.getType() instanceof WeaponType) {
                        // if so then I need to find out if it is the same class
                        // as the current weapon bay
                        // If the current bay is null, then it needs to be
                        // initialized
                        WeaponType weap = (WeaponType) newmount.getType();
                        if (bayMount == null) {
                            if (subCap) {
                                try {
                                    bayMount = a.addEquipment(WeaponType.getSubCapBayType(weap.getAtClass()), nLoc, rearMount);
                                    newBay = false;
                                } catch (LocationFullException ex) {
                                    throw new EntityLoadingException(ex.getMessage());
                                }
                            } else {
                                try {
                                    bayMount = a.addEquipment(WeaponType.getBayType(weap.getAtClass()), nLoc, rearMount);
                                    newBay = false;
                                } catch (LocationFullException ex) {
                                    throw new EntityLoadingException(ex.getMessage());
                                }
                            }
                        }

                        int damage = weap.getRoundShortAV();
                        if (weap.isCapital()) {
                            damage *= 10;
                        }
                        if (!newBay && (bayDamage + damage) <= 700 && bayMount.isRearMounted() == rearMount && weap.getAtClass() == ((WeaponType) bayMount.getType()).getAtClass() && !(((WeaponType) bayMount.getType()).isSubCapital() && !weap.isSubCapital())) {
                            // then we should add this weapon to the current bay
                            bayMount.addWeaponToBay(a.getEquipmentNum(newmount));
                            bayDamage += damage;
                        } else {
                            if (subCap) {
                                try {
                                    bayMount = a.addEquipment(WeaponType.getSubCapBayType(weap.getAtClass()), nLoc, rearMount);
                                } catch (LocationFullException ex) {
                                    throw new EntityLoadingException(ex.getMessage());
                                }
                            } else {
                                try {
                                    bayMount = a.addEquipment(WeaponType.getBayType(weap.getAtClass()), nLoc, rearMount);
                                } catch (LocationFullException ex) {
                                    throw new EntityLoadingException(ex.getMessage());
                                }
                            }
                            bayMount.addWeaponToBay(a.getEquipmentNum(newmount));
View Full Code Here

            tempPanel.add(choC3, GBC.eol());
            refreshC3();
        }
        boolean eligibleForOffBoard = false;
        for (Mounted mounted : entity.getWeaponList()) {
            WeaponType wtype = (WeaponType) mounted.getType();
            if (wtype.hasFlag(WeaponType.F_ARTILLERY)) {
                eligibleForOffBoard = true;
            }
        }
        if (eligibleForOffBoard) {
            tempPanel.add(labOffBoard, GBC.std());
View Full Code Here

        panRapidfireMGs.setLayout(gbl);
        GridBagConstraints gbc = new GridBagConstraints();

        int row = 0;
        for (Mounted m : entity.getWeaponList()) {
            WeaponType wtype = (WeaponType) m.getType();
            if (!wtype.hasFlag(WeaponType.F_MG)) {
                continue;
            }
            gbc.gridy = row++;
            RapidfireMGPanel rmp = new RapidfireMGPanel(m);
            gbl.setConstraints(rmp, gbc);
View Full Code Here

    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

            tempPanel.add(choC3, GBC.eol());
            refreshC3();
        }
        boolean eligibleForOffBoard = false;
        for (Mounted mounted : entity.getWeaponList()) {
            WeaponType wtype = (WeaponType) mounted.getType();
            if (wtype.hasFlag(WeaponType.F_ARTILLERY)) {
                eligibleForOffBoard = true;
            }
        }
        if (eligibleForOffBoard) {
            tempPanel.add(labOffBoard, GBC.std());
View Full Code Here

    private void setupRapidfireMGs() {
        GridBagLayout gbl = new GridBagLayout();
        panRapidfireMGs.setLayout(gbl);
        for (Mounted m : entity.getWeaponList()) {
            WeaponType wtype = (WeaponType) m.getType();
            if (!wtype.hasFlag(WeaponType.F_MG)) {
                continue;
            }
            RapidfireMGPanel rmp = new RapidfireMGPanel(m);
            panRapidfireMGs.add(rmp, GBC.eol());
            m_vMGs.add(rmp);
View Full Code Here

    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

                    if (newmount.getType() instanceof WeaponType) {
                        // if so then I need to find out if it is the same class
                        // as the current weapon bay
                        // If the current bay is null, then it needs to be
                        // initialized
                        WeaponType weap = (WeaponType) newmount.getType();
                        if (bayMount == null) {
                            if (subCap) {
                                try {
                                    bayMount = a.addEquipment(WeaponType.getSubCapBayType(weap.getAtClass()), nLoc, rearMount);
                                    newBay = false;
                                } catch (LocationFullException ex) {
                                    throw new EntityLoadingException(ex.getMessage());
                                }
                            } else {
                                try {
                                    bayMount = a.addEquipment(WeaponType.getBayType(weap.getAtClass()), nLoc, rearMount);
                                    newBay = false;
                                } catch (LocationFullException ex) {
                                    throw new EntityLoadingException(ex.getMessage());
                                }
                            }
                        }

                        int damage = weap.getRoundShortAV();
                        if (weap.isCapital()) {
                            damage *= 10;
                        }
                        if (!newBay && (bayDamage + damage) <= 700 && bayMount.isRearMounted() == rearMount && weap.getAtClass() == ((WeaponType) bayMount.getType()).getAtClass() && !(((WeaponType) bayMount.getType()).isSubCapital() && !weap.isSubCapital())) {
                            // then we should add this weapon to the current bay
                            bayMount.addWeaponToBay(a.getEquipmentNum(newmount));
                            bayDamage += damage;
                        } else {
                            if (subCap) {
                                try {
                                    bayMount = a.addEquipment(WeaponType.getSubCapBayType(weap.getAtClass()), nLoc, rearMount);
                                } catch (LocationFullException ex) {
                                    throw new EntityLoadingException(ex.getMessage());
                                }
                            } else {
                                try {
                                    bayMount = a.addEquipment(WeaponType.getBayType(weap.getAtClass()), nLoc, rearMount);
                                } catch (LocationFullException ex) {
                                    throw new EntityLoadingException(ex.getMessage());
                                }
                            }
                            bayMount.addWeaponToBay(a.getEquipmentNum(newmount));
View Full Code Here

TOP

Related Classes of megamek.common.WeaponType

Copyright © 2018 www.massapicom. 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.