Examples of GunEmplacement


Examples of megamek.common.GunEmplacement

            if (isMD) {
                buffer.append(Messages.getString("BoardView1.md")); //$NON-NLS-1$
            }
            tipStrings[0] = buffer.toString();

            GunEmplacement ge = null;
            if (entity instanceof GunEmplacement) {
                ge = (GunEmplacement) entity;
            }

            Aero a = null;
            if(entity instanceof Aero) {
                a = (Aero) entity;
            }

            buffer = new StringBuffer();
            if ((ge == null) && (a == null)) {
                buffer.append(Messages.getString("BoardView1.move")) //$NON-NLS-1$
                .append(entity.getMovementAbbr(entity.moved)).append(
                ":") //$NON-NLS-1$
                .append(entity.delta_distance).append(" (+") //$NON-NLS-1$
                .append(
                        Compute.getTargetMovementModifier(game,
                                entity.getId()).getValue())
                                .append(");") //$NON-NLS-1$
                                .append(Messages.getString("BoardView1.Heat")) //$NON-NLS-1$
                                .append(entity.heat);
                if (entity.isCharging()) {
                    buffer.append(" ") //$NON-NLS-1$
                    .append(Messages.getString("BoardView1.charge1")); //$NON-NLS-1$
                }
                if (entity.isMakingDfa()) {
                    buffer.append(" ") //$NON-NLS-1$
                    .append(Messages.getString("BoardBiew1.DFA1")); //$NON-NLS-1$
                }
            } else if (ge == null) {
                buffer.append( Messages.getString("BoardView1.move") ) //$NON-NLS-1$
                .append( entity.getMovementAbbr(entity.moved) )
                .append( ":" ) //$NON-NLS-1$
                .append( entity.delta_distance )
                .append( Messages.getString("BoardView1.Heat") ) //$NON-NLS-1$
                .append( entity.heat );
                if (entity.isCharging()) {
                    buffer.append(" ") //$NON-NLS-1$
                    .append( Messages.getString("BoardView1.charge1")); //$NON-NLS-1$
                }
            } else {
                if (ge.hasTurret() && ge.isTurretLocked()) {
                    buffer
                    .append(Messages
                            .getString("BoardView1.TurretLocked"));
                    if (ge.getFirstWeapon() == -1) {
                        buffer.append(",");
                        buffer.append(Messages
                                .getString("BoardView1.WeaponsDestroyed"));
                    }
                } else if (ge.getFirstWeapon() == -1) {
                    buffer.append(Messages
                            .getString("BoardView1.WeaponsDestroyed"));
                } else {
                    buffer.append(Messages.getString("BoardView1.Operational"));
                }
            }
            if (entity.isDone()) {
                buffer.append(" (").append(
                        Messages.getString("BoardView1.done")).append(")");
            }
            tipStrings[1] = buffer.toString();

            buffer = new StringBuffer();
            if (ge == null) {
                buffer.append(Messages.getString("BoardView1.Armor")) //$NON-NLS-1$
                .append(entity.getTotalArmor()).append(
                        Messages.getString("BoardView1.internal")) //$NON-NLS-1$
                        .append(entity.getTotalInternal());
            } else {
                buffer.append(Messages.getString("BoardView1.cf")) //$NON-NLS-1$
                .append(ge.getCurrentCF()).append(
                        Messages.getString("BoardView1.turretArmor")) //$NON-NLS-1$
                        .append(ge.getCurrentTurretArmor());
            }
            tipStrings[2] = buffer.toString();

            return tipStrings;
        }
View Full Code Here

