コード例 #1
0
ファイル: Util.java プロジェクト: zbolmb/MULE
 /**
  * moves / increments turn based off of players priority queue
  *
  * @throws IOException exception
  */
 private static void movePhaseTurnIncre() throws IOException {
   if (playerOrder.isEmpty()) {
     for (Player p : Configurations.getPlayers()) {
       playerOrder.add(p);
     }
     Configurations.setRound(Configurations.getRound() + 1);
     if (Configurations.getPhase() == 1) {
       produce();
     }
   }
   Configurations.setCurPlayer(playerOrder.remove());
   if (Configurations.getPhase() != 0) {
     if (Math.random() < .27) {
       Configurations.getCurPlayer().setMessage(applyRandomEvent());
       Configurations.getGameScreenController()
           .updateText(Configurations.getCurPlayer().getMessage());
     } else {
       Configurations.getCurPlayer().setMessage("");
       Configurations.getGameScreenController()
           .updateText(Configurations.getCurPlayer().getMessage());
     }
   } else {
     Configurations.getGameScreenController().updateText();
   }
 }
コード例 #2
0
ファイル: Util.java プロジェクト: zbolmb/MULE
  /**
   * gives turns for buying to players
   *
   * @throws IOException exception
   */
  private static void buyTurnIncre() throws IOException {
    if (playerOrder.isEmpty()) {
      for (Player p : Configurations.getPlayers()) {
        if (p.getMoney() > 300 && !p.isPassed()) {
          playerOrder.add(p);
        }
      }
      if (playerOrder.isEmpty()) {
        Configurations.setRound(Configurations.getRound() + 1);

        // Applying random event to player 1 during initial game start
        Configurations.getCurPlayer().setMessage(applyRandomEvent());
        Configurations.getGameScreenController()
            .updateText(Configurations.getCurPlayer().getMessage());
        Configurations.getLoopService().start();
        movePhaseTurnIncre();
        return;
      }
    }
    Configurations.setCurPlayer(playerOrder.remove());
    if (Configurations.getCurPlayer().isPassed()) {
      buyTurnIncre();
    }
    Configurations.getGameScreenController().updateText();
  }
コード例 #3
0
ファイル: Util.java プロジェクト: zbolmb/MULE
 /**
  * produces game values
  *
  * @throws IOException exception
  */
 public static void produce() throws IOException {
   for (Player p : Configurations.getPlayers()) {
     for (MapTiles tile : p.getOwned()) {
       for (int i = 0; i < tile.getMules().length && p.getEnergy() > 0; i++) {
         if (tile.getMules()[i]) {
           if (i == 0) {
             p.setFood(p.getFood() + tile.getFood());
             p.setEnergy(p.getEnergy() - 1);
           } else if (i == 1) {
             p.setEnergy(p.getEnergy() + tile.getEnergy());
             p.setEnergy(p.getEnergy() - 1);
           } else {
             p.setSmithore(p.getSmithore() + tile.getOre());
             p.setEnergy(p.getEnergy() - 1);
           }
         }
       }
     }
   }
   // Save.save();
 }
コード例 #4
0
ファイル: Util.java プロジェクト: zbolmb/MULE
 /** adds players in Util */
 public static void addPlayers() {
   for (Player p : Configurations.getPlayers()) {
     playerOrder.add(p);
   }
 }