Пример #1
0
 /**
  * TODO - Verify Completion
  *
  * <p>Places a Road for the specified player at specified edgeLocation
  *
  * @pre canDoPlaceRoadOnEdge != false
  * @param UserId
  * @throws Exception
  * @return Void
  */
 public void placeRoadOnEdge(int UserId, EdgeLocation edgeLocation) throws Exception {
   if (canDoPlaceRoadOnEdge(UserId, edgeLocation) == false) {
     throw new Exception("Specified Player cannot place a road on the given edgeLocation");
   }
   // If we are in the setup phase, the rules for placing a road are slightly different
   if (turnNumber < 2) {
     board.placeInitialRoadOnEdge(getCurrentPlayer(), edgeLocation);
     versionNumber++;
   } else {
     board.placeRoadOnEdge(getCurrentPlayer(), edgeLocation);
   }
 }
Пример #2
0
 public void placeRoadOnEdge(int userId, EdgeLocation edgeLocation, boolean usingRoadBuilder)
     throws Exception {
   if (canDoPlaceRoadOnEdge(userId, edgeLocation) == false) {
     throw new Exception("Specified Player cannot place a road on the given edgeLocation");
   }
   // If we are in the setup phase, the rules for placing a road are slightly different
   if (usingRoadBuilder == true) {
     if (currentPlayer.getPlayerId() == userId
         && currentPlayer.canDoPlayDevelopmentCard(turnNumber, DevCardType.ROAD_BUILD)
         && currentPlayer.getNumberUnplayedRoads() >= 2) {
       board.placeRoadBuildRoadOnEdge(getCurrentPlayer(), edgeLocation);
       versionNumber++;
     } else {
       throw new Exception("Unable to play Road Builder!");
     }
   } else {
     board.placeRoadOnEdge(getCurrentPlayer(), edgeLocation);
     versionNumber++;
   }
 }