public override IEnumerator Play()
        {
            IEnumerator coroutine;
            Card        characterCard = base.TurnTaker.FindCard("WinterTiamatCharacter");

            //If {Tiamat}, The Jaws of Winter is active, she deals each hero target 2+X cold damage, where X is the number of Element of Ice cards in the villain trash.
            if (characterCard.IsInPlayAndHasGameText && !characterCard.IsFlipped)
            {
                Func <Card, int?> X = (Card c) => new int?(PlusNumberOfThisCardInTrash(2));
                coroutine = base.DealDamage(characterCard, (Card c) => c.IsHero, X, DamageType.Cold);

                if (base.UseUnityCoroutines)
                {
                    yield return(base.GameController.StartCoroutine(coroutine));
                }
                else
                {
                    base.GameController.ExhaustCoroutine(coroutine);
                }
            }

            //The hero with the highest HP...
            List <SelectCardDecision> storedResults = new List <SelectCardDecision>();
            LinqCardCriteria          criteria      = new LinqCardCriteria((Card card) => base.CanCardBeConsideredHighestHitPoints(card, (Card c) => c.IsHeroCharacterCard && c.IsInPlayAndHasGameText && !c.IsFlipped));

            coroutine = base.GameController.SelectCardAndStoreResults(this.DecisionMaker, SelectionType.HeroCharacterCard, criteria, storedResults, false, cardSource: base.GetCardSource());
            if (base.UseUnityCoroutines)
            {
                yield return(base.GameController.StartCoroutine(coroutine));
            }
            else
            {
                base.GameController.ExhaustCoroutine(coroutine);
            }
            Card highestHpHero = highestHpHero = storedResults.FirstOrDefault().SelectedCard;

            //...may not use powers until the start of the next villain turn.
            CannotUsePowersStatusEffect cannotUsePowersStatusEffect = new CannotUsePowersStatusEffect();

            cannotUsePowersStatusEffect.TurnTakerCriteria.IsSpecificTurnTaker = highestHpHero.NativeDeck.OwnerTurnTaker;
            cannotUsePowersStatusEffect.UntilStartOfNextTurn(base.TurnTaker);
            coroutine = base.AddStatusEffect(cannotUsePowersStatusEffect);
            if (base.UseUnityCoroutines)
            {
                yield return(base.GameController.StartCoroutine(coroutine));
            }
            else
            {
                base.GameController.ExhaustCoroutine(coroutine);
            }
            yield break;
        }
예제 #2
0
        public override IEnumerator Play()
        {
            LinqCardCriteria criteria = new LinqCardCriteria(this.IsTactic, "tactic");
            IEnumerator      routine  = base.SearchForCards(this.DecisionMaker, true, false, 1, 1, criteria, true, false, false, shuffleAfterwards: true);

            if (base.UseUnityCoroutines)
            {
                yield return(base.GameController.StartCoroutine(routine));
            }
            else
            {
                base.GameController.ExhaustCoroutine(routine);
            }
        }
예제 #3
0
        private IEnumerable <Function> ChoiceFunction(HeroTurnTakerController httc)
        {
            var drawACard = new Function(httc, "Draw a card", SelectionType.DrawCard, () => this.DrawCard(httc.HeroTurnTaker), CanDrawCards(httc));

            var criteria      = new LinqCardCriteria(c => IsEquipment(c) || c.IsOngoing, "equipment or ongoing");
            var coroutine     = this.GameController.SelectCardFromLocationAndMoveIt(httc, httc.HeroTurnTaker.Trash, criteria, new[] { new MoveCardDestination(httc.HeroTurnTaker.Deck) }, cardSource: this.GetCardSource());
            var pullFromTrash = new Function(httc, "Select an Equipment or Ongoing from the trash to put on top of your deck", SelectionType.MoveCardOnDeck, () => coroutine, httc.HeroTurnTaker.Trash.HasCards);

            return(new Function[]
            {
                drawACard,
                pullFromTrash
            });
        }
예제 #4
0
        private IEnumerator StartOfTurnResponse(PhaseChangeAction pca)
        {
            LinqCardCriteria envCardsInPlay =
                new LinqCardCriteria(card => !card.Equals(this.Card) && card.IsInPlayAndHasGameText && card.IsEnvironment);

            IEnumerable <Card> cardResults = FindCardsWhere(envCardsInPlay);

            if (!cardResults.Any())
            {
                yield break;
            }

            // At least one other env. card is in play that isn't this card, proceed
            List <Card> revealedCards      = new List <Card>();
            IEnumerator revealCardsRoutine = base.GameController.RevealCards(this.TurnTakerController, base.FindEnvironment().TurnTaker.Deck,
                                                                             CardsToReveal, revealedCards, cardSource: base.GetCardSource());

            if (base.UseUnityCoroutines)
            {
                yield return(base.GameController.StartCoroutine(revealCardsRoutine));
            }
            else
            {
                base.GameController.ExhaustCoroutine(revealCardsRoutine);
            }

            IEnumerator cardActionRoutine;

            if (revealedCards.Any() && IsHound(revealedCards.First()))
            {
                // The Hound revealed, put into play
                cardActionRoutine = base.GameController.PlayCard(this.TurnTakerController, revealedCards.First(), true);
            }
            else
            {
                // Discard
                cardActionRoutine = base.GameController.MoveCard(this.TurnTakerController, revealedCards.First(),
                                                                 FindEnvironment().TurnTaker.Trash);
            }

            if (base.UseUnityCoroutines)
            {
                yield return(base.GameController.StartCoroutine(cardActionRoutine));
            }
            else
            {
                base.GameController.ExhaustCoroutine(cardActionRoutine);
            }
        }
