public Defence Defend(State state, Card[] attackingCards)
        {
            var d = new Defence();
            if (_hand.Cards.Count < 3)
            {
                return d;
            }
            if (attackingCards.Count<Card>() > 1)
            {
                d.Response[attackingCards[0]] = new Card[] { _hand.Cards[0] };
                d.Response[attackingCards[1]] = new Card[] { _hand.Cards[1] };
            }

            return d;
        }
Example #2
0
        public Defence Defend(State state, Card[] attackingCards)
        {
            // Show attackers
            Console.WriteLine("### YOU'RE UNDER ATTACK!!! ###");
            Console.WriteLine();
            DisplayCards(attackingCards, "Attackers:");

            // Show hand
            DisplayCards(_hand.Cards.ToArray(), "Hand:");

            // Loop over attackers and request defenders for each attacker
            var defence = new Defence();
            foreach (Card c in attackingCards)
            {
                Console.WriteLine("Input the Numbers of Defending Cards for [{0}] separated by spaces", c);
                var defenders = SelectCards(_hand.Cards.ToArray());
                defence.Response[c] = defenders;
            }

            // Return defenders
            return defence;
        }