Package com.jcloisterzone.board

Examples of com.jcloisterzone.board.Tile


        }
    }

    private BridgeAction prepareBridgeAction() {
        BridgeAction action = null;
        Tile tile = game.getCurrentTile();
        action = prepareTileBridgeAction(tile, action, Location.NS);
        action = prepareTileBridgeAction(tile, action, Location.WE);
        for (Entry<Location, Tile> entry : getBoard().getAdjacentTilesMap(tile.getPosition()).entrySet()) {
            Tile adjacent = entry.getValue();
            Location rel = entry.getKey();
            action = prepareTileBridgeAction(adjacent, action, getBridgeLocationForAdjacent(rel));
        }
        return action;
    }
View Full Code Here


    private boolean isBridgePlacementAllowed(Tile tile, Position p, Location bridgeLoc) {
        if (!tile.isBridgeAllowed(bridgeLoc)) return false;
        for (Entry<Location, Tile> e : getBoard().getAdjacentTilesMap(p).entrySet()) {
            Location rel = e.getKey();
            if (rel.intersect(bridgeLoc) != null) {
                Tile adjacent = e.getValue();
                char adjacentSide = adjacent.getEdge(rel.rev());
                if (adjacentSide != 'R') return false;
            }
        }
        return true;
    }
View Full Code Here

    private boolean isTilePlacementWithBridgeAllowed(Tile tile, Position p, Location bridgeLoc) {
        if (!tile.isBridgeAllowed(bridgeLoc)) return false;

        for (Entry<Location, Tile> e : getBoard().getAdjacentTilesMap(p).entrySet()) {
            Tile adjacent = e.getValue();
            Location rel = e.getKey();

            char adjacentSide = adjacent.getEdge(rel.rev());
            char tileSide = tile.getEdge(rel);
            if (rel.intersect(bridgeLoc) != null) {
                if (adjacentSide != 'R') return false;
            } else {
                if (adjacentSide != tileSide) return false;
View Full Code Here

    }

    private boolean isTilePlacementWithOneAdjacentBridgeAllowed(Tile tile, Position p) {
        boolean bridgeUsed = false;
        for (Entry<Location, Tile> e : getBoard().getAdjacentTilesMap(p).entrySet()) {
            Tile adjacent = e.getValue();
            Location rel = e.getKey();

            char tileSide = tile.getEdge(rel);
            char adjacentSide = adjacent.getEdge(rel.rev());

            if (tileSide != adjacentSide) {
                if (bridgeUsed) return false;
                if (tileSide != 'R') return false;

                Location bridgeLoc = getBridgeLocationForAdjacent(rel);
                if (!isBridgePlacementAllowed(adjacent, adjacent.getPosition(), bridgeLoc)) return false;
                bridgeUsed = true;
            }
        }
        return bridgeUsed; //ok if exactly one bridge is used
    }
View Full Code Here

        if (n == 0) throw new IllegalStateException("Player has no bridges");
        bridges.put(player, n-1);
    }

    public void deployBridge(Position pos, Location loc) {
        Tile tile = getBoard().get(pos);
        if (!tile.isBridgeAllowed(loc)) {
            throw new IllegalArgumentException("Cannot deploy " + loc + " bridge on " + pos);
        }
        bridgeUsed = true;
        tile.placeBridge(loc);
        game.post(new BridgeDeployedEvent(game.getActivePlayer(), pos, loc));
    }
View Full Code Here

        Integer duration = client.getConfig().getScore_display_duration();
        return duration == null ? 10 : Math.max(duration, 1);
    }

    public void scored(Feature scoreable, Player player, String points, Class<? extends Meeple> meepleType, boolean finalScoring) {
        Tile tile = scoreable.getTile();
        Position pos = tile.getPosition();
        ImmutablePoint offset = client.getResourceManager().getMeeplePlacement(tile, meepleType, scoreable.getLocation());
        animationService.registerAnimation(new ScoreAnimation(
            pos,
            points,
            offset,
View Full Code Here

            c = client.getPlayerSecondTunelColor(player);
        } else {
            c = player.getColors().getMeepleColor();
        }
        Image tunnelPiece = client.getFigureTheme().getTunnelImage(c);
        Tile tile = gridPanel.getTile(p);
        ImmutablePoint offset = client.getResourceManager().getMeeplePlacement(tile, SmallFollower.class, loc);
        meepleLayer.addPermanentImage(p, offset, tunnelPiece);
    }
View Full Code Here

            logger.error("Feature must be occupies with own follower");
            return;
        }

        Meeple m = getActivePlayer().getMeepleFromSupply(meepleType);
        Tile tile = getBoard().get(p);
        m.deploy(tile, loc);
        nextCornPlayer();
    }
View Full Code Here

        Composite oldComposite = g2.getComposite();
//    Stroke oldStroke = g2.getStroke();
//    g2.setStroke(new BasicStroke(getSquareSize() * 0.015f));
        for (Entry<Tile, Location> entry : bridges.entrySet()) {
            //devel code only - use image instead
            Tile tile = entry.getKey();
            Location loc = entry.getValue();
            Position pos = tile.getPosition();
            Area a = getClient().getResourceManager().getBridgeArea(tile, getSquareSize(), loc);
            a.transform(AffineTransform.getTranslateInstance(getOffsetX(pos), getOffsetY(pos)));
            g2.setColor(Color.BLACK);
            g2.setComposite(BRIDGE_FILL_COMPOSITE);
            g2.fill(a);
View Full Code Here

    }


    public void bridgeDeployed(Position pos, Location loc) {
        Tile tile = getGame().getBoard().get(pos);
        bridges.put(tile, loc);
    }
View Full Code Here

TOP

Related Classes of com.jcloisterzone.board.Tile

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.