Examples of megamek.common.GunEmplacement

            if (isMD) {
                buffer.append(Messages.getString("BoardView1.md")); //$NON-NLS-1$
            }
            tipStrings[0] = buffer.toString();

            GunEmplacement ge = null;
            if (entity instanceof GunEmplacement) {
                ge = (GunEmplacement) entity;
            }

            buffer = new StringBuffer();
            if (ge == null) {
                buffer.append(Messages.getString("BoardView1.move")) //$NON-NLS-1$
                        .append(entity.getMovementAbbr(entity.moved)).append(":") //$NON-NLS-1$
                        .append(entity.delta_distance).append(" (+") //$NON-NLS-1$
                        .append(Compute.getTargetMovementModifier(game, entity.getId()).getValue())
                        .append(");") //$NON-NLS-1$
                        .append(Messages.getString("BoardView1.Heat")) //$NON-NLS-1$
                        .append(entity.heat);
                if (entity.isCharging()) {
                    buffer.append(" ") //$NON-NLS-1$
                            .append(Messages.getString("BoardView1.charge1")); //$NON-NLS-1$
                }
                if (entity.isMakingDfa()) {
                    buffer.append(" ") //$NON-NLS-1$
                            .append(Messages.getString("BoardBiew1.DFA1")); //$NON-NLS-1$
                }
            } else {
                if (ge.hasTurret() && ge.isTurretLocked()) {
                    buffer.append(Messages.getString("BoardView1.TurretLocked"));
                    if (ge.getFirstWeapon() == -1) {
                        buffer.append(",");
                        buffer.append(Messages.getString("BoardView1.WeaponsDestroyed"));
                    }
                } else if (ge.getFirstWeapon() == -1) {
                    buffer.append(Messages.getString("BoardView1.WeaponsDestroyed"));
                } else {
                    buffer.append(Messages.getString("BoardView1.Operational"));
                }
            }
            if (entity.isDone()) {
                buffer.append(" (").append(Messages.getString("BoardView1.done")).append(")");
            }
            tipStrings[1] = buffer.toString();

            buffer = new StringBuffer();
            if (ge == null) {
                buffer.append(Messages.getString("BoardView1.Armor")) //$NON-NLS-1$
                        .append(entity.getTotalArmor()).append(
                                Messages.getString("BoardView1.internal")) //$NON-NLS-1$
                        .append(entity.getTotalInternal());
            } else {
                buffer.append(Messages.getString("BoardView1.cf")) //$NON-NLS-1$
                        .append(ge.getCurrentCF()).append(
                                Messages.getString("BoardView1.turretArmor")) //$NON-NLS-1$
                        .append(ge.getCurrentTurretArmor());
            }
            tipStrings[2] = buffer.toString();

            return tipStrings;
        }
View Full Code Here

Examples of megamek.common.GunEmplacement

    public Vector<BackGroundDrawer> getBackgroundDrawers() {
        return bgDrawers;
    }

    public void setEntity(Entity e) {
        GunEmplacement ge = (GunEmplacement) e;
        int loc = GunEmplacement.LOC_BUILDING;
        vLabels[loc].setValue(ge.getArmorString(loc));
        WidgetUtils.setAreaColor(areas[loc], vLabels[loc], (double) ge
                .getArmor(loc)
                / (double) ge.getOArmor(loc));
        loc = GunEmplacement.LOC_TURRET;
        vLabels[loc].setValue(ge.getArmorString(loc));
        WidgetUtils.setAreaColor(areas[loc], vLabels[loc],
                ge.hasTurret() ? (double) ge.getArmor(loc)
                        / (double) ge.getOArmor(loc) : 0);

    }
View Full Code Here

Examples of megamek.common.GunEmplacement

    public Vector<BackGroundDrawer> getBackgroundDrawers() {
        return bgDrawers;
    }

    public void setEntity(Entity e) {
        GunEmplacement ge = (GunEmplacement) e;
        int loc = GunEmplacement.LOC_BUILDING;
        vLabels[loc].setValue(ge.getArmorString(loc));
        WidgetUtils.setAreaColor(areas[loc], vLabels[loc], (double) ge
                .getArmor(loc)
                / (double) ge.getOArmor(loc));
        loc = GunEmplacement.LOC_TURRET;
        vLabels[loc].setValue(ge.getArmorString(loc));
        WidgetUtils.setAreaColor(areas[loc], vLabels[loc],
                ge.hasTurret() ? (double) ge.getArmor(loc)
                        / (double) ge.getOArmor(loc) : 0);

    }
View Full Code Here

