protected virtual void ResolveEffect(IGame game, IEffectHandle handle, string paymentText)
 {
     if (costlyCard != null)
     {
         handle.Resolve(string.Format("{0} chose to pay {1} to play '{2}' from their hand", player.Name, paymentText, costlyCard.Title));
     }
     else
     {
         handle.Resolve(string.Format("{0} chose to pay {1} to trigger '{2}'", player.Name, paymentText, cardEffect.ToString()));
     }
 }
Esempio n. 2
0
            private void ReadyExhaustedAlly(IGame game, IEffectHandle handle, IPlayer player, IExhaustableInPlay ally)
            {
                var controller = game.GetController(ally.BaseCard.Id);

                ally.Ready();

                if (player == controller)
                {
                    handle.Resolve(string.Format("{0} chose to ready '{1}'", player.Name, ally.Title));
                }
                else
                {
                    handle.Resolve(string.Format("{0} chose to ready '{1}' controlled by {2}", player.Name, ally.Title, controller.Name));
                }
            }
Esempio n. 3
0
            private void ExhaustAndPlayerDrawsTwoCards(IGame game, IEffectHandle handle, IPlayer controller, IExhaustableInPlay exhaustable, IPlayer player)
            {
                exhaustable.Exhaust();

                player.DrawCards(2);

                if (controller.StateId == player.StateId)
                {
                    handle.Resolve(string.Format("{0} exhausted '{1}' to draw 2 cards", controller.Name, CardSource.Title));
                }
                else
                {
                    handle.Resolve(string.Format("{0} exhausted '{1}' to have {2} draw 2 cards", controller.Name, CardSource.Title, player.Name));
                }
            }
Esempio n. 4
0
            private void ExhaustAndPlayerDrawsTwoCards(IGame game, IEffectHandle handle, IPlayer controller, IExhaustableInPlay exhaustable, IPlayer player)
            {
                exhaustable.Exhaust();

                player.DrawCards(2);

                if (controller.StateId == player.StateId)
                {
                    handle.Resolve(string.Format("{0} exhausted '{1}' to draw 2 cards", controller.Name, CardSource.Title));
                }
                else
                {
                    handle.Resolve(string.Format("{0} exhausted '{1}' to have {2} draw 2 cards", controller.Name, CardSource.Title, player.Name));
                }
            }
Esempio n. 5
0
            private void ReadyExhaustedAlly(IGame game, IEffectHandle handle, IPlayer player, IExhaustableInPlay ally)
            {
                var controller = game.GetController(ally.BaseCard.Id);

                ally.Ready();

                if (player == controller)
                {
                    handle.Resolve(string.Format("{0} chose to ready '{1}'", player.Name, ally.Title));
                }
                else
                {
                    handle.Resolve(string.Format("{0} chose to ready '{1}' controlled by {2}", player.Name, ally.Title, controller.Name));
                }
            }
            public override void Trigger(IGame game, IEffectHandle handle)
            {
                var currentStage = game.QuestArea.GetCurrentQuestStage();
                if (currentStage == null)
                    { handle.Cancel(GetCancelledString()); return; }

                var random = new Random();
                var number = random.Next(1, 2);

                if (number == 1)
                {
                    var dontLeaveThePath = game.QuestArea.QuestDeck.Cards.Where(x => x.Title == "Don't Leave The Path").FirstOrDefault();
                    if (dontLeaveThePath != null)
                    {
                        currentStage.NextStage = dontLeaveThePath;
                    }
                }
                else
                {
                    var beornsPath = game.QuestArea.QuestDeck.Cards.Where(x => x.Title == "Beorn's Path").FirstOrDefault();
                    if (beornsPath != null)
                    {
                        currentStage.NextStage = beornsPath;
                    }
                }

                handle.Resolve(GetCompletedStatus());
            }
        private void TriggerResponse(IGame game, IEffectHandle handle)
        {
            var responseHandle = responseEffect.GetHandle(game);
            game.TriggerEffect(responseHandle);

            handle.Resolve(string.Format("{0} decided to trigger '{1}'", player.Name, responseEffect));
        }
        public override void Trigger(IGame game, IEffectHandle handle)
        {
            if (game.StagingArea.CardsInStagingArea.Any(x => x.Card.Id == cardInPlay.BaseCard.Id))
            {
                game.StagingArea.RemoveFromStagingArea(cardInPlay as IEncounterInPlay);
            }
            else if (game.QuestArea.ActiveLocation != null && game.QuestArea.ActiveLocation.Card.Id == cardInPlay.BaseCard.Id)
            {
                game.QuestArea.RemoveActiveLocation();
            }
            else
            {
                foreach (var player in game.Players)
                {
                    if (player.CardsInPlay.Any(x => x.BaseCard.Id == cardInPlay.BaseCard.Id))
                    {
                        player.RemoveCardInPlay(cardInPlay);
                        break;
                    }
                }
            }

            var state = new CardLeavesPlay(game, cardInPlay);

            foreach (var card in game.GetCardsInPlayWithEffect<ICardInPlay, IAfterCardLeavesPlay>())
            {
                foreach (var effect in card.BaseCard.Text.Effects.OfType<IAfterCardLeavesPlay>())
                {
                    effect.AfterCardLeavesPlay(state);
                }
            }

            handle.Resolve(GetCompletedStatus());
        }
            private void ExhaustAndAddTwoResources(IGame game, IEffectHandle handle, IPlayer player, IExhaustableInPlay exhaustable, ICharacterInPlay resourceful)
            {
                exhaustable.Exhaust();
                resourceful.Resources += 2;

                handle.Resolve(string.Format("{0} chose to exhaust '{1}' to add 2 resources to {2}'s resource pool", player.Name, CardSource.Title, resourceful.Title));
            }
