public override IEnumerator Play()
        {
            var coroutine = GameController.SelectLocationsAndDoAction(DecisionMaker, SelectionType.RevealTopCardOfDeck, l => l.IsDeck && !l.OwnerTurnTaker.IsIncapacitatedOrOutOfGame, RevealTopCardAndReturn, cardSource: GetCardSource());

            if (base.UseUnityCoroutines)
            {
                yield return(base.GameController.StartCoroutine(coroutine));
            }
            else
            {
                base.GameController.ExhaustCoroutine(coroutine);
            }
            var sld = new SelectLocationDecision(GameController, HeroTurnTakerController, Game.TurnTakers.Select(tt => new LocationChoice(tt.Deck)), SelectionType.PlayTopCard, false, cardSource: GetCardSource());

            coroutine = GameController.SelectLocationAndDoAction(sld, loc => GameController.PlayTopCardOfLocation(DecisionMaker, loc, isPutIntoPlay: true, cardSource: GetCardSource(), showMessage: true));
            if (base.UseUnityCoroutines)
            {
                yield return(base.GameController.StartCoroutine(coroutine));
            }
            else
            {
                base.GameController.ExhaustCoroutine(coroutine);
            }
            yield break;
        }
Esempio n. 2
0
        public override IEnumerator UseIncapacitatedAbility(int index)
        {
            IEnumerator coroutine;

            switch (index)
            {
            case (0):
            {
                //"One target deals another target 1 melee damage.",
                List <SelectCardDecision> storedResults = new List <SelectCardDecision>();
                coroutine = GameController.SelectCardAndStoreResults(this.DecisionMaker, SelectionType.SelectTargetNoDamage, new LinqCardCriteria((Card c) => c.IsInPlayAndHasGameText && c.IsTarget, "target to deal damage", false), storedResults, false, cardSource: base.GetCardSource());
                if (base.UseUnityCoroutines)
                {
                    yield return(GameController.StartCoroutine(coroutine));
                }
                else
                {
                    GameController.ExhaustCoroutine(coroutine);
                }
                if (DidSelectCard(storedResults))
                {
                    Card selectedCard = GetSelectedCard(storedResults);
                    coroutine = GameController.SelectTargetsAndDealDamage(this.DecisionMaker, new DamageSource(GameController, selectedCard), 1, DamageType.Melee, 1, false, 1, additionalCriteria: (Card c) => c != selectedCard, cardSource: GetCardSource());
                    if (base.UseUnityCoroutines)
                    {
                        yield return(GameController.StartCoroutine(coroutine));
                    }
                    else
                    {
                        GameController.ExhaustCoroutine(coroutine);
                    }
                }
                break;
            }

            case (1):
            {
                //"Put a card in a trash pile under its associated deck.",
                var trashesWithCards = GameController.AllTurnTakers.Where(tt => tt.Trash.HasCards && AskIfTurnTakerIsVisibleToCardSource(tt, GetCardSource()) != false).Select(tt => new LocationChoice(tt.Trash));
                Func <Location, List <MoveCardDestination> > bottomOfSameDeck = (Location trash) => new List <MoveCardDestination> {
                    new MoveCardDestination(trash.OwnerTurnTaker.Deck, toBottom: true)
                };

                if (trashesWithCards.Count() == 1)
                {
                    var trash = trashesWithCards.FirstOrDefault().Location;
                    coroutine = GameController.SelectCardsFromLocationAndMoveThem(DecisionMaker, trash, 1, 1, new LinqCardCriteria(c => true), bottomOfSameDeck(trash), cardSource: GetCardSource());
                }
                else
                {
                    var selectLocation = new SelectLocationDecision(GameController, DecisionMaker, trashesWithCards, SelectionType.MoveCardOnBottomOfDeck, false, cardSource: GetCardSource());
                    coroutine = GameController.SelectLocationAndDoAction(selectLocation,
                                                                         trash => GameController.SelectCardsFromLocationAndMoveThem(DecisionMaker, trash, 1, 1, new LinqCardCriteria(c => true), bottomOfSameDeck(trash), cardSource: GetCardSource()));
                }

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

            case (2):
            {
                //"One player selects a keyword and reveals the top 3 cards of their deck, putting any revealed cards with that keyword into their hand and discarding the rest."
                var selectHero = new SelectTurnTakerDecision(GameController, DecisionMaker, GameController.AllTurnTakers.Where(tt => tt.IsHero && !tt.IsIncapacitatedOrOutOfGame), SelectionType.RevealCardsFromDeck, cardSource: GetCardSource());
                coroutine = GameController.SelectTurnTakerAndDoAction(selectHero, SelectKeywordThenRevealAndMoveCards);
                if (UseUnityCoroutines)
                {
                    yield return(GameController.StartCoroutine(coroutine));
                }
                else
                {
                    GameController.ExhaustCoroutine(coroutine);
                }
                break;
            }
            }
            yield break;
        }