Beispiel #1
0
 /**
  * The Specified Player will discard the specified number of Resource Cards back to the bank from
  * his hand
  *
  * @pre canDoDiscardNumberOfResourceType != false
  * @param UserId
  * @param numberToDiscard
  * @param resourceType
  * @throws Exception
  * @post The Specified Player will have discarded the specified number of Resource Cards back to
  *     the bank from his hand
  */
 public void discardNumberOfResourceType(
     int UserId, int numberToDiscard, ResourceType resourceType) throws Exception {
   getPlayerByID(UserId).discardResourcesOfType(resourceType, numberToDiscard);
   getPlayerByID(UserId).setHasDiscarded(true);
   status = "Robbing";
   System.out.println("Status: " + status);
   // If there is any player that has more than 7 cards and has not yet discarded this turn
   // must discard, so we set the game status to "Discarding"
   for (Player player : players) {
     if (player.getResourceCardHandSize() > 7 && player.isHasDiscarded() == false) {
       status = "Discarding";
       System.out.println("Status: " + status);
     }
   }
 }
Beispiel #2
0
 public void setRollDice(int UserId, int rollValue) throws Exception {
   if (canDoRollDice(UserId) == false) {
     throw new Exception("canDoRollDice == false");
   }
   if (rollValue == 7) {
     status = "Robbing";
     // If there is any player that has more than 7 cards and has not yet discarded this turn
     // must discard, so we set the game status to "Discarding"
     for (Player player : players) {
       if (player.getResourceCardHandSize() > 7 && player.isHasDiscarded() == false) {
         status = "Discarding";
       }
     }
   } else {
     status = "Playing";
     playersCollectResources(rollValue);
   }
   versionNumber++;
 }