Esempio n. 10
0
            private void PlayerDiscardsOneCard(IGame game, IEffectHandle handle, IPlayer player, IPlayerCard card)
            {
                if (player.Hand.Cards.Count() == 0)
                {
                    handle.Cancel(string.Format("{0} does not have any cards in their hand to discard", player.Name));
                    return;
                }

                player.DiscardFromHand(new List <IPlayerCard> {
                    card
                });

                var controller = game.GetController(CardSource.Id);

                if (controller == null)
                {
                    handle.Cancel(string.Format("Could not determine the controller of {0}", CardSource.Title));
                    return;
                }

                var willpowerful = controller.CardsInPlay.OfType <IWillpowerfulInPlay>().Where(x => x.Card.Id == source.Id).FirstOrDefault();

                if (willpowerful == null)
                {
                    handle.Cancel(string.Format("'{0}' is no longer in play", CardSource.Title));
                    return;
                }

                game.AddEffect(new WillpowerModifier(game.CurrentPhase.Code, source, willpowerful, TimeScope.Phase, 1));

                handle.Resolve(string.Format("{0} discarded a card to give '{0}' +1 Willpower until the end of the phase", player.Name, CardSource.Title));
            }
Esempio n. 11
0
            public override void Trigger(IGame game, IEffectHandle handle)
            {
                IAttachmentInPlay attachment = null;

                foreach (var player in game.Players)
                {
                    attachment = player.CardsInPlay.OfType <IAttachmentInPlay>().Where(x => x.Card.Id == source.Id).FirstOrDefault();
                    if (attachment != null)
                    {
                        continue;
                    }
                }

                if (attachment == null || attachment.AttachedTo == null)
                {
                    handle.Cancel(GetCancelledString()); return;
                }

                var resourceful = attachment.AttachedTo as ICharacterInPlay;

                if (resourceful == null)
                {
                    handle.Cancel(GetCancelledString()); return;
                }

                resourceful.Resources += 1;

                handle.Resolve(GetCompletedStatus());
            }
Esempio n. 12
0
            public override void Trigger(IGame game, IEffectHandle handle)
            {
                var topTwo = game.FirstPlayer.Deck.GetFromTop(2);
                game.FirstPlayer.Hand.AddCards(topTwo);

                handle.Resolve(GetCompletedStatus());
            }
Esempio n. 13
0
            public override void Trigger(IGame game, IEffectHandle handle)
            {
                var questPhase = game.CurrentPhase as IQuestPhase;
                if (questPhase == null || !questPhase.IsCommittedToQuest(CardSource.Id))
                {
                    handle.Cancel(string.Format("This ability only applies while '{0}' is committed to the quest", CardSource.Title));
                    return;
                }

                if (game.StagingArea.RevealedEncounterCard == null)
                {
                    handle.Cancel(string.Format("There is no revealed encounter card for '{0}' to deal damage to", CardSource.Title));
                    return;
                }

                var enemy = game.StagingArea.RevealedEncounterCard as IEnemyInPlay;
                if (enemy == null)
                {
                    handle.Cancel(string.Format("The revealed encounter card, '{0}' is not an enemy", game.StagingArea.RevealedEncounterCard.Title));
                    return;
                }

                enemy.Damage += 1;

                handle.Resolve(string.Format("'{0}' dealt 1 damage to '{1}' as it was revealed from the encounter deck", CardSource.Title, enemy.Title));
            }