예제 #5
0
        public IEnumerator DestroyTargetsOrSelf(PhaseChangeAction pca)
        {
            // "... destroy each target with 2 or fewer HP."
            List <DestroyCardAction> destroyed = new List <DestroyCardAction>();
            string             message         = base.Card.Title + " destroys each target with 2 or fewer HP...";
            LinqCardCriteria   vulnerable      = new LinqCardCriteria((Card c) => c.IsTarget && c.IsInPlay && c.HitPoints.Value <= 2);
            IEnumerable <Card> toDestroy       = FindCardsWhere(vulnerable, visibleToCard: GetCardSource());

            if (toDestroy != null && toDestroy.Count() > 0)
            {
                IEnumerator showCoroutine = base.GameController.SendMessageAction(message, Priority.Medium, GetCardSource(), associatedCards: toDestroy, showCardSource: true);
                if (base.UseUnityCoroutines)
                {
                    yield return(base.GameController.StartCoroutine(showCoroutine));
                }
                else
                {
                    base.GameController.ExhaustCoroutine(showCoroutine);
                }
                IEnumerator destroyCoroutine = base.GameController.DestroyCards(base.DecisionMaker, vulnerable, storedResults: destroyed, cardSource: GetCardSource());
                if (base.UseUnityCoroutines)
                {
                    yield return(base.GameController.StartCoroutine(destroyCoroutine));
                }
                else
                {
                    base.GameController.ExhaustCoroutine(destroyCoroutine);
                }
            }
            // "If no targets were destroyed this way, destroy this card."
            if (destroyed == null || destroyed.Count() <= 0)
            {
                string failMessage = "None of the targets could be digested, so " + base.Card.Title + " destroys itself!";
                if (toDestroy.Count() <= 0)
                {
                    failMessage = "There are no targets that could be digested, so " + base.Card.Title + " destroys itself!";
                }
                IEnumerator selfDestructCoroutine = base.GameController.DestroyCard(base.DecisionMaker, base.Card, overrideOutput: failMessage, showOutput: true, actionSource: pca, responsibleCard: base.Card, cardSource: GetCardSource());
                if (base.UseUnityCoroutines)
                {
                    yield return(base.GameController.StartCoroutine(selfDestructCoroutine));
                }
                else
                {
                    base.GameController.ExhaustCoroutine(selfDestructCoroutine);
                }
            }
            yield break;
        }
        public override IEnumerator Play()
        {
            // "When this card enters play, reveal cards from the top of the environment deck until a Divergence is revealed. Put that Divergence into play. Shuffle the other revealed cards back into the deck."
            LinqCardCriteria divergence      = new LinqCardCriteria((Card c) => c.DoKeywordsContain(DivergenceKeyword), "Divergence", true, false);
            IEnumerator      summonCoroutine = RevealCards_MoveMatching_ReturnNonMatchingCards(base.TurnTakerController, base.TurnTaker.Deck, false, true, false, divergence, 1, revealedCardDisplay: RevealedCardDisplay.Message);

            if (base.UseUnityCoroutines)
            {
                yield return(base.GameController.StartCoroutine(summonCoroutine));
            }
            else
            {
                base.GameController.ExhaustCoroutine(summonCoroutine);
            }
            // "Then, if there are no Divergences in play, each player draws a card and play the top card of the environment deck."
            if (GameController.FindCardsWhere(new LinqCardCriteria((Card c) => c.IsInPlayAndHasGameText && c.DoKeywordsContain(DivergenceKeyword), "Divergence cards in play", false, false, "Divergence card in play", "Divergence cards in play"), visibleToCard: GetCardSource()).Count() <= 0)
            {
                IEnumerator drawCoroutine = EachPlayerDrawsACard();
                if (base.UseUnityCoroutines)
                {
                    yield return(base.GameController.StartCoroutine(drawCoroutine));
                }
                else
                {
                    base.GameController.ExhaustCoroutine(drawCoroutine);
                }
                IEnumerator playCoroutine = base.GameController.PlayTopCardOfLocation(base.TurnTakerController, base.TurnTaker.Deck, responsibleTurnTaker: base.TurnTaker, cardSource: GetCardSource());
                if (base.UseUnityCoroutines)
                {
                    yield return(base.GameController.StartCoroutine(playCoroutine));
                }
                else
                {
                    base.GameController.ExhaustCoroutine(playCoroutine);
                }
            }
            // "Then, destroy this card."
            IEnumerator destroyCoroutine = base.GameController.DestroyCard(DecisionMaker, base.Card, responsibleCard: base.Card, cardSource: GetCardSource());

            if (base.UseUnityCoroutines)
            {
                yield return(base.GameController.StartCoroutine(destroyCoroutine));
            }
            else
            {
                base.GameController.ExhaustCoroutine(destroyCoroutine);
            }
            yield break;
        }
예제 #7
0
        private IEnumerator DestroyThisOrConstellation(PhaseChangeAction pc)
        {
            var         criteria  = new LinqCardCriteria((Card c) => c.IsInPlayAndHasGameText && (IsConstellation(c) || base.Card == c));
            IEnumerator coroutine = GameController.SelectAndDestroyCard(HeroTurnTakerController, criteria, false, cardSource: GetCardSource());

            if (UseUnityCoroutines)
            {
                yield return(GameController.StartCoroutine(coroutine));
            }
            else
            {
                GameController.ExhaustCoroutine(coroutine);
            }
            yield break;
        }
