Beispiel #1
0
  public void update() {
    int tokenID = game.getCurrentPlayer().getPlayerID();
    int tokenTile = game.getCurrentPlayer().getToken().getLandIndex() % game.getBoard().getSize();
    tokens.get(tokenID).setLocation(tileCoordinates[tokenTile][0], tileCoordinates[tokenTile][1]);
    drawCircle(tokenID, tokenTile);
    repaint();
    revalidate();

    // Test Purpose
    System.out.println("Dice : " + DicePair.getDiceValue());
    System.out.println(
        "Player : "
            + game.getCurrentPlayer().getName()
            + "  -  index : "
            + game.getCurrentPlayer().getToken().getLandIndex());
  }
 private void makeTransaction(Game game, int payment) {
   Player source = game.getCurrentPlayer();
   Player target = game.getOwner((PropertyLand) getCurrentLand(game));
   if (!source.equals(target)) {
     source.decreaseBalance(payment);
     target.increaseBalance(payment);
     JOptionPane.showMessageDialog(
         null, source.getName() + " paid " + payment + "K to " + target.getName());
   }
 }
 protected Land getCurrentLand(Game game) {
   return game.getBoard().getLands().get(game.getCurrentPlayer().getToken().getLandIndex());
 }