예제 #1
0
            public void SetAsideTheDrawnCards(IActionScope scope)
            {
                var action = DrawnCards.First();

                DrawnCards.Remove(action);
                SetAsideCards.Add(action, scope);
            }
예제 #2
0
        public void GainCardFromSupply(Card typeToGain, IActionScope turnScope)
        {
            Card gainedCard = turnScope.Supply.AcquireCard(typeToGain, turnScope);

            turnScope.Publish(new PlayerGainedCardEvent(gainedCard, turnScope));
            DiscardPile.Discard(gainedCard, turnScope);
        }
예제 #3
0
        public CardSet Draw(int cardCount, IActionScope turnScope)
        {
            var cardSet = new CardSet();

            cardCount.Times(() => cardSet.Add(Draw(turnScope), turnScope));
            return(cardSet);
        }
예제 #4
0
        public void ShuffleDiscardPileIntoDeck(IActionScope turnScope)
        {
            DiscardPile.Into(Deck, turnScope);
            Deck = Deck.Shuffle();

            turnScope.Publish(new DeckReplenishedEvent(turnScope));
        }
예제 #5
0
        public IEventResponse HandleGameEvent(IGameMessage @event, IActionScope scope)
        {
            var aiContext = Mapper.Map <IGameMessage, AiContext>(@event);
            var votes     = _root.Evaluate(aiContext);

            votes = votes.VoteFor(@event.GetDefaultResponse(), 1);
            return(votes.Winner);
        }
 public PlayerGainedCardEvent(CardType card, IActionScope turnScope) : base(turnScope)
 {
     _card       = card;
     Description = String.Format("{0}: gained {1}",
                                 (turnScope == null || turnScope.Player == null)
                                 ? "none" : turnScope.Player.Name,
                                 card.Create().Name);
 }
예제 #7
0
 public void Discard(Card card, DiscardPile discardPile, IActionScope scope)
 {
     if (this.Contains(card))
     {
         InnerList.Remove(card);
         discardPile.Discard(card, scope);
     }
 }
예제 #8
0
 public void PlayCard(Card cardToPlay, CardSet cardsInPlay, IActionScope turnScope)
 {
     if (this.Contains(cardToPlay))
     {
         InnerList.Remove(cardToPlay);
         cardsInPlay.Add(cardToPlay, turnScope);
     }
 }
예제 #9
0
 public SelectReplacementCardForSaboteur(IActionScope scope, Card trashedCard) : base(scope)
 {
     Description = scope.Player.Name + ", select a card to replace the trashed card (" + trashedCard.Name +
                   ")";
     GetAvailableResponses = () => scope.Supply.FindCardsCostingUpTo(scope.GetPrice(trashedCard) - 2, scope)
                             .OrderByDescending(scope.GetPrice)
                             .Select(c => new ReplaceCardForSaboteur(scope, c));
 }
예제 #10
0
 public TrashTreasureCardFromThief(IActionScope scope, IActionScope reactionScope, Card item) : base(scope, item)
 {
     Description           = "Trash " + item.Name + " [Thief]";
     _reactionScope        = reactionScope;
     GetAvailableResponses = () => new List <IEventResponse> {
         this
     };
 }
예제 #11
0
 public void DiscardInto(DiscardPile discardPile, IActionScope turnScope)
 {
     this.ToList().ForEach(card =>
     {
         Remove(card);
         discardPile.Discard(card, turnScope);
     });
 }
예제 #12
0
        public CardSet FindCardsCostingUpTo(Money maxCost, IActionScope scope)
        {
            var eligibleCards = this.Select(x => x.Value)
                                .Where(t => t.Type.Create().BaseCost <= maxCost && t.Count > 0)
                                .Select(z => z.Type.Create());

            return(new CardSet(eligibleCards));
        }
예제 #13
0
 public ReplaceCardForSaboteur(IActionScope scope, Card card) : base(scope, card)
 {
     if (card == null)
     {
         throw new ArgumentNullException("card");
     }
     Description = "Replace trashed card with " + card.Name + ". [Saboteur]";
 }
예제 #14
0
 public ChooseWhetherToGainTrashedTreasureForThief(IActionScope turnScope, Card item) : base(turnScope, item)
 {
     Description           = turnScope.Player.Name + ", would you like to gain the trashed treasure: " + item.Name + " [Thief]";
     GetAvailableResponses = () => new List <IEventResponse>
     {
         new GainTrashedTreasureForThief(turnScope, Item),
         new DoNotGainTrashedTreasureForThief(turnScope, Item)
     };
 }
        public PlayerRevealedCardEvent(IActionScope actionScope, Card card) : base(actionScope)
        {
            if (card == null)
            {
                throw new ArgumentNullException("card");
            }

            _card = card;
        }
