Esempio n. 1
0
 //adding a card to PlayHand
 public void AddCardToPlayHand(PlayHand ph, Hand defPlayer, Card c)
 {
     if (ph.NumCards < defPlayer.NumCards * 2)
     {
         ph.AddCard(c);
     }
 }
Esempio n. 2
0
 //Adding cards to the Discard Pile
 public DiscardHand AddToDiscardPile(DiscardHand dh, PlayHand ph)
 {
     for (int i = 0; i < ph.NumCards; i++)
     {
         dh.AddCard(ph.GetCard(i));
     }
     return(dh);
 }
Esempio n. 3
0
        public Hand PickPlayHandCards(Hand h, PlayHand ph)
        {
            for (int i = 0; i < ph.NumCards; i++)
            {
                h.AddCard(ph.cards[i]);
            }

            ph.DiscardAll();

            return(h);
        }
Esempio n. 4
0
        public bool CanAttackAgain(int index, Hand h, PlayHand ph) //Checks if a player can attack again with a specific card
        {
            bool canAttack  = false;
            Card attackCard = h.GetCard(index);

            for (int i = 0; i < ph.NumCards; i++)
            {
                Card c = ph.GetCard(i);
                if (attackCard.Value == c.Value)
                {
                    canAttack = true;
                }
            }
            return(canAttack);
        }
Esempio n. 5
0
        public bool CanAttackAgain(Hand h, PlayHand ph) //Checks if Computer can attack again based on cards in the PlayHand
        {
            bool canAttack = false;

            for (int i = 0; i < ph.NumCards; i++)
            {
                Card c = ph.GetCard(i);
                for (int j = 0; j < h.NumCards; j++)
                {
                    Card c1 = h.GetCard(i);
                    if (c1.Value == c.Value)
                    {
                        canAttack = true;
                    }
                }
            }
            return(canAttack);
        }
Esempio n. 6
0
 public Card AttackAgain(Hand h, PlayHand ph) // REWORKED THE METHOD A BIT
 {
     for (int i = 0; i < ph.NumCards; i++)
     {
         Card c1 = ph.cards[i];
         for (int j = 0; j < h.NumCards; j++)
         {
             Card c = h.cards[j];
             if (c.HasMatchingValue(c1))
             {
                 h.cards.Remove(c);
                 return(c);
             }
         }
         //else
         //    throw new ArgumentException("This card's value does not match any cards currently in play; therefore it cannot be played.");
     }
     return(null);
 }
Esempio n. 7
0
        public PlayHand PickCardUp(PlayHand ph, Card c) //Picking up a card voluntarily
        {
            ph.AddCard(c);

            return(ph);
        }