예제 #8
0
        public override IEnumerator Play()
        {
            //"Search your deck for a copy of “Plate Mail” or “Plate Helm” and put it into play. Shuffle your deck.",
            //"Select a hero target. Until the start of your next turn, reduce damage dealt to that target by 1."
            var criteria  = new LinqCardCriteria(c => c.Identifier == "PlateHelm" || c.Identifier == "PlateMail", "armor");
            var coroutine = base.SearchForCards(this.DecisionMaker, true, false, 1, 1, criteria, true, false, false, shuffleAfterwards: true);

            if (base.UseUnityCoroutines)
            {
                yield return(base.GameController.StartCoroutine(coroutine));
            }
            else
            {
                base.GameController.ExhaustCoroutine(coroutine);
            }
            var storedResult = new List <SelectCardDecision>();

            criteria  = new LinqCardCriteria(c => c.IsHero && c.IsTarget && c.IsInPlayAndHasGameText, "hero target");
            coroutine = base.GameController.SelectCardAndStoreResults(this.DecisionMaker, SelectionType.ReduceDamageTaken, criteria, storedResult, false, cardSource: base.GetCardSource());
            if (base.UseUnityCoroutines)
            {
                yield return(base.GameController.StartCoroutine(coroutine));
            }
            else
            {
                base.GameController.ExhaustCoroutine(coroutine);
            }

            if (DidSelectCard(storedResult))
            {
                Card card = GetSelectedCard(storedResult);
                ReduceDamageStatusEffect reduceDamageStatusEffect = new ReduceDamageStatusEffect(1);
                reduceDamageStatusEffect.TargetCriteria.IsSpecificCard = card;
                reduceDamageStatusEffect.UntilStartOfNextTurn(base.TurnTaker);
                reduceDamageStatusEffect.UntilTargetLeavesPlay(card);

                coroutine = base.AddStatusEffect(reduceDamageStatusEffect, true);
                if (base.UseUnityCoroutines)
                {
                    yield return(base.GameController.StartCoroutine(coroutine));
                }
                else
                {
                    base.GameController.ExhaustCoroutine(coroutine);
                }
            }
            yield break;
        }
        public override IEnumerator Play()
        {
            //"Search your deck for a Single Hand Equipment card and put it into play. Shuffle your deck.",
            //"Select a hero target. Until the start of your next turn, increase damage dealt by that target by 1."
            var criteria  = new LinqCardCriteria(c => IsEquipment(c) && IsSingleHandCard(c), "single hand equipment");
            var coroutine = base.SearchForCards(this.DecisionMaker, true, false, 1, 1, criteria, true, false, false, shuffleAfterwards: true);

            if (base.UseUnityCoroutines)
            {
                yield return(base.GameController.StartCoroutine(coroutine));
            }
            else
            {
                base.GameController.ExhaustCoroutine(coroutine);
            }
            var storedResult = new List <SelectCardDecision>();

            criteria  = new LinqCardCriteria(c => c.IsHero && c.IsTarget && c.IsInPlayAndHasGameText, "hero target");
            coroutine = base.GameController.SelectCardAndStoreResults(this.DecisionMaker, SelectionType.IncreaseDamage, criteria, storedResult, false, cardSource: base.GetCardSource());
            if (base.UseUnityCoroutines)
            {
                yield return(base.GameController.StartCoroutine(coroutine));
            }
            else
            {
                base.GameController.ExhaustCoroutine(coroutine);
            }

            if (DidSelectCard(storedResult))
            {
                Card card = GetSelectedCard(storedResult);
                IncreaseDamageStatusEffect increaseDamageStatusEffect = new IncreaseDamageStatusEffect(1);
                increaseDamageStatusEffect.SourceCriteria.IsSpecificCard = card;
                increaseDamageStatusEffect.UntilStartOfNextTurn(base.TurnTaker);
                increaseDamageStatusEffect.UntilTargetLeavesPlay(card);

                coroutine = base.AddStatusEffect(increaseDamageStatusEffect, true);
                if (base.UseUnityCoroutines)
                {
                    yield return(base.GameController.StartCoroutine(coroutine));
                }
                else
                {
                    base.GameController.ExhaustCoroutine(coroutine);
                }
            }
            yield break;
        }
예제 #10
0
        public IEnumerator DestroyResponse(GameAction ga)
        {
            // "... destroy {H - 1} hero Ongoing cards."
            LinqCardCriteria heroOngoingInPlay = new LinqCardCriteria((Card c) => c.IsHero && c.DoKeywordsContain("ongoing") && c.IsInPlayAndHasGameText && base.GameController.IsCardVisibleToCardSource(c, GetCardSource()), "hero Ongoing");
            IEnumerator      destroyCoroutine  = base.GameController.SelectAndDestroyCards(DecisionMaker, heroOngoingInPlay, H - 1, requiredDecisions: H - 1, allowAutoDecide: base.GameController.FindCardsWhere(heroOngoingInPlay, visibleToCard: GetCardSource()).Count() <= H - 1, responsibleCard: base.Card, cardSource: GetCardSource());

            if (base.UseUnityCoroutines)
            {
                yield return(base.GameController.StartCoroutine(destroyCoroutine));
            }
            else
            {
                base.GameController.ExhaustCoroutine(destroyCoroutine);
            }
            yield break;
        }
예제 #11
0
        public IEnumerator SummonImperialResponse(PhaseChangeAction pca)
        {
            // "... reveal cards from the top of the environment deck until an Imperial target is revealed. Put that target into play. Shuffle the other revealed cards back into the deck."
            LinqCardCriteria imperialTarget  = new LinqCardCriteria((Card c) => c.IsTarget && c.DoKeywordsContain(AuthorityKeyword), "Imperial target", true);
            IEnumerator      revealCoroutine = RevealCards_MoveMatching_ReturnNonMatchingCards(base.TurnTakerController, base.TurnTaker.Deck, false, true, false, imperialTarget, 1, revealedCardDisplay: RevealedCardDisplay.Message);

            if (base.UseUnityCoroutines)
            {
                yield return(base.GameController.StartCoroutine(revealCoroutine));
            }
            else
            {
                base.GameController.ExhaustCoroutine(revealCoroutine);
            }
            yield break;
        }
