Search in sources :

Example 6 with EquipmentType

use of megamek.common.EquipmentType in project megameklab by MegaMek.

the class EquipmentView method loadEquipmentCombo.

private void loadEquipmentCombo() {
    equipmentCombo.setRenderer(new EquipmentListCellRenderer(getBattleArmor()));
    equipmentCombo.setKeySelectionManager(new EquipmentListCellKeySelectionManager());
    equipmentCombo.removeAllItems();
    equipmentTypes = new Vector<EquipmentType>();
    for (EquipmentType eq : masterEquipmentList) {
        if (UnitUtil.isLegal(getBattleArmor(), eq)) {
            equipmentTypes.add(eq);
            equipmentCombo.addItem(eq);
        }
    }
}
Also used : EquipmentListCellKeySelectionManager(megameklab.com.util.EquipmentListCellKeySelectionManager) EquipmentListCellRenderer(megameklab.com.util.EquipmentListCellRenderer) EquipmentType(megamek.common.EquipmentType)

Example 7 with EquipmentType

use of megamek.common.EquipmentType in project megameklab by MegaMek.

the class AerospaceBuildView method mousePressed.

public void mousePressed(MouseEvent e) {
    // locations, but only if those locations are make sense
    if (e.getButton() == MouseEvent.BUTTON3) {
        JPopupMenu popup = new JPopupMenu();
        JMenuItem item = null;
        if (equipmentTable.getSelectedRowCount() > 1) {
            List<Mounted> list = new ArrayList<>();
            for (int row : equipmentTable.getSelectedRows()) {
                list.add((Mounted) equipmentTable.getModel().getValueAt(row, CriticalTableModel.EQUIPMENT));
            }
            for (BayWeaponCriticalTree l : arcViews) {
                // Aerodyne small craft and dropships skip the aft side arcs
                if (getAero().hasETypeFlag(Entity.ETYPE_SMALL_CRAFT) && !getAero().isSpheroid() && !l.validForAerodyne()) {
                    continue;
                }
                if (list.stream().anyMatch(eq -> l.canAdd(eq))) {
                    item = new JMenuItem(l.getLocationName());
                    item.addActionListener(ev -> l.addToLocation(list));
                    popup.add(item);
                }
            }
        } else {
            final int selectedRow = equipmentTable.rowAtPoint(e.getPoint());
            Mounted eq = (Mounted) equipmentTable.getModel().getValueAt(selectedRow, CriticalTableModel.EQUIPMENT);
            for (BayWeaponCriticalTree l : arcViews) {
                // Aerodyne small craft and dropships skip the aft side arcs
                if (getAero().hasETypeFlag(Entity.ETYPE_SMALL_CRAFT) && !getAero().isSpheroid() && !l.validForAerodyne()) {
                    continue;
                }
                if (getAero().usesWeaponBays()) {
                    JMenu menu = new JMenu(l.getLocationName());
                    for (Mounted bay : l.baysFor(eq)) {
                        if (eq.getType() instanceof AmmoType) {
                            final int shotCount = ((AmmoType) eq.getType()).getShots();
                            JMenu locMenu = new JMenu(bay.getName());
                            for (int shots = shotCount; shots <= eq.getUsableShotsLeft(); shots += shotCount) {
                                item = new JMenuItem("Add " + shots + ((shots > 1) ? " shots" : " shot"));
                                final int addShots = shots;
                                item.addActionListener(ev -> l.addAmmoToBay(bay, eq, addShots));
                                locMenu.add(item);
                            }
                            menu.add(locMenu);
                        } else {
                            item = new JMenuItem(bay.getName());
                            item.addActionListener(ev -> l.addToBay(bay, eq));
                            menu.add(item);
                        }
                    }
                    if (eq.getType() instanceof WeaponType) {
                        final EquipmentType bayType = ((WeaponType) eq.getType()).getBayType();
                        item = new JMenuItem("New " + bayType.getName());
                        item.addActionListener(ev -> l.addToNewBay(bayType, eq));
                        menu.add(item);
                    }
                    if (menu.getItemCount() > 0) {
                        popup.add(menu);
                    } else if ((eq.getType() instanceof MiscType) && l.canAdd(eq)) {
                        item = new JMenuItem(l.getLocationName());
                        item.addActionListener(ev -> l.addToLocation(eq));
                        popup.add(item);
                    }
                } else {
                    item = new JMenuItem(l.getLocationName());
                    item.addActionListener(ev -> l.addToLocation(eq));
                    popup.add(item);
                }
            }
        }
        popup.show(this, e.getX(), e.getY());
    }
}
Also used : ListSelectionModel(javax.swing.ListSelectionModel) Weapon(megamek.common.weapons.Weapon) ArrayList(java.util.ArrayList) EquipmentType(megamek.common.EquipmentType) EntitySource(megameklab.com.ui.EntitySource) Vector(java.util.Vector) JMenuItem(javax.swing.JMenuItem) TitledBorder(javax.swing.border.TitledBorder) Mounted(megamek.common.Mounted) StringUtils(megameklab.com.util.StringUtils) BorderLayout(java.awt.BorderLayout) MouseListener(java.awt.event.MouseListener) AmmoType(megamek.common.AmmoType) TableColumn(javax.swing.table.TableColumn) JPopupMenu(javax.swing.JPopupMenu) AeroBayTransferHandler(megameklab.com.ui.util.AeroBayTransferHandler) JMenu(javax.swing.JMenu) IView(megameklab.com.util.IView) BorderFactory(javax.swing.BorderFactory) ActionEvent(java.awt.event.ActionEvent) MouseEvent(java.awt.event.MouseEvent) JScrollPane(javax.swing.JScrollPane) Dimension(java.awt.Dimension) List(java.util.List) WeaponType(megamek.common.WeaponType) CriticalTableModel(megameklab.com.util.CriticalTableModel) MiscType(megamek.common.MiscType) JTable(javax.swing.JTable) Collections(java.util.Collections) Entity(megamek.common.Entity) BayWeaponCriticalTree(megameklab.com.ui.util.BayWeaponCriticalTree) RefreshListener(megameklab.com.util.RefreshListener) CopyOnWriteArrayList(java.util.concurrent.CopyOnWriteArrayList) MiscType(megamek.common.MiscType) ArrayList(java.util.ArrayList) CopyOnWriteArrayList(java.util.concurrent.CopyOnWriteArrayList) BayWeaponCriticalTree(megameklab.com.ui.util.BayWeaponCriticalTree) EquipmentType(megamek.common.EquipmentType) JPopupMenu(javax.swing.JPopupMenu) AmmoType(megamek.common.AmmoType) Mounted(megamek.common.Mounted) WeaponType(megamek.common.WeaponType) JMenuItem(javax.swing.JMenuItem) JMenu(javax.swing.JMenu)

