Package com.jcloisterzone.board

Examples of com.jcloisterzone.board.Position


        EventCatchingGame game = createGame("/saved-games/actionPhase.jcz");
        assertTrue(game.getPhase() instanceof ActionPhase);

        String s1 = snapshotGame(game);
        Phase phase = game.getPhase();
        phase.deployMeeple(new Position(1, -3), Location.NE, BigFollower.class);
        assertEquals(1, game.events.size());

        MeepleEvent ev = (MeepleEvent) game.events.get(0);
        ev.undo(game);
        game.setPhase(phase);
View Full Code Here


        EventCatchingGame game = createGame("/saved-games/actionPhase.jcz");
        assertTrue(game.getPhase() instanceof ActionPhase);

        String s1 = snapshotGame(game);
        Phase phase = game.getPhase();
        phase.deployMeeple(new Position(1, -2), Location.TOWER, SmallFollower.class);
        assertEquals(1, game.events.size());

        MeepleEvent ev = (MeepleEvent) game.events.get(0);
        ev.undo(game);
        game.setPhase(phase);
View Full Code Here

        EventCatchingGame game = createGame("/saved-games/actionPhase.jcz");
        assertTrue(game.getPhase() instanceof ActionPhase);

        String s1 = snapshotGame(game);
        Phase phase = game.getPhase();
        phase.placeTowerPiece(new Position(1, -2));
        //assertEquals(2, game.events.size()); //TowerIncreasedEvent, SelectActionEvent

        TowerIncreasedEvent ev = (TowerIncreasedEvent) game.events.get(0);
        ev.undo(game);
        game.setPhase(phase);
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

        player.addMeeple(new Barn(game, player));
    }

    @Override
    public void prepareActions(List<PlayerAction<?>> actions, Set<FeaturePointer> followerOptions) {
        Position pos = getTile().getPosition();

        if (game.getActivePlayer().hasSpecialMeeple(Barn.class)) {
            BarnAction barnAction = null;
            Location corner = Location.WR.union(Location.NL);
            Location positionChange = Location.W;
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();
        }

        if (!game.hasRule(CustomRule.MULTI_BARN_ALLOWED)) {
            return !farm.walk(new IsOccupied().with(Barn.class));
View Full Code Here

        this.monastery = monastery;
    }

    @Override
    public boolean isOpen() {
        Position p = getTile().getPosition();
        return getGame().getBoard().getAdjacentAndDiagonalTiles(p).size() < 8;
    }
View Full Code Here

    }

    @Override
    public boolean visit(Feature feature) {
        cloister = (Cloister) feature;
        Position pos = cloister.getTile().getPosition();
        neigbouringTiles = game.getBoard().getAdjacentAndDiagonalTiles(pos).size();
        return true;
    }
View Full Code Here

    }

    @Override
    public int getPoints() {
        int points = 1;
        Position monasteryPosition = cloister.getTile().getPosition();
        for (Location loc : Location.sides()) {
            points += game.getBoard().getContinuousRowSize(monasteryPosition, loc);
        }
        return points;
    }
View Full Code Here

        return game.hasCapability(TowerCapability.class);
    }

    @Override
    public void enter() {
        Position pos = towerCap.getLastIncreasedTower();
        TakePrisonerAction captureAction = prepareCapture(pos, getBoard().get(pos).getTower().getHeight());
        if (captureAction.isEmpty()) {
            next();
            return;
        }
View Full Code Here

TOP

Related Classes of com.jcloisterzone.board.Position

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.