Exemplo n.º 1
0
        public override IEnumerator UsePower(int index = 0)
        {
            //Discard Card.
            List <DiscardCardAction> storedResults = new List <DiscardCardAction>();
            IEnumerator coroutine = base.GameController.SelectAndDiscardCard(this.DecisionMaker, true, null, storedResults, SelectionType.DiscardCard, null, base.TurnTaker, false, null, base.GetCardSource(null));

            //If you do, 1 player may play a card or draw a card.
            {
                if (!base.DidDiscardCards(storedResults, new int?(1), false))
                {
                    coroutine = base.GameController.SendMessageAction(base.TurnTaker.Name + " did not discard a card, so no card will be played or drawn.", Priority.Medium, base.GetCardSource(null), null, true);
                }
                else
                {
                    //Create list of Functions
                    List <Function> list = new List <Function>();

                    //Add play a card option
                    list.Add(new Function(this.DecisionMaker, "Play a card.", SelectionType.PlayCard, () => base.SelectAndPlayCardFromHand(base.HeroTurnTakerController, true, null, null, false, false, false, "Play a card.")));

                    //Add draw a card option
                    list.Add(new Function(this.DecisionMaker, "Draw a card.", SelectionType.DrawCard, () => base.DrawCard(null, false, null, true), null, "Draw a card.", null));

                    //Have player choose which option to do
                    SelectFunctionDecision selectFunction = new SelectFunctionDecision(base.GameController, this.DecisionMaker, list, false, null, null, null, base.GetCardSource(null));

                    //Perform the Selected Option
                    IEnumerator performFunction = base.GameController.SelectAndPerformFunction(selectFunction, null, null);
                }
            }
            return(base.UsePower(index));
        }
        public override IEnumerator Play()
        {
            // "Up to 2 other players may each return a card from their trash to their hand."
            SelectTurnTakersDecision selectPlayers = new SelectTurnTakersDecision(base.GameController, base.HeroTurnTakerController, new LinqTurnTakerCriteria((TurnTaker tt) => tt != base.TurnTaker && tt.IsHero && !tt.IsIncapacitatedOrOutOfGame && GameController.IsTurnTakerVisibleToCardSource(tt, GetCardSource())), SelectionType.MoveCardToHandFromTrash, 2, isOptional: false, numberOfCards: 1, cardSource: GetCardSource());
            IEnumerator returnCoroutine            = base.GameController.SelectTurnTakersAndDoAction(selectPlayers, (TurnTaker tt) => base.GameController.SelectCardFromLocationAndMoveIt(FindHeroTurnTakerController(tt.ToHero()), tt.Trash, new LinqCardCriteria((Card c) => true), new List <MoveCardDestination> {
                new MoveCardDestination(tt.ToHero().Hand)
            }, optional: true, responsibleTurnTaker: base.TurnTaker, cardSource: GetCardSource()), cardSource: GetCardSource());

            if (base.UseUnityCoroutines)
            {
                yield return(base.GameController.StartCoroutine(returnCoroutine));
            }
            else
            {
                base.GameController.ExhaustCoroutine(returnCoroutine);
            }
            // "You may draw a card or play an Ongoing card."
            List <Function>       options = new List <Function>();
            List <PlayCardAction> plays   = new List <PlayCardAction>();

            options.Add(new Function(base.HeroTurnTakerController, "Draw a card", SelectionType.DrawCard, () => base.GameController.DrawCard(base.HeroTurnTaker, optional: true, cardSource: GetCardSource())));
            options.Add(new Function(base.HeroTurnTakerController, "Play an Ongoing card", SelectionType.PlayCard, () => SelectAndPlayCardFromHand(base.HeroTurnTakerController, storedResults: plays, cardCriteria: new LinqCardCriteria((Card c) => c.DoKeywordsContain("ongoing"), "Ongoing"))));
            SelectFunctionDecision choice          = new SelectFunctionDecision(base.GameController, base.HeroTurnTakerController, options, true, noSelectableFunctionMessage: base.CharacterCard.Title + " cannot draw or play any cards.", cardSource: GetCardSource());
            IEnumerator            chooseCoroutine = base.GameController.SelectAndPerformFunction(choice);

            if (base.UseUnityCoroutines)
            {
                yield return(base.GameController.StartCoroutine(chooseCoroutine));
            }
            else
            {
                base.GameController.ExhaustCoroutine(chooseCoroutine);
            }
            yield break;
        }
        public override IEnumerator Play()
        {
            //You may draw 2 cards or put a Rune from your trash into your hand.
            string          option1 = "Draw 2 cards";
            string          option2 = "Put a Rune from your trash into your hand";
            List <Function> list    = new List <Function>();

            list.Add(new Function(this.DecisionMaker, option1, SelectionType.DrawCard, () => base.DrawCards(this.DecisionMaker, 2), new bool?(true), null, option1));
            list.Add(new Function(this.DecisionMaker, option2, SelectionType.MoveCardToHandFromTrash, () => base.GameController.SelectCardFromLocationAndMoveIt(this.DecisionMaker, base.TurnTaker.Trash, new LinqCardCriteria((Card c) => this.IsRune(c), "rune"), new MoveCardDestination[] { new MoveCardDestination(base.Card.Owner.ToHero().Hand, false, false, false) }), null, null, option2));
            SelectFunctionDecision selectFunction = new SelectFunctionDecision(base.GameController, this.DecisionMaker, list, false, null, null, null, base.GetCardSource(null));
            IEnumerator            coroutine      = base.GameController.SelectAndPerformFunction(selectFunction, null, null);

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

            //You may play a Rune or Glyph now.
            IEnumerator play = base.SelectAndPlayCardFromHand(base.HeroTurnTakerController, true, null, new LinqCardCriteria((Card card) => this.IsRune(card) || this.IsGlyph(card), "rune or glyph"), false, false, true, null);

            if (base.UseUnityCoroutines)
            {
                yield return(base.GameController.StartCoroutine(play));
            }
            else
            {
                base.GameController.ExhaustCoroutine(play);
            }
            yield break;
        }
        private IEnumerator ReplaceOrDiscard(Card cardToMove, Location deckItCameFrom)
        {
            var deckController = FindHeroTurnTakerController(deckItCameFrom.OwnerTurnTaker.ToHero());
            var functions      = new List <Function>
            {
                new Function(deckController, $"Put {cardToMove.Title} back on top of the deck", SelectionType.MoveCardOnDeck, () => GameController.MoveCard(deckController, cardToMove, deckItCameFrom, responsibleTurnTaker: DecisionMaker.TurnTaker, cardSource: GetCardSource())),
                new Function(deckController, $"Discard {cardToMove.Title}", SelectionType.DiscardCard, () => GameController.MoveCard(deckController, cardToMove, cardToMove.NativeTrash, responsibleTurnTaker: DecisionMaker.TurnTaker, cardSource: GetCardSource()))
            };
            var selectFunction = new SelectFunctionDecision(GameController, deckController, functions, optional: false, associatedCards: new List <Card> {
                cardToMove
            }, cardSource: GetCardSource());
            IEnumerator coroutine = GameController.SelectAndPerformFunction(selectFunction, associatedCards: new List <Card> {
                cardToMove
            });

            if (UseUnityCoroutines)
            {
                yield return(GameController.StartCoroutine(coroutine));
            }
            else
            {
                GameController.ExhaustCoroutine(coroutine);
            }
            yield break;
        }
        private IEnumerator PlayConstellationFromHandOrTrash(PhaseChangeAction pc)
        {
            string          heroName = TurnTaker.Name;
            List <Function> actions  = new List <Function>()
            {
                new Function(HeroTurnTakerController,
                             "Play constellation from hand",
                             SelectionType.PutIntoPlay,
                             () => SelectAndPlayCardFromHand(HeroTurnTakerController, false, null, new LinqCardCriteria((Card c) => IsConstellation(c), "constellation"), true),
                             GetPlayableCardsInHand(HeroTurnTakerController, true, pc.ToPhase).Any(IsConstellation)),
                new Function(HeroTurnTakerController,
                             "Play constellation from trash",
                             SelectionType.SearchTrash,
                             () => SelectAndPutInPlayConstellationFromTrash(HeroTurnTakerController, pc.ToPhase),
                             GetPuttableConstellationsFromTrash(HeroTurnTakerController, pc.ToPhase).Any()),
            };

            SelectFunctionDecision selectFunction = new SelectFunctionDecision(GameController, HeroTurnTakerController, actions, optional: false, pc, $"{heroName} had no constellations to put into play from their hand or trash.", cardSource: GetCardSource());
            var coroutine = GameController.SelectAndPerformFunction(selectFunction);

            if (UseUnityCoroutines)
            {
                yield return(GameController.StartCoroutine(coroutine));
            }
            else
            {
                GameController.ExhaustCoroutine(coroutine);
            }
            yield break;
        }