Esempio n. 14
0
            private void HealCreatureInPlay(IGame game, IEffectHandle handle, IPlayer controller, ICharacterInPlay radagast, ICharacterInPlay creature, byte numberOfResources)
            {
                radagast.Resources -= numberOfResources;
                creature.Damage    -= numberOfResources;

                handle.Resolve(string.Format("{0} chose to have '{1}' heal {2} damage from '{3}'", controller.Name, CardSource.Title, numberOfResources, creature.Title));
            }
Esempio n. 15
0
            private void HealOneDamageOnCharacter(IGame game, IEffectHandle handle, IPlayer player, ICharacterInPlay glorfindel, ICharacterInPlay character)
            {
                glorfindel.Resources -= 1;
                character.Damage     -= 1;

                handle.Resolve(string.Format("{0} chose to heal 1 damage on '{1}'", player.Name, character.Title));
            }
Esempio n. 16
0
            public override void Trigger(IGame game, IEffectHandle handle)
            {
                var allyInPlay = game.GetCardInPlay <IAllyInPlay>(allyId);

                if (allyInPlay == null)
                {
                    handle.Cancel(GetCancelledString()); return;
                }

                var allyController = game.GetController(allyId);

                if (allyController == null)
                {
                    handle.Cancel(GetCancelledString()); return;
                }

                allyController.RemoveCardInPlay(allyInPlay);

                var eventController = game.GetController(CardSource.Id);

                if (eventController == null)
                {
                    handle.Cancel(GetCancelledString()); return;
                }

                eventController.Hand.AddCards(new List <IPlayerCard> {
                    allyInPlay.Card
                });

                handle.Resolve(GetCompletedStatus());
            }
        public override void Trigger(IGame game, IEffectHandle handle)
        {
            if (game.StagingArea.CardsInStagingArea.Any(x => x.Card.Id == cardInPlay.BaseCard.Id))
            {
                game.StagingArea.RemoveFromStagingArea(cardInPlay as IEncounterInPlay);
            }
            else if (game.QuestArea.ActiveLocation != null && game.QuestArea.ActiveLocation.Card.Id == cardInPlay.BaseCard.Id)
            {
                game.QuestArea.RemoveActiveLocation();
            }
            else
            {
                foreach (var player in game.Players)
                {
                    if (player.CardsInPlay.Any(x => x.BaseCard.Id == cardInPlay.BaseCard.Id))
                    {
                        player.RemoveCardInPlay(cardInPlay);
                        break;
                    }
                }
            }

            var state = new CardLeavesPlay(game, cardInPlay);

            foreach (var card in game.GetCardsInPlayWithEffect <ICardInPlay, IAfterCardLeavesPlay>())
            {
                foreach (var effect in card.BaseCard.Text.Effects.OfType <IAfterCardLeavesPlay>())
                {
                    effect.AfterCardLeavesPlay(state);
                }
            }

            handle.Resolve(GetCompletedStatus());
        }
        public override void Trigger(IGame game, IEffectHandle handle)
        {
            var defeatedEnemies = new List<IEnemyInPlay>();

            foreach (var enemy in game.StagingArea.CardsInStagingArea.OfType<IEnemyInPlay>())
            {
                if (enemy.Damage >= enemy.Card.PrintedHitPoints)
                {
                    defeatedEnemies.Add(enemy);
                }
            }

            foreach (var player in game.Players)
            {
                foreach (var enemy in player.EngagedEnemies)
                {
                    if (enemy.Damage >= enemy.Card.PrintedHitPoints)
                    {
                        defeatedEnemies.Add(enemy);
                    }
                }
            }

            foreach (var enemy in defeatedEnemies)
            {
                var defeatedEffect = new EnemyDefeatedEffect(game, enemy, attackers);
                var defeatedHandle = defeatedEffect.GetHandle(game);
                game.AddEffect(defeatedEffect);
                game.TriggerEffect(defeatedHandle);
            }

            handle.Resolve(GetCompletedStatus());
        }
