public override IEnumerator Play()
        {
            //Reveal cards from the top of the villain deck until 2 Radiation cards are revealed.
            List <RevealCardsAction> storedResults = new List <RevealCardsAction>();
            IEnumerator coroutine = base.GameController.RevealCards(base.TurnTakerController, base.TurnTaker.Deck, (Card c) => c.DoKeywordsContain("radiation"), 2, storedResults, cardSource: base.GetCardSource());

            if (base.UseUnityCoroutines)
            {
                yield return(base.GameController.StartCoroutine(coroutine));
            }
            else
            {
                base.GameController.ExhaustCoroutine(coroutine);
            }
            RevealCardsAction revealedCards = storedResults.FirstOrDefault <RevealCardsAction>();

            if (revealedCards != null)
            {
                if (revealedCards.RevealedCards != null && revealedCards.MatchingCards != null && revealedCards.MatchingCards.Count <Card>() > 0)
                {
                    //Put those cards into play...
                    foreach (Card radiation in revealedCards.MatchingCards)
                    {
                        if (radiation != null && radiation.DoKeywordsContain("radiation"))
                        {
                            coroutine = base.GameController.PlayCard(base.TurnTakerController, radiation, cardSource: base.GetCardSource());
                            if (base.UseUnityCoroutines)
                            {
                                yield return(base.GameController.StartCoroutine(coroutine));
                            }
                            else
                            {
                                base.GameController.ExhaustCoroutine(coroutine);
                            }
                        }
                    }
                }
                //...and discard the rest.
                foreach (Card cardToMove in revealedCards.NonMatchingCards)
                {
                    coroutine = base.GameController.MoveCard(base.TurnTakerController, cardToMove, base.TurnTaker.Trash, isDiscard: true, cardSource: base.GetCardSource());
                    if (base.UseUnityCoroutines)
                    {
                        yield return(base.GameController.StartCoroutine(coroutine));
                    }
                    else
                    {
                        base.GameController.ExhaustCoroutine(coroutine);
                    }
                }
            }
            yield break;
        }