Exemplo n.º 6
0
        public override IEnumerator Play()
        {
            //Increase the next damage dealt by {Baccarat} by 1, or {Baccarat} deals 1 target 2 toxic damage.
            IEnumerable <Function> functionChoices = new Function[]
            {
                //Increase the next damage dealt by {Baccarat} by 1...
                new Function(base.HeroTurnTakerController, "Increase the next damage dealt by Baccarat by 1", SelectionType.IncreaseNextDamage, () => base.AddStatusEffect(new IncreaseDamageStatusEffect(1)
                {
                    SourceCriteria = { IsSpecificCard = base.CharacterCard }, NumberOfUses = new int?(1)
                })),

                //...or {Baccarat} deals 1 target 2 toxic damage.
                new Function(base.HeroTurnTakerController, "Baccarat deals 1 target 2 toxic damage", SelectionType.TurnTaker, () => base.GameController.SelectTargetsAndDealDamage(this.DecisionMaker, new DamageSource(base.GameController, base.CharacterCard), 2, DamageType.Toxic, new int?(1), false, new int?(1), cardSource: base.GetCardSource()))
            };
            SelectFunctionDecision selectFunction = new SelectFunctionDecision(base.GameController, base.HeroTurnTakerController, functionChoices, false);
            IEnumerator            coroutine      = base.GameController.SelectAndPerformFunction(selectFunction);

            if (base.UseUnityCoroutines)
            {
                yield return(base.GameController.StartCoroutine(coroutine));
            }
            else
            {
                base.GameController.ExhaustCoroutine(coroutine);
            }
            yield break;
        }
        public IEnumerator OnDestroyResponse(DestroyCardAction dca)
        {
            // "When this card is destroyed, you may draw a card or use a power."
            List <Function> options    = new List <Function>();
            Function        drawOption = new Function(base.DecisionMaker, "Draw a card", SelectionType.DrawCard, () => base.GameController.DrawCard(base.HeroTurnTaker, cardSource: GetCardSource()), null, null, "Draw a card");

            options.Add(drawOption);
            Function powerOption = new Function(base.DecisionMaker, "Use a power", SelectionType.UsePower, () => base.GameController.SelectAndUsePower(base.HeroTurnTakerController, optional: true, null, 1, cardSource: GetCardSource()), null, null, "Use a power");

            options.Add(powerOption);
            if (options.Count > 0)
            {
                SelectFunctionDecision choice          = new SelectFunctionDecision(base.GameController, base.HeroTurnTakerController, options, true, cardSource: GetCardSource());
                IEnumerator            chooseCoroutine = base.GameController.SelectAndPerformFunction(choice);
                if (base.UseUnityCoroutines)
                {
                    yield return(base.GameController.StartCoroutine(chooseCoroutine));
                }
                else
                {
                    base.GameController.ExhaustCoroutine(chooseCoroutine);
                }
            }
            yield break;
        }
        public override IEnumerator Play()
        {
            //Put a Glyph from your trash into your hand, or reveal cards from the top of your deck until you reveal a Glyph, put it into play, and shuffle the other revealed cards into your deck.
            string          option1 = "Put a Glyph from your trash into your hand";
            string          option2 = "Reveal cards from the top of your deck until you reveal a Glyph, put it into play, and shuffle the other revealed cards into your deck";
            List <Function> list    = new List <Function>();

            list.Add(new Function(this.DecisionMaker, option1, SelectionType.MoveCardToHandFromTrash, () => base.GameController.SelectCardFromLocationAndMoveIt(this.DecisionMaker, base.TurnTaker.Trash, new LinqCardCriteria((Card c) => this.IsGlyph(c), "glyph"), new MoveCardDestination[] { new MoveCardDestination(base.Card.Owner.ToHero().Hand, false, false, false) }), null, null, option1));
            list.Add(new Function(this.DecisionMaker, option2, SelectionType.RevealCardsFromDeck, () => base.RevealCards_MoveMatching_ReturnNonMatchingCards(this.DecisionMaker, base.TurnTaker.Deck, false, true, false, new LinqCardCriteria((Card c) => this.IsGlyph(c), "glyph", true, false, null, null, false), new int?(1), null, true, false, RevealedCardDisplay.None, false, false, null, false, false), new bool?(true), null, option2));
            SelectFunctionDecision selectFunction = new SelectFunctionDecision(base.GameController, this.DecisionMaker, list, false, null, null, null, base.GetCardSource(null));
            IEnumerator            coroutine      = base.GameController.SelectAndPerformFunction(selectFunction, null, null);

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

            //You may draw a card.
            IEnumerator draw = base.DrawCard(base.HeroTurnTaker, true, null, true);

            if (base.UseUnityCoroutines)
            {
                yield return(base.GameController.StartCoroutine(draw));
            }
            else
            {
                base.GameController.ExhaustCoroutine(draw);
            }
            yield break;
        }
        public override IEnumerator UsePower(int index = 0)
        {
            //PowerNumerals Required on powers
            int op1Targets = GetPowerNumeral(0, 1);
            int op1Damage  = GetPowerNumeral(1, 1);
            int op2Targets = GetPowerNumeral(2, 1);
            int op2Damage  = GetPowerNumeral(3, 2);

            //Option 1: Deal 1 Target 1 Toxic damage
            var response1 = base.GameController.SelectTargetsAndDealDamage(this.DecisionMaker, new DamageSource(base.GameController, base.CharacterCard), op1Damage, DamageType.Toxic, op1Targets, false, op1Targets, cardSource: base.GetCardSource());
            var op1       = new Function(this.DecisionMaker, $"Deal {op1Targets} target {op1Damage} toxic damage", SelectionType.DealDamage, () => response1);

            //Option: 2 Daeal 1 Undead Target 2 Toxic damage (Hide if no Undead Targets)
            var response2 = base.GameController.SelectTargetsAndDealDamage(this.DecisionMaker, new DamageSource(base.GameController, base.CharacterCard), op2Damage, DamageType.Toxic, op2Targets, false, op2Targets,
                                                                           additionalCriteria: (Card c) => IsUndead(c) && c.IsTarget,
                                                                           cardSource: base.GetCardSource());
            var op2 = new Function(this.DecisionMaker, $"Deal {op2Targets} Undead target {op2Damage} toxic damage", SelectionType.DealDamage, () => response2,
                                   onlyDisplayIfTrue: base.GameController.GetAllCards().Any(c => IsUndead(c) && c.IsTarget && c.IsInPlayAndHasGameText));

            //Execute
            var         options = new Function[] { op1, op2 };
            var         selectFunctionDecision = new SelectFunctionDecision(base.GameController, this.DecisionMaker, options, false, cardSource: base.GetCardSource());
            IEnumerator coroutine = base.GameController.SelectAndPerformFunction(selectFunctionDecision);

            if (base.UseUnityCoroutines)
            {
                yield return(base.GameController.StartCoroutine(coroutine));
            }
            else
            {
                base.GameController.ExhaustCoroutine(coroutine);
            }
            yield break;
        }
        public override IEnumerator Play()
        {
            //LadyOfTheWood deals 1 target 3 toxic damage or up to 3 targets 1 cold damage each.
            List <Function> list = new List <Function>();

            string      option1Message = "Deal 1 target 3 toxic damage";
            IEnumerator option1Effect  = base.GameController.SelectTargetsAndDealDamage(this.DecisionMaker, new DamageSource(base.GameController, base.CharacterCard), 3, DamageType.Toxic, new int?(1), false, new int?(1), cardSource: base.GetCardSource());

            list.Add(new Function(this.DecisionMaker, option1Message, SelectionType.DealDamage, () => option1Effect, repeatDecisionText: option1Message));

            string      option2Message = "Deal up to 3 targets 1 cold damage each";
            IEnumerator option2Effect  = base.GameController.SelectTargetsAndDealDamage(this.DecisionMaker, new DamageSource(base.GameController, base.CharacterCard), 1, DamageType.Cold, new int?(3), false, new int?(0), cardSource: base.GetCardSource());

            list.Add(new Function(this.DecisionMaker, option2Message, SelectionType.DealDamage, () => option2Effect, repeatDecisionText: option2Message));

            SelectFunctionDecision selectFunction = new SelectFunctionDecision(base.GameController, this.DecisionMaker, list, false, cardSource: base.GetCardSource());
            IEnumerator            coroutine      = base.GameController.SelectAndPerformFunction(selectFunction);

            if (base.UseUnityCoroutines)
            {
                yield return(base.GameController.StartCoroutine(coroutine));
            }
            else
            {
                base.GameController.ExhaustCoroutine(coroutine);
            }
            yield break;
        }
