BuildCity() public method

Let a player upgrade a settlement to a city If the player doesn't have enough resources to build a city a InsufficientResourcesException is thrown If the player tries to build at a position where he doesn't have a settlement a IllegalBuildPosition is thrown If the player doesn't have any more city pieces left to place a IllegalActionException is thrown The required resources are taken from the player and placed back at the resource bank The settlement previously on the location is given back to the player
public BuildCity ( Player player, Intersection intersection ) : GameState
player Player The player upgrading to a city
intersection AIsOfCatan.API.Intersection The intersection to upgrade to a city on
return GameState
Example #1
0
 public GameState BuildCity(Intersection intersection)
 {
     if (!valid)
     {
         throw new IllegalActionException("Tried to perform an action on an invalid GameAction");
     }
     if (!isAfterDieRoll)
     {
         throw new IllegalActionException("Tried to build before the die roll");
     }
     return(controller.BuildCity(player, intersection));
 }