Example 8 with EquipmentType

use of megamek.common.EquipmentType in project megameklab by MegaMek.

the class PrintInfantry method printImage.

public void printImage(Graphics2D g2d, PageFormat pageFormat) {
    if ((null == g2d) || (null == infantry)) {
        return;
    }
    SVGDiagram diagram;
    int stop = Math.min(4, infantryList.size() - currentPosition);
    if (stop > 3) {
        diagram = ImageHelper.loadSVGImage(new File("data/images/recordsheets/Conventional_Infantry_no_tables.svg"));
    } else {
        diagram = ImageHelper.loadSVGImage(new File("data/images/recordsheets/Conventional_Infantry_tables.svg"));
    }
    try {
        Tspan tspan = (Tspan) diagram.getElement("text_copyright");
        tspan.setText(String.format(tspan.getText(), Calendar.getInstance().get(Calendar.YEAR)));
        ((Text) tspan.getParent()).rebuild();
        diagram.render(g2d);
        for (int pos = 0; pos < stop; pos++) {
            diagram = ImageHelper.loadSVGImage(new File("data/images/recordsheets/Conventional_Infantry_platoon_" + (pos + 1) + ".svg"));
            infantry = infantryList.get(pos + currentPosition);
            tspan = (Tspan) diagram.getElement(ID_PLATOON_NAME);
            String name = infantry.getChassis();
            if (infantry.getModel().length() > 0) {
                name += " " + infantry.getModel();
            }
            if (name.length() > 48) {
                tspan.setText(infantry.getChassis());
            } else {
                tspan.setText(name);
            }
            ((Text) tspan.getParent()).rebuild();
            tspan = (Tspan) diagram.getElement(ID_ARMOR_KIT);
            EquipmentType armor = infantry.getArmorKit();
            if (armor != null) {
                tspan.setText(armor.getName());
                ((Text) tspan.getParent()).rebuild();
            } else if (infantry.hasDEST()) {
                tspan.setText("DEST");
                ((Text) tspan.getParent()).rebuild();
            } else {
                StringJoiner sj = new StringJoiner("/");
                if (infantry.hasSneakCamo()) {
                    sj.add("Camo");
                }
                if (infantry.hasSneakIR()) {
                    sj.add("IR");
                }
                if (infantry.hasSneakECM()) {
                    sj.add("ECM");
                }
                if (sj.length() > 0) {
                    tspan.setText("Sneak(" + sj.toString() + ")");
                    ((Text) tspan.getParent()).rebuild();
                }
            }
            tspan = (Tspan) diagram.getElement(ID_ARMOR_DIVISOR);
            tspan.setText(String.valueOf(infantry.getDamageDivisor() + (infantry.isArmorEncumbering() ? "E" : "")));
            ((Text) tspan.getParent()).rebuild();
            for (int j = 1; j <= 30; j++) {
                if (j > infantry.getShootingStrength()) {
                    diagram.getElement(ID_SOLDIER + j).addAttribute("display", AnimationElement.AT_XML, "none");
                    diagram.getElement(ID_NO_SOLDIER + j).removeAttribute("display", AnimationElement.AT_XML);
                } else {
                    tspan = (Tspan) diagram.getElement(ID_DAMAGE + j);
                    tspan.setText(String.valueOf((int) Math.round(infantry.getDamagePerTrooper() * j)));
                    ((Text) tspan.getParent()).rebuild();
                }
            }
            diagram.updateTime(0);
            InfantryWeapon rangeWeapon = infantry.getPrimaryWeapon();
            if (infantry.getSecondaryWeapon() != null && infantry.getSecondaryN() > 1 && !infantry.getSecondaryWeapon().hasFlag(WeaponType.F_TAG)) {
                rangeWeapon = infantry.getSecondaryWeapon();
            }
            boolean scuba = infantry.getMovementMode() == EntityMovementMode.INF_UMU || infantry.getMovementMode() == EntityMovementMode.SUBMARINE;
            if (scuba) {
                diagram.getElement(ID_UW_LABEL).removeAttribute("display", AnimationElement.AT_XML);
            }
            InfantryWeapon singleSecondary = (infantry.getSecondaryN() == 1) ? infantry.getSecondaryWeapon() : null;
            for (int j = 0; j <= 21; j++) {
                tspan = (Tspan) diagram.getElement(ID_RANGE_MOD + j);
                tspan.setText(rangeMod(j, rangeWeapon, singleSecondary, false));
                if (scuba) {
                    tspan = (Tspan) diagram.getElement(ID_UW_RANGE_MOD + j);
                    tspan.setText(rangeMod(j, rangeWeapon, singleSecondary, true));
                }
                ((Text) tspan.getParent()).rebuild();
            }
            int numGuns = 0;
            int numShots = 0;
            WeaponType gun = null;
            for (Mounted m : infantry.getEquipment()) {
                if (m.getLocation() == Infantry.LOC_FIELD_GUNS) {
                    if (m.getType() instanceof WeaponType) {
                        gun = (WeaponType) m.getType();
                        numGuns++;
                    } else if (m.getType() instanceof AmmoType) {
                        numShots += ((AmmoType) m.getType()).getShots();
                    }
                }
            }
            if (gun == null) {
                diagram.getElement(ID_FIELD_GUN_COLUMNS).addAttribute("display", AnimationElement.AT_XML, "none");
            } else {
                tspan = (Tspan) diagram.getElement(ID_FIELD_GUN_QTY);
                tspan.setText(Integer.toString(numGuns));
                ((Text) tspan.getParent()).rebuild();
                tspan = (Tspan) diagram.getElement(ID_FIELD_GUN_TYPE);
                tspan.setText(gun.getName());
                ((Text) tspan.getParent()).rebuild();
                /* We don't use StringUnits.getEquipmentInfo() to format the damage
					 * string because gauss explosion flags do not apply, and switchable
					 * only applies for non-LBX.
					 */
                tspan = (Tspan) diagram.getElement(ID_FIELD_GUN_DMG);
                if (gun instanceof ArtilleryWeapon) {
                    tspan.setText(gun.getRackSize() + " [AE,S,F]");
                } else {
                    StringBuilder sb = new StringBuilder(Integer.toString(gun.getDamage()));
                    switch(gun.getAmmoType()) {
                        case AmmoType.T_AC_ULTRA:
                        case AmmoType.T_AC_ULTRA_THB:
                            sb.append("/Sht, R2 [DB,R/S/C]");
                            break;
                        case AmmoType.T_AC_ROTARY:
                            sb.append("/Sht, R6 [DB,R/S/C]");
                            break;
                        case AmmoType.T_AC:
                        case AmmoType.T_AC_PRIMITIVE:
                        case AmmoType.T_LAC:
                            sb.append(" [DB,C/S/F]");
                            break;
                        case AmmoType.T_AC_LBX:
                        case AmmoType.T_AC_LBX_THB:
                            sb.append(" [DB,C/F]");
                            break;
                        default:
                            sb.append(" [DB]");
                    }
                    tspan.setText(sb.toString());
                }
                ((Text) tspan.getParent()).rebuild();
                tspan = (Tspan) diagram.getElement(ID_FIELD_GUN_MIN_RANGE);
                if (gun.getMinimumRange() > 0) {
                    tspan.setText(Integer.toString(gun.getMinimumRange()));
                } else {
                    tspan.setText("—");
                }
                ((Text) tspan.getParent()).rebuild();
                tspan = (Tspan) diagram.getElement(ID_FIELD_GUN_SHORT);
                tspan.setText(Integer.toString(gun.getShortRange()));
                ((Text) tspan.getParent()).rebuild();
                tspan = (Tspan) diagram.getElement(ID_FIELD_GUN_MED);
                tspan.setText(Integer.toString(gun.getMediumRange()));
                ((Text) tspan.getParent()).rebuild();
                tspan = (Tspan) diagram.getElement(ID_FIELD_GUN_LONG);
                tspan.setText(Integer.toString(gun.getLongRange()));
                ((Text) tspan.getParent()).rebuild();
                tspan = (Tspan) diagram.getElement(ID_FIELD_GUN_AMMO);
                tspan.setText(Integer.toString(numShots));
                ((Text) tspan.getParent()).rebuild();
                tspan = (Tspan) diagram.getElement(ID_FIELD_GUN_CREW);
                tspan.setText(Integer.toString((int) Math.ceil(gun.getTonnage(infantry))));
                ((Text) tspan.getParent()).rebuild();
            }
            if (infantry.hasDEST()) {
                diagram.getElement(ID_DEST_MODS).removeAttribute("display", AnimationElement.AT_XML);
                diagram.getElement(ID_SNEAK_IR_MODS).removeAttribute("display", AnimationElement.AT_XML);
            } else if (infantry.hasSneakCamo()) {
                diagram.getElement(ID_SNEAK_CAMO_MODS).removeAttribute("display", AnimationElement.AT_XML);
            }
            if (infantry.hasSneakIR()) {
                diagram.getElement(ID_SNEAK_IR_MODS).removeAttribute("display", AnimationElement.AT_XML);
            }
            tspan = (Tspan) diagram.getElement(ID_BV);
            tspan.setText(Integer.toString(infantry.calculateBattleValue()));
            ((Text) tspan.getParent()).rebuild();
            tspan = (Tspan) diagram.getElement(ID_TRANSPORT_WT);
            tspan.setText(String.format("%.1f tons", infantry.getWeight()));
            ((Text) tspan.getParent()).rebuild();
            Tspan mp1 = (Tspan) diagram.getElement(ID_MP_1);
            Tspan mode1 = (Tspan) diagram.getElement(ID_MODE_1);
            Tspan mp2 = (Tspan) diagram.getElement(ID_MP_2);
            Tspan mode2 = (Tspan) diagram.getElement(ID_MODE_2);
            switch(infantry.getMovementMode()) {
                case INF_JUMP:
                    mp1.setText(Integer.toString(infantry.getJumpMP(false)));
                    mode1.setText("Jump");
                    mp2.setText(Integer.toString(infantry.getWalkMP(true, true, false)));
                    mode2.setText("Ground");
                    ((Text) mp2.getParent()).rebuild();
                    ((Text) mode2.getParent()).rebuild();
                    break;
                case INF_UMU:
                    mp1.setText(Integer.toString(infantry.getActiveUMUCount()));
                    if (infantry.getOriginalJumpMP() > 1) {
                        mode1.setText("SCUBA (Motorized)");
                    } else {
                        mode1.setText("SCUBA");
                    }
                    mp2.setText(Integer.toString(infantry.getWalkMP(true, true, false)));
                    mode2.setText("Ground");
                    ((Text) mp2.getParent()).rebuild();
                    ((Text) mode2.getParent()).rebuild();
                    break;
                case HOVER:
                    mp1.setText(Integer.toString(infantry.getWalkMP(true, true, false)));
                    mode1.setText("Mechanized Hover");
                    break;
                case TRACKED:
                    mp1.setText(Integer.toString(infantry.getWalkMP(true, true, false)));
                    mode1.setText("Mechanized Tracked");
                    break;
                case WHEELED:
                    mp1.setText(Integer.toString(infantry.getWalkMP(true, true, false)));
                    mode1.setText("Mechanized Wheeled");
                    break;
                case VTOL:
                    mp1.setText(Integer.toString(infantry.getJumpMP(false)));
                    if (infantry.hasMicrolite()) {
                        mode1.setText("VTOL (Microlite)");
                    } else {
                        mode1.setText("VTOL (Micro-copter)");
                    }
                    break;
                case SUBMARINE:
                    mp1.setText(Integer.toString(infantry.getActiveUMUCount()));
                    mode1.setText("Mechanized SCUBA");
                    break;
                case INF_MOTORIZED:
                    mp1.setText(Integer.toString(infantry.getWalkMP(true, true, false)));
                    mode1.setText("Motorized");
                    break;
                case INF_LEG:
                default:
                    mp1.setText(Integer.toString(infantry.getWalkMP(true, true, false)));
                    mode1.setText("Ground");
                    break;
            }
            if (mp1.getText().equals("0")) {
                mp1.setText("0*");
            }
            ((Text) mp1.getParent()).rebuild();
            ((Text) mode1.getParent()).rebuild();
            List<String> notes = new ArrayList<>();
            if (infantry.isMechanized() || infantry.isArmorEncumbering()) {
                notes.add("Cannot make anti-'Mech attacks.");
            }
            if (infantry.hasSpaceSuit()) {
                notes.add("Can operate in vacuum.");
            }
            if (rangeWeapon.hasFlag(WeaponType.F_INF_BURST)) {
                notes.add("+1D6 damage vs. conventional infantry.");
            }
            if (rangeWeapon.hasFlag(WeaponType.F_INF_NONPENETRATING)) {
                notes.add("Can only damage conventional infantry.");
            }
            if (infantry.getPrimaryWeapon().hasFlag(WeaponType.F_INFERNO) || (infantry.getSecondaryWeapon() != null && infantry.getSecondaryWeapon().hasFlag(WeaponType.F_INFERNO))) {
                notes.add("Flame-based weapon.");
            } else {
                for (int i = 0; i < infantry.getPrimaryWeapon().getModesCount(); i++) {
                    if (infantry.getPrimaryWeapon().getMode(i).equals("Heat")) {
                        notes.add("Flame-based weapon.");
                        break;
                    }
                }
                if (infantry.getSecondaryWeapon() != null) {
                    for (int i = 0; i < infantry.getSecondaryWeapon().getModesCount(); i++) {
                        if (infantry.getSecondaryWeapon().getMode(i).equals("Heat")) {
                            notes.add("Flame-based weapon.");
                        }
                    }
                }
            }
            if (infantry.getPrimaryWeapon().hasFlag(WeaponType.F_INF_AA) || (infantry.getSecondaryWeapon() != null && infantry.getSecondaryWeapon().hasFlag(WeaponType.F_INF_AA))) {
                notes.add("Can attack airborn units.");
            }
            if (infantry.hasSpecialization(Infantry.BRIDGE_ENGINEERS)) {
                notes.add("Bridge-building equipment");
            }
            if (infantry.hasSpecialization(Infantry.DEMO_ENGINEERS)) {
                notes.add("Equipped with demolition gear");
            }
            if (infantry.hasSpecialization(Infantry.FIRE_ENGINEERS)) {
                notes.add("Firefighting equipment");
            }
            if (infantry.hasSpecialization(Infantry.MINE_ENGINEERS)) {
                notes.add("Minesweeper equipment");
            }
            if (infantry.hasSpecialization(Infantry.TRENCH_ENGINEERS)) {
                notes.add("Trench/Fieldwork equipment");
            }
            if (infantry.hasSpecialization(Infantry.MARINES)) {
                notes.add("No penalties for vacuum or zero-G");
            }
            if (infantry.hasSpecialization(Infantry.MOUNTAIN_TROOPS)) {
                notes.add("Mountain climbing equipment");
            }
            if (infantry.hasSpecialization(Infantry.PARAMEDICS)) {
                notes.add("Paramedic equipment.");
            }
            if (infantry.hasSpecialization(Infantry.PARATROOPS)) {
                notes.add("Can make atmospheric drops.");
            }
            if (infantry.hasSpecialization(Infantry.SENSOR_ENGINEERS)) {
                notes.add("Surveillance and communication equipment");
            }
            if (infantry.hasSpecialization(Infantry.TAG_TROOPS)) {
                notes.add("Equipped with TAG (Range 3/6/9)");
            }
            if (infantry.hasSneakECM()) {
                notes.add("Invisible to standard/light active probes.");
            }
            for (int i = 0; i < Math.min(8, notes.size()); i++) {
                tspan = (Tspan) diagram.getElement(ID_NOTE_LINE + i);
                tspan.setText(notes.get(i));
            }
            ((Text) diagram.getElement(ID_NOTES)).rebuild();
            diagram.updateTime(0);
            diagram.render(g2d);
        }
    } catch (SVGException ex) {
        ex.printStackTrace();
    }
    g2d.scale(pageFormat.getImageableWidth(), pageFormat.getImageableHeight());
}
Also used : SVGException(com.kitfox.svg.SVGException) ArrayList(java.util.ArrayList) Text(com.kitfox.svg.Text) Tspan(com.kitfox.svg.Tspan) EquipmentType(megamek.common.EquipmentType) AmmoType(megamek.common.AmmoType) SVGDiagram(com.kitfox.svg.SVGDiagram) ArtilleryWeapon(megamek.common.weapons.artillery.ArtilleryWeapon) Mounted(megamek.common.Mounted) WeaponType(megamek.common.WeaponType) File(java.io.File) StringJoiner(java.util.StringJoiner) InfantryWeapon(megamek.common.weapons.infantry.InfantryWeapon)