Esempio n. 19
0
            //public override void Validate(IGame game, IEffectHandle handle)
            //{
            //    var resourcePayment = handle.Payment as IResourcePayment;
            //    if (resourcePayment == null)
            //    {
            //        handle.Reject();
            //        return;
            //    }

            //    if (resourcePayment.Characters.Count() != 1)
            //    {
            //        handle.Reject();
            //        return;
            //    }

            //    var hero = resourcePayment.Characters.First() as IHeroInPlay;
            //    if (hero == null || !hero.HasResourceIcon(Sphere.Spirit))
            //    {
            //        handle.Reject();
            //        return;
            //    }

            //    if (resourcePayment.GetPaymentBy(hero.Card.Id) != 1)
            //    {
            //        handle.Reject();
            //        return;
            //    }

            //    hero.Resources -= 1;

            //    handle.Accept();
            //}

            public override void Trigger(IGame game, IEffectHandle handle)
            {
                var card = CardSource as IPlayerCard;

                if (card == null || card.Owner == null)
                {
                    handle.Cancel(GetCancelledString());
                    return;
                }

                var ally = card.Owner.Hand.Cards.Where(x => x.Id == source.Id).FirstOrDefault() as IAllyCard;

                if (ally == null)
                {
                    handle.Cancel(GetCancelledString());
                    return;
                }

                card.Owner.Hand.RemoveCards(new List <IPlayerCard> {
                    ally
                });
                card.Owner.AddCardInPlay(new AllyInPlay(game, ally));

                game.AddEffect(new ReturnToHandAfterSuccessfulQuest(CardSource));

                handle.Resolve(GetCompletedStatus());
            }
Esempio n. 20
0
            public override void Trigger(IGame game, IEffectHandle handle)
            {
                var questPhase = game.CurrentPhase as IQuestPhase;

                if (questPhase == null || !questPhase.IsCommittedToQuest(CardSource.Id))
                {
                    handle.Cancel(string.Format("This ability only applies while '{0}' is committed to the quest", CardSource.Title));
                    return;
                }

                if (game.StagingArea.RevealedEncounterCard == null)
                {
                    handle.Cancel(string.Format("There is no revealed encounter card for '{0}' to deal damage to", CardSource.Title));
                    return;
                }

                var enemy = game.StagingArea.RevealedEncounterCard as IEnemyInPlay;

                if (enemy == null)
                {
                    handle.Cancel(string.Format("The revealed encounter card, '{0}' is not an enemy", game.StagingArea.RevealedEncounterCard.Title));
                    return;
                }

                enemy.Damage += 1;

                handle.Resolve(string.Format("'{0}' dealt 1 damage to '{1}' as it was revealed from the encounter deck", CardSource.Title, enemy.Title));
            }
Esempio n. 21
0
            private void PlayerDiscardsOneCard(IGame game, IEffectHandle handle, IPlayer player, IPlayerCard card)
            {
                if (player.Hand.Cards.Count() == 0)
                {
                    handle.Cancel(string.Format("{0} does not have any cards in their hand to discard", player.Name));
                    return;
                }

                player.DiscardFromHand(new List<IPlayerCard> { card });

                var controller = game.GetController(CardSource.Id);
                if (controller == null)
                {
                    handle.Cancel(string.Format("Could not determine the controller of {0}", CardSource.Title));
                    return;
                }

                var willpowerful = controller.CardsInPlay.OfType<IWillpowerfulInPlay>().Where(x => x.Card.Id == source.Id).FirstOrDefault();
                if (willpowerful == null)
                {
                    handle.Cancel(string.Format("'{0}' is no longer in play", CardSource.Title));
                    return;
                }

                game.AddEffect(new WillpowerModifier(game.CurrentPhase.Code, source, willpowerful, TimeScope.Phase, 1));

                handle.Resolve(string.Format("{0} discarded a card to give '{0}' +1 Willpower until the end of the phase", player.Name, CardSource.Title));
            }
Esempio n. 22
0
        public override void Trigger(IGame game, IEffectHandle handle)
        {
            var defeatedEnemies = new List <IEnemyInPlay>();

            foreach (var enemy in game.StagingArea.CardsInStagingArea.OfType <IEnemyInPlay>())
            {
                if (enemy.Damage >= enemy.Card.PrintedHitPoints)
                {
                    defeatedEnemies.Add(enemy);
                }
            }

            foreach (var player in game.Players)
            {
                foreach (var enemy in player.EngagedEnemies)
                {
                    if (enemy.Damage >= enemy.Card.PrintedHitPoints)
                    {
                        defeatedEnemies.Add(enemy);
                    }
                }
            }

            foreach (var enemy in defeatedEnemies)
            {
                var defeatedEffect = new EnemyDefeatedEffect(game, enemy, attackers);
                var defeatedHandle = defeatedEffect.GetHandle(game);
                game.AddEffect(defeatedEffect);
                game.TriggerEffect(defeatedHandle);
            }

            handle.Resolve(GetCompletedStatus());
        }
Esempio n. 23
0
            private void HealOneDamageOnCharacter(IGame game, IEffectHandle handle, IPlayer player, ICharacterInPlay glorfindel, ICharacterInPlay character)
            {
                glorfindel.Resources -= 1;
                character.Damage -= 1;

                handle.Resolve(string.Format("{0} chose to heal 1 damage on '{1}'", player.Name, character.Title));
            }
