Package com.jcloisterzone.event

Examples of com.jcloisterzone.event.TileEvent


        Phase phase = game.getPhase();
        phase.placeTile(Rotation.R90, new Position(-2, 0));
        assertEquals(1, game.events.size());

        TileEvent ev = (TileEvent) game.events.get(0);
        ev.undo(game);
        game.setPhase(phase);

        String s2 = snapshotGame(game);
        assertEquals(s1, s2);
    }
View Full Code Here


        }
    }

    public void discardTile(Tile tile) {
        discardedTiles.add(tile);
        game.post(new TileEvent(TileEvent.DISCARD, null, tile, null));
    }
View Full Code Here

            phase = lastUndoablePhase;
            lastUndoable = null;
            lastUndoablePhase = null;

            //post should be in event undo. silent vs firing undo ?
            post(new TileEvent(TileEvent.REMOVE, getActivePlayer(), tile, pos));
            phase.enter();
        }
    }
View Full Code Here

    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

        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) {
            BridgeAction action = bridgeCap.prepareMandatoryBridgeAction();

            assert action.getOptions().size() == 1;
View Full Code Here

    protected void preplaceTiles() {
        for (Tile preplaced : ((DefaultTilePack)getTilePack()).drawPrePlacedActiveTiles()) {
            game.getBoard().add(preplaced, preplaced.getPosition(), true);
            game.getBoard().mergeFeatures(preplaced);
            game.post(new TileEvent(TileEvent.PLACEMENT, null, preplaced, preplaced.getPosition()));
        }
    }
View Full Code Here

        //super.preplaceTiles();
        for (Iterator<Tile> iter = ((DefaultTilePack)getTilePack()).drawPrePlacedActiveTiles().iterator(); iter.hasNext();) {
            Tile preplaced = iter.next();
            game.getBoard().add(preplaced, preplaced.getPosition(), true);
            game.getBoard().mergeFeatures(preplaced);
            game.post(new TileEvent(TileEvent.PLACEMENT, null, preplaced, preplaced.getPosition()));
            if (preplaced.getBridge() != null) {
                game.post(new BridgeDeployedEvent(null, preplaced.getPosition(), preplaced.getBridge().getLocation()));
            }
        }
        snapshot.loadCapabilities(game);
View Full Code Here

        if (getBoard().getAvailablePlacementPositions().isEmpty()) {
            getBoard().discardTile(tile);
            next(DrawPhase.class);
            return;
        }
        game.post(new TileEvent(TileEvent.DRAW, getActivePlayer(), tile, null));
        next();
    }
View Full Code Here

        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

        getBoard().refreshAvailablePlacements(lake);
        Entry<Position, Set<Rotation>> entry = getBoard().getAvailablePlacements().entrySet().iterator().next();
        lake.setRotation(entry.getValue().iterator().next());
        getBoard().add(lake, entry.getKey());
        getBoard().mergeFeatures(lake);
        game.post(new TileEvent(TileEvent.PLACEMENT, null, lake, lake.getPosition()));
    }
View Full Code Here

TOP

Related Classes of com.jcloisterzone.event.TileEvent

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.