public void EndAge() { ITradeManager manager = new TradeManager(); manager.ResolveMilitaryConflicts(players.Select(p => (IGamePlayer)p).ToList(), currentAge); if (this.currentAge != Age.III) { MoveToNextAge(); } }
public void SetupGame() { try { LoggerHelper.Info("Starting to setup the game."); IDeckOfCardsManager deckManager = new DeckOfCardsManager(); ITradeManager tradeManager = new TradeManager(); wonderCards = deckManager.GetShuffledWonderCards(); fullDeckOfCards = deckManager.GetShuffledDeck(players.Count); tradeManager.SetupCoinsFromBank(this.BasePlayers); DrawWonderCards(); } catch (Exception e) { LoggerHelper.Error("Could not setup game properly.", e); } }
private void Play(ITurnPlayer player, IGamePlayer rightPlayer, IGamePlayer leftPlayer, IList <IStructureCard> discardedCards) { LoggerHelper.DebugFormat("Player {0} will {1} {2}", player.Name, player.ChosenAction, player.SelectedCard.Name); var success = false; ITradeManager tradeManager = new TradeManager(unitOfWork); CheckResourcesToBorrow(player.SelectedCard, player); if ((player.ChosenAction != TurnAction.BuyCard || !player.HasCard(player.SelectedCard)) && tradeManager.BorrowResources(player, rightPlayer, leftPlayer, player.ResourcesToBorrow, true)) { switch (player.ChosenAction) { case TurnAction.BuyCard: success = BuyCard(player.SelectedCard, player, age, player.SpecialCaseToUse); break; case TurnAction.SellCard: SellCard(player, discardedCards); success = true; break; case TurnAction.BuildWonderStage: success = BuildWonderStage(player); break; default: break; } } if (!success) { LoggerHelper.DebugFormat("Player {0} could not {1}. Selling and discarding card", player.Name, player.ChosenAction); SellCard(player, discardedCards); player.ExecutedAction = TurnAction.SellCard; } else { player.ExecutedAction = player.ChosenAction; } RemoveCardFromSelectable(player); }