コード例 #1
0
ファイル: Replace.cs プロジェクト: gulbanana/cardgame
        protected override async Task ActAsync(IActionHost host)
        {
            var trashed = await host.SelectCard("Choose a card to trash.", Zone.Hand);

            if (trashed != null)
            {
                var cost = trashed.GetCost(host);
                host.Trash(trashed);

                var gained = await host.SelectCard(
                    "Choose a card to gain.",
                    Zone.SupplyAvailable,
                    card => card.GetCost(host).LessThanOrEqual(cost.Plus(2))
                    );

                if (gained != null)
                {
                    if (gained.Types.Contains(CardType.Action) || gained.Types.Contains(CardType.Treasure))
                    {
                        await host.Gain(gained, Zone.Deck);
                    }
                    else
                    {
                        await host.Gain(gained);
                    }

                    if (gained.Types.Contains(CardType.Victory))
                    {
                        await host.Attack(target => target.Gain("Curse"));
                    }
                }
            }
        }
コード例 #2
0
ファイル: Island.cs プロジェクト: gulbanana/cardgame
        protected override async Task ActAsync(IActionHost host)
        {
            var matted = await host.SelectCard("Choose an additional card to put on your Island mat.");

            host.PutOnMat("IslandMat", "Island", Zone.InPlay);
            host.PutOnMat("IslandMat", matted, Zone.Hand);
        }
コード例 #3
0
ファイル: Remodel.cs プロジェクト: gulbanana/cardgame
        protected override async Task ActAsync(IActionHost host)
        {
            var modifiers = host.GetModifiers();

            var trashedCard = await host.SelectCard("Choose a card to trash.");

            host.Trash(trashedCard.Name);

            var gainedCard = await host.SelectCard(
                "Choose a card to gain.",
                Zone.SupplyAvailable,
                card => card.GetCost(modifiers).LessThanOrEqual(trashedCard.GetCost(modifiers).Plus(2))
                );

            await host.Gain(gainedCard.Name);
        }
コード例 #4
0
        protected override async Task ActAsync(IActionHost host)
        {
            host.DrawCards(2);
            host.AddActions(1);

            var inserted = await host.SelectCard("Choose a card to put in your deck.", Zone.Hand);

            var deckSize = host.Count(Zone.Deck);

            if (deckSize == 0)
            {
                host.PutOnDeck(inserted);
            }
            else
            {
                var options = Enumerable.Range(0, deckSize + 1).Select(i =>
                {
                    var label =
                        i == 0 ? "Top" :
                        i == deckSize ? "Bottom" :
                        i.ToString();
                    return(new NamedOption(label, () => host.InsertIntoDeck(inserted.Name, i)));
                });
                await host.ChooseOne($"Choose where to put {inserted.Name}.", options.ToArray());
            }
        }
コード例 #5
0
        protected override async Task ActAsync(IActionHost host)
        {
            var gainedCard = await host.SelectCard(
                "Choose a card to gain.",
                Zone.SupplyAvailable,
                card => card.GetCost(host).LessThanOrEqual(5)
                );

            await host.Gain(gainedCard.Name, Zone.Hand);

            var placedCard = await host.SelectCard(
                "Choose a card to put onto your deck.",
                Zone.Hand
                );

            host.PutOnDeck(placedCard, Zone.Hand);
        }
コード例 #6
0
ファイル: Lurker.cs プロジェクト: gulbanana/cardgame
        protected override async Task ActAsync(IActionHost host)
        {
            host.AddActions(1);

            await host.ChooseOne("Lurker",
                                 new NamedOption("Trash an Action card from the Supply", async() =>
            {
                var trashed = await host.SelectCard("Choose a card to trash.", Zone.SupplyAvailable, cards => cards.OfType <IActionCard>());
                host.Trash(trashed, Zone.SupplyAvailable);
            }),
                                 new NamedOption("Gain an Action card from the Trash", async() =>
            {
                var gained = await host.SelectCard("Choose a card to gain.", Zone.Trash, cards => cards.OfType <IActionCard>());
                await host.GainFrom(gained, Zone.Trash);
            })
                                 );
        }
