Exemple #1
0
 public GainCardCostingUpToMessage(Money maxCost, ITurnScope turnScope) : base(turnScope)
 {
     Description           = "Select a card costing up to " + maxCost + ".";
     GetAvailableResponses = () =>
                             turnScope.Supply.FindCardsCostingUpTo(maxCost, turnScope).OrderByDescending(c => c.BaseCost)
                             .Select(c => new CardSelectedToGainResponse(c, turnScope));
 }
 public OptionallyDiscard(ITurnScope turnScope) : base(turnScope)
 {
     _doneDiscarding       = new DoneDiscardingResponse(turnScope);
     GetAvailableResponses = () => turnScope.Hand.Select(c => new OptionalDiscardResponse(turnScope, c, this))
                             .Union(new IEventResponse[] { _doneDiscarding })
     ;
 }
Exemple #3
0
        public Turn BeginTurn(ITurnScope scope)
        {
            var turn = new Turn(this, scope);

            turn.Begin();
            return(turn);
        }
Exemple #4
0
 public void PlayAction(Card cardToPlay, ITurnScope turnScope)
 {
     if (this.Contains(cardToPlay))
     {
         turnScope.PlayAction(cardToPlay);
     }
 }
Exemple #5
0
 public override void PlayAsAction(ITurnScope turnScope)
 {
     turnScope.ChangeState(1.TurnActions());
     turnScope.Player.DrawIntoHand(1, turnScope);
     turnScope.Publish(new ChooseToDiscardOrReturnTopCardFromSpy(turnScope, turnScope));
     turnScope.Publish(new SpyAttackEffect(turnScope));
 }
 public override void PlayAsAction(ITurnScope turnScope)
 {
     if (turnScope.Hand.Contains <Card>(Treasure.Copper))
     {
         turnScope.TrashCardFromHand(Treasure.Copper);
         turnScope.ChangeState(3.TurnCoins());
     }
 }
 public PickCardToRemodelToCommand(Money cost, ITurnScope turnScope) : base(turnScope)
 {
     Description           = String.Format("Select a card that costs up to {0} coins to remodel to.", cost);
     GetAvailableResponses =
         () =>
         turnScope.Supply.FindCardsCostingUpTo(cost, turnScope).Select
             (c => new CardSelectedToRemodelToResponse(c, TurnScope));
 }
Exemple #8
0
        public CardSet DrawIntoHand(int cards, ITurnScope turnScope)
        {
            var drawnCards         = Deck.Draw(cards, turnScope);
            var cardsThatWereDrawn = new CardSet(drawnCards);

            drawnCards.Into(Hand, turnScope);
            return(cardsThatWereDrawn);
        }
Exemple #9
0
 public PlayActionResponse(ITurnScope turnScope, Card card) : base(turnScope)
 {
     if (card == null)
     {
         throw new ArgumentNullException("card");
     }
     this.Card        = card;
     this.Description = card.Name;
 }
Exemple #10
0
        public override void PlayAsAction(ITurnScope turnScope)
        {
            var id = Guid.NewGuid();

            turnScope.Publish(new RemodelPlayedMessage(turnScope)
            {
                Id = id, OriginalEventId = id, CorrelationId = id
            });
        }
Exemple #11
0
 public PickTreasureToUpgradeToForMineCommand(Money cost, ITurnScope scope) : base(scope)
 {
     Description           = String.Format("Pick a treasure costing {0} to upgrade to [Mine]", cost);
     GetAvailableResponses =
         () =>
         scope.Supply.FindCardsCostingUpTo(cost, scope)
         .Treasures().OrderByDescending(scope.GetPrice)
         .Select(t => new TreasurePickedToUpgradeToWithMine(t, scope));
 }
 public BuyPhase(ITurnScope turnScope) : base(turnScope)
 {
     Description           = String.Format("{0}, select a card to buy", turnScope.Player.Name);
     GetAvailableResponses = () =>
                             (from card in TurnScope.Supply.FindCardsEligibleForPurchase(turnScope).OrderByDescending(c => c.BaseCost)
                              select new BuyCardResponse(turnScope, card)
     {
     }).Union(new GameEventResponse[] { new DeclineToPurchaseResponse(turnScope) })
     ;
 }
 public ActionPhase(ITurnScope turnScope, CardSet availableActions) : base(turnScope)
 {
     Description      = String.Format("{0}, select an action to play", turnScope.Player.Name);
     AvailableActions = new CardSet(availableActions.OrderByDescending(a => a.BaseCost).ToList());
     AvailableActions.ToList().ForEach(actionCard => _availableResponses.Add(new PlayActionResponse(turnScope, actionCard)));
     if (_availableResponses.Any())
     {
         _availableResponses.Add(new SkipActionPhaseResponse(turnScope));
     }
 }
Exemple #14
0
 public ActionDrawnForLibrary(Card action, LibraryState state, ITurnScope scope) : base(scope)
 {
     Description           = "Take " + action.Name + " into hand, or set it aside?";
     _action               = action;
     GetAvailableResponses = () => new List <IEventResponse>
     {
         new SetAsideActionForLibrary(scope, state, action),
         new TakeActionCardIntoHandForLibrary(scope, state, action)
     };
 }
