Ejemplo n.º 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);
            }
Ejemplo n.º 2
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);
            }
Ejemplo n.º 3
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);
            }
Ejemplo n.º 4
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);
            }
Ejemplo n.º 5
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);
                }
            }
Ejemplo n.º 6
0
 private ISelectCardsActivity CreatePassCardsActivity(TurnContext context, Player player, ICard source, Player tempPlayer)
 {
     return(new SelectCardsActivity
                (context.Game.Log, player, "Select a card to pass.", SelectionSpecifications.SelectExactlyXCards(1), source)
     {
         AfterCardsSelected = cards =>
         {
             _cardMovements[cards.Single()] = context.Game.PlayerToLeftOf(tempPlayer).Hand;
             if (_cardMovements.Keys.Count == _expectedMovementCount)
             {
                 DoMovements();
                 DoTrash(context, source);
             }
         },
         Hint = ActivityHint.PassCards
     });
 }
Ejemplo n.º 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);
            }
Ejemplo n.º 8
0
            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.");
                }
            }
Ejemplo n.º 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);
                }
            }
Ejemplo n.º 10
0
            private IActivity CreateChooseActionActivity(TurnContext context, RevealZone revealZone, ICard source)
            {
                var selectTreasure = new SelectFromRevealedCardsActivity(context.Game.Log, context.ActivePlayer, revealZone,
                                                                         "Select the action to play first.", SelectionSpecifications.SelectExactlyXCards(1), source);

                selectTreasure.AfterCardsSelected = cards =>
                {
                    var first  = cards.OfType <IActionCard>().Single();
                    var second = revealZone.OfType <IActionCard>().Single(c => c != first);

                    // Reverse order because we're on a stack.
                    context.AddEffect(source, new PlayCardEffect(second));
                    context.AddEffect(source, new PlayCardEffect(first));
                };

                return(selectTreasure);
            }
Ejemplo n.º 11
0
            private IActivity CreateChooseCardActivity(TurnContext context, RevealZone revealZone, Player player, ICard source)
            {
                var selectTreasure = new SelectFromRevealedCardsActivity(context.Game.Log, player, revealZone,
                                                                         string.Format("Select the card you do NOT want {0} to draw.", revealZone.Owner.Name), SelectionSpecifications.SelectExactlyXCards(1), source);

                selectTreasure.AfterCardsSelected = cards =>
                {
                    var discardingCard = cards.Single();
                    discardingCard.MoveTo(context.ActivePlayer.Discards);
                    revealZone.MoveAll(context.ActivePlayer.Hand);
                };

                return(selectTreasure);
            }
Ejemplo n.º 12
0
            private IActivity CreateChooseTreasureActivity(TurnContext context, RevealZone revealZone, ICard source)
            {
                var selectTreasure = new SelectFromRevealedCardsActivity(context.Game.Log, context.ActivePlayer, revealZone,
                                                                         "Select a treasure to trash (you will have the opportunity to gain it).", SelectionSpecifications.SelectExactlyXCards(1), source);

                selectTreasure.AfterCardsSelected = cards =>
                {
                    var trashedCard         = TrashAndDiscard(context, revealZone, cards.OfType <ITreasureCard>());
                    var gainOrTrashActivity = Activities.GainOpponentsCardChoice(context, trashedCard, revealZone.Owner, source);
                    _activities.Insert(0, gainOrTrashActivity);
                };

                return(selectTreasure);
            }