Esempio n. 1
0
  /**
   * This method does the actual trade by interacting with the bank and the Current Player to
   * ascertain the port type and what if they can trade or not.
   *
   * @pre the resource types it receives are valid, and that tradeIn is what the player performing
   *     the trade already has
   * @throws Exception
   */
  public void doMaritimeTrade(ResourceType tradeIn, ResourceType receive) throws Exception {

    if (canDoPlayerDoMaritimeTrade(tradeIn, receive)) {

      ResourceCard[] tradingCards = currentPlayer.prepareBankTrade(tradeIn);

      bank.playerTurnInResources(tradingCards);

      currentPlayer.getResourceCardHand().addCard(bank.playerTakeResource(receive));

    } else throw new Exception("Cannot do Maritime Trade");
  }