Package megamek.common

Examples of megamek.common.EquipmentMode


            int possibleSinkage = ((Mech) entity).getNumberOfSinks() - entity.getCoolantFailureAmount();
            for (Mounted m : entity.getEquipment()) {
                if (m.getType() instanceof AmmoType) {
                    AmmoType at = (AmmoType) m.getType();
                    if ((at.getAmmoType() == AmmoType.T_COOLANT_POD) && m.isAmmoUsable()) {
                        EquipmentMode mode = m.curMode();
                        if (mode.equals("dump")) {
                            r = new Report(5260);
                            r.subject = entity.getId();
                            addReport(r);
                            m.setShotsLeft(0);
                            tosink += possibleSinkage;
                            break;
                        }
                        if (mode.equals("safe") && (entity.heat - tosink > safeHeat)) {
                            r = new Report(5265);
                            r.subject = entity.getId();
                            addReport(r);
                            m.setShotsLeft(0);
                            tosink += possibleSinkage;
                            break;
                        }
                        if (mode.equals("efficient") && (entity.heat - tosink >= possibleSinkage)) {
                            r = new Report(5270);
                            r.subject = entity.getId();
                            addReport(r);
                            m.setShotsLeft(0);
                            tosink += possibleSinkage;
View Full Code Here


                        modeLabel.setEnabled(true);
                        m_chMode.setEnabled(true);
                        m_chMode.removeAll();
                        for (Enumeration<EquipmentMode> e = m.getType()
                                .getModes(); e.hasMoreElements();) {
                            EquipmentMode em = e.nextElement();
                            m_chMode.add(em.getDisplayableName());
                        }
                        m_chMode.select(m.curMode().getDisplayableName());
                    }
                } else if ((m != null) && bOwner && m.getType().hasModes()) {
                    if (!m.isDestroyed() && en.isActive()) {
                        m_chMode.setEnabled(true);
                    }
                    if (!m.isDestroyed() && !en.isActive()
                            && en.isCapitalFighter()
                            && en.isPartOfFighterSquadron()) {
                        m_chMode.setEnabled(true);
                    }
                    if (!m.isDestroyed()
                            && m.getType().hasFlag(MiscType.F_STEALTH)) {
                        m_chMode.setEnabled(true);
                    }

                    // If not using tacops Energy Weapon rule then remove all
                    // the dial down statements
                    if (m.getType().hasFlag(WeaponType.F_ENERGY)
                            && (((WeaponType) m.getType()).getAmmoType() == AmmoType.T_NA)
                            && !clientgui.getClient().game.getOptions()
                                    .booleanOption("tacops_energy_weapons")) {
                        m_chMode.removeAll();
                        return;
                    }

                    // If not using tacops Gauss Weapon rule then remove all the
                    // power up/down modes
                    if ((m.getType() instanceof GaussWeapon)
                            && !clientgui.getClient().game.getOptions()
                                    .booleanOption("tacops_gauss_weapons")) {
                        m_chMode.removeAll();
                        return;
                    }
                    // disable rapid fire mode switching for Aeros
                    if (((en instanceof Aero) && (m.getType() instanceof ACWeapon))
                            || (m.getType() instanceof RACWeapon)
                            || (m.getType() instanceof UACWeapon)) {
                        m_chMode.removeAll();
                        return;
                    }
                    modeLabel.setEnabled(true);
                    m_chMode.removeAll();
                    for (Enumeration<EquipmentMode> e = m.getType().getModes(); e
                            .hasMoreElements();) {
                        EquipmentMode em = e.nextElement();
                        m_chMode.add(em.getDisplayableName());
                    }
                    m_chMode.select(m.curMode().getDisplayableName());
                } else {
                    CriticalSlot cs = getSelectedCritical();
                    if ((cs != null) && (cs.getType() == CriticalSlot.TYPE_SYSTEM)) {
View Full Code Here

                    }
                    ((DefaultComboBoxModel) m_chMode.getModel())
                            .removeAllElements();
                    for (Enumeration<EquipmentMode> e = m.getType().getModes(); e
                            .hasMoreElements();) {
                        EquipmentMode em = e.nextElement();
                        m_chMode.addItem(em.getDisplayableName());
                    }
                    m_chMode.setSelectedItem(m.curMode().getDisplayableName());
                } else {
                    CriticalSlot cs = getSelectedCritical();
                    if ((cs != null) && (cs.getType() == CriticalSlot.TYPE_SYSTEM)) {
View Full Code Here

            r = new Report(3187);
            r.subject = subjectId;
            vPhaseReport.addElement(r);
        } else {
            int priority = 1;
            EquipmentMode mode = (weapon.curMode());
            if (mode != null) {
                if (mode.getName() == "1-shot") {
                    priority = 1;
                } else if (mode.getName() == "2-shot") {
                    priority = 2;
                } else if (mode.getName() == "3-shot") {
                    priority = 3;
                } else if (mode.getName() == "4-shot") {
                    priority = 4;
                }
            }
            if (priority < 1)
                priority = 1;
View Full Code Here

     *      boolean, megamek.common.Building, java.util.Vector)
     */
    protected boolean handleSpecialMiss(Entity entityTarget,
            boolean targetInBuilding, Building bldg, Vector<Report> vPhaseReport) {
        int priority = 1;
        EquipmentMode mode = (weapon.curMode());
        if (mode != null) {
            if (mode.getName() == "1-shot") {
                priority = 1;
            } else if (mode.getName() == "2-shot") {
                priority = 2;
            } else if (mode.getName() == "3-shot") {
                priority = 3;
            } else if (mode.getName() == "4-shot") {
                priority = 4;
            }
        }
        //add even misses, as they waste homing missiles.
        TagInfo info = new TagInfo(ae.getId(), entityTarget.getId(), priority,
View Full Code Here

    }

    private MenuItem createModeMenuItem(Mounted mounted, int position) {
        MenuItem item = new MenuItem();

        EquipmentMode mode = mounted.getType().getMode(position);

        if (mode.equals(mounted.curMode())) {
            item.setLabel("* " + mode.getDisplayableName());
        } else {
            item.setLabel(mode.getDisplayableName());
        }

        item.setActionCommand(Integer.toString(position));
        item.addActionListener(new ActionListener() {
            public void actionPerformed(ActionEvent e) {
View Full Code Here

    }

    private JMenuItem createModeJMenuItem(Mounted mounted, int position) {
        JMenuItem item = new JMenuItem();

        EquipmentMode mode = mounted.getType().getMode(position);

        if (mode.equals(mounted.curMode())) {
            item.setText("* " + mode.getDisplayableName());
        } else {
            item.setText(mode.getDisplayableName());
        }

        item.setActionCommand(Integer.toString(position));
        item.addActionListener(new ActionListener() {
            public void actionPerformed(ActionEvent e) {
View Full Code Here

TOP

Related Classes of megamek.common.EquipmentMode

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.