コード例 #7
0
ファイル: Courtyard.cs プロジェクト: gulbanana/cardgame
        protected override async Task ActAsync(IActionHost host)
        {
            host.DrawCards(3);

            var put = await host.SelectCard("Choose a card to put onto your deck.");

            host.PutOnDeck(put);
        }
コード例 #8
0
ファイル: Embargo.cs プロジェクト: gulbanana/cardgame
        protected override async Task ActAsync(IActionHost host)
        {
            host.AddCoins(2);
            host.Trash("Embargo", Zone.InPlay);

            var pile = await host.SelectCard("Choose a Supply pile to embargo.", Zone.SupplyAvailable);

            host.AddToken("EmbargoToken", pile.Name);
        }
コード例 #9
0
        protected override async Task ActAsync(IActionHost host)
        {
            host.AddActions(1);

            var trashed = await host.SelectCard("Choose a card to trash.", Zone.DeckTop(3));

            if (trashed != null)
            {
                host.Trash(trashed, Zone.Deck);

                var discarded = await host.SelectCard("Choose a card to discard.", Zone.DeckTop(2));

                if (discarded != null)
                {
                    host.Discard(discarded, Zone.Deck);
                }
            }
        }
コード例 #10
0
ファイル: Workshop.cs プロジェクト: gulbanana/cardgame
        protected override async Task ActAsync(IActionHost host)
        {
            var gainedCard = await host.SelectCard(
                "Choose a card to gain.",
                Zone.SupplyAvailable,
                card => card.GetCost(host).LessThanOrEqual(4)
                );

            await host.Gain(gainedCard.Name);
        }
コード例 #11
0
ファイル: Upgrade.cs プロジェクト: gulbanana/cardgame
        protected override async Task ActAsync(IActionHost host)
        {
            host.DrawCards(1);
            host.AddActions(1);

            var trashed = await host.SelectCard("Choose a card to trash.", Zone.Hand);

            if (trashed != null)
            {
                host.Trash(trashed);

                var value  = trashed.GetCost(host).Plus(1);
                var gained = await host.SelectCard("Choose a card to gain.", Zone.SupplyAvailable, card => card.GetCost(host).Equals(value));

                if (gained != null)
                {
                    await host.Gain(gained);
                }
            }
        }
コード例 #12
0
ファイル: ThroneRoom.cs プロジェクト: gulbanana/cardgame
        protected override async Task ActAsync(IActionHost host)
        {
            var doubledCard = await host.SelectCard("Choose an Action card.", Zone.Hand, cards => cards.OfType <IActionCard>());

            if (doubledCard != null)
            {
                await host.PlayCard(doubledCard, Zone.Hand);

                await host.PlayCard(doubledCard, Zone.InPlay);
            }
        }
コード例 #13
0
        protected override async Task ActAsync(IActionHost host)
        {
            host.Trash("Feast", Zone.InPlay);

            var gainedCard = await host.SelectCard(
                "Choose a card to gain.",
                Zone.SupplyAvailable,
                card => card.GetCost(host).LessThanOrEqual(5)
                );

            await host.Gain(gainedCard);
        }
コード例 #14
0
        protected override async Task ActAsync(IActionHost host)
        {
            host.AddBuys(1);

            var trashed = await host.SelectCard("Choose a card to trash.");

            if (trashed != null)
            {
                host.Trash(trashed);
                host.AddCoins(trashed.GetCost(host).Coins);
            }
        }
コード例 #15
0
        protected override async Task ActAsync(IActionHost host)
        {
            host.AddActions(1);

            var trashed = await host.SelectCard("Choose a card to trash.");

            if (trashed != null)
            {
                var cost = trashed.GetCost(host);
                host.Trash(trashed);

                host.DrawCards(cost.Coins + (cost.Potion ? 2 : 0));
            }
        }
