public void UseCards(BTCard card) { Hand.RemoveCards(new List <BTCard> { card }); DealCardMenu.UpdateHand(Hand); }
public PlayedCards PlayTurn(PlayedCards currentMove) { var cardsToPlay = new PlayedCards(this); // display the cards to the player DisplayCardList(); bool valid = false; do { var stillBuildingHand = true; do { int selectedCardIndex = GetUserSelectedCardIndex(); if (selectedCardIndex >= 0) { BTCard selectedCard = Hand[selectedCardIndex]; cardsToPlay.AddCard(selectedCard); valid = true; } if (!ContinueBuildingHandPrompt()) { stillBuildingHand = false; } } while (stillBuildingHand); try { // validate the move cardsToPlay.Validate(currentMove); } catch (Exception ex) { cardsToPlay.Clear(); Console.WriteLine("Invalid move: " + ex.Message); valid = false; } } while (valid == false); // play the cards); return(cardsToPlay); }
public bool IsCardPartOfStrongerHand(BTCard BTCard) { if (!this.Contains(BTCard)) { throw new ArgumentOutOfRangeException("We don't have a " + BTCard.GetCardName()); } // check if it's part of a pair, this return true for trips and quads as well. var isAtleastPair = GetSameValuedCards(BTPokerHands.Double) .Any(g => g .Any(c => c.Value == BTCard.Value) ); // todo: check if it's part of a poker hand // not part of stronger hand. return(isAtleastPair); }
public void AddCard(BTCard BTCard) { Hand.AddCard(BTCard); }
public bool IsGreaterThan(BTCard other) { return((GameValue == other.GameValue && Suit > other.Suit) || GameValue > other.GameValue); }