Example 9 with EquipmentType

use of megamek.common.EquipmentType in project megameklab by MegaMek.

the class EquipmentTab method removeHeatSinks.

private void removeHeatSinks() {
    int location = 0;
    for (; location < equipmentList.getRowCount(); ) {
        Mounted mount = (Mounted) equipmentList.getValueAt(location, CriticalTableModel.EQUIPMENT);
        EquipmentType eq = mount.getType();
        if ((eq instanceof MiscType) && (UnitUtil.isHeatSink(mount))) {
            try {
                equipmentList.removeCrit(location);
            } catch (ArrayIndexOutOfBoundsException aioobe) {
                return;
            } catch (Exception ex) {
                ex.printStackTrace();
            }
        } else {
            location++;
        }
    }
}
Also used : Mounted(megamek.common.Mounted) MiscType(megamek.common.MiscType) EquipmentType(megamek.common.EquipmentType) LocationFullException(megamek.common.LocationFullException)

Example 10 with EquipmentType

use of megamek.common.EquipmentType in project megameklab by MegaMek.

the class StructureTab method jumpChanged.

@Override
public void jumpChanged(int jumpMP, EquipmentType jumpJet) {
    // Don't set jumpMP for UMU.
    if (null == jumpJet) {
        getMech().setOriginalJumpMP(0);
        jumpMP = 0;
    } else if (jumpJet.hasFlag(MiscType.F_JUMP_JET) || jumpJet.hasFlag(MiscType.F_JUMP_BOOSTER)) {
        getMech().setOriginalJumpMP(jumpMP);
    } else {
        getMech().setOriginalJumpMP(0);
    }
    List<Mounted> jjs = getMech().getMisc().stream().filter(m -> m.getType() == jumpJet).collect(Collectors.toList());
    if (jumpJet.hasFlag(MiscType.F_JUMP_BOOSTER)) {
        if (!getMech().hasWorkingMisc(MiscType.F_JUMP_BOOSTER)) {
            UnitUtil.createSpreadMounts(getMech(), jumpJet);
        }
    } else {
        while (jjs.size() > jumpMP) {
            UnitUtil.removeMounted(getMech(), jjs.remove(jjs.size() - 1));
        }
        while (jumpMP > jjs.size()) {
            try {
                UnitUtil.addMounted(getMech(), new Mounted(getMech(), jumpJet), Entity.LOC_NONE, false);
            } catch (LocationFullException e) {
            // Adding to LOC_NONE
            }
            jumpMP--;
        }
    }
    panSummary.refresh();
    refresh.refreshBuild();
    refresh.refreshStatus();
    refresh.refreshPreview();
    panMovement.setFromEntity(getMech());
}
Also used : MekBuildListener(megameklab.com.ui.view.listeners.MekBuildListener) CriticalSlot(megamek.common.CriticalSlot) EntityLoadingException(megamek.common.loaders.EntityLoadingException) SummaryView(megameklab.com.ui.Mek.views.SummaryView) SwingConstants(javax.swing.SwingConstants) TestEntity(megamek.common.verifier.TestEntity) EquipmentType(megamek.common.EquipmentType) EntitySource(megameklab.com.ui.EntitySource) ArmorAllocationView(megameklab.com.ui.view.ArmorAllocationView) QuadVee(megamek.common.QuadVee) Mounted(megamek.common.Mounted) UnitUtil(megameklab.com.util.UnitUtil) BorderLayout(java.awt.BorderLayout) MVFArmorView(megameklab.com.ui.view.MVFArmorView) MekChassisView(megameklab.com.ui.view.MekChassisView) ITechManager(megamek.common.ITechManager) BoxLayout(javax.swing.BoxLayout) JComponent(javax.swing.JComponent) MechFileParser(megamek.common.MechFileParser) TechConstants(megamek.common.TechConstants) LocationFullException(megamek.common.LocationFullException) Engine(megamek.common.Engine) Mech(megamek.common.Mech) PatchworkArmorView(megameklab.com.ui.view.PatchworkArmorView) BorderFactory(javax.swing.BorderFactory) LandAirMech(megamek.common.LandAirMech) GridBagConstraints(java.awt.GridBagConstraints) JOptionPane(javax.swing.JOptionPane) Collectors(java.util.stream.Collectors) Box(javax.swing.Box) MovementView(megameklab.com.ui.view.MovementView) ITab(megameklab.com.util.ITab) Dimension(java.awt.Dimension) List(java.util.List) HeatSinkView(megameklab.com.ui.view.HeatSinkView) BasicInfoView(megameklab.com.ui.view.BasicInfoView) JLabel(javax.swing.JLabel) SimpleTechLevel(megamek.common.SimpleTechLevel) MiscType(megamek.common.MiscType) Optional(java.util.Optional) GridBagLayout(java.awt.GridBagLayout) Entity(megamek.common.Entity) JPanel(javax.swing.JPanel) RefreshListener(megameklab.com.util.RefreshListener) LocationFullException(megamek.common.LocationFullException) Mounted(megamek.common.Mounted)

Aggregations

EquipmentType (megamek.common.EquipmentType)49 Mounted (megamek.common.Mounted)24 MiscType (megamek.common.MiscType)14 LocationFullException (megamek.common.LocationFullException)10 ArrayList (java.util.ArrayList)8 JLabel (javax.swing.JLabel)6 AmmoType (megamek.common.AmmoType)6 CriticalSlot (megamek.common.CriticalSlot)6 WeaponType (megamek.common.WeaponType)5 Dimension (java.awt.Dimension)4 List (java.util.List)4 Vector (java.util.Vector)4 BattleArmor (megamek.common.BattleArmor)4 Mech (megamek.common.Mech)4 EntitySource (megameklab.com.ui.EntitySource)4 RefreshListener (megameklab.com.util.RefreshListener)4 GridBagConstraints (java.awt.GridBagConstraints)3 GridBagLayout (java.awt.GridBagLayout)3 ActionEvent (java.awt.event.ActionEvent)3 StringJoiner (java.util.StringJoiner)3