public void Start(bool shufflePlayers = false) { if (PlayerCount < GameConfig.MinPlayer || PlayerCount > GameConfig.MaxPlayer) { throw new InvalidOperationException("Invalid player count"); } if (shufflePlayers) { Players = ShufflePlayers(Players); } _governor = Players.First(); CurrentRoleOwnerPlayer = _governor; PlantationDeck = new PlantationDeck(PlayerCount, RandomSeed); var colonistCount = GameConfig.ColonistCount[PlayerCount]; Colonists = new Stack <Colonist>(colonistCount); for (var i = 0; i < colonistCount; i++) { Colonists.Push(new Colonist()); } Quarries = new Stack <Quarry>(GameConfig.QuarryCount); for (var i = 0; i < GameConfig.QuarryCount; i++) { Quarries.Push(new Quarry()); } Buildings = InitializeBuildings(); ColonistShip = new ColonistShip(this); Goods = InitializeGoods(); CargoShips = InitializeCargoShips(PlayerCount); VictoryPointChips = InitializeVictoryPointChips(PlayerCount); Roles = InitializeRoles(PlayerCount, this); InitializePlayerDoubloons(Players); InitializePlayerPlantations(Players, PlantationDeck); Status = GameStatus.RUNNING; }
private static void InitializePlayerPlantations(IReadOnlyList <IPlayer> players, PlantationDeck deck) { players[0].Plant(deck.DrawForType <Indigo>()); players[1].Plant(deck.DrawForType <Indigo>()); switch (players.Count) { case 3: players[2].Plant(deck.DrawForType <Corn>()); break; case 4: players[2].Plant(deck.DrawForType <Corn>()); players[3].Plant(deck.DrawForType <Corn>()); break; case 5: players[2].Plant(deck.DrawForType <Indigo>()); players[3].Plant(deck.DrawForType <Corn>()); players[4].Plant(deck.DrawForType <Corn>()); break; default: throw new InvalidOperationException("Invalid player count: " + players.Count); } }