Examples of megamek.common.GunEmplacement

            curMoveL.setVisible(false);
            curMoveR.setVisible(false);
            buildingTypeL.setVisible(true);
            buildingTypeR.setVisible(true);
            buildingHeightL.setVisible(true);
            GunEmplacement ge = (GunEmplacement) en;
            switch (ge.getConstructionType()) {
                case Building.LIGHT:
                    buildingTypeR.setString(Messages
                            .getString("GeneralInfoMapSet.buildingTypeRLight"));
                    break;
                case Building.MEDIUM:
                    buildingTypeR
                            .setString(Messages
                                    .getString("GeneralInfoMapSet.buildingTypeRMedium"));
                    break;
                case Building.HEAVY:
                    buildingTypeR.setString(Messages
                            .getString("GeneralInfoMapSet.buildingTypeRHeavy"));
                    break;
                case Building.HARDENED:
                    buildingTypeR
                            .setString(Messages
                                    .getString("GeneralInfoMapSet.buildingTypeRHardened"));
                    break;
                case Building.WALL:
                    buildingTypeR.setString(Messages.getString(""));
                    break;
                default:
                    buildingTypeR
                            .setString(Messages
                                    .getString("GeneralInfoMapSet.buildingTypeRUnknown"));
            }
            buildingHeightR.setString(Integer.toString(ge.getHeight()));
        } else {
            weightL.setVisible(true);
            weightR.setVisible(true);
            mpL0.setVisible(true);
            mpR0.setVisible(true);
View Full Code Here

Examples of megamek.common.GunEmplacement

            curMoveL.setVisible(false);
            curMoveR.setVisible(false);
            buildingTypeL.setVisible(true);
            buildingTypeR.setVisible(true);
            buildingHeightL.setVisible(true);
            GunEmplacement ge = (GunEmplacement) en;
            switch (ge.getConstructionType()) {
                case Building.LIGHT:
                    buildingTypeR.setString(Messages
                            .getString("GeneralInfoMapSet.buildingTypeRLight"));
                    break;
                case Building.MEDIUM:
                    buildingTypeR
                            .setString(Messages
                                    .getString("GeneralInfoMapSet.buildingTypeRMedium"));
                    break;
                case Building.HEAVY:
                    buildingTypeR.setString(Messages
                            .getString("GeneralInfoMapSet.buildingTypeRHeavy"));
                    break;
                case Building.HARDENED:
                    buildingTypeR
                            .setString(Messages
                                    .getString("GeneralInfoMapSet.buildingTypeRHardened"));
                    break;
                case Building.WALL:
                    buildingTypeR.setString(Messages.getString(""));
                    break;
                default:
                    buildingTypeR
                            .setString(Messages
                                    .getString("GeneralInfoMapSet.buildingTypeRUnknown"));
            }
            buildingHeightR.setString(Integer.toString(ge.getHeight()));
        } else {
            weightL.setVisible(true);
            weightR.setVisible(true);
            mpL0.setVisible(true);
            mpR0.setVisible(true);
View Full Code Here

Examples of megamek.common.GunEmplacement

        dataFile = bb;
    }

    public Entity getEntity() throws EntityLoadingException {

        GunEmplacement e = new GunEmplacement();

        if (!dataFile.exists("Name")) {
            throw new EntityLoadingException("Could not find name block.");
        }
        e.setChassis(dataFile.getDataAsString("Name")[0]);

        if (dataFile.exists("Model") && dataFile.getDataAsString("Model")[0] != null) {
            e.setModel(dataFile.getDataAsString("Model")[0]);
        } else {
            e.setModel("");
        }

        setTechLevel(e);

        if (dataFile.exists("source")) {
            e.setSource(dataFile.getDataAsString("source")[0]);
        }

        if (!dataFile.exists("ConstructionFactor")) {
            throw new EntityLoadingException("Could not find block.");
        }
        e.initConstructionFactor(dataFile.getDataAsInt("ConstructionFactor")[0]);

        if (dataFile.exists("Height")) {
            e.setHeight(dataFile.getDataAsInt("Height")[0]);
        }

        if (dataFile.exists("Turret")) {
            e.setTurret(true);
            e.initTurretArmor(dataFile.getDataAsInt("Turret")[0]);
        }

        loadEquipment(e, "North", GunEmplacement.LOC_NORTH);
        loadEquipment(e, "East", GunEmplacement.LOC_EAST);
        loadEquipment(e, "West", GunEmplacement.LOC_WEST);
        if (e.hasTurret()) {
            loadEquipment(e, "Turret", GunEmplacement.LOC_TURRET);
        }
        loadEquipment(e, "Building", GunEmplacement.LOC_BUILDING);
        return e;
    }
View Full Code Here

