Beispiel #1
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);
        }
Beispiel #2
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);
        }