예제 #12
0
        private IEnumerator DestroyCardsResponse(PhaseChangeAction pca)
        {
            //Each hero must destroy 1 of their ongoing or equipment cards.
            LinqCardCriteria cardCriteria = new LinqCardCriteria((Card c) => c.IsHero && (c.IsOngoing || IsEquipment(c)) && GameController.IsCardVisibleToCardSource(c, GetCardSource()), "hero ongoing or equipment");
            IEnumerator      coroutine    = base.EachPlayerDestroysTheirCards(new LinqTurnTakerCriteria((TurnTaker tt) => tt.IsHero, "heroes"), cardCriteria, numberOfCards: new int?(1), requiredNumberOfCards: new int?(1));

            if (base.UseUnityCoroutines)
            {
                yield return(base.GameController.StartCoroutine(coroutine));
            }
            else
            {
                base.GameController.ExhaustCoroutine(coroutine);
            }

            yield break;
        }
예제 #13
0
        public override IEnumerator DeterminePlayLocation(List <MoveCardDestination> storedResults, bool isPutIntoPlay, List <IDecision> decisionSources,
                                                          Location overridePlayArea = null, LinqTurnTakerCriteria additionalTurnTakerCriteria = null)
        {
            //When this card enters play, place it next to a hero character.
            LinqCardCriteria validTargets = new LinqCardCriteria(c => c.IsHeroCharacterCard && c.IsTarget && c.IsInPlayAndHasGameText && (additionalTurnTakerCriteria == null || additionalTurnTakerCriteria.Criteria(c.Owner)), "hero character card");

            IEnumerator routine = base.SelectCardThisCardWillMoveNextTo(validTargets, storedResults, isPutIntoPlay, decisionSources);

            if (base.UseUnityCoroutines)
            {
                yield return(base.GameController.StartCoroutine(routine));
            }
            else
            {
                base.GameController.ExhaustCoroutine(routine);
            }
        }
        private IEnumerator StartOfTurnResponse(PhaseChangeAction pca)
        {
            var criteria = new LinqCardCriteria(card => this.Card != card && card.IsInPlayAndHasGameText && card.IsEnvironment && GameController.IsCardVisibleToCardSource(card, GetCardSource()));
            IEnumerable <Card> cardResults = FindCardsWhere(criteria);

            if (cardResults.Any())
            {
                // At least one other env. card is in play that isn't this card, proceed
                List <Card> revealedCards = new List <Card>();
                var         coroutine     = GameController.RevealCards(TurnTakerController, FindEnvironment().TurnTaker.Deck, CardsToReveal, revealedCards, cardSource: GetCardSource());
                if (base.UseUnityCoroutines)
                {
                    yield return(base.GameController.StartCoroutine(coroutine));
                }
                else
                {
                    base.GameController.ExhaustCoroutine(coroutine);
                }
                //deck could be empty
                if (revealedCards.Any())
                {
                    var revealedCard = revealedCards.First();
                    if (IsHound(revealedCard))
                    {
                        // The Hound revealed, put into play
                        coroutine = base.GameController.PlayCard(TurnTakerController, revealedCard, true);
                    }
                    else
                    {
                        // Discard
                        coroutine = base.GameController.MoveCard(TurnTakerController, revealedCard, FindEnvironment().TurnTaker.Trash);
                    }

                    if (base.UseUnityCoroutines)
                    {
                        yield return(base.GameController.StartCoroutine(coroutine));
                    }
                    else
                    {
                        base.GameController.ExhaustCoroutine(coroutine);
                    }
                }
            }
        }
        public override IEnumerator Play()
        {
            LinqCardCriteria isCluster = new LinqCardCriteria((Card c) => c.DoKeywordsContain("cluster"));
            // "Reveal cards from the top of your deck until 3 Clusters are revealed. Put the revealed Clusters into your hand and shuffle the other revealed cards into your deck."
            IEnumerator manipulateCoroutine = RevealCards_MoveMatching_ReturnNonMatchingCards(base.TurnTakerController, base.TurnTaker.Deck, false, false, true, isCluster, 3, revealedCardDisplay: RevealedCardDisplay.ShowMatchingCards);

            if (base.UseUnityCoroutines)
            {
                yield return(base.GameController.StartCoroutine(manipulateCoroutine));
            }
            else
            {
                base.GameController.ExhaustCoroutine(manipulateCoroutine);
            }
            // "{TorrentCharacter} may deal herself 3 energy damage. If she takes damage this way, you may play a Cluster."
            List <DealDamageAction> damageResults   = new List <DealDamageAction>();
            IEnumerator             damageCoroutine = DealDamage(base.CharacterCard, base.CharacterCard, 3, DamageType.Energy, optional: true, storedResults: damageResults, cardSource: GetCardSource());

            if (base.UseUnityCoroutines)
            {
                yield return(base.GameController.StartCoroutine(damageCoroutine));
            }
            else
            {
                base.GameController.ExhaustCoroutine(damageCoroutine);
            }
            if (damageResults != null && damageResults.FirstOrDefault() != null)
            {
                DealDamageAction selfDamage = damageResults.FirstOrDefault();
                if (selfDamage != null && selfDamage.DidDealDamage && selfDamage.Target == base.CharacterCard)
                {
                    IEnumerator playCoroutine = SelectAndPlayCardFromHand(base.HeroTurnTakerController, cardCriteria: isCluster);
                    if (base.UseUnityCoroutines)
                    {
                        yield return(base.GameController.StartCoroutine(playCoroutine));
                    }
                    else
                    {
                        base.GameController.ExhaustCoroutine(playCoroutine);
                    }
                }
            }
            yield break;
        }
        private IEnumerator SearchForWaypoints()
        {
            if (base.TurnTaker.Deck.Cards.Any((Card c) => base.IsWaypoint(c)) || base.TurnTaker.Trash.Cards.Any((Card c) => base.IsWaypoint(c)))
            {
                // Search the environment deck and trash for a First, Second, or Third Waypoint card and put it into play...
                IEnumerable <Card> choices   = TurnTaker.Deck.Cards.Concat(TurnTaker.Trash.Cards);
                LinqCardCriteria   criteria  = new LinqCardCriteria((Card c) => base.IsWaypoint(c), "waypoint");
                IEnumerator        coroutine = GameController.SelectAndPlayCard(base.DecisionMaker, choices.Where((Card c) => base.IsWaypoint(c)), isPutIntoPlay: true, cardSource: GetCardSource());
                if (UseUnityCoroutines)
                {
                    yield return(GameController.StartCoroutine(coroutine));
                }
                else
                {
                    GameController.ExhaustCoroutine(coroutine);
                }
            }
            else
            {
                IEnumerator coroutine2 = base.GameController.SendMessageAction("There are no Waypoints in the deck or trash!", Priority.Medium, GetCardSource(), null, showCardSource: true);
                if (base.UseUnityCoroutines)
                {
                    yield return(base.GameController.StartCoroutine(coroutine2));
                }
                else
                {
                    base.GameController.ExhaustCoroutine(coroutine2);
                }
            }

            // then shuffle the deck...
            IEnumerator coroutine3 = base.ShuffleDeck(base.DecisionMaker, base.TurnTaker.Deck);

            if (base.UseUnityCoroutines)
            {
                yield return(base.GameController.StartCoroutine(coroutine3));
            }
            else
            {
                base.GameController.ExhaustCoroutine(coroutine3);
            }

            yield break;
        }
