예제 #1
0
 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());
   }
 }
예제 #2
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());
  }
예제 #3
0
 private void addTokens() {
   ArrayList<Player> players = game.getPlayers();
   for (Player player : players) {
     Image tokenImage = player.getToken().getImage();
     JLabel token = new JLabel(new ImageIcon(tokenImage));
     token.setBounds(tileCoordinates[0][0], tileCoordinates[0][1], 30, 22);
     tokens.add(token);
     add(token);
   }
 }
예제 #4
0
 protected Land getCurrentLand(Game game) {
   return game.getBoard().getLands().get(game.getCurrentPlayer().getToken().getLandIndex());
 }