Package megamek.common

Examples of megamek.common.QuadMech


    public Entity getEntity() throws EntityLoadingException {
        try {
            Mech mech = null;
            if ((chassisType == ChassisType.QUADRAPED_OMNI)
                    || (chassisType == ChassisType.QUADRAPED)) {
                mech = new QuadMech(gyroType, cockpitType);
            } else if (chassisType == ChassisType.ARMLESS) {
                mech = new ArmlessMech(gyroType, cockpitType);
            } else {
                mech = new BipedMech(gyroType, cockpitType);
            }
View Full Code Here


                }
            } catch (Exception e) {
                iCockpitType = Mech.COCKPIT_STANDARD;
            }
            if (chassisConfig.indexOf("Quad") != -1) {
                mech = new QuadMech(iGyroType, iCockpitType);
            } else if (chassisConfig.indexOf("LAM") != -1) {
                mech = new LandAirMech(iGyroType, iCockpitType);
            } else {
                mech = new BipedMech(iGyroType, iCockpitType);
            }
View Full Code Here

    public Entity getEntity() throws EntityLoadingException {
        try {
            Mech mech;

            if ("Quad".equals(chassisType.trim())) {
                mech = new QuadMech();
            } else {
                mech = new BipedMech();
            }

            int firstSpace = name.indexOf(" ");
View Full Code Here

        }

        Mech mech = null;

        if (chassisType == 1)
            mech = new QuadMech();
        else
            mech = new BipedMech();

        // Do I even write the year for these??
View Full Code Here

            }
            if (cockpitType.equals("Torso-Mounted")) {
                cockpitType = "Torso Mounted";
            }
            if (chassisConfig.equals("Quad")) {
                mech = new QuadMech(gyroType, cockpitType);
            } else {
                mech = new BipedMech(gyroType, cockpitType);
            }

            // aarg! those stupid sub-names in parenthesis screw everything up
View Full Code Here

     *             <code>null</code>.
     * @throws <code>IllegalStateException</code> if the node does not contain
     *             a valid <code>Entity</code>.
     */
    public static Entity decode(ParsedXML node, IGame game) {
        QuadMech entity = null;
        String attrStr;
        int attrVal;

        // Did we get a null node?
        if (null == node) {
            throw new IllegalArgumentException("The QuadMech node is null.");
        }

        // Make sure that the node is for an Mech unit.
        attrStr = node.getAttribute("name");
        if (!node.getName().equals("class") || null == attrStr
                || !attrStr.equals("QuadMech")) {
            throw new IllegalStateException("Not passed a QuadMech node.");
        }

        // TODO : perform version checking.

        // Create the entity.
        entity = new QuadMech();

        // Walk the board node's children.
        Enumeration<?> children = node.elements();
        while (children.hasMoreElements()) {
            ParsedXML child = (ParsedXML) children.nextElement();
            String childName = child.getName();

            // Handle null child names.
            if (null == childName) {

                // No-op.
            }

            // Did we find the stunnedTurns node?
            else if (childName.equals("mascTurns")) {

                // Get the Mech's stunned turns.
                attrStr = child.getAttribute("value");
                if (null == attrStr) {
                    throw new IllegalStateException(
                            "Couldn't decode the mascTurns for a QuadMech unit.");
                }

                // Try to pull the number from the attribute string
                try {
                    attrVal = Integer.parseInt(attrStr);
                } catch (NumberFormatException exp) {
                    throw new IllegalStateException(
                            "Couldn't get an integer from " + attrStr);
                }
                entity.setMASCTurns(attrVal);
            }

            // Did we find the mascUsed node?
            else if (childName.equals("mascUsed")) {

                // See if the Mech used MASC.
                attrStr = child.getAttribute("value");
                if (null == attrStr) {
                    throw new IllegalStateException(
                            "Couldn't decode mascUsed for a QuadMech unit.");
                }

                // If the value is "true", the Mech used MASC.
                if (attrStr.equals("true")) {
                    entity.setMASCUsed(true);
                }
            }

        } // Handle the next element.

View Full Code Here

TOP

Related Classes of megamek.common.QuadMech

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.