Ejemplo n.º 1
0
  /**
   * claims tiles for players
   *
   * @param x double
   * @param y double
   * @param tile MapTiles
   * @throws IOException exception
   */
  public static void claimTile(double x, double y, MapTiles tile) throws IOException {
    if (Configurations.getRound() == 0 && Configurations.getCurPlayer().getMoney() < 300) {
      return;
    }
    if (!(tile instanceof TownTile) && tile.getOwner().equals("None")) {
      Player cp = Configurations.getCurPlayer();
      if (cp.getOwned().size() <= 0) {
        int rx = (int) (x / 100) * 100;
        int ry = (int) (y / 100) * 100;
        cp.setStartX(rx + 0.5 * MapTiles.getW());
        cp.setStartY(ry + 0.5 * MapTiles.getH());
        cp.setPlayerIcon(new Circle(cp.getStartX(), cp.getStartY(), 10, cp.getColor()));
        Configurations.getGameMapController().add(cp.getPlayerIcon());
      }
      cp.getOwned().add(tile);
      tile.setOwner(cp.getName());
      if (Configurations.getRound() == 0) {
        cp.setMoney(cp.getMoney() - 300);
      }
      Rectangle[] sq = Util.drawSelectionSq(x, y, cp.getColor());

      for (Rectangle r : sq) {
        Configurations.getGameMapController().add(r);
      }
      incrementTurn();
    }
  }
Ejemplo n.º 2
0
 /**
  * Goes to next players turn more robust than incrementTurn
  *
  * @throws IOException exception
  */
 public static void next() throws IOException {
   Util.incrementTurn();
   Player cp = Configurations.getCurPlayer();
   cp.moveTo(cp.getStartX(), cp.getStartY());
   if (cp.getPhase() != 0) {
     Configurations.getGameScreenController().removePlayerFromTown(cp);
     cp.setPhase(0);
   }
   Configurations.getGuiController().setScene(Configurations.getGameScreenController().getView());
 }