/// <summary> /// Build a road on the board /// If you try to build at a position not connected to the newly placed settlement an IllegalBuildPositionException is thrown /// If you try to build more than one road an IllegalActionException is thrown /// </summary> /// <param name="firstTile">The first tile that the road will be along</param> /// <param name="secondTile">The second tile that the road will be along</param> public void BuildRoad(Edge edge) { if (roadBuilt) throw new IllegalActionException("Only one road may be built in a turn during the startup"); if (!settlementBuilt) throw new IllegalActionException("The settlement must be placed before the road"); int[] array = new int[] { settlementPosition.FirstTile, settlementPosition.SecondTile, settlementPosition.ThirdTile }; if (!(array.Contains(edge.FirstTile) && array.Contains(edge.SecondTile))) throw new IllegalBuildPositionException("The road must be placed next to the settlement"); roadPosition = edge; controller.BuildFirstRoad(player, edge); roadBuilt = true; }
public GameState PlayRoadBuilding(Edge firstEdge, Edge secondEdge) { if (!valid) throw new IllegalActionException("Tried to perform an action on an invalid GameAction"); if (hasPlayedDevCard) throw new IllegalActionException("Max one development card can be played each turn"); hasPlayedDevCard = true; return controller.PlayRoadBuilding(player, firstEdge, secondEdge); }
public GameState BuildRoad(Edge edge) { 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.BuildRoad(player, edge); }