Exemplo n.º 1
0
 /**
  * This card is special because it is the only development card that references the bank, so
  * additional checks need to be made, and so for security reasons it gets its own method to do so.
  */
 public boolean canDoPlayerUseYearOfPlenty(ResourceType[] resourceType, int userID) {
   // This is important because the bank not have the cards they need.
   if (currentPlayer.getPlayerId() == userID) {
     if (resourceType.length == 1) {
       if (!canDoPlayerTake2OfResource(resourceType[0])) {
         return false;
       }
     } else {
       for (int i = 0; i < resourceType.length; i++) {
         if (!bank.canDoPlayerTakeResource(resourceType[i])) return false;
       }
     }
     return currentPlayer.canDoPlayDevelopmentCard(turnNumber, DevCardType.YEAR_OF_PLENTY);
   }
   return false;
 }
Exemplo n.º 2
0
 /**
  * Can you take a resource? It calls the bank to see if it has cards to take or not
  *
  * @pre valid resource type
  * @param resourceType
  * @return whether or not the bank has cards to take
  */
 public boolean canDoPlayerTakeResource(ResourceType resourceType) {
   return bank.canDoPlayerTakeResource(resourceType);
 }