public void War(Card player1Card, Card player2Card) { DrawCard(_player1); Card card1 = DrawCard(_player1); DrawCard(_player1); DrawCard(_player2); Card card2 = DrawCard(_player2); DrawCard(_player2); GameResults += String.Format("<br><p>!!!!! WAR !!!!!</p> Bounty: {0}", _bounty.Count); performEvaluation(_player1, _player2, card1, card2); }
private void performEvaluation(Player player1, Player player2, Card player1Card, Card player2Card) { GameResults += String.Format("<p>{0} draws a {1} of {2}<br>{3} draws a {4} of {5}<br>", _player1.Name, player1Card.Name, player1Card.Suit, _player2.Name, player2Card.Name, player2Card.Suit); if (player1Card.Number == player2Card.Number) War(player1Card, player2Card); else if (player1Card.Number > player2Card.Number) { _player1.Cards.AddRange(_bounty); GameResults += String.Format("{0} wins with a {1} of {2} and gets {3} cards", _player1.Name, player1Card.Name, player1Card.Suit, _bounty.Count); } else { _player2.Cards.AddRange(_bounty); GameResults += String.Format("{0} wins with a {1} of {2} and gets {3} cards", _player2.Name, player2Card.Name, player2Card.Suit, _bounty.Count); } _bounty.Clear(); }
public List<Card> CreateDeck() { Cards = new List<Card>(); foreach (var number in CardNumbers) { foreach (var suit in SuitsList) { Card card = new Card() { Number = number, Suit = suit}; if (number == 14) card.Name = "Ace"; else if (number == 11) card.Name = "Jack"; else if (number == 12) card.Name = "Queen"; else if (number == 13) card.Name = "King"; else card.Name = number.ToString(); Cards.Add(card); } } return Cards; }