예제 #17
0
        public override IEnumerator Play()
        {
            // "Search your deck for a Relay card and put it into your hand. Shuffle your deck."
            LinqCardCriteria match           = new LinqCardCriteria((Card c) => IsRelay(c));
            IEnumerator      searchCoroutine = base.SearchForCards(base.HeroTurnTakerController, true, false, new int?(1), 1, match, false, true, false, optional: false, shuffleAfterwards: new bool?(true));

            if (base.UseUnityCoroutines)
            {
                yield return(base.GameController.StartCoroutine(searchCoroutine));
            }
            else
            {
                base.GameController.ExhaustCoroutine(searchCoroutine);
            }
            // "You may play a Relay card or draw 2 cards."
            List <Function> options = new List <Function>();

            options.Add(new Function(base.HeroTurnTakerController, "Play a Relay card", SelectionType.PlayCard, () => SelectAndPlayCardFromHand(base.HeroTurnTakerController, cardCriteria: match), onlyDisplayIfTrue: base.HeroTurnTaker.Hand.Cards.Any((Card c) => IsRelay(c))));
            options.Add(new Function(base.HeroTurnTakerController, "Draw 2 cards", SelectionType.DrawCard, () => base.DrawCards(base.HeroTurnTakerController, 2, optional: true)));
            SelectFunctionDecision choice            = new SelectFunctionDecision(base.GameController, base.HeroTurnTakerController, options, true, cardSource: GetCardSource());
            IEnumerator            playDrawCoroutine = base.GameController.SelectAndPerformFunction(choice);

            if (base.UseUnityCoroutines)
            {
                yield return(base.GameController.StartCoroutine(playDrawCoroutine));
            }
            else
            {
                base.GameController.ExhaustCoroutine(playDrawCoroutine);
            }
            // "{TheGoalieCharacter} deals 1 target 1 melee damage."
            IEnumerator damageCoroutine = base.GameController.SelectTargetsAndDealDamage(base.HeroTurnTakerController, new DamageSource(base.GameController, base.CharacterCard), 1, DamageType.Melee, 1, false, 1, cardSource: GetCardSource());

            if (base.UseUnityCoroutines)
            {
                yield return(base.GameController.StartCoroutine(damageCoroutine));
            }
            else
            {
                base.GameController.ExhaustCoroutine(damageCoroutine);
            }
            yield break;
        }
        public override IEnumerator Play()
        {
            MoveCardDestination       turnTakerDeck     = new MoveCardDestination(base.TurnTaker.Deck, true, false, false);
            MoveCardDestination       turnTakerPlayArea = new MoveCardDestination(base.TurnTaker.PlayArea, true, false, false);
            List <SelectCardDecision> storedResults     = new List <SelectCardDecision>();

            //You may shuffle a card from your trash into your deck...
            IEnumerator        coroutine          = base.GameController.SelectCardFromLocationAndMoveIt(this.DecisionMaker, base.TurnTaker.Trash, null, turnTakerDeck.ToEnumerable <MoveCardDestination>(), false, true, true, true, storedResults, false, true, null, false, true, null, null, base.GetCardSource(null));
            SelectCardDecision selectCardDecision = storedResults.FirstOrDefault <SelectCardDecision>();

            if (base.UseUnityCoroutines)
            {
                yield return(base.GameController.StartCoroutine(coroutine));
            }
            else
            {
                base.GameController.ExhaustCoroutine(coroutine);
            }
            LinqCardCriteria cardCriteria = new LinqCardCriteria((Card c) => c.Identifier == selectCardDecision.SelectedCard.Identifier, "card with the same name", true, false, null, null, false);

            //...If you do...
            if (selectCardDecision != null && selectCardDecision.SelectedCard != null)
            {
                //...put a card with the same name from your trash into play.
                IEnumerator coroutine2 = base.GameController.SelectCardFromLocationAndMoveIt(this.DecisionMaker, base.TurnTaker.Trash, cardCriteria, turnTakerPlayArea.ToEnumerable <MoveCardDestination>(), true, true, true, true, storedResults, false, true, null, false, true, null, null, base.GetCardSource(null));

                //Shuffle all copies of that card from your trash into your deck.
                IEnumerator coroutine3 = base.GameController.SelectCardsFromLocationAndMoveThem(this.HeroTurnTakerController, base.TurnTaker.Trash, new int?(0), base.TurnTaker.Deck.NumberOfCards, cardCriteria, turnTakerDeck.ToEnumerable <MoveCardDestination>(), false, true, true, false, storedResults, null, true, false, false, this.TurnTaker, false, true, null, null, base.GetCardSource(null));
                if (base.UseUnityCoroutines)
                {
                    yield return(base.GameController.StartCoroutine(coroutine2));

                    yield return(base.GameController.StartCoroutine(coroutine3));
                }
                else
                {
                    base.GameController.ExhaustCoroutine(coroutine2);
                    base.GameController.ExhaustCoroutine(coroutine3);
                }
            }

            yield break;
        }
