Package com.jcloisterzone.feature.visitor.score

Examples of com.jcloisterzone.feature.visitor.score.CompletableScoreContext


public class CloisterScoring extends AbstractScoringTest {
 
  protected void assertScore(int expected, Tile tile) {
    Cloister cl = (Cloister) tile.getCloister();   
    CompletableScoreContext ctx = cl.getScoreContext();
    cl.walk(ctx);
   
    assertEquals(expected, ctx.getPoints());
  }
View Full Code Here


    }

    private void completed(FeatureCompletedEvent ev) {
        Completable feature = ev.getFeature();
        CompletableScoreContext ctx = ev.getScoreContent();
        if (feature instanceof City) {
            cityCompleted((City) feature, (PositionCollectingScoreContext) ctx);
        }
        if (feature instanceof Road) {
            roadCompleted((Road) feature, (PositionCollectingScoreContext) ctx);
View Full Code Here

    private Set<Meeple> alreadyRated = new HashSet<>();
    private Map<City, CityScoreContext> cityCache = new HashMap<>();

    private void scoreCompletable(Completable completable, ScoreAllCallback callback) {
        CompletableScoreContext ctx = callback.getCompletableScoreContext(completable);
        if (ctx instanceof CityScoreContext) {
            ((CityScoreContext) ctx).setCityCache(cityCache);
        }
        completable.walk(ctx);
        alreadyRated.addAll(ctx.getFollowers());
        callback.scoreCompletableFeature(ctx);
    }
View Full Code Here

        game.post(new ScoreEvent(m.getFeature(), points, PointCategory.CASTLE, m));
        undeloyMeeple(m);
    }

    private void scoreCompleted(Completable completable, boolean triggerBuilder) {
        CompletableScoreContext ctx = completable.getScoreContext();
        completable.walk(ctx);
        if (triggerBuilder && builderCap != null) {
            for (Meeple m : ctx.getSpecialMeeples()) {
                if (m instanceof Builder && m.getPlayer().equals(getActivePlayer())) {
                    if (!m.at(getTile().getPosition())) {
                        builderCap.useBuilder();
                    }
                    break;
                }
            }
        }
        if (ctx.isCompleted()) {
            Completable master = (Completable) ctx.getMasterFeature();
            if (!alredyScored.contains(master)) {
                alredyScored.add(master);
                game.scoreCompleted(ctx);
                game.scoreCompletableFeature(ctx);
                undeployMeeples(ctx);
View Full Code Here

TOP

Related Classes of com.jcloisterzone.feature.visitor.score.CompletableScoreContext

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.