Examples of BridgeAction


Examples of com.jcloisterzone.action.BridgeAction

            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;
            FeaturePointer bp = action.getOptions().iterator().next();

            bridgeCap.decreaseBridges(getActivePlayer());
            bridgeCap.deployBridge(bp.getPosition(), bp.getLocation());
        }
        getBoard().mergeFeatures(tile);
View Full Code Here

Examples of com.jcloisterzone.action.BridgeAction

    }

    @Override
    public void prepareActions(List<PlayerAction<?>> actions, Set<FeaturePointer> followerOptions) {
        if (!bridgeUsed && getPlayerBridges(game.getPhase().getActivePlayer()) > 0) {
            BridgeAction action = prepareBridgeAction();
            if (action != null) {
                actions.add(action);
            }
        }
    }
View Full Code Here

Examples of com.jcloisterzone.action.BridgeAction

            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;
                return prepareTileBridgeAction(adjacent, null, bridgeLoc);
            }
        }
        throw new IllegalStateException();
View Full Code Here

Examples of com.jcloisterzone.action.BridgeAction

            return Location.WE;
        }
    }

    private BridgeAction prepareBridgeAction() {
        BridgeAction action = null;
        Tile tile = game.getCurrentTile();
        action = prepareTileBridgeAction(tile, action, Location.NS);
        action = prepareTileBridgeAction(tile, action, Location.WE);
        for (Entry<Location, Tile> entry : getBoard().getAdjacentTilesMap(tile.getPosition()).entrySet()) {
            Tile adjacent = entry.getValue();
View Full Code Here

Examples of com.jcloisterzone.action.BridgeAction

        return action;
    }

    private BridgeAction prepareTileBridgeAction(Tile tile, BridgeAction action, Location bridgeLoc) {
        if (isBridgePlacementAllowed(tile, tile.getPosition(), bridgeLoc)) {
            if (action == null) action = new BridgeAction();
            action.add(new FeaturePointer(tile.getPosition(), bridgeLoc));
        }
        return action;
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.