예제 #19
0
        public IEnumerator DestroyExcessRelaysResponse()
        {
            // "Then, destroy all but 2 Relay cards."
            int goalpostsCount = NumRelaysInPlay();

            if (goalpostsCount > 2)
            {
                LinqCardCriteria match            = new LinqCardCriteria((Card c) => c.IsInPlayAndHasGameText && IsRelay(c), "relay");
                IEnumerator      destroyCoroutine = base.GameController.SelectAndDestroyCards(base.HeroTurnTakerController, match, goalpostsCount - 2, optional: false, dynamicNumberOfCards: () => NumRelaysInPlay() - 2, responsibleCard: base.Card, cardSource: GetCardSource());
                if (base.UseUnityCoroutines)
                {
                    yield return(base.GameController.StartCoroutine(destroyCoroutine));
                }
                else
                {
                    base.GameController.ExhaustCoroutine(destroyCoroutine);
                }
            }
            yield break;
        }
        private IEnumerator GetPower1()
        {
            // Discard 2 Critical cards. If you do, destroy a non-character card in play
            List <DiscardCardAction> discardCardActions = new List <DiscardCardAction>();
            LinqCardCriteria         cardCriteria       = new LinqCardCriteria(IsCritical, "critical");

            int         discardNumeral      = base.GetPowerNumeral(0, CardsToDiscard);
            IEnumerator discardCardsRoutine = this.GameController.SelectAndDiscardCards(DecisionMaker,
                                                                                        discardNumeral, false,
                                                                                        null,
                                                                                        discardCardActions, false, null, null, null,
                                                                                        cardCriteria, SelectionType.DiscardCard, this.TurnTaker,
                                                                                        cardSource: GetCardSource()
                                                                                        );

            if (base.UseUnityCoroutines)
            {
                yield return(base.GameController.StartCoroutine(discardCardsRoutine));
            }
            else
            {
                base.GameController.ExhaustCoroutine(discardCardsRoutine);
            }

            if (DidDiscardCards(discardCardActions, discardNumeral))
            {
                // Discard requirement fulfilled, choose non character card to destroy
                IEnumerator destroyCardRoutine = this.GameController.SelectAndDestroyCard(DecisionMaker,
                                                                                          new LinqCardCriteria(card => !card.IsCharacter && !card.IsOneShot && !GameController.IsCardIndestructible(card)), false,
                                                                                          cardSource: GetCardSource());
                if (base.UseUnityCoroutines)
                {
                    yield return(base.GameController.StartCoroutine(destroyCardRoutine));
                }
                else
                {
                    base.GameController.ExhaustCoroutine(destroyCardRoutine);
                }
            }
            yield break;
        }
        public override IEnumerator Play()
        {
            // "Search your deck for a Relay card and put it into your hand. Shuffle your deck."
            LinqCardCriteria match           = new LinqCardCriteria((Card c) => IsRelay(c));
            IEnumerator      searchCoroutine = base.SearchForCards(base.HeroTurnTakerController, true, false, new int?(1), 1, match, false, true, false, optional: false, shuffleAfterwards: new bool?(true));

            if (base.UseUnityCoroutines)
            {
                yield return(base.GameController.StartCoroutine(searchCoroutine));
            }
            else
            {
                base.GameController.ExhaustCoroutine(searchCoroutine);
            }
            // "You may destroy an Ongoing or environment card."
            List <DestroyCardAction> destroyed = new List <DestroyCardAction>();
            IEnumerator destroyCoroutine       = base.GameController.SelectAndDestroyCard(base.HeroTurnTakerController, new LinqCardCriteria((Card c) => c.IsOngoing || c.IsEnvironment, "Ongoing or environment"), true, storedResultsAction: destroyed, responsibleCard: base.Card, cardSource: GetCardSource());

            if (base.UseUnityCoroutines)
            {
                yield return(base.GameController.StartCoroutine(destroyCoroutine));
            }
            else
            {
                base.GameController.ExhaustCoroutine(destroyCoroutine);
            }
            if (destroyed != null && destroyed.Count() > 0 && DidDestroyCard(destroyed.First()))
            {
                // "If you do, you may play an Ongoing card."
                IEnumerator playCoroutine = SelectAndPlayCardFromHand(base.HeroTurnTakerController, optional: true, cardCriteria: new LinqCardCriteria((Card c) => c.IsOngoing));
                if (base.UseUnityCoroutines)
                {
                    yield return(base.GameController.StartCoroutine(playCoroutine));
                }
                else
                {
                    base.GameController.ExhaustCoroutine(playCoroutine);
                }
            }
            yield break;
        }
예제 #22
0
        private IEnumerator DestroyExcessSingleHandCardReponse()
        {
            //"When this card is put into play, destroy all but 2 Single Hand Equipment cards.",
            int num = base.FindCardsWhere((Card c) => IsEquipment(c) && IsSingleHandCard(c) && c.IsInPlay).Count();

            if (num > 2)
            {
                List <DestroyCardAction> storedResults = new List <DestroyCardAction>();
                var criteria  = new LinqCardCriteria(c => IsEquipment(c) && IsSingleHandCard(c) && c.IsInPlay, SingleHandKeyword + " equipment");
                var coroutine = base.GameController.SelectAndDestroyCards(this.DecisionMaker, criteria, num - 2, false, storedResultsAction: storedResults, cardSource: base.GetCardSource());
                if (base.UseUnityCoroutines)
                {
                    yield return(base.GameController.StartCoroutine(coroutine));
                }
                else
                {
                    base.GameController.ExhaustCoroutine(coroutine);
                }
            }
            yield break;
        }