Beispiel #2
0
        public override IEnumerator Play()
        {
            List <RevealCardsAction> reveal = new List <RevealCardsAction>();
            var plan = this.GameController.RevealCards(TurnTakerController, TurnTaker.Deck, c => c.DoKeywordsContain("command"), 2, reveal, RevealedCardDisplay.ShowMatchingCards, GetCardSource());

            if (UseUnityCoroutines)
            {
                yield return(this.GameController.StartCoroutine(plan));
            }
            else
            {
                this.GameController.ExhaustCoroutine(plan);
            }
            RevealCardsAction rca = reveal.FirstOrDefault();
            IEnumerator       move;

            if (rca.FoundMatchingCards)
            {
                foreach (Card c in rca.MatchingCards)
                {
                    move = this.GameController.MoveCard(TurnTakerController, c, HeroTurnTaker.Hand, false, false, false, null, true, cardSource: GetCardSource());
                    if (UseUnityCoroutines)
                    {
                        yield return(this.GameController.StartCoroutine(move));
                    }
                    else
                    {
                        this.GameController.ExhaustCoroutine(move);
                    }
                }
            }
            else
            {
                move = this.GameController.SendMessageAction("There were no commands strategized", Priority.Medium, GetCardSource());
                if (UseUnityCoroutines)
                {
                    yield return(this.GameController.StartCoroutine(move));
                }
                else
                {
                    this.GameController.ExhaustCoroutine(move);
                }
            }

            //Console.WriteLine();
            var deploy = this.GameController.SelectAndMoveCard(HeroTurnTakerController, c => c.Location == TurnTaker.Revealed && c.DoKeywordsContain("dragon"), HeroTurnTaker.Hand, false, cardSource: GetCardSource());

            if (UseUnityCoroutines)
            {
                yield return(this.GameController.StartCoroutine(deploy));
            }
            else
            {
                this.GameController.ExhaustCoroutine(deploy);
            }
            var clean = CleanupRevealedCards(TurnTaker.Revealed, TurnTaker.Deck, false, true, true, true);

            if (UseUnityCoroutines)
            {
                yield return(this.GameController.StartCoroutine(clean));
            }
            else
            {
                this.GameController.ExhaustCoroutine(clean);
            }
        }
 public IEnumerator NameSearchResponse(TurnTaker tt)
 {
     // If the player's deck is empty, this does nothing regardless of their choices, so skip everything
     if (tt.Deck.Cards.Any())
     {
         // "[This player] may name a keyword other than One-Shot."
         IOrderedEnumerable <string> keywords = from s in tt.Deck.Cards.SelectMany((Card c) => base.GameController.GetAllKeywords(c)).Distinct().Where((string s) => s.ToLower() != "one-shot") orderby s select s;
         keywords = keywords.Concat("Another keyword - find nothing, shuffle your deck".ToEnumerable()).OrderBy((string s) => s);
         List <SelectWordDecision> choice = new List <SelectWordDecision>();
         IEnumerator selectCoroutine      = base.GameController.SelectWord(base.GameController.FindHeroTurnTakerController(tt.ToHero()), keywords, SelectionType.SelectKeyword, choice, true, cardSource: GetCardSource());
         if (base.UseUnityCoroutines)
         {
             yield return(base.GameController.StartCoroutine(selectCoroutine));
         }
         else
         {
             base.GameController.ExhaustCoroutine(selectCoroutine);
         }
         if (DidSelectWord(choice))
         {
             string chosen = GetSelectedWord(choice);
             // "[This player] reveals cards from the top of their deck until they reveal a card with the keyword they named, puts that card into play or into their hand, then shuffles the other revealed cards into their deck."
             List <RevealCardsAction> revealedCards = new List <RevealCardsAction>();
             IEnumerator revealCoroutine            = base.GameController.RevealCards(base.GameController.FindTurnTakerController(tt), tt.Deck, (Card c) => c.DoKeywordsContain(chosen), 1, revealedCards, revealedCardDisplay: RevealedCardDisplay.ShowMatchingCards, cardSource: GetCardSource());
             if (base.UseUnityCoroutines)
             {
                 yield return(base.GameController.StartCoroutine(revealCoroutine));
             }
             else
             {
                 base.GameController.ExhaustCoroutine(revealCoroutine);
             }
             RevealCardsAction revealed = revealedCards.FirstOrDefault();
             if (revealed != null && revealed.FoundMatchingCards)
             {
                 Card selectedCard = revealed.MatchingCards.FirstOrDefault();
                 List <MoveCardDestination> choices = new List <MoveCardDestination>();
                 choices.Add(new MoveCardDestination(tt.PlayArea));
                 choices.Add(new MoveCardDestination(tt.ToHero().Hand));
                 if (selectedCard != null)
                 {
                     IEnumerator moveCoroutine = base.GameController.SelectLocationAndMoveCard(base.GameController.FindHeroTurnTakerController(tt.ToHero()), selectedCard, choices, isPutIntoPlay: true, responsibleTurnTaker: base.TurnTaker, cardSource: GetCardSource());
                     if (base.UseUnityCoroutines)
                     {
                         yield return(base.GameController.StartCoroutine(moveCoroutine));
                     }
                     else
                     {
                         base.GameController.ExhaustCoroutine(moveCoroutine);
                     }
                     revealed.MatchingCards.Remove(selectedCard);
                 }
                 IEnumerator replaceCoroutine = base.GameController.MoveCards(base.GameController.FindTurnTakerController(tt), revealed.RevealedCards.Where((Card c) => c != selectedCard), tt.Deck, responsibleTurnTaker: base.TurnTaker, cardSource: GetCardSource());
                 if (base.UseUnityCoroutines)
                 {
                     yield return(base.GameController.StartCoroutine(replaceCoroutine));
                 }
                 else
                 {
                     base.GameController.ExhaustCoroutine(replaceCoroutine);
                 }
                 IEnumerator shuffleCoroutine = base.GameController.ShuffleLocation(tt.Deck, cardSource: GetCardSource());
                 if (base.UseUnityCoroutines)
                 {
                     yield return(base.GameController.StartCoroutine(shuffleCoroutine));
                 }
                 else
                 {
                     base.GameController.ExhaustCoroutine(shuffleCoroutine);
                 }
             }
         }
     }
     else
     {
         IEnumerator messageCoroutine = base.GameController.SendMessageAction(tt.Name + "'s deck has no cards for " + base.Card.Title + " to reveal.", Priority.Medium, GetCardSource());
         if (base.UseUnityCoroutines)
         {
             yield return(base.GameController.StartCoroutine(messageCoroutine));
         }
         else
         {
             base.GameController.ExhaustCoroutine(messageCoroutine);
         }
     }
     yield break;
 }