コード例 #16
0
        protected override async Task ActAsync(IActionHost host)
        {
            var revealed = await host.SelectCard("Choose a card to reveal.");

            if (revealed != null)
            {
                host.Reveal(revealed);
                await host.ChooseMultiple("Courtier", revealed.Types.Length,
                                          new NamedOption("<bold>+1 Action</bold>", () => host.AddActions(1)),
                                          new NamedOption("<bold>+1 Buy</bold>", () => host.AddBuys(1)),
                                          new NamedOption("<bold><sym>+coin3</sym></bold>", () => host.AddCoins(3)),
                                          new NamedOption("<run>Gain a</run><card>Gold</card>", () => host.Gain("Gold"))
                                          );
            }
        }
コード例 #17
0
        protected override async Task ActAsync(IActionHost host)
        {
            var lastGains = host.Examine(Zone.RecentGains, host.GetPlayerToRight()).Where(c => c.GetCost(host).LessThanOrEqual(6));

            if (lastGains.Count() == 1)
            {
                await host.Gain(lastGains.Single());
            }
            else if (lastGains.Count() > 1)
            {
                var gainedCopy = await host.SelectCard("Choose a card to gain.", lastGains);

                await host.Gain(gainedCopy);
            }
        }
コード例 #18
0
ファイル: Mine.cs プロジェクト: gulbanana/cardgame
        protected override async Task ActAsync(IActionHost host)
        {
            var modifiers = host.GetModifiers();

            var trashedCard = await host.SelectCard(
                "Choose a Treasure to trash.",
                cards => cards.OfType <ITreasureCard>()
                );

            if (trashedCard != null)
            {
                host.Trash(trashedCard);

                var gainedCard = await host.SelectCard(
                    "Choose a Treasure to gain.",
                    Zone.SupplyAvailable,
                    cards => cards
                    .OfType <ITreasureCard>()
                    .Where(card => card.GetCost(modifiers).LessThanOrEqual(trashedCard.GetCost(modifiers).Plus(3)))
                    );

                await host.Gain(gainedCard.Name, Zone.Hand);
            }
        }
コード例 #19
0
        protected override async Task ActAsync(IActionHost host)
        {
            host.DrawCards(1);
            host.AddActions(1);

            var setAside = await host.SelectCard("Choose a card to set aside.");

            if (setAside != null)
            {
                host.Attach(setAside, Zone.Hand);
            }
            else
            {
                host.CompleteDuration();
            }
        }
コード例 #20
0
        protected override async Task ActAsync(IActionHost host)
        {
            host.DrawCards(1);
            host.AddActions(1);

            var named = await host.SelectCard("Name a card.", Zone.SupplyAll);

            host.Name(named);

            var top1 = host.Reveal(Zone.DeckTop(1));

            if (named.Equals(top1.SingleOrDefault()))
            {
                host.PutIntoHand(named, Zone.Deck);
            }
        }
コード例 #21
0
ファイル: Ambassador.cs プロジェクト: gulbanana/cardgame
        protected override async Task ActAsync(IActionHost host)
        {
            var revealed = await host.SelectCard("Choose a card to reveal.");

            if (revealed != null)
            {
                host.Reveal(revealed);
                var hand   = host.Examine(Zone.Hand);
                var copies = hand.Where(c => c == revealed);

                var returned = await host.SelectCards("Choose copies to return.", copies);

                host.ReturnToSupply(returned);

                await host.Attack(target => target.Gain(revealed));
            }
        }
コード例 #22
0
        protected override async Task ActAsync(IActionHost host)
        {
            var gained = await host.SelectCard("Choose a card to gain.", Zone.SupplyAvailable, card => card.GetCost(host).LessThanOrEqual(4));

            await host.Gain(gained);

            if (gained is IActionCard)
            {
                host.AddActions(1);
            }
            if (gained is ITreasureCard)
            {
                host.AddCoins(1);
            }
            if (gained is IVictoryCard)
            {
                host.DrawCards(1);
            }
        }