Exemplo n.º 11
0
        public override IEnumerator UsePower(int index = 0)
        {
            int trashedTricks        = base.GetPowerNumeral(0, 2);
            MoveCardDestination hand = new MoveCardDestination(base.HeroTurnTaker.Hand);
            //Play any number of tricks from your hand, or put 2 tricks from your trash into your hand.
            IEnumerable <Function> functionChoices = new Function[]
            {
                //Play any number of tricks from your hand
                new Function(base.HeroTurnTakerController, "Play any number of tricks from your hand", SelectionType.PlayCard, () => base.SelectAndPlayCardsFromHand(base.HeroTurnTakerController, 40, true, cardCriteria: new LinqCardCriteria((Card c) => c.DoKeywordsContain("trick")))),
                //put 2 tricks from your trash into your hand
                new Function(base.HeroTurnTakerController, "put 2 tricks from your trash into your hand", SelectionType.MoveCardToHandFromTrash, () => base.GameController.SelectCardsFromLocationAndMoveThem(base.HeroTurnTakerController, base.TurnTaker.Trash, trashedTricks, trashedTricks, new LinqCardCriteria((Card c) => c.DoKeywordsContain("trick")), hand.ToEnumerable <MoveCardDestination>(), cardSource: base.GetCardSource()))
            };
            SelectFunctionDecision selectFunction = new SelectFunctionDecision(base.GameController, base.HeroTurnTakerController, functionChoices, false);
            IEnumerator            coroutine      = base.GameController.SelectAndPerformFunction(selectFunction);

            if (base.UseUnityCoroutines)
            {
                yield return(base.GameController.StartCoroutine(coroutine));
            }
            else
            {
                base.GameController.ExhaustCoroutine(coroutine);
            }
            yield break;
        }
        public override IEnumerator Play()
        {
            List <Function> list = new List <Function>();

            string      option1Message = "Deal 1 target 4 fire damage";
            IEnumerator option1Effect  = base.GameController.SelectTargetsAndDealDamage(this.DecisionMaker, new DamageSource(base.GameController, base.CharacterCard), 4, DamageType.Fire, 1, false, 1, cardSource: base.GetCardSource());

            list.Add(new Function(this.DecisionMaker, option1Message, SelectionType.DealDamage, () => option1Effect, repeatDecisionText: option1Message));

            string      option2Message = "Deal up to 3 targets 2 fire damage each";
            IEnumerator option2Effect  = base.GameController.SelectTargetsAndDealDamage(this.DecisionMaker, new DamageSource(base.GameController, base.CharacterCard), 2, DamageType.Fire, 3, false, 1, cardSource: base.GetCardSource());

            list.Add(new Function(this.DecisionMaker, option2Message, SelectionType.DealDamage, () => option2Effect, repeatDecisionText: option2Message));

            SelectFunctionDecision selectFunction = new SelectFunctionDecision(base.GameController, this.DecisionMaker, list, false, cardSource: base.GetCardSource());
            IEnumerator            coroutine      = base.GameController.SelectAndPerformFunction(selectFunction);

            if (base.UseUnityCoroutines)
            {
                yield return(base.GameController.StartCoroutine(coroutine));
            }
            else
            {
                base.GameController.ExhaustCoroutine(coroutine);
            }
            yield break;
        }
        public override IEnumerator Play()
        {
            List <DiscardCardAction> storedResults = new List <DiscardCardAction>();
            var coroutine = base.SelectAndDiscardCards(this.DecisionMaker, 1,
                                                       optional: false,
                                                       requiredDecisions: 0,
                                                       storedResults: storedResults,
                                                       cardCriteria: new LinqCardCriteria(c => IsDjinn(c), "djinn"),
                                                       selectionType: SelectionType.DiscardCard);

            if (base.UseUnityCoroutines)
            {
                yield return(base.GameController.StartCoroutine(coroutine));
            }
            else
            {
                base.GameController.ExhaustCoroutine(coroutine);
            }
            if (DidDiscardCards(storedResults, 1))
            {
                //Option 1: You may put a Djinn card from your Trash into play
                //Hide if no Djinn in Trash
                var response1 = base.GameController.SelectAndMoveCard(this.DecisionMaker, c => c.IsInTrash && IsDjinn(c), this.DecisionMaker.TurnTaker.PlayArea,
                                                                      optional: true,
                                                                      isPutIntoPlay: true,
                                                                      cardSource: GetCardSource());
                var op1 = new Function(this.DecisionMaker, "You may put a Djinn card from your Trash into play", SelectionType.PutIntoPlay, () => response1,
                                       onlyDisplayIfTrue: this.GetTrashDestination().Cards.Any(c => IsDjinn(c)));

                //Option 2: Draw 2 cards.
                var response2 = base.DrawCards(this.DecisionMaker, 2);
                var op2       = new Function(this.DecisionMaker, $"Draw 2 cards", SelectionType.DrawCard, () => response2);

                //Execute
                var options = new Function[] { op1, op2 };
                var selectFunctionDecision = new SelectFunctionDecision(base.GameController, this.DecisionMaker, options, false, cardSource: base.GetCardSource());
                coroutine = base.GameController.SelectAndPerformFunction(selectFunctionDecision);
                if (base.UseUnityCoroutines)
                {
                    yield return(base.GameController.StartCoroutine(coroutine));
                }
                else
                {
                    base.GameController.ExhaustCoroutine(coroutine);
                }
            }
            coroutine = base.GameController.SelectAndUsePower(this.DecisionMaker, cardSource: GetCardSource());
            if (base.UseUnityCoroutines)
            {
                yield return(base.GameController.StartCoroutine(coroutine));
            }
            else
            {
                base.GameController.ExhaustCoroutine(coroutine);
            }


            yield break;
        }
        public override IEnumerator Play()
        {
            //{Titan} deals 1 target 3 melee damage.
            List <SelectCardDecision> storedTarget = new List <SelectCardDecision>();
            IEnumerator coroutine = base.GameController.SelectTargetsAndDealDamage(base.HeroTurnTakerController, new DamageSource(base.GameController, base.CharacterCard), 3, DamageType.Melee, 1, false, 1, storedResultsDecisions: storedTarget, cardSource: base.GetCardSource());

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

            //If Titanform is in play...
            if (base.GetTitanform().IsInPlayAndNotUnderCard&& storedTarget.Any() && storedTarget.FirstOrDefault().SelectedCard.Location.IsInPlayAndNotUnderCard)
            {
                //you may discard a card...
                List <DiscardCardAction> storedResult = new List <DiscardCardAction>();
                coroutine = base.SelectAndDiscardCards(base.HeroTurnTakerController, 1, true, storedResults: storedResult);
                if (base.UseUnityCoroutines)
                {
                    yield return(base.GameController.StartCoroutine(coroutine));
                }
                else
                {
                    base.GameController.ExhaustCoroutine(coroutine);
                }

                //...to search your deck and trash for a copy of the card Immolate and play it next to that target. If you searched your deck, shuffle it.
                if (base.DidDiscardCards(storedResult))
                {
                    List <SelectCardDecision> selectedImmolate = new List <SelectCardDecision>();
                    IEnumerable <Card>        immolates        = base.FindCardsWhere(new LinqCardCriteria((Card c) => c.Identifier == "Immolate" && (c.IsInTrash || c.IsInDeck)));
                    bool immolateInDeck  = FindCardsWhere((Card c) => c.Location == TurnTaker.Deck && c.Identifier == "Immolate").Any();
                    bool immolateInTrash = FindCardsWhere((Card c) => c.Location == TurnTaker.Trash && c.Identifier == "Immolate").Any();
                    var  searches        = new List <Function>
                    {
                        new Function(HeroTurnTakerController, "Search deck", SelectionType.SearchDeck, () => SearchLocationAndPlayImmolateByTarget(TurnTaker.Deck, storedTarget.FirstOrDefault().SelectedCard), immolateInDeck, $"{TurnTaker.Name} searches their deck for Immolate."),
                        new Function(HeroTurnTakerController, "Search trash", SelectionType.SearchTrash, () => SearchLocationAndPlayImmolateByTarget(TurnTaker.Trash, storedTarget.FirstOrDefault().SelectedCard), immolateInTrash, $"{TurnTaker.Name} searches their trash for Immolate.")
                    };

                    var decision = new SelectFunctionDecision(GameController, HeroTurnTakerController, searches, false, noSelectableFunctionMessage: "There were no more copies of Immolate to search for.", cardSource: GetCardSource());

                    coroutine = GameController.SelectAndPerformFunction(decision);
                    if (base.UseUnityCoroutines)
                    {
                        yield return(base.GameController.StartCoroutine(coroutine));
                    }
                    else
                    {
                        base.GameController.ExhaustCoroutine(coroutine);
                    }
                }
            }
            yield break;
        }
