Examples of BipedMech


Examples of megamek.common.BipedMech

                    || (chassisType == ChassisType.QUADRAPED)) {
                mech = new QuadMech(gyroType, cockpitType);
            } else if (chassisType == ChassisType.ARMLESS) {
                mech = new ArmlessMech(gyroType, cockpitType);
            } else {
                mech = new BipedMech(gyroType, cockpitType);
            }

            mech.setChassis(name);
            mech.setModel(model);
            mech.setYear(year);
View Full Code Here

Examples of megamek.common.BipedMech

            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);
            }

            // aarg! those stupid sub-names in parenthesis screw everything up
            // we may do something different in the future, but for now, I'm
            // going to strip them out
View Full Code Here

Examples of megamek.common.BipedMech

            Mech mech;

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

            int firstSpace = name.indexOf(" ");
            if (firstSpace != -1) {
                mech.setChassis(name.substring(firstSpace).trim());
View Full Code Here

Examples of megamek.common.BipedMech

        Mech mech = null;

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

        // Do I even write the year for these??

        if (!dataFile.exists("name"))
            throw new EntityLoadingException("Could not find block.");
View Full Code Here

Examples of megamek.common.BipedMech

                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
            // we may do something different in the future, but for now, I'm
            // going to strip them out
View Full Code Here

Examples of megamek.common.BipedMech

        // Give the game a blank map.
        Game game = new Game();
        game.board = new Board(16, 17);

        // Now create an entity in the game.
        Entity entity = new BipedMech();
        entity.setGame(game);

        // Deploy the entity 30 hexes north of
        // the board and check it's position.
        entity.setOffBoard(30, IOffBoardDirections.NORTH);
        entity.deployOffBoard();
        Coords north = new Coords(8, -30);
        testCoords(north, entity.getPosition());

        // Deploy the entity 45 hexes south of
        // the board and check it's position.
        entity.setOffBoard(45, IOffBoardDirections.SOUTH);
        entity.deployOffBoard();
        Coords south = new Coords(8, 62);
        testCoords(south, entity.getPosition());

        // Deploy the entity 105 hexes east of
        // the board and check it's position.
        entity.setOffBoard(105, IOffBoardDirections.EAST);
        entity.deployOffBoard();
        Coords east = new Coords(121, 9);
        testCoords(east, entity.getPosition());

        // Deploy the entity 3200 hexes west of
        // the board and check it's position.
        entity.setOffBoard(3200, IOffBoardDirections.WEST);
        entity.deployOffBoard();
        Coords west = new Coords(-3200, 9);
        testCoords(west, entity.getPosition());

    }
View Full Code Here

Examples of megamek.common.BipedMech

     *             <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) {
        BipedMech entity = null;
        String attrStr;
        int attrVal;

        // Did we get a null node?
        if (null == node) {
            throw new IllegalArgumentException("The BipedMech 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("BipedMech")) {
            throw new IllegalStateException("Not passed a BipedMech node.");
        }

        // TODO : perform version checking.

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

        // 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 BipedMech 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 BipedMech 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
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.