コード例 #23
0
ファイル: Transmute.cs プロジェクト: gulbanana/cardgame
        protected override async Task ActAsync(IActionHost host)
        {
            var trashed = await host.SelectCard("Choose a card to trash.");

            if (trashed != null)
            {
                if (trashed.Types.Contains(CardType.Action))
                {
                    await host.Gain("Duchy");
                }
                if (trashed.Types.Contains(CardType.Treasure))
                {
                    await host.Gain("Transmute");
                }
                if (trashed.Types.Contains(CardType.Victory))
                {
                    await host.Gain("Gold");
                }
            }
        }
コード例 #24
0
ファイル: Swindler.cs プロジェクト: gulbanana/cardgame
        protected override async Task ActAsync(IActionHost host)
        {
            host.AddCoins(2);

            await host.Attack(async target =>
            {
                var topDeck = target.Examine(Zone.DeckTop(1)).SingleOrDefault();
                if (topDeck != null)
                {
                    var topDeckCost = topDeck.GetCost(host);

                    target.Trash(topDeck, Zone.Deck);

                    var gained = await host.SelectCard(
                        $"Choose a card for {target.Player} to gain.",
                        Zone.SupplyAvailable,
                        card => card.GetCost(host).Equals(topDeckCost)
                        );
                    await target.Gain(gained);
                }
            });
        }
コード例 #25
0
        protected override async Task ActAsync(IActionHost host)
        {
            var tokens = host.Count(Zone.PlayerMat("PirateShipMat"));

            await host.ChooseOne("Pirate Ship",
                                 new NamedOption($"<sym>+coin1</sym><run>per Coin token (+${tokens}).</run>", () =>
            {
                host.AddCoins(tokens);
            }),
                                 new NamedOption("Raid for Treasures!", async() =>
            {
                var anyTrashes = false;
                await host.Attack(async target =>
                {
                    var top2 = target.Reveal(Zone.DeckTop(2));
                    var top2Treasures = top2.OfType <ITreasureCard>();
                    if (top2Treasures.Count() == 1)
                    {
                        target.Trash(top2Treasures.Single(), Zone.Deck);
                        anyTrashes = true;
                    }
                    else if (top2Treasures.Count() == 2)
                    {
                        var trashed = await host.SelectCard($"Choose a Treasure for {target.Player} to trash.", top2Treasures);
                        target.Trash(trashed, Zone.Deck);
                        anyTrashes = true;
                    }
                    target.Discard(top2.Without(top2Treasures).ToArray(), Zone.Deck);
                });

                if (anyTrashes)
                {
                    host.PutOnMat("PirateShipMat", "Coin", Zone.Create);
                }
            })
                                 );
        }
コード例 #26
0
ファイル: Thief.cs プロジェクト: gulbanana/cardgame
        protected override async Task ActAsync(IActionHost host)
        {
            var trashed = new List <ICard>();

            await host.Attack(async player =>
            {
                var top2 = player.Reveal(Zone.DeckTop(2));

                var treasures = top2.OfType <ITreasureCard>();
                if (treasures.Any())
                {
                    if (treasures.Count() == 1 || treasures.First().Equals(treasures.Last()))
                    {
                        var soleTreasure = treasures.First();
                        player.Trash(soleTreasure, Zone.Deck);
                        trashed.Add(soleTreasure);
                    }
                    else
                    {
                        var chosenTreasure = await host.SelectCard("Choose a Treasure to trash.", treasures);
                        player.Trash(chosenTreasure, Zone.Deck);
                        trashed.Add(chosenTreasure);
                    }
                }
            });

            if (trashed.Any())
            {
                var gained = await host.SelectCards("Choose trashed Treasures to gain.", trashed);

                if (gained.Any())
                {
                    await host.GainFrom(gained, Zone.Trash);
                }
            }
        }