// Logic for a single round public void PlaySingleRound() { wars = (int)ViewState["Wars"]; if (player1Deck.Deck.Count() >= 10 || player2Deck.Deck.Count() >= 10) { if (player1Deck.Deck.ElementAt(0).Rank == player2Deck.Deck.ElementAt(0).Rank) { // Actions for a round of war resultLabel.Text += WarRound.PrintWar(player1Deck, player2Deck); WarRound.War(player1Deck, player2Deck); ViewState["Wars"] = ++wars; StoreDecks(); } else { // Actions for a normal round resultLabel.Text += RegularRound.PrintRound(player1Deck, player2Deck); RegularRound.Fight(player1Deck, player2Deck); StoreDecks(); } } else { PrintWinner(); } }
public static string PrintRound(CardDeck player1Deck, CardDeck player2Deck) { List <Card> _cards = new List <Card>() { player1Deck.Deck.ElementAt(0), player2Deck.Deck.ElementAt(0) }; return(string.Format( "<div class=\"bg-secondary rounded my-3 p-2 text-light text-center\">" + "<p>{0} -- vs -- {1}</p><h5><strong class=\"{2} player\">{3}" + "</strong> wins the round</h5></div>", _cards.ElementAt(0).PrintCardName(), _cards.ElementAt(1).PrintCardName(), RegularRound.PrintRoundWinnerCSSClass(_cards), RegularRound.PrintRoundWinner(_cards))); }