Exemplo n.º 15
0
        private IEnumerator DestroyedResponse(DestroyCardAction destroy)
        {
            List <Card> revealedCards      = new List <Card>();
            IEnumerator revealCardsRoutine = base.GameController.RevealCards(this.TurnTakerController, base.TurnTaker.Deck,
                                                                             CardsToReveal, revealedCards, revealedCardDisplay: RevealedCardDisplay.ShowRevealedCards, cardSource: base.GetCardSource());

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

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

            IEnumerable <Function> choices = new[]
            {
                new Function(base.DecisionMaker, "Discard Card", SelectionType.DiscardCard,
                             () => base.GameController.MoveCard(base.DecisionMaker, revealedCards.First(), base.TurnTaker.Trash, showMessage: true, cardSource: GetCardSource())),

                new Function(base.DecisionMaker, "Replace Card", SelectionType.MoveCardOnDeck,
                             () => base.GameController.MoveCard(base.DecisionMaker, revealedCards.First(), base.TurnTaker.Deck, showMessage: true, cardSource: GetCardSource()))
            };

            List <MoveCardAction> virusMoveAction = new List <MoveCardAction>();

            if (IsSuperVirusInPlay() && IsVirus(revealedCards.First()))
            {
                choices = choices.Concat(new[]
                {
                    new Function(base.DecisionMaker, "Put under Super Virus", SelectionType.MoveCardToUnderCard,
                                 () => base.GameController.MoveCard(base.DecisionMaker, revealedCards.First(),
                                                                    GetSuperVirusCard().UnderLocation, storedResults: virusMoveAction, showMessage: true, cardSource: GetCardSource())),
                });
            }

            SelectFunctionDecision selectFunctionDecision
                = new SelectFunctionDecision(base.GameController, this.DecisionMaker, choices, false, associatedCards: revealedCards, cardSource: base.GetCardSource());

            IEnumerator routine = base.GameController.SelectAndPerformFunction(selectFunctionDecision);

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

            yield break;
        }
        public IEnumerator ModifyDamageResponse(DealDamageAction dda)
        {
            // "... you may increase or reduce that damage by 1."
            MyDamageAction = dda;
            if (base.GameController.PretendMode || dda.Target != MyTarget)
            {
                IEnumerable <Function> options = new Function[2]
                {
                    new Function(base.HeroTurnTakerController, "Increase by 1", SelectionType.IncreaseDamage, IncreaseFunction),
                    new Function(base.HeroTurnTakerController, "Reduce by 1", SelectionType.ReduceDamageTaken, ReduceFunction)
                };
                List <SelectFunctionDecision> decisions = new List <SelectFunctionDecision>();
                SelectFunctionDecision        choice    = new SelectFunctionDecision(base.GameController, base.HeroTurnTakerController, options, true, dda, cardSource: GetCardSource());
                IEnumerator chooseCoroutine             = base.GameController.SelectAndPerformFunction(choice, decisions);
                if (base.UseUnityCoroutines)
                {
                    yield return(base.GameController.StartCoroutine(chooseCoroutine));
                }
                else
                {
                    base.GameController.ExhaustCoroutine(chooseCoroutine);
                }
                if (decisions.Count() > 0)
                {
                    MySelection = decisions.FirstOrDefault();
                }
                MyTarget = dda.Target;
            }
            else if (MySelection.SelectedFunction != null)
            {
                IEnumerator executeCoroutine = MySelection.SelectedFunction.FunctionToExecute();
                if (base.UseUnityCoroutines)
                {
                    yield return(base.GameController.StartCoroutine(executeCoroutine));
                }
                else
                {
                    base.GameController.ExhaustCoroutine(executeCoroutine);
                }
            }

            if (!base.GameController.PretendMode)
            {
                MySelection = null;
                MyTarget    = null;
            }
            yield break;
        }