Examples of megamek.common.GunEmplacement

     * @param out - the <code>Writer</code> that will receive the XML. This
     *            value must not be <code>null</code>.
     * @throws <code>IOException</code> if there's any error on write.
     */
    public static void encode(Entity entity, Writer out) throws IOException {
        GunEmplacement ge = (GunEmplacement) entity;
        // save this so that the GE has the correct building type when decoded
        out.write("<cf>");
        out.write(Integer.toString(ge.getConstructionFactor()));
        out.write("<cf/>");

        if (ge.hasTurret() && ge.isTurretLocked()) {
            out.write("<turretLocked facing=\"");
            out.write(Integer.toString(ge.getSecondaryFacing()));
            out.write("\"/>");
        }
    }
View Full Code Here

Examples of megamek.common.GunEmplacement

                || !"GunEmplacement".equals(node.getAttribute("name"))) {
            throw new IllegalStateException(
                    "Not passed an GunEmplacement node.");
        }

        GunEmplacement ge = new GunEmplacement();

        // TODO : perform version checking.

        Enumeration<?> children = node.elements();
        while (children.hasMoreElements()) {
            ParsedXML child = (ParsedXML) children.nextElement();
            String childName = child.getName();

            if (childName.equals("cf")) {
                String cf = child.getContent().trim();
                try {
                    ge.setConstructionFactor(Integer.parseInt(cf));
                } catch (NumberFormatException nfe) {
                    throw new IllegalStateException(
                            "Invalid integer value for cf element: " + cf);
                }
            } else if (childName.equals("turretLocked")) {
                String facing = child.getAttribute("facing");
                ge.setTurretLocked(true);
                try {
                    ge.setSecondaryFacing(Integer.parseInt(facing));
                } catch (NumberFormatException nfe) {
                    throw new IllegalStateException(
                            "Invalid integer value for facing attribute: "
                                    + facing);
                }
View Full Code Here

Examples of megamek.common.GunEmplacement

        if (isMD) {
            buffer.append(Messages.getString("BoardView1.md")); //$NON-NLS-1$
        }
        out.add(buffer.toString());

        GunEmplacement ge = null;
        if (e instanceof GunEmplacement) {
            ge = (GunEmplacement) e;
        }

        buffer = new StringBuffer();
        if (ge == null) {
            buffer.append(Messages.getString("BoardView1.move")) //$NON-NLS-1$
                    .append(e.getMovementAbbr(e.moved)).append(
                            ":") //$NON-NLS-1$
                    .append(e.delta_distance).append(" (+") //$NON-NLS-1$
                    .append(
                            Compute.getTargetMovementModifier(game,
                                    e.getId()).getValue())
                    .append(");") //$NON-NLS-1$
                    .append(Messages.getString("BoardView1.Heat")) //$NON-NLS-1$
                    .append(e.heat);
            if (e.isCharging()) {
                buffer.append(" ") //$NON-NLS-1$
                        .append(Messages.getString("BoardView1.charge1")); //$NON-NLS-1$
            }
            if (e.isMakingDfa()) {
                buffer.append(" ") //$NON-NLS-1$
                        .append(Messages.getString("BoardBiew1.DFA1")); //$NON-NLS-1$
            }
        } else {
            if (ge.hasTurret() && ge.isTurretLocked()) {
                buffer
                        .append(Messages
                                .getString("BoardView1.TurretLocked"));
                if (ge.getFirstWeapon() == -1) {
                    buffer.append(",");
                    buffer.append(Messages
                            .getString("BoardView1.WeaponsDestroyed"));
                }
            } else if (ge.getFirstWeapon() == -1) {
                buffer.append(Messages
                        .getString("BoardView1.WeaponsDestroyed"));
            } else {
                buffer.append(Messages.getString("BoardView1.Operational"));
            }
        }
        if (e.isDone()) {
            buffer.append(" (").append(
                    Messages.getString("BoardView1.done")).append(")");
        }
        out.add(buffer.toString());

        buffer = new StringBuffer();
        if (ge == null) {
            buffer.append(Messages.getString("BoardView1.Armor")) //$NON-NLS-1$
                    .append(e.getTotalArmor()).append(
                            Messages.getString("BoardView1.internal")) //$NON-NLS-1$
                    .append(e.getTotalInternal());
        } else {
            buffer.append(Messages.getString("BoardView1.cf")) //$NON-NLS-1$
                    .append(ge.getCurrentCF()).append(
                            Messages.getString("BoardView1.turretArmor")) //$NON-NLS-1$
                    .append(ge.getCurrentTurretArmor());
        }
        out.add(buffer.toString());

        Vector<String> strs = sources.get(new Integer(e.getId()));
        if (strs != null) {
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.