Esempio n. 24
0
            public override void Trigger(IGame game, IEffectHandle handle)
            {
                var currentStage = game.QuestArea.GetCurrentQuestStage();

                if (currentStage == null)
                {
                    handle.Cancel(GetCancelledString()); return;
                }

                var random = new Random();
                var number = random.Next(1, 2);

                if (number == 1)
                {
                    var dontLeaveThePath = game.QuestArea.QuestDeck.Cards.Where(x => x.Title == "Don't Leave The Path").FirstOrDefault();
                    if (dontLeaveThePath != null)
                    {
                        currentStage.NextStage = dontLeaveThePath;
                    }
                }
                else
                {
                    var beornsPath = game.QuestArea.QuestDeck.Cards.Where(x => x.Title == "Beorn's Path").FirstOrDefault();
                    if (beornsPath != null)
                    {
                        currentStage.NextStage = beornsPath;
                    }
                }

                handle.Resolve(GetCompletedStatus());
            }
Esempio n. 25
0
            private void DiscardChosenAttachment(IGame game, IEffectHandle handle, IPlayer player, IAttachableInPlay attachment)
            {
                if (attachment.AttachedTo == null)
                {
                    handle.Cancel(string.Format("Could not discard '{1}', it was not attached to anything", attachment.Title));
                    return;
                }

                attachment.AttachedTo.RemoveAttachment(attachment);

                if (attachment.Card is IObjectiveCard)
                {
                    game.StagingArea.EncounterDeck.Discard(new List <IEncounterCard> {
                        attachment.Card as IObjectiveCard
                    });
                }
                else if (attachment.Card is IPlayerCard)
                {
                    player.Deck.Discard(new List <IPlayerCard> {
                        attachment.Card as IPlayerCard
                    });
                }
                else
                {
                    handle.Cancel(string.Format("'{0}' could not be discarded because it is not a valid attachment controlled by {1}", attachment.Title, player.Name));
                    return;
                }

                handle.Resolve(string.Format("{0} chose to have '{1}' discarded by the shadow effect of '{2}'", player.Name, attachment.Title, CardSource.Title));
            }
Esempio n. 26
0
            private void HealCreatureInPlay(IGame game, IEffectHandle handle, IPlayer controller, ICharacterInPlay radagast, ICharacterInPlay creature, byte numberOfResources)
            {
                radagast.Resources -= numberOfResources;
                creature.Damage -= numberOfResources;

                handle.Resolve(string.Format("{0} chose to have '{1}' heal {2} damage from '{3}'", controller.Name, CardSource.Title, numberOfResources, creature.Title));
            }
Esempio n. 27
0
            private void AttachCaughtInAWebToHero(IGame game, IEffectHandle handle, IPlayer player, IAttachableCard attachable, IHeroInPlay hero)
            {
                var attachmentHost = hero as IAttachmentHostInPlay;

                attachmentHost.AddAttachment(new AttachableInPlay(game, attachable, attachmentHost));

                handle.Resolve(string.Format("{0} chose to attach '{1}' to '{2}'", player.Name, CardSource.Title, hero.Title));
            }
 private void AddChosenCardToHand(IGame game, IEffectHandle handle, IPlayer player, IPlayerCard card)
 {
     player.Hand.AddCards(new List <IPlayerCard> {
         card
     });
     player.Deck.RemoveFromDeck(card);
     handle.Resolve(string.Format("{0} added '{1}' to their hand", player.Name, card.Title));
 }
Esempio n. 29
0
 private void ReduceEachPlayersThreatByTwo(IGame game, IEffectHandle handle)
 {
     foreach (var player in game.Players)
     {
         player.DecreaseThreat(2);
     }
     handle.Resolve("Each players had their threat reduced by 2");
 }
Esempio n. 30
0
        private void TriggerResponse(IGame game, IEffectHandle handle)
        {
            var responseHandle = responseEffect.GetHandle(game);

            game.TriggerEffect(responseHandle);

            handle.Resolve(string.Format("{0} decided to trigger '{1}'", player.Name, responseEffect));
        }
 private void ResolveSuccessfulQuest(IGame game, IEffectHandle handle, byte difference)
 {
     game.QuestArea.AddProgress(difference);
     
     var description = GetProgressDescription(difference);
     var verb = difference > 1 ? "were" : "was";
     handle.Resolve(string.Format("Questing was successful: {0} {1} added to the current quest.", description, verb));
 }
Esempio n. 32
0
            private void AttachCaughtInAWebToHero(IGame game, IEffectHandle handle, IPlayer player, IAttachableCard attachable, IHeroInPlay hero)
            {
                var attachmentHost = hero as IAttachmentHostInPlay;
                
                attachmentHost.AddAttachment(new AttachableInPlay(game, attachable, attachmentHost));

                handle.Resolve(string.Format("{0} chose to attach '{1}' to '{2}'", player.Name, CardSource.Title, hero.Title));
            }
