Package com.jcloisterzone.feature

Examples of com.jcloisterzone.feature.Feature


        }
        super.zoomChanged(squareSize);
    }

    private MeeplePositionedImage createMeepleImage(Class<? extends Meeple> type, Color c, FeaturePointer fp) {
        Feature feature = getGame().getBoard().get(fp);
        ImmutablePoint offset = getClient().getResourceManager().getMeeplePlacement(feature.getTile(), type, fp.getLocation());
        Image image = getClient().getFigureTheme().getFigureImage(type, c, getExtraDecoration(type, fp));
        if (fp.getLocation() == Location.ABBOT) {
            image = rotate(image, 90);
        }
        return new MeeplePositionedImage(type, fp, offset, image, feature instanceof Bridge);
View Full Code Here


        return true;
    }

    protected boolean selectDummyMeepleAction(MeepleAction ma) {
        for (FeaturePointer fp : ma) {
            Feature f = game.getBoard().get(fp.getPosition()).getFeature(fp.getLocation());
            if (f instanceof City || f instanceof Road || f instanceof Cloister) {
                getServer().deployMeeple(fp.getPosition(), fp.getLocation(), ma.getMeepleType());
                return true;
            }
        }
View Full Code Here

        return tile.getFeature(loc);
    }

    public void deployUnoccupied(Tile tile, Location loc) {
        //perorm unoccupied check for followers only!!!
        Feature feature = getDeploymentFeature(tile, loc);
        deploy(tile, loc, feature);
    }
View Full Code Here

        Feature feature = getDeploymentFeature(tile, loc);
        deploy(tile, loc, feature);
    }

    public final void deploy(Tile tile, Location loc) {
        Feature feature = getDeploymentFeature(tile, loc);
        deploy(tile, loc, feature);
    }
View Full Code Here

        return !(getFeature() instanceof Castle);
    }

    @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


    //TODO ??? can be this in score visitor instead of here ???
    public void undeploy(boolean checkForLonelyBuilderOrPig) {
        //store ref which is lost be super call
        Feature piece = getFeature();
        super.undeploy(checkForLonelyBuilderOrPig); //clear piece
        if (checkForLonelyBuilderOrPig) {
            boolean builder = game.hasCapability(BuilderCapability.class) && (piece instanceof City || piece instanceof Road);
            boolean pig = game.hasCapability(PigCapability.class) && piece instanceof Farm;
            if (builder || pig) {
                Special toRemove = piece.walk(new RemoveLonelyBuilderAndPig(getPlayer()));
                if (toRemove != null) {
                    toRemove.undeploy(false);
                }
            }
        }
View Full Code Here

  private EdgePattern() { }
  private EdgePattern(char[] code) { this.code = code; }

  private static char getTileEdgePattern(Tile tile, Location loc) {
    Feature f = tile.getFeaturePartOf(loc);
    if (f == null) {
      return 'F';
    }
    if (f instanceof Road) {
      return 'R';
View Full Code Here

        if (getTo() != null) {
            meeple.getFeature().removeMeeple(meeple);
            meeple.clearDeployment();
        }
        if (getFrom() != null) {
            Feature f = game.getBoard().get(getFrom());
            f.addMeeple(meeple);
            meeple.setPosition(getFrom().getPosition());
            meeple.setLocation(getFrom().getLocation());
            meeple.setFeature(f);
        }
    }
View Full Code Here

    public void scoreAll(Game game, ScoreAllCallback callback) {
        //first score non-farm features to fill city cache
        for (Meeple m : game.getDeployedMeeples()) {
            if (!(m instanceof Follower)) continue;
            Feature f = m.getFeature();

            if (f instanceof Castle) {
                callback.scoreCastle(m, (Castle) f);
                continue;
            }
            if (f instanceof Completable) {
                if (alreadyRated.contains(m)) continue;
                scoreCompletable((Completable) f, callback);
                if (f instanceof Cloister && ((Cloister)f).isMonastery()) {
                    //additionally to common monk scoring count score for abbots
                    MonasteryAbbotScoreContext ctx = new MonasteryAbbotScoreContext(game);
                    ctx.visit(f);
                    callback.scoreCompletableFeature(ctx);
                }
            }
        }

        for (Meeple m : game.getDeployedMeeples()) {
            if (!(m instanceof Follower) && !(m instanceof Barn)) continue;
            Feature f = m.getFeature();

            if (f instanceof Farm) {
                if (alreadyRated.contains(m)) continue;
                scoreFarm((Farm) f, callback);
            }
View Full Code Here

    }

    private void scoreCompletedNearAbbey(Position pos) {
        for (Entry<Location, Tile> e : getBoard().getAdjacentTilesMap(pos).entrySet()) {
            Tile tile = e.getValue();
            Feature feature = tile.getFeaturePartOf(e.getKey().rev());
            if (feature instanceof Completable) {
                scoreCompleted((Completable) feature, false);
            }
        }
    }
View Full Code Here

TOP

Related Classes of com.jcloisterzone.feature.Feature

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.