Exemple #1
0
 public void Handle(IGameMessage @event, IReactionScope scope)
 {
     if (@event is AttackCardPlayed)
     {
         @event.ActionScope.Publish(new CanRevealCardEvent(this, scope));
     }
 }
            public void Resolve(IReactionScope scope)
            {
                bool    validCardFound;
                bool    hasReshuffled = false;
                Card    card;
                CardSet revealedCards = new CardSet();

                do
                {
                    card           = scope.RevealCardFromDeck();
                    validCardFound = card != null && scope.GetPrice(card) >= 3;
                    if (card == null && !hasReshuffled)
                    {
                        scope.ReactingPlayer.ShuffleDiscardPileIntoDeck(scope);
                        hasReshuffled = true;
                    }
                    if (!validCardFound)
                    {
                        revealedCards.Add(card, scope);
                    }
                } while (!validCardFound && card != null);
                if (card == null)
                {
                    return;
                }

                scope.PutCardInTrash(card);
                scope.Publish(new SelectReplacementCardForSaboteur(scope, card));
            }
 public void Handle(IGameMessage @event, IReactionScope scope)
 {
     if (Next != null)
     {
         Next.Handle(@event, scope);
     }
 }
 public void Resolve(IReactionScope scope)
 {
     while (scope.ReactingPlayer.Hand.Count() > 3)
     {
         scope.ReactingPlayer.Handle(new DiscardReactionCommand(scope, "You must discard down to 3 cards [Militia]."), scope);
     }
 }
        public DiscardReactionCommand(IReactionScope receiverScope, string description) : base(receiverScope.OriginatingTurnScope)
        {
            Description = description;
            _receiverScope = receiverScope;

            GetAvailableResponses =
                () => 
                _receiverScope.ReactingPlayer.Hand.Select(c => new DiscardCardReaction(_receiverScope, c));
        }
Exemple #6
0
            public void Resolve(IReactionScope scope)
            {
                Card curse = null;

                try
                {
                    scope.GainCardFromSupply(BasicCards.Curse);
                }
                catch (Exception)
                {
                }
            }
Exemple #7
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));
                }
            }
Exemple #8
0
        public void Handle(IGameMessage @event, IReactionScope scope)
        {
            if (@event is DeckDepletedEvent)
            {
                Handle(@event as DeckDepletedEvent);
                return;
            }

            if (@event is IAttackEffect)
            {
                HandleAttack(@event as IAttackEffect, scope);
            }

            Hand.Handle(@event, scope);

            if (@event.GetAvailableResponses().Count() == 1)
            {
                @event.GetDefaultResponse().Execute();
            }
            else
            {
                _controller.HandleGameEvent(@event, scope).Execute();
            }
        }
Exemple #9
0
 public RevealHandWithNoVictoryCardsForBureaucratGameEventReaction(IReactionScope scope) : base(scope)
 {
 }
Exemple #10
0
 public RevealVictoryCardForBureaucrat(IReactionScope scope, Card card) : base(scope, card)
 {
 }
Exemple #11
0
            public SelectVictoryCardToRevealForBureaucrat(IReactionScope scope) : base(scope)
            {
                Description = "Select a victory card to reveal [Bureaucrat]";

                GetAvailableResponses = GetResponses;
            }
Exemple #12
0
 public void Resolve(IReactionScope scope)
 {
     scope.DrawCardsIntoHand(1);
 }
Exemple #13
0
 public void RevealCard(Card card, IReactionScope externalEventScope)
 {
 }
 public void Handle(IGameMessage @event, IReactionScope scope)
 {
     Front.Handle(@event, scope);
 }
 public IEventResponse HandleGameEvent(IGameMessage @event, IReactionScope scope)
 {
     return(@event.GetDefaultResponse());
 }
Exemple #16
0
 public void Resolve(IReactionScope scope)
 {
     TurnScope.Publish(new ChooseToDiscardOrReturnTopCardFromSpy(TurnScope, scope));
 }
Exemple #17
0
 public ChooseTreasureCardToTrashFromThief(IActionScope turnScope, IReactionScope reactionScope, CardSet cards) : base(turnScope)
 {
     Description           = "Choose a treasure card for " + reactionScope.ReactingPlayer.Name + " to trash [Thief]";
     GetAvailableResponses =
         () => cards.Select(card => new TrashTreasureCardFromThief(turnScope, reactionScope, card));
 }
 public IEventResponse HandleGameEvent(IGameMessage @event, IReactionScope scope)
 {
     throw new NotImplementedException();
 }
Exemple #19
0
 public void RevealCard(Card card, IReactionScope externalEventScope)
 {
     Hand.RevealCard(card, externalEventScope, this);
 }
Exemple #20
0
 private void HandleAttack(IAttackEffect attackEffect, IReactionScope scope)
 {
     attackEffect.Resolve(scope);
 }
 public void FilterMessage(IGameMessage message, IReactionScope scope, IHandleExternalEvents next)
 {
     Front.Handle(message, scope);
 }
Exemple #22
0
 public void RevealCard(Card card, IReactionScope externalEventScope, Player player)
 {
     card.Reveal(externalEventScope, player);
 }
 public IEventResponse HandleGameEvent(IGameMessage @event, IReactionScope scope)
 {
     return(_ai.HandleGameEvent(@event, scope));
 }
Exemple #24
0
 public override void OnRevealed(IReactionScope externalEventScope, Player player)
 {
     externalEventScope.RegisterEventFilter(MoatEffect());
 }
Exemple #25
0
 public void Reveal(IReactionScope externalEventScope, Player player)
 {
     externalEventScope.Publish(new PlayerRevealedCardEvent(externalEventScope, this));
     OnRevealed(externalEventScope, player);
 }
Exemple #26
0
 public virtual void OnRevealed(IReactionScope externalEventScope, Player player)
 {
 }
Exemple #27
0
 public void Handle(IGameMessage @event, IReactionScope scope)
 {
     this.OfType <IHandleExternalEvents>().ForEach(card => card.Handle(@event, scope));
 }
Exemple #28
0
 public void Resolve(IReactionScope scope)
 {
     scope.Publish(new SelectVictoryCardToRevealForBureaucrat(scope));
 }
Exemple #29
0
 public void Handle(IGameMessage @event, IReactionScope scope)
 {
 }
 protected GameEventReaction(IReactionScope scope)
     : base(scope)
 {
     ReactionScope = scope;
 }