Package com.jcloisterzone.board

Examples of com.jcloisterzone.board.Tile


        tilePackFactory.setExpansions(game.getExpansions());
        tilePackFactory.setSnapshot(snapshot);
        DefaultTilePack tilePack = tilePackFactory.createTilePack();
        game.setTilePack(tilePack);
        for (String tileId : snapshot.getDiscardedTiles()) {
            Tile tile = tilePack.drawTile(tileId);
            game.getBoard().discardTile(tile);
        }
    }
View Full Code Here


        g2.setPaint(null);
        g2.setComposite(old);
    }

    public void tileEvent(TileEvent ev) {
        Tile tile = ev.getTile();
        if (ev.getType() == TileEvent.PLACEMENT) {
            ResourceManager resourceManager = getClient().getResourceManager();
            Set<Location> farmLocations = new HashSet<>();
            for (Feature f : tile.getFeatures()) {
                if (f instanceof Farm) {
                    farmLocations.add(f.getLocation());
                }
            }
            if (farmLocations.isEmpty()) return;
View Full Code Here

        NodeList nl = node.getElementsByTagName("bazaar-supply");
        if (nl.getLength() > 0) {
            bazaarSupply = new ArrayList<BazaarItem>(nl.getLength());
            for (int i = 0; i < nl.getLength(); i++) {
                Element el = (Element) nl.item(i);
                Tile tile = game.getTilePack().drawTile(el.getAttribute("tile"));
                BazaarItem bi = new BazaarItem(tile);
                bazaarSupply.add(bi);
                if (el.hasAttribute("owner")) bi.setOwner(game.getPlayer(Integer.parseInt(el.getAttribute("owner"))));
                if (el.hasAttribute("bidder")) bi.setCurrentBidder(game.getPlayer(Integer.parseInt(el.getAttribute("bidder"))));
                bi.setCurrentPrice(XmlUtils.attributeIntValue(el, "price"));
View Full Code Here

    }

    public Tile drawNextTile() {
        if (bazaarSupply == null) return null;
        Player p = game.getActivePlayer();
        Tile tile = null;
        BazaarItem currentItem = null;
        for (BazaarItem bi : bazaarSupply) {
            if (bi.getOwner() == p) {
                currentItem = bi;
                tile = bi.getTile();
View Full Code Here

            if (tileId.equals(DEBUG_END_OF_PACK)) {
                next(GameOverPhase.class);
                return true;
            }
            TilePack tilePack = getTilePack();
            Tile tile = tilePack.drawTile(tileId);
            if (tile == null) {
                logger.warn("Invalid debug draw id: " + tileId);
            } else {
                boolean riverActive = tilePack.getGroupState("river-start") == TileGroupState.ACTIVE || tilePack.getGroupState("river") == TileGroupState.ACTIVE;
                if (game.hasCapability(RiverCapability.class) && tile.getRiver() == null && riverActive) {
                    game.getCapability(RiverCapability.class).activateNonRiverTiles();
                    tilePack.setGroupState("river-start", TileGroupState.RETIRED);
                    game.setCurrentTile(tile); //recovery from lake placement
                }
                nextTile(tile);
View Full Code Here

            }
            next(GameOverPhase.class);
            return;
        }
        if (bazaarCap != null) {
            Tile tile = bazaarCap.drawNextTile();
            if (tile != null) {
                nextTile(tile);
                return;
            }
        }
View Full Code Here

    public void handleRandSample(RandSampleMessage msg) {
        if (!msg.getName().equals("draw") || msg.getPopulation() != getTilePack().size()) {
            logger.error("Invalid message");
            return;
        }
        Tile tile = getTilePack().drawTile(msg.getValues()[0]);
        nextTile(tile);
    }
View Full Code Here

        }
    }

    @Override
    public void squareEntered(MouseEvent e, Position p) {
        Tile tile = gridPanel.getTile(p);
        if (tile != null) {
            selectedPosition = p;
            areas = prepareAreas(tile, p);
        }
    }
View Full Code Here

    /** debug purposes highlight - it always shows basic follower (doesn't important for dbg */
    private void paintFigureHighlight(Graphics2D g2) {
        //ugly copy pasted code from Meeple but uncached here
        g2.setComposite(FIGURE_HIGHLIGHT_AREA_ALPHA_COMPOSITE);
        Tile tile = getGame().getBoard().get(selectedPosition);
        ImmutablePoint point = getClient().getResourceManager().getMeeplePlacement(tile, SmallFollower.class, selectedLocation);
        Player p = getGame().getActivePlayer();
        Image unscaled = getClient().getFigureTheme().getFigureImage(SmallFollower.class, p.getColors().getMeepleColor(), null);
        int size = (int) (getSquareSize() * MeepleLayer.FIGURE_SIZE_RATIO);
        Image scaled = unscaled.getScaledInstance(size, size, Image.SCALE_SMOOTH);
View Full Code Here

    @Override
    public void placeTile(Rotation rotation, Position position) {
        abbeyCap.useAbbey(getActivePlayer());

        Tile nextTile = game.getTilePack().drawTile("inactive", Tile.ABBEY_TILE_ID);
        game.setCurrentTile(nextTile);
        nextTile.setRotation(rotation);
        getBoard().add(nextTile, position);
        getBoard().mergeFeatures(nextTile);

        game.post(new TileEvent(TileEvent.PLACEMENT, getActivePlayer(), nextTile, position));
        next(ActionPhase.class);
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.