示例#1
0
            public override void Resolve(TurnContext context, ICard source)
            {
                if (context.ActivePlayer.Hand.CardCount == 0)
                {
                    context.Game.Log.LogMessage("{0} did not have any cards to upgrade.", context.ActivePlayer.Name);
                    return;
                }

                var upgradeActivity = new SelectCardsActivity(context, "Select a card to Upgrade",
                                                              SelectionSpecifications.SelectExactlyXCards(1), source);

                upgradeActivity.AfterCardsSelected = cardList =>
                {
                    var player        = context.ActivePlayer;
                    var cardToUpgrade = cardList.Single();
                    var upgradeCost   = cardToUpgrade.Cost + 1;
                    context.Trash(player, cardToUpgrade);

                    if (context.Game.Bank.Piles.Any(p => !p.IsEmpty && p.TopCard.Cost == upgradeCost))
                    {
                        var gainActivity = Activities.GainACardCostingExactlyX(context.Game.Log, player,
                                                                               upgradeCost, player.Discards, source);
                        _activities.Add(gainActivity);
                    }
                    else
                    {
                        context.Game.Log.LogMessage("{0} could gain no card of appropriate cost", player);
                    }
                };

                _activities.Add(upgradeActivity);
            }
示例#2
0
 public override void Resolve(TurnContext context, ICard source)
 {
     if (context.ActivePlayer.Hand.CardCount > 0)
     {
         SelectCardsActivity revealActivity = GetRevealActivity(context, source);
         _activities.Add(revealActivity);
     }
 }
示例#3
0
            private SelectCardsActivity GetReturnActivity(TurnContext context, ICard selection)
            {
                var returnActivity = new SelectCardsActivity(context,
                                                             string.Format("Select up to two {0} to return to the supply", selection.Name),
                                                             SelectionSpecifications.SelectUpToXCardsOfSameName(selection.Name, 2),
                                                             _source);

                returnActivity.AfterCardsSelected = cards => ReturnCardsAndAttack(cards, context, selection.Name);
                return(returnActivity);
            }
示例#4
0
            private SelectCardsActivity GetRevealActivity(TurnContext context, ICard source)
            {
                var revealActivity = new SelectCardsActivity(context, "Select a card to reveal.",
                                                             SelectionSpecifications.SelectExactlyXCards(1), _source);

                revealActivity.AfterCardsSelected = cards =>
                {
                    var selection      = cards.Single();
                    var returnActivity = GetReturnActivity(context, selection);
                    _activities.Add(returnActivity);
                };

                return(revealActivity);
            }
示例#5
0
            public override void Resolve(TurnContext context, ICard source)
            {
                var activity = new SelectCardsActivity(
                    context,
                    "Select any number of cards to discard, you will gain $1 per card",
                    SelectionSpecifications.SelectUpToXCards(context.ActivePlayer.Hand.CardCount), source);

                activity.AfterCardsSelected = cards =>
                {
                    context.DiscardCards(activity.Player, cards);
                    context.AvailableSpend += cards.Count();
                };

                _activities.Add(activity);
            }
示例#6
0
            public override void Resolve(TurnContext context, ICard source)
            {
                if (context.ActivePlayer.Hand.CardCount > 0)
                {
                    var activity = new SelectCardsActivity(context, "Select a card to trash",
                                                           SelectionSpecifications.SelectExactlyXCards(1), source);

                    activity.AfterCardsSelected = cardList =>
                    {
                        var cardToSalvage = cardList.Single();
                        context.AvailableSpend += cardToSalvage.Cost.Money;
                        context.Trash(context.ActivePlayer, cardToSalvage);
                    };
                    _activities.Add(activity);
                }
            }
示例#7
0
            public override void Resolve(TurnContext context, ICard source)
            {
                var remodelActivity = new SelectCardsActivity(context, _message,
                                                              SelectionSpecifications.SelectExactlyXCards(1), source);

                remodelActivity.AfterCardsSelected = cardList =>
                {
                    var player        = context.ActivePlayer;
                    var cardToRemodel = cardList.Single();
                    context.Trash(player, cardToRemodel);

                    var gainActivity = Activities.GainACardCostingUpToX(context.Game.Log, player, cardToRemodel.Cost + _costIncrease, source);
                    _activities.Add(gainActivity);
                };

                _activities.Add(remodelActivity);
            }
示例#8
0
文件: Mine.cs 项目: vladdou/Dominion
            public override void Resolve(TurnContext context, ICard source)
            {
                if (context.ActivePlayer.Hand.OfType <ITreasureCard>().Any())
                {
                    var activity = new SelectCardsActivity(context, "Select a treasure card to mine",
                                                           SelectionSpecifications.SelectExactlyXCards(1), source);

                    activity.Specification.CardTypeRestriction = typeof(ITreasureCard);
                    activity.AfterCardsSelected = cardList =>
                    {
                        var cardToMine = cardList.Single();
                        context.Trash(context.ActivePlayer, cardToMine);
                        AddGainActivity(context.Game.Log, context.ActivePlayer, cardToMine.Cost + 3, source);
                    };

                    _activities.Add(activity);
                }
                else
                {
                    context.Game.Log.LogMessage("No treasure cards to trash.");
                }
            }
示例#9
0
            public override void Resolve(TurnContext context, ICard source)
            {
                if (context.ActivePlayer.Hand.CardCount > 0)
                {
                    var activity = new SelectCardsActivity(context, "Select a card to trash",
                                                           SelectionSpecifications.SelectExactlyXCards(1), source);

                    activity.AfterCardsSelected = cardList =>
                    {
                        var cardToTrash = cardList.Single();
                        var cardsToDraw = cardToTrash.Cost.Money;

                        // Notice the card doesn't say its 2 per potion (if we add cards that cost multiple potions)
                        if (cardToTrash.Cost.Potions > 0)
                        {
                            cardsToDraw += 2;
                        }

                        context.DrawCards(cardsToDraw);
                        context.Trash(context.ActivePlayer, cardToTrash);
                    };
                    _activities.Add(activity);
                }
            }