Package com.jcloisterzone.board

Examples of com.jcloisterzone.board.Tile


        assertScore(0, t, Location.N);
    }

    @Test
    public void finshedCathedral() {
        Tile t;
        t = putTile(new Position(0,0), Rotation.R0, Expansion.INNS_AND_CATHEDRALS, "Cccc.c");
        putTile(new Position(0,-1), Rotation.R0, Expansion.INNS_AND_CATHEDRALS, "CCc+");
        putTile(new Position(0,1), Rotation.R0, Expansion.INNS_AND_CATHEDRALS, "C!");
        putTile(new Position(1,0), Rotation.R0, Expansion.INNS_AND_CATHEDRALS, "CCC");
        putTile(new Position(-1,0), Rotation.R0, Expansion.INNS_AND_CATHEDRALS, "CCC");
View Full Code Here


        assertScore(15, t, Location.N);
    }

    @Test
    public void twoCathedrals() {
        Tile t;
        t = putTile(new Position(0,0), Rotation.R0, Expansion.INNS_AND_CATHEDRALS, "Cccc.c");
        putTile(new Position(1,0), Rotation.R0, Expansion.INNS_AND_CATHEDRALS, "Cccc.c");
        putTile(new Position(0,-1), Rotation.R180, Expansion.INNS_AND_CATHEDRALS, "CcRr+.i");
        putTile(new Position(1,-1), Rotation.R270, Expansion.INNS_AND_CATHEDRALS, "CcRr+.i");
        putTile(new Position(0,1), Rotation.R0, Expansion.INNS_AND_CATHEDRALS, "CFR");
View Full Code Here

        assertScore(30, t, Location.N);
    }

    @Test
    public void siege() {
        Tile t;
        t = putTile(new Position(0,0), Rotation.R0, Expansion.CATHARS, "C");
        putTile(new Position(0,-1), Rotation.R270, Expansion.CATHARS, "Cc");
        putTile(new Position(-1,-1), Rotation.R90, Expansion.CATHARS, "C");

        assertScore(3, t, Location.N);
View Full Code Here

        return position;
    }

    @Override
    public void undo(Game game) {
        Tile tile = game.getBoard().get(position);
        assert tile.getTower().getHeight() > 0;
        tile.getTower().setHeight(tile.getTower().getHeight() - 1);

        TowerCapability cap = game.getCapability(TowerCapability.class);
        cap.setLastIncreasedTower(null);
        cap.setTowerPieces(getTriggeringPlayer(), cap.getTowerPieces(getTriggeringPlayer()) + 1);
    }
View Full Code Here

    }

    public void undo() {
        //proof of concept
        if (lastUndoable instanceof TileEvent) {
            Tile tile = ((TileEvent)lastUndoable).getTile();
            Position pos = tile.getPosition();

            lastUndoable.undo(this);
            phase = lastUndoablePhase;
            lastUndoable = null;
            lastUndoablePhase = null;
View Full Code Here

    private boolean isBarnCorner(Location corner, Location positionChange) {
        Farm farm = null;
        Position pos = getTile().getPosition();
        for (int i = 0; i < 4; i++) {
            Tile tile = getBoard().get(pos);
            if (tile == null) return false;
            farm = (Farm) tile.getFeaturePartOf(corner);
            if (farm == null) return false;
            corner = corner.next();
            pos = pos.add(positionChange);
            positionChange = positionChange.next();
        }
View Full Code Here

    }

    @Override
    public void loadGame(Snapshot snapshot) {
         String tileId = snapshot.getNextTile();
         Tile tile = game.getTilePack().drawTile(tileId);
         game.setCurrentTile(tile);
         game.getBoard().refreshAvailablePlacements(tile);
         game.post(new TileEvent(TileEvent.DRAW, getActivePlayer(), tile, null));
    }
View Full Code Here

         game.post(new TileEvent(TileEvent.DRAW, getActivePlayer(), tile, null));
    }

    @Override
    public void placeTile(Rotation rotation, Position p) {
        Tile tile = getTile();
        tile.setRotation(rotation);

        boolean bridgeRequired = bridgeCap != null && !getBoard().isPlacementAllowed(tile, p);

        getBoard().add(tile, p);
        if (tile.getTower() != null) {
            game.getCapability(TowerCapability.class).registerTower(p);
        }
        game.post(new TileEvent(TileEvent.PLACEMENT, getActivePlayer(), tile, p));

        if (bridgeRequired) {
View Full Code Here

        }
    }

    private void scoreCompletedNearAbbey(Position pos) {
        for (Entry<Location, Tile> e : getBoard().getAdjacentTilesMap(pos).entrySet()) {
            Tile tile = e.getValue();
            Feature feature = tile.getFeaturePartOf(e.getKey().rev());
            if (feature instanceof Completable) {
                scoreCompleted((Completable) feature, false);
            }
        }
    }
View Full Code Here

            }
        }
    }

    public BridgeAction prepareMandatoryBridgeAction() {
        Tile tile = game.getCurrentTile();
        for (Entry<Location, Tile> entry : getBoard().getAdjacentTilesMap(tile.getPosition()).entrySet()) {
            Tile adjacent = entry.getValue();
            Location rel = entry.getKey();

            char adjacentSide = adjacent.getEdge(rel.rev());
            char tileSide = tile.getEdge(rel);
            if (tileSide != adjacentSide) {
                Location bridgeLoc = getBridgeLocationForAdjacent(rel);
                BridgeAction action = prepareTileBridgeAction(tile, null, bridgeLoc);
                if (action != null) return action;
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.