@Override
 public void scoreBarn(FarmScoreContext ctx, Barn meeple) {
   int points = ctx.getBarnPoints();
   meeple.getPlayer().addPoints(points, PointCategory.FARM);
   ScoreEvent ev = new ScoreEvent(meeple.getFeature(), points, PointCategory.FARM, meeple);
   ev.setFinal(true);
   game.post(ev);
 }
Beispiel #2
0
  private void scoreFollowersOnBarnFarm(Farm farm, Map<City, CityScoreContext> cityCache) {
    FarmScoreContext ctx = farm.getScoreContext();
    ctx.setCityCache(cityCache);
    farm.walk(ctx);

    boolean hasBarn = false;
    for (Meeple m : ctx.getSpecialMeeples()) {
      if (m instanceof Barn) {
        hasBarn = true;
        break;
      }
    }
    if (hasBarn) {
      for (Player p : ctx.getMajorOwners()) {
        int points = ctx.getPointsWhenBarnIsConnected(p);
        game.scoreFeature(points, ctx, p);
      }
      for (Meeple m : ctx.getMeeples()) {
        if (!(m instanceof Barn)) {
          m.undeploy(false);
        }
      }
    }
  }
 @Override
 public void scoreFarm(FarmScoreContext ctx, Player p) {
   int points = ctx.getPoints(p);
   game.scoreFeature(points, ctx, p);
 }
 protected double getFarmPoints(Farm farm, Player p, FarmScoreContext ctx) {
   if (isMe(p)) {
     openCount[OPEN_COUNT_FARM]++;
   }
   return ctx.getPoints(p);
 }
 @Override
 public void scoreBarn(FarmScoreContext ctx, Barn meeple) {
   // prefer barn placement - magic constant
   rank += reducePoints(1.2 * ctx.getBarnPoints(), meeple.getPlayer());
 }
 @Override
 public void scoreFarm(FarmScoreContext ctx, Player player) {
   double points = getFarmPoints((Farm) ctx.getMasterFeature(), player, ctx);
   rank += reducePoints(points, player);
 }