예제 #23
0
        public override IEnumerator Play()
        {
            //Draw a card.
            IEnumerator coroutine = base.DrawCard();

            if (base.UseUnityCoroutines)
            {
                yield return(base.GameController.StartCoroutine(coroutine));
            }
            else
            {
                base.GameController.ExhaustCoroutine(coroutine);
            }

            //Search your deck for a Season card. Put it into your hand, then shuffle your deck.
            LinqCardCriteria criteria   = new LinqCardCriteria((Card c) => this.IsSeason(c), "season");
            IEnumerator      coroutine2 = base.SearchForCards(this.DecisionMaker, true, false, new int?(1), 1, criteria, false, true, false, shuffleAfterwards: new bool?(true));

            if (base.UseUnityCoroutines)
            {
                yield return(base.GameController.StartCoroutine(coroutine2));
            }
            else
            {
                base.GameController.ExhaustCoroutine(coroutine2);
            }

            //You may play a card.
            IEnumerator coroutine3 = base.SelectAndPlayCardFromHand(base.HeroTurnTakerController);

            if (base.UseUnityCoroutines)
            {
                yield return(base.GameController.StartCoroutine(coroutine3));
            }
            else
            {
                base.GameController.ExhaustCoroutine(coroutine3);
            }
            yield break;
        }
예제 #24
0
        public IEnumerator DamageDestroySequence(GameAction ga)
        {
            // "... this card deals the hero with the most cards in play {H - 2} melee damage."
            List <DealDamageAction> damage          = new List <DealDamageAction>();
            IEnumerator             damageCoroutine = DealDamageToMostCardsInPlay(base.Card, 1, new LinqCardCriteria((Card c) => c.IsHeroCharacterCard), H - 2, DamageType.Melee, storedResults: damage, mostFewestSelectionType: SelectionType.MostCardsInPlay);

            if (base.UseUnityCoroutines)
            {
                yield return(base.GameController.StartCoroutine(damageCoroutine));
            }
            else
            {
                base.GameController.ExhaustCoroutine(damageCoroutine);
            }
            // "Destroy an Equipment card belonging to a hero dealt damage this way."
            List <Card> damagedHeroes = (from DealDamageAction dda in damage where dda.Target.IsHeroCharacterCard && dda.DidDealDamage select dda.Target).ToList();

            if (damagedHeroes.Count() > 0)
            {
                LinqCardCriteria        equipmentOfDamaged = new LinqCardCriteria((Card c) => c.IsInPlayAndHasGameText && c.DoKeywordsContain("equipment") && damagedHeroes.Any((Card target) => target.Owner == c.Owner), "Equipment cards owned by heroes who were dealt damage by " + base.Card.Title, false, false, "Equipment card owned by a hero who was dealt damage by " + base.Card.Title, "Equipment cards owned by a hero who was dealt damage by " + base.Card.Title);
                List <TurnTaker>        damagedTurnTakers  = (from Card target in damagedHeroes select target.Owner).ToList();
                HeroTurnTakerController destroyChooser     = DecisionMaker;
                if (damagedTurnTakers.Count() == 1)
                {
                    destroyChooser = FindHeroTurnTakerController(damagedTurnTakers.FirstOrDefault().ToHero());
                }
                IEnumerator destroyCoroutine = base.GameController.SelectAndDestroyCard(destroyChooser, equipmentOfDamaged, false, responsibleCard: base.Card, cardSource: GetCardSource());
                if (base.UseUnityCoroutines)
                {
                    yield return(base.GameController.StartCoroutine(destroyCoroutine));
                }
                else
                {
                    base.GameController.ExhaustCoroutine(destroyCoroutine);
                }
            }
            yield break;
        }
예제 #25
0
        public override IEnumerator Play()
        {
            IEnumerator coroutine;

            List <SelectCardDecision> storedResults = new List <SelectCardDecision>();
            LinqCardCriteria          criteria      = new LinqCardCriteria((Card c) => base.CanCardBeConsideredLowestHitPoints(c, (Card card) => card.DoKeywordsContain("head") && card.IsTarget));

            coroutine = base.GameController.SelectCardAndStoreResults(this.DecisionMaker, SelectionType.GainHP, criteria, storedResults, false, cardSource: base.GetCardSource());
            if (base.UseUnityCoroutines)
            {
                yield return(base.GameController.StartCoroutine(coroutine));
            }
            else
            {
                base.GameController.ExhaustCoroutine(coroutine);
            }
            Card lowestHPHead = storedResults.FirstOrDefault().SelectedCard;

            //The Head with the lowest HP regains {H} + X HP, where X is the number of Healing Magic cards in the villain trash.
            Func <int> X = () => PlusNumberOfThisCardInTrash(base.H);

            coroutine = base.GameController.GainHP(lowestHPHead, PlusNumberOfThisCardInTrash(base.H), X);
            //Play the top card of the villain deck.
            IEnumerator coroutine2 = base.GameController.PlayTopCard(this.DecisionMaker, base.TurnTakerController, cardSource: base.GetCardSource());

            if (base.UseUnityCoroutines)
            {
                yield return(base.GameController.StartCoroutine(coroutine));

                yield return(base.GameController.StartCoroutine(coroutine2));
            }
            else
            {
                base.GameController.ExhaustCoroutine(coroutine);
                base.GameController.ExhaustCoroutine(coroutine2);
            }
            yield break;
        }