Exemplo n.º 17
0
        public IEnumerator DiscardOrRemoveChoice(TurnTaker tt, List <MoveCardAction> moveResults)
        {
            // "... reveals the top card of their deck. They may discard it or remove it from the game."
            HeroTurnTakerController player          = base.GameController.FindHeroTurnTakerController(tt.ToHero());
            List <Card>             revealed        = new List <Card>();
            IEnumerator             revealCoroutine = base.GameController.RevealCards(player, tt.Deck, 1, revealed, revealedCardDisplay: RevealedCardDisplay.ShowRevealedCards, cardSource: GetCardSource());

            if (base.UseUnityCoroutines)
            {
                yield return(base.GameController.StartCoroutine(revealCoroutine));
            }
            else
            {
                base.GameController.ExhaustCoroutine(revealCoroutine);
            }
            Card revealedCard = GetRevealedCard(revealed);

            if (revealedCard != null)
            {
                List <Function> options = new List <Function>();
                options.Add(new Function(player, "Discard it", SelectionType.DiscardCard, () => base.GameController.DiscardCard(player, revealedCard, null, responsibleTurnTaker: tt, cardSource: GetCardSource())));
                options.Add(new Function(player, "Remove it from the game", SelectionType.RemoveCardFromGame, () => base.GameController.MoveCard(player, revealedCard, tt.OutOfGame, showMessage: true, responsibleTurnTaker: tt, storedResults: moveResults, cardSource: GetCardSource())));
                List <Card> relevantCards = new List <Card>();
                relevantCards.Add(revealedCard);
                SelectFunctionDecision choice          = new SelectFunctionDecision(base.GameController, player, options, false, associatedCards: relevantCards, cardSource: GetCardSource());
                IEnumerator            chooseCoroutine = base.GameController.SelectAndPerformFunction(choice, null, relevantCards);
                if (base.UseUnityCoroutines)
                {
                    yield return(base.GameController.StartCoroutine(chooseCoroutine));
                }
                else
                {
                    base.GameController.ExhaustCoroutine(chooseCoroutine);
                }
            }
            IEnumerator cleanCoroutine = CleanupRevealedCards(tt.Revealed, tt.Deck);

            if (base.UseUnityCoroutines)
            {
                yield return(base.GameController.StartCoroutine(cleanCoroutine));
            }
            else
            {
                base.GameController.ExhaustCoroutine(cleanCoroutine);
            }
            yield break;
        }
