Ejemplo n.º 1
0
        public StatusObject discardCardsAndDrawSameAmount(List<Card> cards)
        {
            StatusObject retVal = new StatusObject(false);
            //check if there are actually no cards in the list. Skip the rest of the code  if there aren't any.

            if (cards.Count == 0)
            {
                retVal.setDiscardedAndDrawn(true);
                return retVal;
            }

            StatusObject returner = allCardsInHand(cards, retVal);
            if (returner != null)
            {
                return returner;
            }

            //if it gets to here all the cards are in the hand. Proceed to remove them and draw the same number.
            //now we can modify the player's actual hand
            Hand h = this.getHand();
            Deck d = this.getDeck();
            foreach (Card c in cards)
            {
                h.discard(c, d);
            }

            //now we discarded all of the cards, draw the number that we need
            CardFunctions.draw(this, cards.Count);
            retVal.setDiscardedAndDrawn(true);

            return retVal;
        }