예제 #1
0
        protected override async Task ActAsync(IActionHost host)
        {
            var trashes = await host.SelectCards("Choose cards to trash.", Zone.DeckTop(2));

            if (trashes.Any())
            {
                host.Trash(trashes, Zone.Deck);
            }

            if (trashes.Length < 2)
            {
                var discards = await host.SelectCards("Choose cards to discard.", Zone.DeckTop(trashes.Length == 1 ? 1 : 2));

                if (discards.Any())
                {
                    host.Discard(discards, Zone.Deck);
                }
                else if (!trashes.Any())
                {
                    var orderedCards = await host.OrderCards("Put these cards back in any order.", Zone.DeckTop(2));

                    host.Reorder(orderedCards, Zone.Deck);
                }
            }
        }
예제 #2
0
        protected override async Task ActAsync(IActionHost host)
        {
            host.AddCoins(2);

            var top5 = host.Examine(Zone.DeckTop(5));

            var namesBuilder = new StringBuilder();
            {
                for (var i = 0; i < top5.Length; i++)
                {
                    var suffix = (i == top5.Length - 1) ? "" :
                                 (i == top5.Length - 2) ? " and" :
                                 ",";

                    namesBuilder.Append($"<card suffix='{suffix}'>{top5[i].Name}</card>");
                }
            }
            var names = namesBuilder.ToString();

            await host.ChooseOne("Navigator",
                                 new NamedOption($"<run>Discard cards:</run>{names}.", () => host.Discard(top5, Zone.Deck)),
                                 new NamedOption("<run>Put cards back on deck.</run>", async() =>
            {
                var reordered = await host.OrderCards("Navigator", Zone.DeckTop(5));
                host.Reorder(reordered, Zone.DeckTop(5));
            })
                                 );
        }
예제 #3
0
        protected override async Task ReactAsync(IActionHost host)
        {
            host.DrawCards(2);
            var put = await host.SelectCards("Choose cards to put back.", Zone.Hand, 2, 2);

            host.PutOnDeck(put);
            var ordered = await host.OrderCards("Choose the order of the cards put back.", Zone.DeckTop(2));

            host.Reorder(ordered, Zone.Deck);
        }
예제 #4
0
        protected override async Task ActAsync(IActionHost host)
        {
            host.DrawCards(1);
            host.AddActions(1);

            var top4     = host.Reveal(Zone.DeckTop(4));
            var drawn    = top4.Where(card => card.Name == "Copper" || card.Name == "Potion").ToArray();
            var notDrawn = top4.Without(drawn).ToArray();

            host.PutIntoHand(drawn, Zone.Deck);

            if (notDrawn.Length > 1)
            {
                var reordered = await host.OrderCards("Put these cards back in any order.", notDrawn);

                host.Reorder(reordered, Zone.DeckTop(notDrawn.Length));
            }
        }
예제 #5
0
        protected override async Task ActAsync(IActionHost host)
        {
            host.DrawCards(3);

            var top4 = host.Reveal(Zone.DeckTop(4));
            var victoryOrCurseCards = top4.Where(card => card.Types.Contains(CardType.Victory) || card.Name == "Curse").ToArray();

            if (victoryOrCurseCards.Length > 0)
            {
                host.PutIntoHand(victoryOrCurseCards, Zone.Deck);

                if (victoryOrCurseCards.Length < 3)
                {
                    var zone           = Zone.DeckTop(4 - victoryOrCurseCards.Length);
                    var reorderedCards = await host.OrderCards("Put these cards back in any order.", zone);

                    host.Reorder(reorderedCards, zone);
                }
            }
        }
예제 #6
0
파일: Scout.cs 프로젝트: gulbanana/cardgame
        protected override async Task ActAsync(IActionHost host)
        {
            host.AddActions(1);

            var top4            = host.Reveal(Zone.DeckTop(4));
            var victoryCards    = top4.Where(c => c.Types.Contains(CardType.Victory)).ToArray();
            var nonVictoryCards = top4.Where(c => !c.Types.Contains(CardType.Victory)).ToArray();

            if (victoryCards.Any())
            {
                host.PutIntoHand(victoryCards, Zone.Deck);
            }

            if (nonVictoryCards.Count() > 1)
            {
                var zone           = Zone.DeckTop(nonVictoryCards.Count());
                var reorderedCards = await host.OrderCards("Put these cards back in any order.", zone);

                host.Reorder(reorderedCards, zone);
            }
        }
예제 #7
0
 public static void Reorder(this IActionHost host, ICard[] cards, Zone @in)
 {
     host.Reorder(cards.Names(), @in);
 }