Esempio n. 1
0
 public static ISelectCardsActivity DiscardCards(TurnContext context, Player player, int numberToDiscard, ICard source)
 {
     return(new SelectCardsActivity(
                context.Game.Log, player, string.Format("Select {0} card(s) to discard.", numberToDiscard),
                SelectionSpecifications.SelectExactlyXCards(numberToDiscard), source)
     {
         AfterCardsSelected = cards => context.DiscardCards(player, cards),
         Hint = ActivityHint.DiscardCards
     });
 }
Esempio n. 2
0
        public static ISelectCardsActivity SelectUpToXCardsToTrash(TurnContext context, Player player, int count, ICard source)
        {
            var activity = new SelectCardsActivity(context.Game.Log, player,
                                                   string.Format("Select up to {0} card(s) to trash.", count),
                                                   SelectionSpecifications.SelectUpToXCards(count), source);

            activity.Hint = ActivityHint.TrashCards;
            activity.AfterCardsSelected = cards => context.TrashAll(player, cards);

            return(activity);
        }
Esempio n. 3
0
 public static ISelectCardsActivity PutCardFromHandOnTopOfDeck(IGameLog log, Player player, string message, ICard source)
 {
     return(new SelectCardsActivity
                (log, player, message, SelectionSpecifications.SelectExactlyXCards(1), source)
     {
         AfterCardsSelected = cards =>
         {
             player.Deck.MoveToTop(cards.Single());
             log.LogMessage("{0} put a card on top of the deck.", player.Name);
         },
         Hint = ActivityHint.RedrawCards
     });
 }
Esempio n. 4
0
 public static ISelectPileActivity SelectACardForOpponentToGain(TurnContext context, Player player, Player victim, CardCost cost, ICard source)
 {
     return(new SelectPileActivity(context.Game.Log, player, string.Format("Select a card for {0} to gain of cost {1}.", victim.Name, cost),
                                   SelectionSpecifications.SelectPileCostingExactlyX(cost), source)
     {
         AfterPileSelected = pile =>
         {
             var card = pile.TopCard;
             card.MoveTo(victim.Discards);
             context.Game.Log.LogGain(victim, card);
         },
         Hint = ActivityHint.OpponentGainCards
     });
 }
Esempio n. 5
0
        public static IActivity DiscardCardsToDrawCards(TurnContext context, ICard source)
        {
            var activity = new SelectCardsActivity(
                context,
                "Select any number of cards to discard, you will draw 1 new card for each discard.",
                SelectionSpecifications.SelectUpToXCards(context.ActivePlayer.Hand.CardCount), source);

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

            return(activity);
        }
Esempio n. 6
0
        public static ISelectCardsActivity PutCardOfTypeFromHandOnTopOfDeck(IGameLog log, Player player, string message, Type cardType, ICard source)
        {
            var spec = SelectionSpecifications.SelectExactlyXCards(1);

            spec.CardTypeRestriction = cardType;

            return(new SelectCardsActivity
                       (log, player, message, spec, source)
            {
                AfterCardsSelected = cards =>
                {
                    var card = cards.Single();
                    player.Deck.MoveToTop(card);
                    log.LogMessage("{0} put a {1} on top of the deck.", player.Name, card.Name);
                },
                Hint = ActivityHint.RedrawCards
            });
        }
Esempio n. 7
0
 public static IActivity SelectARevealedCardToPutOnTopOfDeck(IGameLog log, Player player, RevealZone revealZone, string message, ICard source)
 {
     return(new SelectFromRevealedCardsActivity(log, player, revealZone, message,
                                                SelectionSpecifications.SelectExactlyXCards(1), source)
     {
         AfterCardsSelected = cards =>
         {
             player.Deck.MoveToTop(cards.Single());
             if (revealZone.CardCount == 1)
             {
                 var lastCard = revealZone.Single();
                 player.Deck.MoveToTop(lastCard);
                 //log.LogMessage("{0} put a {1} on top.", player.Name, lastCard.Name);
             }
         },
         Hint = ActivityHint.RedrawCards
     });
 }
Esempio n. 8
0
        public static IActivity GainAnActionCardCostingUpToX(IGameLog log, Player player, int cost, ICard source, bool optional)
        {
            var activity = new SelectPileActivity(log, player, string.Format("Select an action card to gain of cost {0} or less.", cost),
                                                  SelectionSpecifications.SelectPileCostingUpToX(cost), source)
            {
                AfterPileSelected = pile =>
                {
                    var card = pile.TopCard;
                    card.MoveTo(player.Discards);
                    log.LogGain(player, card);
                },
                Hint = ActivityHint.GainCards
            };

            activity.Specification.CardTypeRestriction = typeof(IActionCard);
            activity.IsOptional = optional;

            return(activity);
        }
Esempio n. 9
0
        public static IActivity SelectACardToTrash(TurnContext context, Player player, ICard source, Action <ICard> afterTrash)
        {
            var activity = new SelectCardsActivity(context.Game.Log, player,
                                                   "Select a card to trash.",
                                                   SelectionSpecifications.SelectExactlyXCards(1), source);

            activity.Hint = ActivityHint.TrashCards;
            activity.AfterCardsSelected = cards =>
            {
                foreach (var cardToTrash in cards)
                {
                    context.Trash(activity.Player, cardToTrash);
                }

                afterTrash(cards.Single());
            };

            return(activity);
        }
Esempio n. 10
0
        public static ISelectCardsActivity SelectActionToPlayMultipleTimes(TurnContext context, Player player, IGameLog log, ICard source, int count)
        {
            var activity = new SelectCardsActivity(
                log, player,
                string.Format("Select an action to play {0} times", count),
                SelectionSpecifications.SelectExactlyXCards(1), source);

            activity.Hint = ActivityHint.PlayCards;
            activity.Specification.CardTypeRestriction = typeof(IActionCard);
            activity.AfterCardsSelected = cards =>
            {
                var actionCard = cards.OfType <IActionCard>().Single();
                log.LogMessage("{0} selected {1} to be played {2} times.", player.Name, actionCard.Name, count);

                actionCard.MoveTo(context.ActivePlayer.PlayArea);

                count.Times(() => context.AddEffect(source, new PlayCardEffect(actionCard)));
            };

            return(activity);
        }
Esempio n. 11
0
 public SelectReactionActivity(TurnContext currentTurn, Player player, AttackEffect attackEffect)
     : base(currentTurn.Game.Log, player, "Select a reaction to use, click Done when finished.", SelectionSpecifications.SelectUpToXCards(1), null)
 {
     _currentTurn  = currentTurn;
     _attackEffect = attackEffect;
     Specification.CardTypeRestriction = typeof(IReactionCard);
 }
Esempio n. 12
0
 public static GainACardActivity GainACardCostingExactlyX(IGameLog log, Player player, CardCost cost, CardZone destination, ICard source)
 {
     return(new GainACardActivity(log, player,
                                  string.Format("Select a card to gain with a cost of exactly {0}.", cost),
                                  SelectionSpecifications.SelectPileCostingExactlyX(cost), destination, source));
 }
Esempio n. 13
0
 public static GainACardActivity GainACardCostingUpToX(IGameLog log, Player player, CardCost cost, CardZone destination, ICard source)
 {
     return(new GainACardActivity(log, player, string.Format("Select a card to gain of cost {0} or less.", cost),
                                  SelectionSpecifications.SelectPileCostingUpToX(cost), destination, source));
 }