Package com.jcloisterzone.feature.visitor

Examples of com.jcloisterzone.feature.visitor.IsOccupied


    }

    @Override
    public void deployUnoccupied(Tile tile, Location loc) {
        Feature feature = getDeploymentFeature(tile, loc);
        if (feature.walk(new IsOccupied())) {
            throw new IllegalArgumentException("Feature is occupied.");
        }
        deploy(tile, loc, feature);
    }
View Full Code Here


    @Override
    public DeploymentCheckResult isDeploymentAllowed(Feature farm) {
        if (!(farm instanceof Farm)) {
            return new DeploymentCheckResult("Pig must be placed on a farm only.");
        }
        if (!farm.walk(new IsOccupied().with(Follower.class))) {
            return new DeploymentCheckResult("Feature is not occupied by follower.");
        }
        return super.isDeploymentAllowed(farm);
    }
View Full Code Here

            pos = pos.add(positionChange);
            positionChange = positionChange.next();
        }

        if (!game.hasRule(CustomRule.MULTI_BARN_ALLOWED)) {
            return !farm.walk(new IsOccupied().with(Barn.class));
        }

        return true;
    }
View Full Code Here

    public Set<Location> getUnoccupiedScoreables(boolean excludeCompleted) {
        Set<Location> locations = new HashSet<>();
        for (Feature f : features) {
            //if (f instanceof Farm && !game.hasCapability(Capability.FARM_PLACEMENT)) continue;
            if (f instanceof Scoreable) {
                IsOccupied visitor;
                if (excludeCompleted && f instanceof Completable) {
                    visitor = new IsOccupiedOrCompleted();
                } else {
                    visitor = new IsOccupied();
                }
                if (f.walk(visitor)) continue;
                locations.add(f.getLocation());
            }
        }
View Full Code Here

    private Set<Location> getPlayerFeatures(Player player, Class<? extends Feature> featureClass, boolean uncompletedOnly)  {
        Set<Location> locations = new HashSet<>();
        for (Feature f : features) {
            if (!featureClass.isInstance(f)) continue;
            IsOccupied visitor = uncompletedOnly ? new IsOccupoedAndUncompleted() : new IsOccupied();
            if (f.walk(visitor.with(player).with(Follower.class))) {
                locations.add(f.getLocation());
            }
        }
        return locations;
    }
View Full Code Here

    }

    @Override
    public void prepareActions(List<PlayerAction<?>> actions, Set<FeaturePointer> followerOptions) {
        City c = getTile().getCityWithPrincess();
        if (c == null || ! c.walk(new IsOccupied().with(Follower.class))) return;
        Feature cityRepresentative = c.getMaster();

        PrincessAction princessAction = null;
        for (Meeple m : game.getDeployedMeeples()) {
            if (!(m.getFeature() instanceof City)) continue;
View Full Code Here

TOP

Related Classes of com.jcloisterzone.feature.visitor.IsOccupied

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.