Ejemplo n.º 1
0
        public bool Bout(DurakPlayer att, DurakPlayer def)
        {
            bool quit    = false;
            bool victory = true;
            int  check   = def.playerHand.Count;

            wave = 1;
            do
            {
                Console.Clear();
                Card beat = Attack(att, wave);
                if (beat == null)
                {
                    quit = true;
                }
                else
                {
                    victory = Defend(def, beat);
                }
                if (victory == false)
                {
                    quit = true;
                }
                wave++;
            } while (!quit && wave <= 6 && wave <= check);

            return(victory);
        }
Ejemplo n.º 2
0
        public bool Defend(DurakPlayer def, Card beat)
        {
            Console.Clear();
            DisplayTrump();
            Console.WriteLine("Attacker playerd:\t" + beat.ToString());
            Card defense;

            Console.WriteLine();
            List <string> options = def.DisplayHand();
            bool          valid   = false;

            do
            {
                int choice = CIO.PromptForMenuSelection(options, true);
                if (choice == 0)
                {
                    def.playerHand.AddRange(playfield);
                    playfield.Clear();
                    return(false);
                }
                else
                {
                    defense = def.playerHand[choice - 1];
                    valid   = CheckDefense(beat, defense);
                }
            } while (!valid);
            playfield.Add(defense);
            def.playerHand.Remove(defense);
            return(true);
        }
Ejemplo n.º 3
0
 public void RestockHand(DurakPlayer attack, DurakPlayer defense)
 {
     for (int i = attack.playerHand.Count; i < 6; i++)
     {
         Card restock = dealer.Deal();
         attack.AddCard(restock);
     }
     if (defPass == true)
     {
         for (int i = defense.playerHand.Count; i < 6; i++)
         {
             Card restock = dealer.Deal();
             defense.AddCard(restock);
         }
     }
 }
Ejemplo n.º 4
0
 public void CheckLoss(DurakPlayer p1, DurakPlayer p2)
 {
     if (p1.playerHand.Count == 0)
     {
         Console.WriteLine("Player 2 has lost.");
         noHand = true;
     }
     else if (p2.playerHand.Count == 0)
     {
         Console.WriteLine("Player 1 has lost.");
         noHand = true;
     }
     else
     {
         noHand = false;
     }
 }
Ejemplo n.º 5
0
        public Card Attack(DurakPlayer att, int wave)
        {
            Card attack;

            Console.Clear();
            DisplayTrump();
            PrintField();
            if (wave == 1)
            {
                List <string> options = att.DisplayHand();
                int           choice  = CIO.PromptForMenuSelection(options, false);
                attack = att.playerHand[choice - 1];
            }
            else
            {
                List <string> options = att.DisplayHand();
                bool          valid   = false;
                do
                {
                    int choice = CIO.PromptForMenuSelection(options, true);
                    if (choice == 0)
                    {
                        valid  = true;
                        attack = null;
                        playfield.Clear();
                    }
                    else
                    {
                        attack = att.playerHand[choice - 1];
                        valid  = CheckAttack(attack);
                    }
                } while (!valid);
            }
            if (attack != null)
            {
                playfield.Add(attack);
            }
            att.playerHand.Remove(attack);
            return(attack);
        }