Exemple #15
0
        public CardSelectedToTrashForMineEvent(Card card, ITurnScope turnScope) : base(turnScope)
        {
            if (card == null)
            {
                throw new ArgumentNullException("card");
            }
            _card = card;

            Description = string.Format("{0} trashed {1}", turnScope.Player.Name, card.Name);
        }
 public PickCardToRemodelCommand(ITurnScope turnScope)
     : base(turnScope)
 {
     Description           = "Select a card from your hand to remodel [Remodel].";
     GetAvailableResponses = () =>
                             turnScope.Player.Hand.Select(c =>
                                                          new CardSelectedToRemodelResponse(turnScope, c)
     {
         Id = Guid.NewGuid(), CorrelationId = this.CorrelationId, OriginalEventId = this.OriginalEventId
     })
                             .Append <GameEventResponse>(new DeclinedToRemodelCardResponse(turnScope));
 }
Exemple #17
0
 public ReactionScope(IEventAggregator eventAggregator,
                      Player actingPlayer,
                      Player reactingPlayer,
                      ITurnScope originatingTurnScope,
                      TrashPile trashPile,
                      Supply supply) : base(supply, eventAggregator, trashPile, 1)
 {
     _player               = reactingPlayer;
     _actingPlayer         = actingPlayer;
     _reactingPlayer       = reactingPlayer;
     _originatingTurnScope = originatingTurnScope;
     _trashPile            = trashPile;
     _eventPipeline        = new EventFilterPipeline(_reactingPlayer);
 }
Exemple #18
0
 public PickTreasureToTrashForMineCommand(ITurnScope scope) : base(scope)
 {
     Description           = "Select a treasure to trash [Mine]";
     GetAvailableResponses =
         () => scope.Player.Hand.Treasures()
         .Select(
             t =>
             new TrashCardForMineResponse(scope)
     {
         Id              = Guid.NewGuid(),
         CorrelationId   = this.OriginalEventId,
         OriginalEventId = this.OriginalEventId,
         Item            = t
     })
         .Append <GameEventResponse>(new DeclinedToTrashCardForMineResponse(TurnScope));
 }
Exemple #19
0
        public override void PlayAsAction(ITurnScope turnScope)
        {
            while (turnScope.Player.Hand.Count() < 7)
            {
                var state = new LibraryState();
                turnScope.DrawCardIntoCardset(state.DrawnCards);
                var card = state.DrawnCards.First();
                if (card.IsAction)
                {
                    turnScope.Publish(new ActionDrawnForLibrary(card, state, turnScope));
                }
                else
                {
                    state.DrawnCards.Add(card, turnScope);
                }

                turnScope.PutCardsIntoHand(state.DrawnCards);
                turnScope.Discard(state.SetAsideCards);
            }
        }
        public override void PlayAsAction(ITurnScope turnScope)
        {
            CardSet drawnTreasures = new CardSet();
            CardSet revealedCards  = new CardSet();

            do
            {
                var card = turnScope.RevealCardFromTopOfDeck();
                if (card.IsTreasure)
                {
                    drawnTreasures.Add(card, turnScope);
                }
                else
                {
                    revealedCards.Add(card, turnScope);
                }
            } while (drawnTreasures.Count() < 2);

            turnScope.PutCardsIntoHand(drawnTreasures);
            turnScope.PutCardsIntoDiscardPile(revealedCards);
        }
 public CardSet FindCardsEligibleForPurchase(ITurnScope turnScope)
 {
     return(new CardSet());
 }
Exemple #22
0
 public void GainCardFromSupply(Card cardToUpgradeTo, ITurnScope turnScope)
 {
 }
Exemple #23
0
 public CardSet FindCardsEligibleForPurchase(ITurnScope turnScope)
 {
     return(Supply.FindCardsEligibleForPurchase(turnScope));
 }
Exemple #24
0
 public override int Score(ITurnScope scope)
 {
     return(scope.Deck.Count() / 10);
 }
Exemple #25
0
 public override void PlayAsAction(ITurnScope turnScope)
 {
     turnScope.ChangeState(2.TurnCoins());
     turnScope.Publish(new AttackCardPlayed(this, turnScope));
     turnScope.Publish(new MilitiaAttackEffect(turnScope));
 }
Exemple #26
0
 public CardSet DrawIntoHand(int cards, ITurnScope turnScope)
 {
     throw new NotImplementedException();
 }
Exemple #27
0
 public Turn BeginTurn(ITurnScope scope)
 {
     throw new NotImplementedException();
 }
Exemple #28
0
 public void BeginCleanupPhase(ITurnScope turnScope)
 {
 }
Exemple #29
0
 public void DiscardHand(ITurnScope turnScope)
 {
 }
Exemple #30
0
 public void DrawNewHand(ITurnScope turnScope)
 {
 }