Esempio n. 33
0
            private void PutAllyIntoPlayFromYourHand(IGame game, IEffectHandle handle, IPlayer player, IAllyCard allyCard)
            {
                player.Hand.RemoveCards(new List<IPlayerCard> { allyCard });
                player.AddCardInPlay(new AllyInPlay(game, allyCard));
                game.AddEffect(new AtEndOfPhaseReturnAllyToYourHand(CardSource, allyCard.Id));

                handle.Resolve(GetCompletedStatus());
            }
        protected override void ResolveEffect(IGame game, IEffectHandle handle, string paymentText)
        {
            var attachedTo = handle.Target as IAttachmentHostInPlay;
            if (attachedTo == null)
                throw new InvalidOperationException("target undefined for this attachment");

            handle.Resolve(string.Format("{0} chose to pay {1} to attach '{2}' to '{3}'", player.Name, paymentText, attachmentCard.Title, attachedTo.Title));
        }
 private void ReduceEachPlayersThreatByTwo(IGame game, IEffectHandle handle)
 {
     foreach (var player in game.Players)
     {
         player.DecreaseThreat(2);
     }
     handle.Resolve("Each players had their threat reduced by 2");
 }
        private void TriggerEffect(IGame game, IEffectHandle handle, ICardEffect cardEffect)
        {
            game.AddEffect(cardEffect);
            var playEffectHandle = cardEffect.GetHandle(game);

            game.TriggerEffect(playEffectHandle);
            handle.Resolve(string.Format("{0} triggered {1}", player.Name, cardEffect.ToString()));
        }
Esempio n. 37
0
            public override void Trigger(IGame game, IEffectHandle handle)
            {
                var topTwo = game.FirstPlayer.Deck.GetFromTop(2);

                game.FirstPlayer.Hand.AddCards(topTwo);

                handle.Resolve(GetCompletedStatus());
            }
        public override void Trigger(IGame game, IEffectHandle handle)
        {
            if (numberOfCards == 0)
                { handle.Cancel(GetCancelledString()); return; }

            player.DrawCards(numberOfCards);

            handle.Resolve(GetCompletedStatus());
        }
            private void AddSpiderToTheStagingArea(IGame game, IEffectHandle handle, IEnemyCard spider)
            {
                if (game.StagingArea.EncounterDeck.Cards.Any(x => x.Id == spider.Id))
                {
                    game.StagingArea.EncounterDeck.RemoveFromDeck(spider);
                    game.StagingArea.AddToStagingArea(spider);
                    handle.Resolve(string.Format("'{0}' added to the staging area from the encounter deck", spider.Title));
                    return;
                }
                else if (game.StagingArea.EncounterDeck.DiscardPile.Any(x => x.Id == spider.Id))
                {
                    game.StagingArea.EncounterDeck.RemoveFromDiscardPile(new List<IEncounterCard> { spider });
                    game.StagingArea.AddToStagingArea(spider);
                    handle.Resolve(string.Format("'{0}' added to the staging area from the encounter discard pile", spider.Title));
                }

                handle.Cancel(string.Format("'{0}' was not added to the staging area because it could not be located", spider.Title));
            }
        private void DrawNewStartingHand(IEffectHandle handle)
        {
            var startingHand = Player.Hand.Cards.ToList();
            Player.Hand.RemoveCards(startingHand);
            Player.Deck.ShuffleIn(startingHand);
            Player.DrawCards(6);

            handle.Resolve(string.Format("{0} chose to take a mulligan and draw a new starting hand", Player.Name));
        }
Esempio n. 41
0
            private void PutEncounterCardOnBottomOfDeck(IGame game, IEffectHandle handle, IPlayer player, IExhaustableInPlay denethor, IEncounterCard encounterCard)
            {
                denethor.Exhaust();

                game.StagingArea.EncounterDeck.RemoveFromDeck(encounterCard);
                game.StagingArea.EncounterDeck.PutOnBottom(new List<IEncounterCard> { encounterCard });
                
                handle.Resolve(string.Format("{0} chose to put '{1}' on the bottom of the encounter deck", player.Name, encounterCard.Title));
            }
        private void ResolveSuccessfulQuest(IGame game, IEffectHandle handle, byte difference)
        {
            game.QuestArea.AddProgress(difference);

            var description = GetProgressDescription(difference);
            var verb        = difference > 1 ? "were" : "was";

            handle.Resolve(string.Format("Questing was successful: {0} {1} added to the current quest.", description, verb));
        }
