public override void Execute()
 {
     TurnScope.Publish(new CardSelectedToTrashForMineEvent(Item, TurnScope)
     {
         Id = Guid.NewGuid(), CorrelationId = this.OriginalEventId, OriginalEventId = this.OriginalEventId
     });
 }
Beispiel #2
0
 public override void Execute()
 {
     TurnScope.TrashCardFromHand(Item);
     if (TurnScope.Hand.Any())
     {
         TurnScope.Publish(new SelectCardsToChapel(TurnScope));
     }
 }
Beispiel #3
0
        public void When_an_illegal_card_is_selected_action_phase_ends()
        {
            var eventAggregator = new MockEventAggregator();
            var discardPile     = new DiscardPile();
            var deck            = new Deck(7.Coppers(), 3.Estates());
            var player          = new Player(deck, discardPile, new NaivePlayerController());
            var turnScope       = new TurnScope(player, new Supply(), eventAggregator);
            var actionPhase     = new ActionPhase(turnScope,
                                                  new CardSet(Action.Village, Action.Village));
            var response = actionPhase.PlayAction(Treasure.Copper);

            response.ShouldBeType <SkipActionPhaseResponse>();
        }
Beispiel #4
0
        public void When_an_valid_action_card_is_selected_action_the_action_will_be_played()
        {
            var eventAggregator = new MockEventAggregator();
            var discardPile     = new DiscardPile();
            var deck            = new Deck(7.Coppers(), 3.Estates());
            var player          = new Player(deck, discardPile, new NaivePlayerController());
            var turnScope       = new TurnScope(player, new Supply(), eventAggregator);
            var actionPhase     = new ActionPhase(turnScope,
                                                  new CardSet(Action.Village, Action.Village));
            var response = actionPhase.PlayAction(Action.Village);

            response.ShouldBeType <PlayActionResponse>();
            ((PlayActionResponse)response).Card.ShouldEqual <Card>(Action.Village);
        }
        public void When_a_valid_card_is_selected_the_card_will_be_purchased()
        {
            var eventAggregator = new MockEventAggregator();
            var discardPile     = new DiscardPile();
            var deck            = new Deck(7.Coppers(), 3.Estates());
            var player          = new Player(deck, discardPile, new NaivePlayerController());
            var supply          = new Supply(new SupplyPile(1, Treasure.Silver, eventAggregator), new SupplyPile(1, Treasure.Copper, eventAggregator));

            var scope = new TurnScope(player, supply, eventAggregator);

            player.DrawNewHand(scope);
            player.PlayTreasures(player.Hand.Treasures(), scope);
            var buyPhase = new BuyPhase(scope);

            player.BeginBuyPhase(buyPhase);
            eventAggregator.AssertMessageWasSent <PlayerGainedCardEvent>();
        }
Beispiel #6
0
            public void Resolve(IReactionScope scope)
            {
                var revealedTreasures = new CardSet();

                2.Times(() =>
                {
                    var revealedCard = scope.RevealCardFromDeck();
                    if (revealedCard.IsTreasure && !revealedTreasures.Contains(revealedCard))
                    {
                        revealedTreasures.Add(revealedCard, scope);
                    }
                });
                if (revealedTreasures.Count() == 1)
                {
                    scope.Publish(new TrashTreasureCardFromThief(TurnScope, scope, revealedTreasures.Single()));
                }
                else if (revealedTreasures.Count() == 2)
                {
                    TurnScope.Publish(new ChooseTreasureCardToTrashFromThief(TurnScope, scope, revealedTreasures));
                }
            }
Beispiel #7
0
 public override void Execute()
 {
     TurnScope.GainCardFromSupplyOntoTopOfDeck(Item);
 }
Beispiel #8
0
 public BuyCardResponse(ITurnScope turnScope, Card cardToPurchase) : base(turnScope)
 {
     Item        = cardToPurchase;
     Description = String.Format("Buy a {0} {1} [{2} remaining]", Item.Name, TurnScope.GetPrice(Item),
                                 TurnScope.Supply == null || !TurnScope.Supply.ContainsKey(Item) ? 0 : TurnScope.Supply[Item].Count);
 }
 public override void Execute()
 {
     TurnScope.ChangeState((-TurnScope.Actions).TurnActions());
     TurnScope.Publish(this);
 }
Beispiel #10
0
 public override void Execute()
 {
     TurnScope.Publish(this);
 }
Beispiel #11
0
 public override void Execute()
 {
     TurnScope.GainCardFromSupply(_card);
 }
Beispiel #12
0
 public override void Execute()
 {
     TurnScope.ChangeState(2.TurnCoins());
     TurnScope.TrashCardInPlay(CardType.Of <MiningVillage>());
 }
Beispiel #13
0
 public override void Execute()
 {
     TurnScope.Discard(_card);
 }
Beispiel #14
0
 public override void Execute()
 {
     TurnScope.TrashCardFromHand(new Feast().CardType);
     TurnScope.GainCardFromSupply(Item);
 }
Beispiel #15
0
 public override void Execute()
 {
     _reactionScope.PutCardInTrash(Item);
     TurnScope.Publish(new ChooseWhetherToGainTrashedTreasureForThief(TurnScope, Item));
 }
Beispiel #16
0
 public void Resolve(IReactionScope scope)
 {
     TurnScope.Publish(new ChooseToDiscardOrReturnTopCardFromSpy(TurnScope, scope));
 }
Beispiel #17
0
 public override void Execute()
 {
     TurnScope.Publish(this);
     TurnScope.ChangeState((-TurnScope.Buys).TurnBuys());
 }
Beispiel #18
0
 public override void Execute()
 {
     TurnScope.PutCardFromHandIntoPlay(Item);
     2.Times(() => Item.PlayAsAction(TurnScope));
 }
Beispiel #19
0
 public override void Execute()
 {
     TurnScope.PlayTreasures(TurnScope.TreasuresInHand);
 }
Beispiel #20
0
 public override void Execute()
 {
     TurnScope.PlayAction(Card);
 }
Beispiel #21
0
 public override void Execute()
 {
     TurnScope.MoveCardsFrom(TurnScope.Deck).Into(TurnScope.DiscardPile, TurnScope);
 }
Beispiel #22
0
 public void PlayTreasures(CardSet treasuresToPlay, TurnScope turnScope)
 {
 }
Beispiel #23
0
 public override void Execute()
 {
     TurnScope.PerformBuy(Item.CardType);
 }