Exemplo n.º 1
0
        private void DoAttack(Player attacker, Player attacked)
        {
            List<CardModel> cards = attacked.DrawCards(2);

            bool hadTreasure = cards.Any(c => c.Is(CardType.Treasure));
            IEnumerable<CardModel> gainable = cards.Where(c => c is Silver || c is Gold);

            if (gainable.Any())
            {
                CardModel treasure = attacker.Chooser.ChooseOneCard(CardChoiceType.TrashForNobleBrigand, "Trash a treasure", ChoiceSource.None, gainable);
                if (treasure != null)
                {
                    attacked.Trash(treasure);
                    attacker.GainCard(treasure, null);
                    cards.Remove(treasure);
                }
            }

            foreach (CardModel other in cards)
            {
                attacked.DiscardCard(other);
            }

            if (!hadTreasure)
            {
                attacked.GainCard(typeof(Copper));
            }
        }