Package megamek.common

Examples of megamek.common.Coords.translated()


        // Spread to the next hex downwind on a 12 if the first hex wasn't
        // burning...
        // unless a higher hex intervenes
        IHex nextHex = game.getBoard().getHex(nextCoords);
        IHex jumpHex = game.getBoard().getHex(nextCoords.translated(windDir));
        if ((nextHex != null) && (jumpHex != null) && !(nextHex.containsTerrain(Terrains.FIRE))
                && ((curHeight >= nextHex.ceiling()) || (jumpHex.ceiling() >= nextHex.ceiling()))) {
            // we've already gone one step in the wind direction, now go another
            directroll.addModifier(3, "crossing non-burning hex");
            spreadFire(nextCoords.translated(windDir), directroll, curHeight);
View Full Code Here


        IHex jumpHex = game.getBoard().getHex(nextCoords.translated(windDir));
        if ((nextHex != null) && (jumpHex != null) && !(nextHex.containsTerrain(Terrains.FIRE))
                && ((curHeight >= nextHex.ceiling()) || (jumpHex.ceiling() >= nextHex.ceiling()))) {
            // we've already gone one step in the wind direction, now go another
            directroll.addModifier(3, "crossing non-burning hex");
            spreadFire(nextCoords.translated(windDir), directroll, curHeight);
        }

        // spread fire 60 degrees clockwise....
        spreadFire(src.translated((windDir + 1) % 6), obliqueroll, curHeight);
View Full Code Here

            if (!hexNeedsBridge(board.getHex(next))) {
                end = next;
                break;
            }
            hexes.add(next);
            next = next.translated(direction);
        }
        if (end != null) {
            // got start and end, can we make a bridge?
            if (hexes.size() == 0)
                return null;
View Full Code Here

            Coords c = i.next();
            IHex hex = board.getHex(c);
            // work out exits...
            int exits = 0;
            for (int dir = 0; dir < 6; dir++) {
                if (building.containsCoords(c.translated(dir))) {
                    exits |= (1 << dir);
                }
            }

            // remove everything
View Full Code Here

        IHex curHex = game.getBoard().getHex(start);
        Report r;
        int skidDistance = 0; // actual distance moved
        ArrayList<Entity> avoidedChargeUnits = new ArrayList<Entity>();
        while (!entity.isDoomed() && (distance > 0)) {
            nextPos = curPos.translated(direction);
            // Is the next hex off the board?
            if (!game.getBoard().contains(nextPos)) {

                // Can the entity skid off the map?
                if (game.getOptions().booleanOption("push_off_board")) {
View Full Code Here

                        int forward = Math.max(step.getVelocityLeft() / 2, 1);
                        if (forward < step.getVelocityLeft()) {
                            fellDuringMovement = true;
                        }
                        while (forward > 0) {
                            curPos = curPos.translated(step.getFacing());
                            forward--;
                            distance++;
                            // make sure it didn't fly off the map
                            if (!game.getBoard().contains(curPos)) {
                                r = new Report(9370, Report.PUBLIC);
View Full Code Here

                    // could also look at intervening defensive
                    ArrayList<Coords> coord = new ArrayList<Coords>();
                    Coords back = option.getFinalCoords().translated(
                            (option.getFinalFacing() + 3) % 6);
                    coord.add(back);
                    coord.add(back.translated((option.getFinalFacing() + 2) % 6));
                    coord.add(back.translated((option.getFinalFacing() + 4) % 6));
                    coord.add(option.getFinalCoords().translated((option.getFinalFacing())));
                    coord
                            .add(option.getFinalCoords().translated(
                                    (option.getFinalFacing() + 1) % 6));
View Full Code Here

                    ArrayList<Coords> coord = new ArrayList<Coords>();
                    Coords back = option.getFinalCoords().translated(
                            (option.getFinalFacing() + 3) % 6);
                    coord.add(back);
                    coord.add(back.translated((option.getFinalFacing() + 2) % 6));
                    coord.add(back.translated((option.getFinalFacing() + 4) % 6));
                    coord.add(option.getFinalCoords().translated((option.getFinalFacing())));
                    coord
                            .add(option.getFinalCoords().translated(
                                    (option.getFinalFacing() + 1) % 6));
                    coord
View Full Code Here

                    server.sendServerChat(connId, "Hex (" + (coord.x + 1)
                            + ", " + (coord.y + 1) + ") is not on the board.");
                }

                if (i < args.length) {
                    coord = coord.translated(args[i]);
                }

                i++;
            } while (i < args.length);
        } catch (NumberFormatException nfe) {
View Full Code Here

                    report = report + "Hex (" + (coord.x + 1) + ", "
                            + (coord.y + 1) + ") is not on the board.\n";
                }

                if (i < args.length) {
                    coord = coord.translated(args[i]);
                }

                i++;
            } while (i < args.length);
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.