Esempio n. 43
0
            public override void Trigger(IGame game, IEffectHandle handle)
            {
                foreach (var player in game.Players)
                {
                    var eventsToDiscard = player.Hand.Cards.OfType <IEventCard>().ToList();
                    player.DiscardFromHand(eventsToDiscard);
                }

                handle.Resolve(GetCompletedStatus());
            }
        private void PlayCardFromHand(IGame game, IEffectHandle handle, IPlayableFromHand playableCard)
        {
            var playCardEffect = playableCard.GetPlayFromHandEffect(game, player);

            game.AddEffect(playCardEffect);
            var playCardHandle = playCardEffect.GetHandle(game);

            game.TriggerEffect(playCardHandle);
            handle.Resolve(string.Format("{0} played {1} from their hand", player.Name, playableCard.Title));
        }
        private void DrawNewStartingHand(IEffectHandle handle)
        {
            var startingHand = Player.Hand.Cards.ToList();

            Player.Hand.RemoveCards(startingHand);
            Player.Deck.ShuffleIn(startingHand);
            Player.DrawCards(6);

            handle.Resolve(string.Format("{0} chose to take a mulligan and draw a new starting hand", Player.Name));
        }
Esempio n. 46
0
            private void PutAllyIntoPlayFromYourHand(IGame game, IEffectHandle handle, IPlayer player, IAllyCard allyCard)
            {
                player.Hand.RemoveCards(new List <IPlayerCard> {
                    allyCard
                });
                player.AddCardInPlay(new AllyInPlay(game, allyCard));
                game.AddEffect(new AtEndOfPhaseReturnAllyToYourHand(CardSource, allyCard.Id));

                handle.Resolve(GetCompletedStatus());
            }
Esempio n. 47
0
            public override void Trigger(IGame game, IEffectHandle handle)
            {
                foreach (var player in game.Players)
                {
                    var eventsToDiscard = player.Hand.Cards.OfType<IEventCard>().ToList();
                    player.DiscardFromHand(eventsToDiscard);
                }

                handle.Resolve(GetCompletedStatus());
            }
Esempio n. 48
0
            public override void Trigger(IGame game, IEffectHandle handle)
            {
                var enemy = game.GetCardInPlay<IEnemyInPlay>(source.Id);
                if (enemy == null)
                    { handle.Cancel(GetCancelledString()); return; }

                enemy.Resources += 1;

                handle.Resolve(GetCompletedStatus());
            }
            private void AddSpiderToTheStagingArea(IGame game, IEffectHandle handle, IEnemyCard spider)
            {
                if (game.StagingArea.EncounterDeck.Cards.Any(x => x.Id == spider.Id))
                {
                    game.StagingArea.EncounterDeck.RemoveFromDeck(spider);
                    game.StagingArea.AddToStagingArea(spider);
                    handle.Resolve(string.Format("'{0}' added to the staging area from the encounter deck", spider.Title));
                    return;
                }
                else if (game.StagingArea.EncounterDeck.DiscardPile.Any(x => x.Id == spider.Id))
                {
                    game.StagingArea.EncounterDeck.RemoveFromDiscardPile(new List <IEncounterCard> {
                        spider
                    });
                    game.StagingArea.AddToStagingArea(spider);
                    handle.Resolve(string.Format("'{0}' added to the staging area from the encounter discard pile", spider.Title));
                }

                handle.Cancel(string.Format("'{0}' was not added to the staging area because it could not be located", spider.Title));
            }
        public override void Trigger(IGame game, IEffectHandle handle)
        {
            if (numberOfCards == 0)
            {
                handle.Cancel(GetCancelledString()); return;
            }

            player.DrawCards(numberOfCards);

            handle.Resolve(GetCompletedStatus());
        }
Esempio n. 51
0
        protected override void ResolveEffect(IGame game, IEffectHandle handle, string paymentText)
        {
            var attachedTo = handle.Target as IAttachmentHostInPlay;

            if (attachedTo == null)
            {
                throw new InvalidOperationException("target undefined for this attachment");
            }

            handle.Resolve(string.Format("{0} chose to pay {1} to attach '{2}' to '{3}'", player.Name, paymentText, attachmentCard.Title, attachedTo.Title));
        }
Esempio n. 52
0
            private void PutEncounterCardOnBottomOfDeck(IGame game, IEffectHandle handle, IPlayer player, IExhaustableInPlay denethor, IEncounterCard encounterCard)
            {
                denethor.Exhaust();

                game.StagingArea.EncounterDeck.RemoveFromDeck(encounterCard);
                game.StagingArea.EncounterDeck.PutOnBottom(new List <IEncounterCard> {
                    encounterCard
                });

                handle.Resolve(string.Format("{0} chose to put '{1}' on the bottom of the encounter deck", player.Name, encounterCard.Title));
            }