예제 #26
0
 public IEnumerator UnderPressureStartResponse(PhaseChangeAction pca)
 {
     if (base.CharacterCardController is BreakawayCharacterCardController && base.TurnTaker.FindCard("BreakawayCharacter").IsFlipped)
     {
         // Breakaway base character card, "Dead End Job" side: "Skip start of turn effects on {Momentum}."
     }
     else
     {
         // "At the start of the villain turn, if this card has more than {H + 2} HP, flip it."
         if (this.Card.HitPoints.Value > Game.H + 2)
         {
             IEnumerator flipCoroutine = base.GameController.FlipCard(this, cardSource: GetCardSource());
             if (base.UseUnityCoroutines)
             {
                 yield return(base.GameController.StartCoroutine(flipCoroutine));
             }
             else
             {
                 base.GameController.ExhaustCoroutine(flipCoroutine);
             }
         }
         // "If this card did not flip this turn, return {H - 2} hero cards in play to their players' hands."
         if (!Journal.WasCardFlippedThisTurn(base.Card))
         {
             LinqCardCriteria choices         = new LinqCardCriteria((Card c) => c.IsHero && c.IsInPlay && !c.IsCharacter);
             IEnumerator      returnCoroutine = base.GameController.SelectAndReturnCards(this.DecisionMaker, Game.H - 2, choices, true, false, false, Game.H - 2, cardSource: GetCardSource());
             if (base.UseUnityCoroutines)
             {
                 yield return(base.GameController.StartCoroutine(returnCoroutine));
             }
             else
             {
                 base.GameController.ExhaustCoroutine(returnCoroutine);
             }
         }
     }
     yield break;
 }
        public override IEnumerator Play()
        {
            //When this card enters play, shuffle all Spell cards from the villain trash and place them beneath this card face down.
            LinqCardCriteria   criteria      = new LinqCardCriteria((Card c) => c.DoKeywordsContain("spell") && base.TurnTaker.Trash.Cards.Contains(c));
            IEnumerable <Card> spellsInTrash = FindCardsWhere(criteria);
            IEnumerator        coroutine     = base.GameController.BulkMoveCards(this.TurnTakerController, spellsInTrash, base.Card.UnderLocation);
            IEnumerator        coroutine2    = base.GameController.ShuffleLocation(base.Card.UnderLocation);

            if (base.UseUnityCoroutines)
            {
                yield return(base.GameController.StartCoroutine(coroutine));

                yield return(base.GameController.StartCoroutine(coroutine2));
            }
            else
            {
                base.GameController.ExhaustCoroutine(coroutine);
                base.GameController.ExhaustCoroutine(coroutine2);
            }
            //this card has cards under it, so mark as primed so that if any future actions result in 0 cards under this one, it is destroyed
            this._primed = true;
            yield break;
        }
        private IEnumerator DealDamageResponse(PhaseChangeAction pca)
        {
            // "At the end of the villain turn, {Momentum} deals the hero character with the lowest HP and itself {H - 1} energy damage each."
            List <SelectCardDecision> storedResultsHero = new List <SelectCardDecision>();

            // Find the hero character card with the lowest HP; save it to tiredHero...
            LinqCardCriteria criteria      = new LinqCardCriteria((Card card) => base.CanCardBeConsideredLowestHitPoints(card, (Card c) => c.IsHeroCharacterCard && c.IsInPlayAndHasGameText && !c.IsFlipped));
            IEnumerator      findCoroutine = base.GameController.SelectCardAndStoreResults(this.DecisionMaker, SelectionType.LowestHP, criteria, storedResultsHero, false, cardSource: GetCardSource());

            if (base.UseUnityCoroutines)
            {
                yield return(this.GameController.StartCoroutine(findCoroutine));
            }
            else
            {
                this.GameController.ExhaustCoroutine(findCoroutine);
            }
            Card tiredHero = storedResultsHero.FirstOrDefault().SelectedCard;

            // Momentum deals that hero and itself H-1 energy damage each
            Card        momentumCard = base.TurnTaker.FindCard("MomentumCharacter");
            List <Card> targets      = new List <Card>()
            {
                tiredHero, momentumCard
            };
            IEnumerator damageCoroutine = base.DealDamage(momentumCard, (Card c) => targets.Contains(c), base.H - 1, DamageType.Energy);

            if (base.UseUnityCoroutines)
            {
                yield return(this.GameController.StartCoroutine(damageCoroutine));
            }
            else
            {
                this.GameController.ExhaustCoroutine(damageCoroutine);
            }
            yield break;
        }
예제 #29
0
 public IEnumerator SelectOwnCharacterCard(List <SelectCardDecision> results, SelectionType selectionType)
 {
     if (base.HeroTurnTakerController.HasMultipleCharacterCards)
     {
         var criteria  = new LinqCardCriteria(c => IsOwnCharacterCard(c), "hero character cards");
         var coroutine = base.GameController.SelectCardAndStoreResults(this.DecisionMaker, selectionType, criteria, results, false, cardSource: base.GetCardSource());
         if (base.UseUnityCoroutines)
         {
             yield return(base.GameController.StartCoroutine(coroutine));
         }
         else
         {
             base.GameController.ExhaustCoroutine(coroutine);
         }
     }
     else
     {
         var result = new SelectCardDecision(this.GameController, this.DecisionMaker, selectionType, new[] { base.CharacterCard }, false, true, cardSource: base.GetCardSource());
         result.ChooseIndex(0);
         result.AutoDecide();
         results.Add(result);
     }
     yield break;
 }
 public InquirerDistortionSharedCardController(Card card, TurnTakerController turnTakerController) : base(card, turnTakerController)
 {
     this.NextToCriteria = new LinqCardCriteria((Card c) => c.IsTarget, "targets", false, false, null, null, false);
 }