Ejemplo n.º 1
0
        private IEnumerator DiscardToDraw(TurnTakerController ttc)
        {
            List <DiscardCardAction> storedResults = new List <DiscardCardAction>();
            IEnumerator coroutine = GameController.SelectAndDiscardCard(ttc.ToHero(), optional: true, storedResults: storedResults, cardSource: GetCardSource());

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

            if (DidDiscardCards(storedResults))
            {
                coroutine = DrawCard(ttc.ToHero().HeroTurnTaker);
                if (base.UseUnityCoroutines)
                {
                    yield return(base.GameController.StartCoroutine(coroutine));
                }
                else
                {
                    base.GameController.ExhaustCoroutine(coroutine);
                }
            }
            yield break;
        }
        private IEnumerator MoveCardToDeckResponse(TurnTakerController turnTakerController)
        {
            TurnTaker turnTaker             = turnTakerController.TurnTaker;
            List <MoveCardDestination> list = new List <MoveCardDestination>
            {
                new MoveCardDestination(turnTaker.Deck)
            };
            HeroTurnTakerController decisionMaker;

            if (turnTaker.IsHero)
            {
                decisionMaker = turnTakerController.ToHero();
            }
            else
            {
                decisionMaker = this.DecisionMaker;
            }
            IEnumerator coroutine  = base.GameController.SelectCardsFromLocationAndMoveThem(decisionMaker, turnTaker.Trash, 2, 2, new LinqCardCriteria((Card c) => c.Location == turnTaker.Trash, "trash"), list, cardSource: base.GetCardSource());
            IEnumerator coroutine2 = base.ShuffleDeck(this.DecisionMaker, turnTaker.Deck);

            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;
        }
Ejemplo n.º 3
0
        private IEnumerator MoveCardToDeckResponse(TurnTakerController turnTakerController)
        {
            TurnTaker turnTaker = turnTakerController.TurnTaker;
            //allow each hero to choose for themselves, TangoOne decides for the villain and environment deck.
            HeroTurnTakerController decisionMaker = turnTaker.IsHero ? turnTakerController.ToHero() : this.DecisionMaker;

            var scsd = new SelectCardsDecision(GameController, decisionMaker, c => c.Location == turnTaker.Trash, SelectionType.ShuffleCardFromTrashIntoDeck,
                                               numberOfCards: CardsToMoveFromTrash,
                                               isOptional: false,
                                               requiredDecisions: CardsToMoveFromTrash,
                                               allowAutoDecide: true,
                                               cardSource: GetCardSource());
            IEnumerator coroutine = GameController.SelectCardsAndDoAction(scsd, scd => GameController.MoveCard(decisionMaker, scd.SelectedCard, turnTaker.Deck, cardSource: GetCardSource()), cardSource: GetCardSource());

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

            coroutine = base.GameController.ShuffleLocation(turnTaker.Deck, cardSource: GetCardSource());
            if (base.UseUnityCoroutines)
            {
                yield return(base.GameController.StartCoroutine(coroutine));
            }
            else
            {
                base.GameController.ExhaustCoroutine(coroutine);
            }
        }
Ejemplo n.º 4
0
 protected void PlayCard(TurnTakerController taker)
 {
     // If hero, player decides
     if (taker is HeroTurnTakerController)
     {
         RunCoroutine(taker.GameController.SelectAndPlayCard(taker.ToHero(), card => card.Location == taker.ToHero().HeroTurnTaker.Hand, false));
     }
     else
     {
         // Otherwise play the top card of the deck.
         RunCoroutine(taker.GameController.PlayTopCard(null, taker));
     }
 }
Ejemplo n.º 5
0
        public override IEnumerator Play()
        {
            Card lastHeroToDamageVillainTarget = GetLastHeroToDamageVillainTarget();

            if (lastHeroToDamageVillainTarget != null)
            {
                TurnTakerController ttc = this.GameController.FindTurnTakerController(lastHeroToDamageVillainTarget.Owner);

                // Discard {H} cards from hand
                int         cardsToDiscard      = Game.H;
                IEnumerator discardCardsRoutine = this.GameController.SelectAndDiscardCards(ttc.ToHero(), cardsToDiscard, false, cardsToDiscard);

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