Esempio n. 53
0
            public override void Trigger(IGame game, IEffectHandle handle)
            {
                var enemyAttack = game.CurrentPhase.GetEnemyAttacks().Where(x => x.Enemy.Card.Id == source.Id).FirstOrDefault();
                if (enemyAttack == null)
                    { handle.Cancel(GetCancelledString()); return; }

                var bonus = enemyAttack.IsUndefended ? 3 : 1;

                game.AddEffect(new AttackModifier(game.CurrentPhase.Code, source, enemyAttack.Enemy, TimeScope.None, bonus));

                handle.Resolve(GetCompletedStatus());
            }
Esempio n. 54
0
            public override void Trigger(IGame game, IEffectHandle handle)
            {
                var enemy = game.GetCardInPlay<IEnemyInPlay>(source.Id);
                if (enemy == null || enemy.Resources == 0)
                    { handle.Cancel(GetCancelledString()); return; }

                var bonus = enemy.Resources * 2;

                game.AddEffect(new AttackModifier(game.CurrentPhase.Code, source, enemy, TimeScope.None, bonus));

                handle.Resolve(GetCompletedStatus());
            }
        public override void Trigger(IGame game, IEffectHandle handle)
        {
            var location = game.StagingArea.CardsInStagingArea.OfType<ILocationInPlay>().Where(x => x.Card.Id == source.Id).FirstOrDefault();
            if (location == null)
            {
                handle.Cancel(string.Format("Could Not Travel To '{0}'", CardSource.Title));
                return;
            }

            game.QuestArea.SetActiveLocation(location);

            handle.Resolve(string.Format("Traveled To '{0}'", CardSource.Title));
        }
Esempio n. 56
0
            public override void Trigger(IGame game, IEffectHandle handle)
            {
                var chooseEnemy = game.CurrentPhase.GetEnemiesChosenToAttack().Where(x => x.Attackers.Any(y => y.Card.Id == source.Id)).FirstOrDefault();
                if (chooseEnemy == null)
                    { handle.Cancel(GetCancelledString()); return; }

                foreach (var enemy in game.StagingArea.CardsInStagingArea.OfType<IEnemyInPlay>())
                {
                    chooseEnemy.AddEnemy(enemy);
                }

                handle.Resolve(GetCompletedStatus());
            }
Esempio n. 57
0
            public override void Trigger(IGame game, IEffectHandle handle)
            {
                var playersDrawingCards = game.CurrentPhase.GetPlayersDrawingCards();
                if (playersDrawingCards == null)
                    { handle.Cancel(GetCancelledString()); return; }

                foreach (var playerId in playersDrawingCards.Players)
                {
                    playersDrawingCards.DisablePlayerCardDraw(playerId);
                }

                handle.Resolve(GetCompletedStatus());
            }
        public override void Trigger(IGame game, IEffectHandle handle)
        {
            var state = new CardEntersPlay(game, cardInPlay);

            foreach (var inPlay in game.GetCardsInPlayWithEffect<ICardInPlay, IAfterCardEntersPlay>())
            {
                foreach (var effect in inPlay.BaseCard.Text.Effects.OfType<IAfterCardEntersPlay>())
                {
                    effect.AfterCardEntersPlay(state);
                }
            }

            handle.Resolve(GetCompletedStatus());
        }
Esempio n. 59
0
            public override void Trigger(IGame game, IEffectHandle handle)
            {
                foreach (var player in game.Players)
                {
                    //TODO: Check for IDuringDrawingCards effects here

                    var drawEffect = new DrawingCardsEffect(game, player, 1);
                    var drawHandle = drawEffect.GetHandle(game);
                    game.AddEffect(drawEffect);
                    game.TriggerEffect(drawHandle);
                }

                handle.Resolve(GetCompletedStatus());
            }
Esempio n. 60
0
            public override void Trigger(IGame game, IEffectHandle handle)
            {
                var damageDealt = game.CurrentPhase.GetDamageDealt().Where(x => x.Target.BaseCard.Id == source.Id).FirstOrDefault();
                if (damageDealt == null || damageDealt.Damage == 0)
                    { handle.Cancel(GetCancelledString()); return; }

                var resourceful = game.GetCardInPlay<ICharacterInPlay>(source.Id);
                if (resourceful == null)
                    { handle.Cancel(GetCancelledString()); return; }

                resourceful.Resources += damageDealt.Damage;

                handle.Resolve(GetCompletedStatus());
            }