예제 #16
0
 public DoYouWantToTrashMiningVillage(IActionScope scope) : base(scope)
 {
     Description           = scope.Player.Name + ", trash Mining Village for (+2)?";
     GetAvailableResponses = () => new List <IEventResponse>
     {
         new TrashMiningVillage(scope),
         new DoNotTrashMiningVillage(scope)
     };
 }
예제 #17
0
 public ChooseWhetherToPutDeckInDiscardPileFromChancellor(IActionScope scope) : base(scope)
 {
     Description           = "Place deck in discard pile [Chancellor]?";
     GetAvailableResponses = () => new List <IEventResponse>
     {
         new PlaceDeckInDiscardPileForChancellor(scope),
         new DoNotPlaceDeckInDiscardPileForChancellor(scope)
     };
 }
예제 #18
0
 public void Into(CardSet targetCardSet, IActionScope turnScope)
 {
     InnerList.ToList().ForEach(
         c =>
     {
         targetCardSet.Add(c, turnScope);
         Remove(c);
     });
 }
        public IEventResponse HandleGameEvent(IGameMessage @event, IActionScope scope)
        {
            if ([email protected]().Any())
            {
                return(@event.GetDefaultResponse());
            }

            return(_ai.HandleGameEvent(@event, scope));
        }
예제 #20
0
        public void Add(Card card, IActionScope turnScope)
        {
            if (card == null)
            {
                return;
            }

            InnerList.Add(card);
            OnCardAdded(card, turnScope);
        }
예제 #21
0
        public IEventResponse HandleGameEvent(IGameMessage @event, IActionScope scope)
        {
            if (@event.GetAvailableResponses().Count() == 1)
            {
                return(@event.GetDefaultResponse());
            }

            //DisplayTurnInfo(scope);
            return(HandleGameEvent(@event, @event.GetAvailableResponses(), scope));
        }
예제 #22
0
        public Card RevealCardFromTopOfDeck(IActionScope turnScope)
        {
            var card = Deck.Draw(turnScope);

            if (card != null)
            {
                turnScope.Publish(new PlayerRevealedCardEvent(turnScope, card));
            }
            return(card);
        }
예제 #23
0
        public void Handle(IGameMessage message, IActionScope turnScope)
        {
            if (message is IPlayerScoped && turnScope.Player != this)
            {
                return;
            }

            _controller.HandleGameEvent(message, turnScope).Execute();
            Hand.Handle(message, turnScope);
        }
예제 #24
0
            public ChooseToDiscardOrReturnTopCardFromSpy(IActionScope scope, IActionScope reactionScope) : base(scope)
            {
                var card = reactionScope.RevealCardFromDeck();

                Description           = reactionScope.Player.Name + " revealed " + card.Name + " [Spy]";
                GetAvailableResponses = () => new List <IEventResponse>
                {
                    new DiscardTopCardFromSpyResponse(scope, reactionScope, card),
                    new ReturnTopCardFromSpyResponse(scope, reactionScope, card)
                };
            }
예제 #25
0
 public Card Draw(IActionScope turnScope)
 {
     if (Count > 0)
     {
         Count--;
         if (Count == 0)
         {
             _eventAggregator.Publish(new SupplyPileDepletedEvent(this.Type, turnScope));
         }
         return(Type.Create());
     }
     throw new SupplyEmptyException();
 }
예제 #26
0
 public Card Draw(IActionScope turnScope)
 {
     if (!InnerList.Any())
     {
         turnScope.Player.Handle(new DeckDepletedEvent(turnScope), turnScope);
     }
     if (InnerList.Any())
     {
         var drawn = InnerList[0];
         InnerList.RemoveAt(0);
         return(drawn);
     }
     return(null);
 }
예제 #27
0
 public void ShuffleDiscardPileIntoDeck(IActionScope turnScope)
 {
 }
예제 #28
0
 public void Discard(CardSet cardsToDiscard, IActionScope turnScope)
 {
 }
예제 #29
0
 public void TrashCardFromHand(Card cardToTrash, IActionScope scope)
 {
 }
예제 #30
0
 public void GainCardFromSupply(Card card, IActionScope turnScope)
 {
 }