Exemplo n.º 18
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;
        }
Exemplo n.º 19
0
        public override IEnumerator Play()
        {
            // "Search your deck or trash for an Ongoing card and put it into play. Shuffle your deck."
            IEnumerator searchCoroutine = SearchForCards(base.HeroTurnTakerController, true, true, 1, 1, new LinqCardCriteria((Card c) => c.DoKeywordsContain("ongoing"), "Ongoing"), true, false, false, shuffleAfterwards: true);

            if (base.UseUnityCoroutines)
            {
                yield return(base.GameController.StartCoroutine(searchCoroutine));
            }
            else
            {
                base.GameController.ExhaustCoroutine(searchCoroutine);
            }
            // "You may destroy a target with 1 HP. If you do, you may play a card or destroy an Ongoing card."
            List <DestroyCardAction> destroyResults = new List <DestroyCardAction>();
            IEnumerator destroyTargetCoroutine      = base.GameController.SelectAndDestroyCard(base.HeroTurnTakerController, TargetWithOneHP(), true, destroyResults, base.Card, GetCardSource());

            if (base.UseUnityCoroutines)
            {
                yield return(base.GameController.StartCoroutine(destroyTargetCoroutine));
            }
            else
            {
                base.GameController.ExhaustCoroutine(destroyTargetCoroutine);
            }
            if (destroyResults != null && destroyResults.Count > 0 && DidDestroyCard(destroyResults.First()))
            {
                List <Function> options = new List <Function>();
                options.Add(new Function(base.HeroTurnTakerController, "Play a card", SelectionType.PlayCard, () => SelectAndPlayCardFromHand(base.HeroTurnTakerController, associateCardSource: true), onlyDisplayIfTrue: base.HeroTurnTaker.HasCardsInHand));
                options.Add(new Function(base.HeroTurnTakerController, "Destroy an Ongoing card", SelectionType.DestroyCard, () => base.GameController.SelectAndDestroyCard(base.HeroTurnTakerController, new LinqCardCriteria((Card c) => c.DoKeywordsContain("ongoing"), "Ongoing"), true, responsibleCard: base.Card, cardSource: GetCardSource()), onlyDisplayIfTrue: FindCardsWhere((Card c) => c.DoKeywordsContain("ongoing"), visibleToCard: GetCardSource()).Count() > 0));
                SelectFunctionDecision choice = new SelectFunctionDecision(base.GameController, base.HeroTurnTakerController, options, true, cardSource: GetCardSource());
                IEnumerator            playDestroyCoroutine = base.GameController.SelectAndPerformFunction(choice);
                if (base.UseUnityCoroutines)
                {
                    yield return(base.GameController.StartCoroutine(playDestroyCoroutine));
                }
                else
                {
                    base.GameController.ExhaustCoroutine(playDestroyCoroutine);
                }
            }
            yield break;
        }
        public override IEnumerator Play()
        {
            // "Return all Goalposts cards in your play area to your hand."
            IEnumerator returnCoroutine = base.GameController.MoveCards(base.TurnTakerController, base.GameController.FindCardsWhere(new LinqCardCriteria((Card c) => IsRelay(c) && c.IsInPlayAndHasGameText && c.Location.HighestRecursiveLocation.OwnerTurnTaker == base.TurnTaker, "Relay cards in " + base.TurnTaker.Name + "'s play area", false, false, "Relay card in " + base.TurnTaker.Name + "'s play area", "Relay cards in " + base.TurnTaker.Name + "'s play area"), visibleToCard: GetCardSource()), (Card c) => new MoveCardDestination(base.HeroTurnTaker.Hand), responsibleTurnTaker: base.TurnTaker, cardSource: GetCardSource());

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

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

            options.Add(new Function(base.HeroTurnTakerController, "Play a Relay card", SelectionType.PlayCard, () => SelectAndPlayCardFromHand(base.HeroTurnTakerController, cardCriteria: new LinqCardCriteria((Card c) => IsRelay(c), "Relay")), onlyDisplayIfTrue: base.HeroTurnTaker.Hand.Cards.Any((Card c) => IsRelay(c))));
            options.Add(new Function(base.HeroTurnTakerController, "Draw 3 cards", SelectionType.DrawCard, () => base.DrawCards(base.HeroTurnTakerController, 3, 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);
            }
            yield break;
        }
Exemplo n.º 21
0
        public override IEnumerator Play()
        {
            //LadyOfTheWood deals 1 target 3 fire damage or up to 3 targets 1 lightning damage each.
            List <Function> list = new List <Function>();

            list.Add(new Function(this.DecisionMaker, "Deal 1 target 3 fire damage", SelectionType.DealDamage, () => base.GameController.SelectTargetsAndDealDamage(this.DecisionMaker, new DamageSource(base.GameController, base.CharacterCard), 3, DamageType.Fire, new int?(1), false, new int?(1), false, false, false, null, null, null, null, null, false, null, null, false, null, base.GetCardSource(null)), null, null, "Deal 1 target 3 fire damage"));
            list.Add(new Function(this.DecisionMaker, "Deal up to 3 targets 1 lightning damage each", SelectionType.DealDamage, () => base.GameController.SelectTargetsAndDealDamage(this.DecisionMaker, new DamageSource(base.GameController, base.CharacterCard), 1, DamageType.Lightning, new int?(3), false, new int?(0), false, false, false, null, null, null, null, null, false, null, null, false, null, base.GetCardSource(null)), new bool?(true), null, "Deal up to 3 targets 1 lightning damage each"));
            SelectFunctionDecision selectFunction = new SelectFunctionDecision(base.GameController, this.DecisionMaker, list, false, null, null, null, base.GetCardSource(null));
            IEnumerator            coroutine      = base.GameController.SelectAndPerformFunction(selectFunction, null, null);

            if (base.UseUnityCoroutines)
            {
                yield return(base.GameController.StartCoroutine(coroutine));
            }
            else
            {
                base.GameController.ExhaustCoroutine(coroutine);
            }
            yield break;
        }
Exemplo n.º 22
0
        private IEnumerator OldResponse(DealDamageAction action)
        {
            HeroTurnTakerController target    = base.FindHeroTurnTakerController(action.Target.Owner.ToHero());
            List <Function>         functions = new List <Function> {
                new Function(target, "increase this damage by 1", SelectionType.IncreaseDamage, () => base.GameController.IncreaseDamage(action, 1, cardSource: base.GetCardSource())),
                new Function(target, "discard a card", SelectionType.DiscardCard, () => base.GameController.SelectAndDiscardCards(target, new int?(1), false, new int?(1), cardSource: base.GetCardSource()), target.HasCardsInHand)
            };
            SelectFunctionDecision selectFunction = new SelectFunctionDecision(base.GameController, target, functions, false, cardSource: base.GetCardSource(null));
            IEnumerator            coroutine      = base.GameController.SelectAndPerformFunction(selectFunction);

            if (base.UseUnityCoroutines)
            {
                yield return(base.GameController.StartCoroutine(coroutine));
            }
            else
            {
                base.GameController.ExhaustCoroutine(coroutine);
            }
            yield break;
        }
        private IEnumerator PutIntoPlayOrHand(Card cardToMove, List <MoveCardAction> moveCardStorage)
        {
            var functions = new List <Function>
            {
                new Function(DecisionMaker, $"Put {cardToMove.Title} in hand", SelectionType.MoveCardToHand, () => GameController.MoveCard(FindHeroTurnTakerController(cardToMove.Owner.ToHero()), cardToMove, cardToMove.Owner.ToHero().Hand, responsibleTurnTaker: DecisionMaker.TurnTaker, storedResults: moveCardStorage, cardSource: GetCardSource())),
                new Function(DecisionMaker, $"Put {cardToMove.Title} in play", SelectionType.PutIntoPlay, () => GameController.MoveCard(FindHeroTurnTakerController(cardToMove.Owner.ToHero()), cardToMove, cardToMove.Owner.PlayArea, isPutIntoPlay: true, responsibleTurnTaker: DecisionMaker.TurnTaker, storedResults: moveCardStorage, cardSource: GetCardSource()))
            };
            var         selectFunction = new SelectFunctionDecision(GameController, DecisionMaker, functions, optional: true, cardSource: GetCardSource());
            IEnumerator coroutine      = GameController.SelectAndPerformFunction(selectFunction);

            if (UseUnityCoroutines)
            {
                yield return(GameController.StartCoroutine(coroutine));
            }
            else
            {
                GameController.ExhaustCoroutine(coroutine);
            }
            yield break;
        }
Exemplo n.º 24
0
        public override IEnumerator UsePower(int index = 0)
        {
            //Necro deals 1 target 1 toxic damage or 1 Undead target 2 toxic damage.
            List <Function> list = new List <Function>();

            list.Add(new Function(this.DecisionMaker, "Deal 1 target 1 toxic damage", SelectionType.DealDamage, () => base.GameController.SelectTargetsAndDealDamage(this.DecisionMaker, new DamageSource(base.GameController, base.CharacterCard), 1, DamageType.Toxic, new int?(1), false, new int?(1), false, false, false, null, null, null, null, null, false, null, null, false, null, base.GetCardSource(null)), null, null, "Deal 1 target 1 toxic damage"));
            list.Add(new Function(this.DecisionMaker, "Deal 1 Undead target 2 toxic damage", SelectionType.DealDamage, () => base.GameController.SelectTargetsAndDealDamage(this.DecisionMaker, new DamageSource(base.GameController, base.CharacterCard), 2, DamageType.Toxic, new int?(1), false, new int?(1), false, false, false, (Card c) => this.IsUndead(c), null, null, null, null, false, null, null, false, null, base.GetCardSource(null)), new bool?(true), null, "Deal 1 undead target 2 toxic damage"));
            SelectFunctionDecision selectFunction = new SelectFunctionDecision(base.GameController, this.DecisionMaker, list, false, null, null, null, base.GetCardSource(null));
            IEnumerator            coroutine      = base.GameController.SelectAndPerformFunction(selectFunction, null, null);

            if (base.UseUnityCoroutines)
            {
                yield return(base.GameController.StartCoroutine(coroutine));
            }
            else
            {
                base.GameController.ExhaustCoroutine(coroutine);
            }
            yield break;
        }
Exemplo n.º 25
0
        public override IEnumerator Play()
        {
            IEnumerator coroutine;

            // Select type.
            List <Function> list = new List <Function>
            {
                new Function(this.DecisionMaker, "Prefix", SelectionType.RevealTopCardOfDeck,
                             () => this.RevealCards_MoveMatching_ReturnNonMatchingCards(this.DecisionMaker, this.HeroTurnTaker.Deck, false, false, true, new LinqCardCriteria((Card c) => c.DoKeywordsContain("prefix"), "prefix"), 2, revealedCardDisplay: RevealedCardDisplay.ShowMatchingCards, shuffleReturnedCards: true),
                             this.HeroTurnTaker.Deck.Cards.Count() > 0),
                new Function(this.DecisionMaker, "Essence", SelectionType.RevealTopCardOfDeck,
                             () => this.RevealCards_MoveMatching_ReturnNonMatchingCards(this.DecisionMaker, this.HeroTurnTaker.Deck, false, false, true, new LinqCardCriteria((Card c) => c.DoKeywordsContain("essence"), "essence"), 2, revealedCardDisplay: RevealedCardDisplay.ShowMatchingCards, shuffleReturnedCards: true),
                             this.HeroTurnTaker.Deck.Cards.Count() > 0),
                new Function(this.DecisionMaker, "Suffix", SelectionType.RevealTopCardOfDeck,
                             () => this.RevealCards_MoveMatching_ReturnNonMatchingCards(this.DecisionMaker, this.HeroTurnTaker.Deck, false, false, true, new LinqCardCriteria((Card c) => c.DoKeywordsContain("suffix"), "suffix"), 2, revealedCardDisplay: RevealedCardDisplay.ShowMatchingCards, shuffleReturnedCards: true),
                             this.HeroTurnTaker.Deck.Cards.Count() > 0),
            };

            SelectFunctionDecision selectFunction = new SelectFunctionDecision(this.GameController, this.DecisionMaker, list, false, null, this.TurnTaker.Name + " does not have any cards in their deck, so" + this.Card.AlternateTitleOrTitle + " has no effect.", null, this.GetCardSource(null));

            coroutine = this.GameController.SelectAndPerformFunction(selectFunction, null, null);
            if (this.UseUnityCoroutines)
            {
                yield return(this.GameController.StartCoroutine(coroutine));
            }
            else
            {
                this.GameController.ExhaustCoroutine(coroutine);
            }

            // You may play card.
            coroutine = this.SelectAndPlayCardFromHand(this.DecisionMaker, true);
            if (this.UseUnityCoroutines)
            {
                yield return(this.GameController.StartCoroutine(coroutine));
            }
            else
            {
                this.GameController.ExhaustCoroutine(coroutine);
            }
        }
        public override IEnumerator UsePower(int index = 0)
        {
            List <Function> list = new List <Function>();

            //Discard the top card of your deck...
            list.Add(new Function(this.DecisionMaker, "Discard the top card of your deck", SelectionType.DiscardFromDeck, () => base.DiscardCardsFromTopOfDeck(this.TurnTakerController, 1, false, null, false, this.TurnTaker)));
            //...or put up to 2 trick cards with the same name from your trash into play.
            list.Add(new Function(this.DecisionMaker, "Put up to 2 trick cards with the same name from your trash into play", SelectionType.PlayCard, () => this.PlayTricksFromTrash()));
            SelectFunctionDecision selectFunction = new SelectFunctionDecision(base.GameController, this.DecisionMaker, list, false, null, null, null, base.GetCardSource(null));
            IEnumerator            coroutine3     = base.GameController.SelectAndPerformFunction(selectFunction, null, null);

            if (base.UseUnityCoroutines)
            {
                yield return(base.GameController.StartCoroutine(coroutine3));
            }
            else
            {
                base.GameController.ExhaustCoroutine(coroutine3);
            }
            yield break;
        }
        private IEnumerator MaybeMoveInsteadResponse(DestroyCardAction dc)
        {
            Card card      = dc.CardToDestroy.Card;
            var  functions = new List <Function>
            {
                new Function(DecisionMaker, $"Put {card.Title} on top of its deck", SelectionType.MoveCardOnDeck, () => CancelDestructionAndMoveCard(dc, card.NativeDeck)),
                new Function(DecisionMaker, $"Put {card.Title} on the bottom of its deck", SelectionType.MoveCardOnBottomOfDeck, () => CancelDestructionAndMoveCard(dc, card.NativeDeck, true))
            };
            var         selectFunction = new SelectFunctionDecision(GameController, DecisionMaker, functions, optional: true, associatedCards: new Card[] { card }, cardSource: GetCardSource());
            IEnumerator coroutine      = GameController.SelectAndPerformFunction(selectFunction);

            if (UseUnityCoroutines)
            {
                yield return(GameController.StartCoroutine(coroutine));
            }
            else
            {
                GameController.ExhaustCoroutine(coroutine);
            }
            yield break;
        }
Exemplo n.º 28
0
        public override IEnumerator UsePower(int index = 0)
        {
            //"{Impact} regains 1 HP, or the next time one of your ongoing cards is destroyed, play it."
            int numHPGain = GetPowerNumeral(0, 1);
            var functions = new Function[]
            {
                new Function(DecisionMaker, $"Regain {numHPGain} HP", SelectionType.GainHP, () => GameController.GainHP(this.CharacterCard, numHPGain, cardSource: GetCardSource())),
                new Function(DecisionMaker, "The next time one of your ongoing cards is destroyed, play it.", SelectionType.PlayCard, AddOngoingDestructionTrigger)
            };
            var         selectFunction = new SelectFunctionDecision(GameController, DecisionMaker, functions, false, cardSource: GetCardSource());;
            IEnumerator coroutine      = GameController.SelectAndPerformFunction(selectFunction);

            if (base.UseUnityCoroutines)
            {
                yield return(base.GameController.StartCoroutine(coroutine));
            }
            else
            {
                base.GameController.ExhaustCoroutine(coroutine);
            }
            yield break;
        }
Exemplo n.º 29
0
        public override IEnumerator Play()
        {
            //"Draw a card, or search your trash and deck for a constellation card, put it into play, then shuffle your deck."
            var httc       = HeroTurnTakerController;
            var actionList = new List <Function>()
            {
                new Function(httc, "Draw a card", SelectionType.DrawCard, () => DrawCard(HeroTurnTaker, false), httc != null && CanDrawCards(httc), $"{TurnTaker.Name} has no constellations in their deck or trash, so they must draw a card."),
                new Function(httc, "Search for a constellation", SelectionType.SearchLocation, () => SearchForConstellationAndShuffleDeck(httc), httc != null && HasFindableConstellations(httc), $"{TurnTaker.Name} cannot draw any cards, so they must search for a constellation.")
            };

            SelectFunctionDecision selectFunction = new SelectFunctionDecision(GameController, httc, actionList, false,
                                                                               noSelectableFunctionMessage: $"{TurnTaker.Name} can neither draw nor search for a constellation, so nothing happens.",
                                                                               cardSource: GetCardSource());
            IEnumerator drawOrSearch = GameController.SelectAndPerformFunction(selectFunction);

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

            //"You may play a card."
            IEnumerator mayPlayCard = SelectAndPlayCardFromHand(httc);

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

            yield break;
        }
        public override IEnumerator UsePower(int index = 0)
        {
            //Play or draw a card. If you played a trick this way, draw a card.
            List <PlayCardAction>  playedCard      = new List <PlayCardAction>();
            IEnumerable <Function> functionChoices = new Function[]
            {
                //Play a card...
                new Function(base.HeroTurnTakerController, "Play a card", SelectionType.PlayCard, () => base.GameController.SelectAndPlayCardFromHand(base.HeroTurnTakerController, false, playedCard, cardSource: base.GetCardSource())),

                //...or draw a card.
                new Function(base.HeroTurnTakerController, "Draw a card", SelectionType.DrawCard, () => base.DrawCard())
            };
            SelectFunctionDecision selectFunction = new SelectFunctionDecision(base.GameController, base.HeroTurnTakerController, functionChoices, false);
            IEnumerator            coroutine      = base.GameController.SelectAndPerformFunction(selectFunction);

            if (base.UseUnityCoroutines)
            {
                yield return(base.GameController.StartCoroutine(coroutine));
            }
            else
            {
                base.GameController.ExhaustCoroutine(coroutine);
            }
            //If you played a trick this way, draw a card.
            if (playedCard.Any() && playedCard.FirstOrDefault().WasCardPlayed&& playedCard.FirstOrDefault().CardToPlay.DoKeywordsContain("trick"))
            {
                coroutine = base.DrawCard();
                if (base.UseUnityCoroutines)
                {
                    yield return(base.GameController.StartCoroutine(coroutine));
                }
                else
                {
                    base.GameController.ExhaustCoroutine(coroutine);
                }
            }
            yield break;
        }