Package megamek.common

Examples of megamek.common.Coords


            ArrayList<Coords> candidate, HashSet<Coords> ignore) {
        candidate.add(c);
        ignore.add(c);
        int elevation = board.getHex(c).getElevation();
        for (int dir = 0; dir < 6; dir++) {
            Coords t = c.translated(dir);
            if (board.contains(t) && !ignore.contains(t)) {
                if (hexCouldBeCliff(board, t)) {
                    IHex hex = board.getHex(t);
                    int el = hex.getElevation();
                    if (el == elevation) {
View Full Code Here


        HashSet<Coords> ignore = new HashSet<Coords>(); // previously considered
                                                        // hexes
        ArrayList<Coords> candidate = new ArrayList<Coords>();
        for (int x = 0; x < board.getWidth(); x++) {
            for (int y = 0; y < board.getHeight(); y++) {
                Coords c = new Coords(x, y);
                int elevation = board.getHex(c).getElevation();
                if (ignore.contains(c))
                    continue;
                if (!hexCouldBeCliff(board, c)) {
                    ignore.add(c);
View Full Code Here

    public static void addWeatherConditions(IBoard board, int weatherCond, int windCond) {
        ITerrainFactory tf = Terrains.getTerrainFactory();
       
        for (int x = 0; x < board.getWidth(); x++) {
            for (int y = 0; y < board.getHeight(); y++) {
                Coords c = new Coords(x, y);
                IHex hex = board.getHex(c);
               
                //moderate rain - mud in clear hexes, depth 0 water, and dirt roads (not implemented yet)
                if(weatherCond == PlanetaryConditions.WE_MOD_RAIN) {
                    if(hex.terrainsPresent() == 0 || (hex.containsTerrain(Terrains.WATER) && hex.depth() == 0)) {
View Full Code Here

        ITerrainFactory tf = Terrains.getTerrainFactory();

        for (int x = 0; x < mapW; x++) {
            for (int y = 0; y < mapH; y++) {
                Coords c = new Coords(x, y);
                int distance = c.distance(centre);
                int elev = (100 * height * (width - distance)) / width;
                elev = (elev / 100)
                        + (Compute.randomInt(100) < (elev % 100) ? 1 : 0);

                IHex hex = board.getHex(c);
View Full Code Here

        }
       
        addHeat();
       
        //deliver screen
        Coords coords = target.getPosition();
        server.deliverScreen(coords, vPhaseReport);
       
        //damage any entities in the hex
        for (Enumeration<Entity> impactHexHits = game.getEntities(coords);impactHexHits.hasMoreElements();) {
            Entity entity = impactHexHits.nextElement();
View Full Code Here

            tempImage.flush();
        }

        public void setOffScreen() {
            bounds.setLocation(-100, -100);
            hexLoc = new Coords(-2, -2);
        }
View Full Code Here

                            && turn.getPlayerNum() == m_client.getLocalPlayer()
                                    .getId()) {
                        for (int j = 0; j < m_game.getBoard().getWidth(); j++) {
                            for (int k = 0; k < m_game.getBoard().getHeight(); k++) {
                                if (m_game.getBoard().isLegalDeployment(
                                        new Coords(j, k),
                                        m_client.getLocalPlayer())) {
                                    paintSingleCoordBorder(g, j, k,
                                            Color.yellow);
                                }
                            }
View Full Code Here

        if (gridX < 0)
            gridX = 0;
        if (gridY < 0)
            gridY = 0;

        return new Coords(gridX, gridY);
    }
View Full Code Here

     * @see megamek.common.weapons.WeaponHandler#specialResolution(java.util.Vector,
     *      megamek.common.Entity, boolean)
     */
    protected boolean specialResolution(Vector<Report> vPhaseReport,
            Entity entityTarget, boolean bMissed) {
        Coords coords = target.getPosition();
        if (!bMissed) {
            r = new Report(3190);
            r.subject = subjectId;
            r.add(coords.getBoardNum());
            vPhaseReport.add(r);
        } else {
            coords = Compute.scatterDiveBombs(coords);
            if (game.getBoard().contains(coords)) {
                r = new Report(3195);
                r.subject = subjectId;
                r.add(coords.getBoardNum());
                vPhaseReport.add(r);
            } else {
                r = new Report(3200);
                r.subject = subjectId;
                vPhaseReport.add(r);
View Full Code Here

                            && turn.getPlayerNum() == m_client.getLocalPlayer()
                                    .getId()) {
                        for (int j = 0; j < m_game.getBoard().getWidth(); j++) {
                            for (int k = 0; k < m_game.getBoard().getHeight(); k++) {
                                if (m_game.getBoard().isLegalDeployment(
                                        new Coords(j, k),
                                        m_client.getLocalPlayer())) {
                                    paintSingleCoordBorder(g, j, k,
                                            Color.yellow);
                                }
                            }
View Full Code Here

TOP

Related Classes of megamek.common.Coords

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.