private static void PlayWildCard(int infantry, int cavalry, int artillery, int wild) { var done = false; while (done == false) { var usedCards = new List <Card>(); var player = GameBoard.GetBoard().CurrentPlayer; Console.Clear(); Colour.SouthAmericaRed("\t **** Risk! ****\n"); Console.WriteLine("\t=========================="); Console.WriteLine("\tTrade a wild card menu"); Console.Write("\tCurrently "); Colour.PrintPlayer(player.Colour, player.Name + "'s"); Console.Write(" turn.\n"); if (player.Cards.Count > 6) { Colour.SouthAmericaRed("\tYou must trade at least one set of cards!\n"); } Console.WriteLine("\tInfantry cards = " + infantry); Console.WriteLine("\tCavalry cards = " + cavalry); Console.WriteLine("\tArtillary cards = " + artillery); Console.WriteLine("\tWild cards = " + wild); Console.WriteLine("\n\t1. Play a wild card with two infantry cards"); Console.WriteLine("\t2. Play a wild card with two cavalry cards"); Console.WriteLine("\t3. Play a wild card with two artillery cards"); Console.WriteLine("\t4. Play a wild card with an infantry and cavalry card"); Console.WriteLine("\t5. Play a wild card with an infantry and artillary card"); Console.WriteLine("\t6. Play a wild card with a cavalry and artillery card"); Console.WriteLine("\t7. return to previous menu"); Console.WriteLine("\t=========================="); var option = GameEngine.UserInputTest("\t(1-7)>", "\tInvalid input, please try again!", 1, 7); switch (option) { case 1: if (infantry >= 2) { usedCards.Add(_cards.Wild[0]); _cards.Wild.RemoveAt(0); for (var index = 0; index <= 1; index++) { usedCards.Add(_cards.Infantry[0]); _cards.Infantry.RemoveAt(0); } wild -= 1; infantry -= 2; GameBoard.GetBoard().AddToUsedCardPile(usedCards); TradedCardValue(); Console.WriteLine("\tCards traded, Press any key to continue...."); Console.ReadKey(); } else { Console.WriteLine("\tYou do not have enough of that type of card!"); Console.WriteLine("\tPress any key to continue...."); Console.ReadKey(); } break; case 2: if (cavalry >= 3) { usedCards.Add(_cards.Wild[0]); _cards.Wild.RemoveAt(0); for (var index = 0; index <= 1; index++) { usedCards.Add(_cards.Cavalry[0]); _cards.Cavalry.RemoveAt(0); } wild -= 1; cavalry -= 2; GameBoard.GetBoard().AddToUsedCardPile(usedCards); TradedCardValue(); Console.WriteLine("\tCards traded, Press any key to continue...."); Console.ReadKey(); } else { Console.WriteLine("\tYou do not have enough of that type of card!"); Console.WriteLine("\tPress any key to continue...."); Console.ReadKey(); } break; case 3: if (artillery >= 3) { usedCards.Add(_cards.Wild[0]); _cards.Wild.RemoveAt(0); for (var index = 0; index <= 1; index++) { usedCards.Add(_cards.Artillary[0]); _cards.Artillary.RemoveAt(0); } wild -= 1; artillery -= 2; GameBoard.GetBoard().AddToUsedCardPile(usedCards); TradedCardValue(); Console.WriteLine("\tCards traded, Press any key to continue...."); Console.ReadKey(); } else { Console.WriteLine("\tYou do not have enough of that type of card!"); Console.WriteLine("\tPress any key to continue...."); Console.ReadKey(); } break; case 4: if (infantry >= 1 && cavalry >= 1) { usedCards.Add(_cards.Wild[0]); _cards.Wild.RemoveAt(0); usedCards.Add(_cards.Infantry[0]); _cards.Infantry.RemoveAt(0); usedCards.Add(_cards.Cavalry[0]); _cards.Cavalry.RemoveAt(0); wild -= 1; infantry -= 1; cavalry -= 1; GameBoard.GetBoard().AddToUsedCardPile(usedCards); TradedCardValue(); Console.WriteLine("\tCards traded, Press any key to continue...."); Console.ReadKey(); } else { Console.WriteLine("\tYou do not have enough of those types of card!"); Console.WriteLine("\tPress any key to continue...."); Console.ReadKey(); } break; case 5: if (infantry >= 1 && artillery >= 1) { usedCards.Add(_cards.Wild[0]); _cards.Wild.RemoveAt(0); usedCards.Add(_cards.Infantry[0]); _cards.Infantry.RemoveAt(0); usedCards.Add(_cards.Artillary[0]); _cards.Artillary.RemoveAt(0); wild -= 1; infantry -= 1; artillery -= 1; GameBoard.GetBoard().AddToUsedCardPile(usedCards); TradedCardValue(); Console.WriteLine("\tCards traded, Press any key to continue...."); Console.ReadKey(); } else { Console.WriteLine("\tYou do not have enough of those types of card!"); Console.WriteLine("\tPress any key to continue...."); Console.ReadKey(); } break; case 6: if (cavalry >= 1 && artillery >= 1) { usedCards.Add(_cards.Wild[0]); _cards.Wild.RemoveAt(0); usedCards.Add(_cards.Cavalry[0]); _cards.Cavalry.RemoveAt(0); usedCards.Add(_cards.Artillary[0]); _cards.Artillary.RemoveAt(0); wild -= 1; cavalry -= 1; artillery -= 1; GameBoard.GetBoard().AddToUsedCardPile(usedCards); TradedCardValue(); Console.WriteLine("\tCards traded, Press any key to continue...."); Console.ReadKey(); } else { Console.WriteLine("\tYou do not have enough of those types of card!"); Console.WriteLine("\tPress any key to continue...."); Console.ReadKey(); } break; case 7: done = true; break; default: Console.WriteLine("\tError"); break; } } }
private static void PlayOneOfEach(int infantry, int cavalry, int artillery, int wild) { var done = false; while (done == false) { var usedCards = new List <Card>(); var player = GameBoard.GetBoard().CurrentPlayer; Console.Clear(); Colour.SouthAmericaRed("\t **** Risk! ****\n"); Console.WriteLine("\t=========================="); Console.WriteLine("\t Trade one of each menu"); Console.Write("\tCurrently "); Colour.PrintPlayer(player.Colour, player.Name + "'s"); Console.Write(" turn.\n"); if (player.Cards.Count > 6) { Colour.SouthAmericaRed("\tYou must trade at least one set of cards!\n"); } Console.WriteLine("\tInfantry cards = " + infantry); Console.WriteLine("\tCavalry cards = " + cavalry); Console.WriteLine("\tArtillary cards = " + artillery); Console.WriteLine("\tWild cards = " + wild); Console.WriteLine("\n\t1. Play one of each card"); Console.WriteLine("\t2. return to previous menu"); Console.WriteLine("\t=========================="); var option = GameEngine.UserInputTest("\t(1-2)>", "\tInvalid input, please try again!", 1, 2); switch (option) { case 1: if (infantry >= 1 && cavalry >= 1 && artillery >= 1) { usedCards.Add(_cards.Infantry[0]); _cards.Infantry.RemoveAt(0); usedCards.Add(_cards.Cavalry[0]); _cards.Cavalry.RemoveAt(0); usedCards.Add(_cards.Artillary[0]); _cards.Artillary.RemoveAt(0); artillery -= 1; cavalry -= 1; artillery -= 1; GameBoard.GetBoard().AddToUsedCardPile(usedCards); TradedCardValue(); Console.WriteLine("\tCards traded, Press any key to continue...."); Console.ReadKey(); } else { Console.WriteLine("\tYou do not have enough of that type of card!"); Console.WriteLine("\tPress any key to continue...."); Console.ReadKey(); } break; case 2: done = true; break; default: Console.WriteLine("\tError"); break; } } }
public static int TradeMenu() { var player = GameBoard.GetBoard().CurrentPlayer; _cards = new PlayersCards(player.Cards); var doneTrading = false; while (doneTrading == false) { Console.Clear(); Colour.SouthAmericaRed("\t **** Risk! ****\n"); Console.WriteLine("\t=========================="); Console.WriteLine("\t Card trade menu"); Console.Write("\tCurrently "); Colour.PrintPlayer(player.Colour, player.Name + "'s"); Console.Write(" turn.\n"); if (player.Cards.Count > 6) { Colour.SouthAmericaRed("\tYou must trade at least one set of cards!\n"); } int infantryCount, cavalryCount, artillaryCount, wildCount; if (_cards.Infantry == null) { infantryCount = 0; } else { infantryCount = _cards.Infantry.Count; } if (_cards.Cavalry == null) { cavalryCount = 0; } else { cavalryCount = _cards.Cavalry.Count; } if (_cards.Artillary == null) { artillaryCount = 0; } else { artillaryCount = _cards.Artillary.Count; } if (_cards.Wild == null) { wildCount = 0; } else { wildCount = _cards.Wild.Count; } Console.WriteLine("\tInfantry cards = " + infantryCount); Console.WriteLine("\tCavalry cards = " + cavalryCount); Console.WriteLine("\tArtillary cards = " + artillaryCount); Console.WriteLine("\tWild cards = " + wildCount); Console.WriteLine("\n\t1. Play three of a kind"); Console.WriteLine("\t2. Play one of each"); Console.WriteLine("\t3. Play a wild card"); Console.WriteLine("\t4. Game Menu"); Console.WriteLine("\t5. Commence deployment of reinforcements"); Console.WriteLine("\t=========================="); var option = GameEngine.UserInputTest("\t(1-5)>", "\tInvalid input, please try again!", 1, 5); switch (option) { case 1: PlayThreeOfAKind(infantryCount, cavalryCount, artillaryCount, wildCount); break; case 2: PlayOneOfEach(infantryCount, cavalryCount, artillaryCount, wildCount); break; case 3: PlayWildCard(infantryCount, cavalryCount, artillaryCount, wildCount); break; case 4: GamePlayMenus.PlayerTurnMenu(); break; case 5: if (player.Cards.Count <= 6) { doneTrading = true; } else { Console.WriteLine("\tYou have more than 6 cards, You must trade some!"); } break; default: Console.WriteLine("\tError"); break; } } return(_armies); }
private static void CheckUserHasTerritories(Player loser, Player winner) { var board = GameBoard.GetBoard(); var count = CountPlayersTerritories(loser); if (count == 0) { Console.Clear(); Colour.SouthAmericaRed("\t **** Risk! ****\n"); Console.WriteLine("\t==========================\n"); Colour.PrintPlayer(loser.Colour, "\t" + loser.Name); Console.Write(", You have no remaining territories."); Console.Write("\n\tYou have been annihilated, "); Colour.SouthAmericaRed("your game is over!!!!"); Console.Write("\n\tPress any key to continue...."); Console.ReadKey(); if (loser.Cards != null && loser.Cards.Count > 0) { foreach (var card in loser.Cards) { if (winner.Cards == null) { winner.Cards = new List <Card>(); winner.Cards.Add(card); } else { winner.Cards.Add(card); } } Console.Clear(); Colour.SouthAmericaRed("\t **** Risk! ****\n"); Console.WriteLine("\t==========================\n"); Colour.PrintPlayer(winner.Colour, "\t" + winner.Name); Console.Write(", You have received all of "); Colour.PrintPlayer(loser.Colour, loser.Name + "'s "); Console.Write("game cards."); if (winner.Cards.Count > 6) { board.CurrentPlayer = winner; Console.Write("\n\tYou now have more than 6 game cards."); Console.WriteLine("\tYou must trade cards now."); Console.WriteLine("\tPress any key to continue...."); Console.ReadKey(); CardTradeingEngine.TradeMenu(); } else { Console.WriteLine("\tPress any key to continue...."); Console.ReadKey(); } } var playerList = board.GetPlayerList(); var index = GameEngine.GetPlayerIndex(loser.Name); playerList.RemoveAt(index); board.SetPlayerTurnQueue(GameEngine.CreateTurnQueue(board.CurrentPlayer)); } }
public override void AssignStartingPlayer() { GameBoard.GetBoard().CurrentPlayer = _mapper.CurrentPlayer; }
private void ReinforcementsPhase(GameBoard board) { board.CurrentPlayer.Armies = ArmyBuilder.ReinforcmentsCalculator(board.GetEarth(), board.CurrentPlayer); TroopDeployer.DeployTroops(board.CurrentPlayer); }