Package com.jcloisterzone.game.phase

Examples of com.jcloisterzone.game.phase.Phase


            aiPlayer.popActionChain();
        }
    }

    private boolean phaseLoop() {
        Phase phase = game.getPhase();
        while (!phase.isEntered()) {
            if (!Iterables.contains(ALLOWED_IN_PHASE_LOOP, phase.getClass())) {
                return true;
            }
            phase.setEntered(true);
            phase.enter();
            phase = game.getPhase();
            game.flushEventQueue();
        }
        game.flushEventQueue();
        return false;
View Full Code Here


        int i = 0;
        for (Capability cap : game.getCapabilities()) {
            cap.restore(sp.getCapabilitiesBackups()[i++]);
        }

        Phase phase = sp.getPhase();
        game.setPhase(phase);
        phase.setEntered(true);
        game.getEventBus().register(operationRecorder);

        if (DEBUG_VERIFY_SAVE_POINT) {
            try {
                String sRestore = new Snapshot(game).saveToString();
View Full Code Here

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

        String s1 = snapshotGame(game);

        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);
View Full Code Here

    public void placeFolloweUndo() {
        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

    public void placeFolloweOnTowerUndo() {
        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

    public void placeTowerPieceUndo() {
        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

    /**
     * Returns player who is allowed to make next action.
     * @return
     */
    public Player getActivePlayer() {
        Phase phase = getPhase();
        return phase == null ? null : phase.getActivePlayer();
    }
View Full Code Here

            phaseLoop();
        }
    }

    protected void phaseLoop() {
        Phase phase = game.getPhase(); //new phase can differ from the phase in prev msg.call !!!
        while (phase != null && !phase.isEntered()) {
            logger.debug("Entering phase {}",  phase.getClass().getSimpleName());
            phase.setEntered(true);
            phase.enter();
            phase = game.getPhase();
            game.flushEventQueue();
            //game.post(new PhaseEnterEvent(phase));
        }
        game.flushEventQueue();
View Full Code Here

    }

    @WsSubscribe
    public void handleRmi(RmiMessage msg) {
        try {
            Phase phase = game.getPhase();
            Method[] methods = RmiProxy.class.getMethods();
            for (int i = 0; i < methods.length; i++) {
                if (methods[i].getName().equals(msg.getMethod())) {
                    methods[i].invoke(phase, (Object[]) msg.decode(msg.getArgs()));
                    return;
View Full Code Here

TOP

Related Classes of com.jcloisterzone.game.phase.Phase

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.