Пример #1
0
        public IEnumerator PreventDrawsThisTurnEffect(PhaseChangeAction _, OnPhaseChangeStatusEffect sourceEffect)
        {
            System.Console.WriteLine("### DEBUG ### - ChokingInspiration.PreventDrawsThisTurnEffect triggered");

            //The status effect must last slightly longer than the triggering phase action, or the effect will not fire.
            HeroTurnTaker             htt    = sourceEffect.TurnTakerCriteria.IsSpecificTurnTaker.ToHero();
            OnPhaseChangeStatusEffect effect = new OnPhaseChangeStatusEffect(CardWithoutReplacements, nameof(ResumeDrawEffect), $"{htt.Name} cannot draw cards.", new TriggerType[] { TriggerType.Hidden }, base.Card);

            effect.TurnTakerCriteria.IsSpecificTurnTaker = htt;
            effect.TurnPhaseCriteria.Phase = Phase.End;
            effect.CanEffectStack          = true;
            effect.UntilThisTurnIsOver(Game);

            //We secretly set a property on the victim's character card to indicate that they can't draw cards.
            //A CannotDrawCards query on DendronCharacterCardController actually makes this happen
            GameController.AddCardPropertyJournalEntry(htt.CharacterCards.First(), PreventDrawPropertyKey, true);

            IEnumerator coroutine = base.AddStatusEffect(effect);

            if (base.UseUnityCoroutines)
            {
                yield return(base.GameController.StartCoroutine(coroutine));
            }
            else
            {
                base.GameController.ExhaustCoroutine(coroutine);
            }
            yield break;
        }
#pragma warning restore IDE0060 // Remove unused parameter

        public IEnumerator MoveAndFlipResponse(HeroTurnTaker hero, Card card)
        {
            HeroTurnTakerController decisionMaker = this.FindHeroTurnTakerController(hero);
            IEnumerator             coroutine;

            if (card.IsMissionCard)
            {
                coroutine = this.GameController.SendMessageAction("Mission cards cannot be flipped face-down, so it is played as normal.", Priority.Low, this.GetCardSource());
                if (this.UseUnityCoroutines)
                {
                    yield return(this.GameController.StartCoroutine(coroutine));
                }
                else
                {
                    this.GameController.ExhaustCoroutine(coroutine);
                }
            }

            coroutine = this.GameController.MoveCard(decisionMaker, card, hero.PlayArea, false, false, card.IsMissionCard, responsibleTurnTaker: decisionMaker.TurnTaker, flipFaceDown: !card.IsMissionCard, cardSource: this.GetCardSource());
            if (this.UseUnityCoroutines)
            {
                yield return(this.GameController.StartCoroutine(coroutine));
            }
            else
            {
                this.GameController.ExhaustCoroutine(coroutine);
            }
        }
Пример #3
0
        public IEnumerator MoveItToTheBottomOfItsDeckResponse(DestroyCardAction d, HeroTurnTaker hero, StatusEffect effect, int[] powerNumerals = null)
        {
            //...you may move it to the bottom of its deck.
            if (d.PostDestroyDestinationCanBeChanged)
            {
                var storedResults            = new List <YesNoCardDecision>();
                HeroTurnTakerController httc = null;
                if (hero != null)
                {
                    httc = FindHeroTurnTakerController(hero);
                }
                var e = this.GameController.MakeYesNoCardDecision(httc, SelectionType.MoveCardToHand, d.CardToDestroy.Card, storedResults: storedResults, cardSource: GetCardSource());
                if (UseUnityCoroutines)
                {
                    yield return(this.GameController.StartCoroutine(e));
                }
                else
                {
                    this.GameController.ExhaustCoroutine(e);
                }

                if (DidPlayerAnswerYes(storedResults))
                {
                    var nativeDeck = d.CardToDestroy.Card.NativeDeck;
                    var hand       = nativeDeck.OwnerTurnTaker.ToHero().Hand;
                    d.SetPostDestroyDestination(hand, false, storedResults.CastEnumerable <YesNoCardDecision, IDecision>(), cardSource: GetCardSource());
                }
            }
        }
Пример #4
0
        public override IEnumerator UsePower(int index = 0)
        {
            HeroTurnTaker hero = null;
            string        turnTakerName;

            if (this.TurnTaker.IsHero)
            {
                hero          = this.TurnTaker.ToHero();
                turnTakerName = this.TurnTaker.Name;
            }
            else
            {
                turnTakerName = this.Card.Title;
            }

            // The next time a hero target is destroyed, you may move it to the owner's hand.
            WhenCardIsDestroyedStatusEffect effect = new WhenCardIsDestroyedStatusEffect(this.CardWithoutReplacements, "MoveItToTheBottomOfItsDeckResponse", "The next time a hero target is destroyed, " + turnTakerName + " may move it to its owner's hand.", new TriggerType[] { TriggerType.MoveCard, TriggerType.ChangePostDestroyDestination }, hero, this.Card);

            effect.CardDestroyedCriteria.IsHero   = true;
            effect.CardDestroyedCriteria.IsTarget = true;
            effect.CanEffectStack = false;
            effect.Priority       = StatusEffectPriority.Medium;
            effect.PostDestroyDestinationMustBeChangeable = true;
            effect.NumberOfUses = 1;

            return(AddStatusEffect(effect));
        }
Пример #5
0
        public override TurnTakerController AskIfTurnTakerControllerIsReplaced(TurnTakerController ttc, CardSource cardSource)
        {
            //This is what handles the "as if it were their card" part of the instructions
            //Since CardController.CharacterCard ultimately goes through TurnTakerController.CharacterCard,
            //this usually handles swapping out hero names too.

            HeroTurnTakerController receiverTTC = _receiverController;
            HeroTurnTaker           receiver    = receiverTTC.HeroTurnTaker;

            if (cardSource != null && cardSource.Card.Owner != receiver && cardSource.AllowReplacements)
            {
                Card cardWithoutReplacements = cardSource.CardController.CardWithoutReplacements;
                TurnTakerController ttcWithoutReplacements = FindCardController(_passedCard).TurnTakerControllerWithoutReplacements;

                if (ttc == ttcWithoutReplacements)
                {
                    if (cardWithoutReplacements == _passedCard)
                    {
                        return(receiverTTC);
                    }
                    if (cardSource.CardSourceChain.Any((CardSource cs) => cs.CardController == this))
                    {
                        return(receiverTTC);
                    }
                }
            }
            return(null);
        }
Пример #6
0
        public IEnumerator DealDamageAndDrawResponse(DestroyCardAction dca, HeroTurnTaker htt, WhenCardIsDestroyedStatusEffect effect, int[] powerNumerals = null)
        {
            int target = powerNumerals?[0] ?? 1;
            int amount = powerNumerals?[1] ?? 1;

            if (dca.WasCardDestroyed && effect.NumberOfUses == null)
            {
                effect.NumberOfUses = 1;

                //1 hero deals a target 1 fire damage and draws a card.
                List <SelectCardDecision> storedResults = new List <SelectCardDecision>();
                IEnumerator coroutine = base.GameController.SelectCardAndStoreResults(DecisionMaker, SelectionType.CardToDealDamage,
                                                                                      new LinqCardCriteria((Card c) => c.IsInPlay && c.IsHeroCharacterCard && !c.IsIncapacitatedOrOutOfGame && GameController.IsCardVisibleToCardSource(c, GetCardSource()), "hero character", useCardsSuffix: false),
                                                                                      storedResults, false,
                                                                                      cardSource: GetCardSource());
                if (base.UseUnityCoroutines)
                {
                    yield return(base.GameController.StartCoroutine(coroutine));
                }
                else
                {
                    base.GameController.ExhaustCoroutine(coroutine);
                }

                if (DidSelectCard(storedResults))
                {
                    Card selectedCard = GetSelectedCard(storedResults);
                    coroutine = base.GameController.SelectTargetsAndDealDamage(DecisionMaker, new DamageSource(base.GameController, selectedCard), amount, DamageType.Fire, target, optional: false, target, cardSource: GetCardSource(effect));
                    if (base.UseUnityCoroutines)
                    {
                        yield return(base.GameController.StartCoroutine(coroutine));
                    }
                    else
                    {
                        base.GameController.ExhaustCoroutine(coroutine);
                    }

                    coroutine = DrawCard(selectedCard.Owner.ToHero());
                    if (base.UseUnityCoroutines)
                    {
                        yield return(base.GameController.StartCoroutine(coroutine));
                    }
                    else
                    {
                        base.GameController.ExhaustCoroutine(coroutine);
                    }
                }

                coroutine = GameController.ExpireStatusEffect(effect, GetCardSource());
                if (base.UseUnityCoroutines)
                {
                    yield return(base.GameController.StartCoroutine(coroutine));
                }
                else
                {
                    base.GameController.ExhaustCoroutine(coroutine);
                }
            }
            yield break;
        }
 public IEnumerator RescueOngoingResponse(DestroyCardAction dc, HeroTurnTaker _1, StatusEffect _2, int[] _3 = null)
 {
     if (dc.PostDestroyDestinationCanBeChanged && dc.CardToDestroy != null)
     {
         dc.PostDestroyDestinationCanBeChanged = false;
         dc.AddAfterDestroyedAction(() => GameController.MoveCard(DecisionMaker, dc.CardToDestroy.Card, dc.CardToDestroy.HeroTurnTaker.Hand, cardSource: GetCardSource()), this);
     }
     yield break;
 }
Пример #8
0
        public override IEnumerator Play()
        {
            List <DiscardCardAction> storedResults = new List <DiscardCardAction>();
            IEnumerator discardCardRoutine         = this.GameController.EachPlayerDiscardsCards(0, 1, storedResults, cardSource: GetCardSource());

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

            foreach (DiscardCardAction dca in storedResults.Where(dca => dca.WasCardDiscarded))
            {
                Debug.WriteLine("DEBUG: card was discarded");

                List <YesNoCardDecision> storedYesNoResults = new List <YesNoCardDecision>();
                HeroTurnTaker            owner = dca.CardToDiscard.Owner.ToHero();
                HeroTurnTakerController  httc  = FindHeroTurnTakerController(owner);
                //ask player if they want to reveal cards
                IEnumerator coroutine = base.GameController.MakeYesNoCardDecision(httc,
                                                                                  SelectionType.RevealCardsFromDeck, base.Card, storedResults: storedYesNoResults, cardSource: GetCardSource());
                if (base.UseUnityCoroutines)
                {
                    yield return(base.GameController.StartCoroutine(coroutine));
                }
                else
                {
                    base.GameController.ExhaustCoroutine(coroutine);
                }

                if (base.DidPlayerAnswerYes(storedYesNoResults))
                {
                    //reveal the top 3 cards of their deck, put 1 in their hand, 1 on the bottom of their deck, and 1 in their trash.
                    IEnumerator orderedDestinationsRoutine = this.CustomizedRevealCardsFromDeckToMoveToOrderedDestinations(httc, owner.Deck, new[]
                    {
                        new MoveCardDestination(owner.Hand),
                        new MoveCardDestination(owner.Deck, true),
                        new MoveCardDestination(owner.Trash)
                    },
                                                                                                                           sendCleanupMessageIfNecessary: true);

                    if (this.UseUnityCoroutines)
                    {
                        yield return(this.GameController.StartCoroutine(orderedDestinationsRoutine));
                    }
                    else
                    {
                        this.GameController.ExhaustCoroutine(orderedDestinationsRoutine);
                    }
                }
            }
            yield break;
        }
        public IEnumerator ChooseDamageTypeResponse(DealDamageAction dd, HeroTurnTaker hero = null, StatusEffect effect = null, int[] powerNumerals = null)
        {
            var coroutine = SelectDamageTypeForDealDamageAction(dd);

            if (UseUnityCoroutines)
            {
                yield return(GameController.StartCoroutine(coroutine));
            }
            else
            {
                GameController.ExhaustCoroutine(coroutine);
            }
            yield break;
        }
Пример #10
0
        protected override IEnumerator WhenDestroyed(DestroyCardAction dca)
        {
            HeroTurnTaker htt  = Enchanted.Owner as HeroTurnTaker;
            var           draw = DrawCard(htt, true);

            if (UseUnityCoroutines)
            {
                yield return(this.GameController.StartCoroutine(draw));
            }
            else
            {
                this.GameController.ExhaustCoroutine(draw);
            }
        }
Пример #11
0
        protected override IEnumerator WhenDestroyed(DestroyCardAction dca)
        {
            HeroTurnTaker htt    = Enchanted.Owner as HeroTurnTaker;
            var           damage = this.GameController.SelectTargetsAndDealDamage(FindHeroTurnTakerController(htt), new DamageSource(GameController, Enchanted), 2, DamageType.Energy, 1, false, 0, additionalCriteria: c => !c.IsHero, cardSource: GetCardSource());

            if (UseUnityCoroutines)
            {
                yield return(this.GameController.StartCoroutine(damage));
            }
            else
            {
                this.GameController.ExhaustCoroutine(damage);
            }
        }
Пример #12
0
        public IEnumerator ResumeDrawEffect(PhaseChangeAction _, OnPhaseChangeStatusEffect sourceEffect)
        {
            System.Console.WriteLine("### DEBUG ### - ChokingInspiration.ResumeDrawEffect triggered");

            HeroTurnTaker htt = sourceEffect.TurnTakerCriteria.IsSpecificTurnTaker.ToHero();

            //Clear the secret property from all Character Cards of the victim, just to be sure
            foreach (var ch in htt.CharacterCards)
            {
                GameController.AddCardPropertyJournalEntry(ch, PreventDrawPropertyKey, (bool?)null);
            }

            return(DoNothing());
        }
        private IEnumerator BlisterDamagedHeroResponse(DealDamageAction dd)
        {
            HeroTurnTaker hero      = dd.Target.Owner.ToHero();
            IEnumerator   coroutine = GameController.SendMessageAction($"{hero.Name} cannot use powers or play cards outside of their own turn until the start of {TurnTaker.Name}'s next turn.", Priority.High, GetCardSource(), showCardSource: true);

            if (base.UseUnityCoroutines)
            {
                yield return(base.GameController.StartCoroutine(coroutine));
            }
            else
            {
                base.GameController.ExhaustCoroutine(coroutine);
            }
            yield break;
        }
        public IEnumerator LowestTargetImmunity(DealDamageAction dealDamage, HeroTurnTaker hero = null, StatusEffect effect = null, int[] powerNumerals = null)
        {
            List <bool> storedResults = new List <bool>();

            //Is the target of the damage the lowest HP target?
            IEnumerator coroutine = DetermineIfGivenCardIsTargetWithLowestOrHighestHitPoints(dealDamage.Target, highest: false, (Card card) => GameController.IsCardVisibleToCardSource(card, GetCardSource()), dealDamage, storedResults);

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

            //If not, is the source of the damage the lowest HP target?
            if (!storedResults.First() && dealDamage.DamageSource.IsTarget)
            {
                IEnumerator coroutine2 = DetermineIfGivenCardIsTargetWithLowestOrHighestHitPoints(dealDamage.DamageSource.Card, highest: false, (Card card) => GameController.IsCardVisibleToCardSource(card, GetCardSource()), dealDamage, storedResults);
                if (UseUnityCoroutines)
                {
                    yield return(GameController.StartCoroutine(coroutine2));
                }
                else
                {
                    GameController.ExhaustCoroutine(coroutine2);
                }
            }

            //If we answered yes to either question, prevent the damage.
            if (storedResults.Contains(true))
            {
                IEnumerator coroutine3 = CancelAction(dealDamage, showOutput: true, cancelFutureRelatedDecisions: true, null, isPreventEffect: true);
                if (UseUnityCoroutines)
                {
                    yield return(GameController.StartCoroutine(coroutine3));
                }
                else
                {
                    GameController.ExhaustCoroutine(coroutine3);
                }
            }

            yield break;
        }
        private IEnumerator DrawCardResponse(DestroyCardAction dca)
        {
            //that hero draws a card
            HeroTurnTaker htt       = dca.CardSource.Card.Owner.ToHero();
            IEnumerator   coroutine = base.DrawCard(htt);

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

            yield break;
        }
Пример #16
0
 public IEnumerator WinterDrawCardReponse(DealDamageAction dd, TurnTaker hero, StatusEffect effect, int[] powerNumerals = null)
 {
     //they draw a card
     if (dd.DamageSource != null && dd.DidDealDamage)
     {
         HeroTurnTaker source    = dd.DamageSource.Card.Owner.ToHero();
         IEnumerator   coroutine = base.DrawCard(source);
         if (base.UseUnityCoroutines)
         {
             yield return(base.GameController.StartCoroutine(coroutine));
         }
         else
         {
             base.GameController.ExhaustCoroutine(coroutine);
         }
     }
     yield break;
 }
 public IEnumerator DrawTwoCardsResponse(DestroyCardAction dca, HeroTurnTaker htt, WhenCardIsDestroyedStatusEffect _, int[] _2 = null)
 {
     if (dca.WasCardDestroyed)
     {
         //1 player may draw 2 cards.
         HeroTurnTakerController httc      = FindHeroTurnTakerController(htt);
         IEnumerator             coroutine = GameController.SelectHeroToDrawCards(httc, 2, cardSource: GetCardSource());
         if (base.UseUnityCoroutines)
         {
             yield return(base.GameController.StartCoroutine(coroutine));
         }
         else
         {
             base.GameController.ExhaustCoroutine(coroutine);
         }
     }
     yield break;
 }
        public IEnumerator ChooseTypeResponse(PhaseChangeAction pca)
        {
            // "... choose fire damage or cold damage."
            List <SelectDamageTypeDecision> choice = new List <SelectDamageTypeDecision>();
            // If this is a hero play area, that hero's player chooses; otherwise, the group does
            HeroTurnTakerController selector = base.DecisionMaker;
            HeroTurnTaker           credited = base.Game.HeroTurnTakers.FirstOrDefault();

            if (base.Card.Location.HighestRecursiveLocation.IsHero)
            {
                selector = base.GameController.FindTurnTakerController(base.Card.Location.HighestRecursiveLocation.OwnerTurnTaker).ToHero();
                credited = base.Card.Location.HighestRecursiveLocation.OwnerTurnTaker.ToHero();
            }
            IEnumerator chooseCoroutine = base.GameController.SelectDamageType(selector, choice, new DamageType[] { DamageType.Fire, DamageType.Cold }, cardSource: GetCardSource());

            if (base.UseUnityCoroutines)
            {
                yield return(base.GameController.StartCoroutine(chooseCoroutine));
            }
            else
            {
                base.GameController.ExhaustCoroutine(chooseCoroutine);
            }
            DamageType chosenType = choice.FirstOrDefault((SelectDamageTypeDecision sdtd) => sdtd.Completed).SelectedDamageType.Value;

            base.SetCardProperty(LastChosenType, typeOptions.IndexOf(chosenType).Value);
            string      message       = base.Card.Title + " will protect itself and targets in " + base.Card.Location.HighestRecursiveLocation.OwnerName + "'s play area from " + MostRecentChosen().Value.ToString() + " damage.";
            IEnumerator showCoroutine = base.GameController.SendMessageAction(message, Priority.Medium, GetCardSource(), showCardSource: true);

            if (base.UseUnityCoroutines)
            {
                yield return(base.GameController.StartCoroutine(showCoroutine));
            }
            else
            {
                base.GameController.ExhaustCoroutine(showCoroutine);
            }
            yield break;
        }
#pragma warning disable IDE0060 // Remove unused parameter

        public IEnumerator WhenEquipIsDestroyed(DestroyCardAction destroy, HeroTurnTaker hero, StatusEffect effect, int[] powerNumerals = null)
        {
            IEnumerator coroutine;

            if (hero != null && destroy.CanBeCancelled)
            {
                List <YesNoCardDecision> storedResults = new List <YesNoCardDecision>();
                coroutine = this.GameController.MakeYesNoCardDecision(this.DecisionMaker, SelectionType.MoveCardToPlayArea, destroy.CardToDestroy.Card, storedResults: storedResults, cardSource: this.GetCardSource());
                if (this.UseUnityCoroutines)
                {
                    yield return(this.GameController.StartCoroutine(coroutine));
                }
                else
                {
                    this.GameController.ExhaustCoroutine(coroutine);
                }

                if (this.DidPlayerAnswerYes(storedResults))
                {
                    // Needs to be done after because most 'after destruction' effects are actually 'when destroyed' effects, and we can't move the card back before it's destroyed without causing more problems than it's worth.
                    destroy.AddAfterDestroyedAction(() => this.MoveAndFlipResponse(hero, destroy.CardToDestroy.Card), this);
                }
            }
        }
Пример #20
0
        public override IEnumerator UseIncapacitatedAbility(int index)
        {
            switch (index)
            {
            case 0:
            {
                List <DealDamageAction>   damages       = new List <DealDamageAction>();
                List <SelectCardDecision> storedResults = new List <SelectCardDecision>();
                var shoot = this.GameController.SelectHeroCharacterCard(DecisionMaker, SelectionType.DealDamage, storedResults, false, false, GetCardSource());
                if (UseUnityCoroutines)
                {
                    yield return(this.GameController.StartCoroutine(shoot));
                }
                else
                {
                    this.GameController.ExhaustCoroutine(shoot);
                }
                Card who = GetSelectedCard(storedResults);
                Func <DealDamageAction, IEnumerator> Leech = (DealDamageAction dda) => this.GameController.GainHP(who, dda.Amount, cardSource: GetCardSource());
                shoot = this.GameController.SelectTargetsAndDealDamage(this.GameController.FindHeroTurnTakerController(who.Owner as HeroTurnTaker), new DamageSource(GameController, who), 1, DamageType.Energy, 1, false, 0, addStatusEffect: Leech, cardSource: GetCardSource());
                if (UseUnityCoroutines)
                {
                    yield return(this.GameController.StartCoroutine(shoot));
                }
                else
                {
                    this.GameController.ExhaustCoroutine(shoot);
                }
                break;
            }

            case 1:
            {
                List <SelectTurnTakerDecision> decision = new List <SelectTurnTakerDecision>();
                List <DrawCardAction>          drawn    = new List <DrawCardAction>();
                var hero = this.GameController.SelectHeroTurnTaker(DecisionMaker, SelectionType.DrawCard, false, false, decision, cardSource: GetCardSource());
                if (UseUnityCoroutines)
                {
                    yield return(this.GameController.StartCoroutine(hero));
                }
                else
                {
                    this.GameController.ExhaustCoroutine(hero);
                }
                if (DidSelectTurnTaker(decision))
                {
                    HeroTurnTaker htt  = (HeroTurnTaker)GetSelectedTurnTaker(decision);
                    var           draw = DrawCard(htt, false, drawn);
                    if (UseUnityCoroutines)
                    {
                        yield return(this.GameController.StartCoroutine(draw));
                    }
                    else
                    {
                        this.GameController.ExhaustCoroutine(draw);
                    }
                    if (DidDrawCards(drawn))
                    {
                        foreach (DrawCardAction dda in drawn)
                        {
                            Card c = dda.DrawnCard;
                            if (dda.DidDrawCard && c.DoKeywordsContain("equipment"))
                            {
                                var play = this.GameController.PlayCard(FindHeroTurnTakerController(htt), c, true, optional: true, associateCardSource: true, cardSource: GetCardSource());
                                if (UseUnityCoroutines)
                                {
                                    yield return(this.GameController.StartCoroutine(play));
                                }
                                else
                                {
                                    this.GameController.ExhaustCoroutine(play);
                                }
                            }
                        }
                    }
                }

                break;
            }

            case 2:
            {
                List <SelectCardDecision> target = new List <SelectCardDecision>();
                var select = this.GameController.SelectCardAndStoreResults(DecisionMaker, SelectionType.IncreaseDamage, new LinqCardCriteria(c => c.IsVillainTarget && c.IsInPlayAndHasGameText), target, false, cardSource: GetCardSource());
                if (UseUnityCoroutines)
                {
                    yield return(this.GameController.StartCoroutine(select));
                }
                else
                {
                    this.GameController.ExhaustCoroutine(select);
                }
                if (DidSelectCard(target))
                {
                    IncreaseDamageStatusEffect idse = new IncreaseDamageStatusEffect(1);
                    idse.UntilStartOfNextTurn(TurnTaker);
                    idse.TargetCriteria.IsSpecificCard = GetSelectedCard(target);
                    var effect = AddStatusEffect(idse);
                    if (UseUnityCoroutines)
                    {
                        yield return(this.GameController.StartCoroutine(effect));
                    }
                    else
                    {
                        this.GameController.ExhaustCoroutine(effect);
                    }
                }
                break;
            }
            }
        }
 protected bool FilterTurnTakerByArchiveAndSpares(HeroTurnTaker arg)
 {
     return(ArkHiveAndTheSparesTurnTakers.Contains(arg));
 }
Пример #22
0
 public IEnumerator PlayDestroyedOngoing(DestroyCardAction dc, HeroTurnTaker hero, StatusEffect effect, int[] powerNumerals = null)
 {
     dc.AddAfterDestroyedAction(() => GameController.PlayCard(DecisionMaker, dc.CardToDestroy.Card, cardSource: GetCardSource()), this);
     dc.PostDestroyDestinationCanBeChanged = false;
     yield break;
 }
Пример #23
0
        public override IEnumerator UseIncapacitatedAbility(int index)
        {
            switch (index)
            {
            case 0:
            {
                //one hero deals a target 3 fire damage
                List <SelectCardDecision> storedResults = new List <SelectCardDecision>();
                IEnumerator dealFire = base.GameController.SelectCardAndStoreResults(this.DecisionMaker, SelectionType.SelectTargetNoDamage, new LinqCardCriteria((Card c) => c.IsTarget && c.IsInPlay && c.IsHeroCharacterCard, "hero", true, false, null, null, false), storedResults, false, false, null, true, base.GetCardSource(null));
                if (base.UseUnityCoroutines)
                {
                    yield return(base.GameController.StartCoroutine(dealFire));
                }
                else
                {
                    base.GameController.ExhaustCoroutine(dealFire);
                }
                Card selectedCard = base.GetSelectedCard(storedResults);
                dealFire = base.GameController.SelectTargetsAndDealDamage(this.DecisionMaker, new DamageSource(base.GameController, selectedCard), 3, DamageType.Fire, 1, false, 0, false, false, false, null, null, null, null, null, false, null, null, false, null, GetCardSource(null));
                if (base.UseUnityCoroutines)
                {
                    yield return(base.GameController.StartCoroutine(dealFire));
                }
                else
                {
                    base.GameController.ExhaustCoroutine(dealFire);
                }
                break;
            }

            case 1:
            {
                //Select a hero. Until the start of your next turn, whenever that hero uses a power, that player's hero deals a target 1 Fire damage.
                List <SelectTurnTakerDecision> storedResults = new List <SelectTurnTakerDecision>();
                IEnumerator selectPlayer = base.GameController.SelectHeroTurnTaker(this.DecisionMaker, SelectionType.TurnTaker, false, false, storedResults, null, null, false, null, null, true, null, GetCardSource(null));
                if (base.UseUnityCoroutines)
                {
                    yield return(base.GameController.StartCoroutine(selectPlayer));
                }
                else
                {
                    base.GameController.ExhaustCoroutine(selectPlayer);
                }
                if (storedResults.Any((SelectTurnTakerDecision d) => d.Completed && d.SelectedTurnTaker != null && d.SelectedTurnTaker.IsHero))
                {
                    TurnTaker selectedTurnTaker = base.GetSelectedTurnTaker(storedResults);
                    if (selectedTurnTaker.IsHero)
                    {
                        HeroTurnTaker htt = selectedTurnTaker.ToHero();
                        Card          damageSource;
                        if (htt.HasMultipleCharacterCards)
                        {
                            damageSource = null;
                        }
                        else
                        {
                            damageSource = htt.CharacterCard;
                        }
                        DealDamageAfterUsePowerStatusEffect ddaupse = new DealDamageAfterUsePowerStatusEffect(htt, damageSource, null, 1, DamageType.Fire, 1, false);
                        ddaupse.TurnTakerCriteria.IsSpecificTurnTaker = htt;
                        if (!htt.HasMultipleCharacterCards)
                        {
                            ddaupse.CardDestroyedExpiryCriteria.Card = htt.CharacterCard;
                        }
                        ddaupse.UntilStartOfNextTurn(this.TurnTaker);
                        IEnumerator dealDamageEffect = base.AddStatusEffect(ddaupse, true);
                        if (base.UseUnityCoroutines)
                        {
                            yield return(base.GameController.StartCoroutine(dealDamageEffect));
                        }
                        else
                        {
                            base.GameController.ExhaustCoroutine(dealDamageEffect);
                        }
                    }
                }
                break;
            }

            case 2:
            {
                //one hero may use a power
                IEnumerator usePower = base.GameController.SelectHeroToUsePower(base.HeroTurnTakerController, false, true, false, null, null, null, true, true, base.GetCardSource(null));
                if (base.UseUnityCoroutines)
                {
                    yield return(base.GameController.StartCoroutine(usePower));
                }
                else
                {
                    base.GameController.ExhaustCoroutine(usePower);
                }
                break;
            }
            }
            yield break;
        }
        //override flip response to remove resetting token pools
        public override IEnumerator BeforeFlipCardImmediateResponse(FlipCardAction flip)
        {
            if (base.CardWithoutReplacements.IsFlipped)
            {
                yield break;
            }
            IEnumerable <Card> enumerable = from c in base.TurnTakerControllerWithoutReplacements.TurnTaker.GetAllCards()
                                            where c.Location.IsEnvironment && (c.Location.IsDeck || c.Location.IsTrash)
                                            select c;

            if (enumerable.Count() > 0)
            {
                IEnumerator coroutine = RemoveCardsFromGame(enumerable);
                if (base.UseUnityCoroutines)
                {
                    yield return(base.GameController.StartCoroutine(coroutine));
                }
                else
                {
                    base.GameController.ExhaustCoroutine(coroutine);
                }
            }
            if (base.CardWithoutReplacements.IsTarget)
            {
                RemoveTargetAction action     = new RemoveTargetAction(base.GameController, base.CardWithoutReplacements);
                IEnumerator        coroutine2 = DoAction(action);
                if (base.UseUnityCoroutines)
                {
                    yield return(base.GameController.StartCoroutine(coroutine2));
                }
                else
                {
                    base.GameController.ExhaustCoroutine(coroutine2);
                }
            }
            if (base.TurnTakerControllerWithoutReplacements.IsIncapacitatedOrOutOfGame)
            {
                base.GameController.RemoveTriggers((ITrigger t) => t.CardSource != null && t.CardSource.CardController.TurnTakerControllerWithoutReplacements == base.TurnTakerControllerWithoutReplacements && !t.IsStatusEffect && !t.IsOutOfPlayTrigger && t.CardSource != null && (t.CardSource.CardController == this || !t.CardSource.Card.IsInPlayAndNotUnderCard));
                IEnumerable <Card> cards = base.TurnTakerControllerWithoutReplacements.TurnTaker.GetAllCards();
                List <Card>        list  = new List <Card>();
                list.AddRange(cards.Where((Card c) => !c.IsHeroCharacterCard).SelectMany((Card c) => c.UnderLocation.Cards.Where((Card co) => co.Owner != base.TurnTakerControllerWithoutReplacements.TurnTaker)));
                if (base.TurnTakerControllerWithoutReplacements.TurnTaker.IsHero)
                {
                    HeroTurnTaker heroTurnTaker = base.TurnTakerControllerWithoutReplacements.ToHero().HeroTurnTaker;
                    list.AddRange(from c in heroTurnTaker.Hand.Cards.Union(heroTurnTaker.Deck.Cards).Union(heroTurnTaker.Trash.Cards)
                                  where c.Owner != base.TurnTakerControllerWithoutReplacements.TurnTaker
                                  select c);
                }
                foreach (Card item in list)
                {
                    MoveCardDestination trashDestination = FindCardController(item).GetTrashDestination();
                    IEnumerator         coroutine3       = base.GameController.MoveCard(base.TurnTakerController, item, trashDestination.Location, trashDestination.ToBottom);
                    if (base.UseUnityCoroutines)
                    {
                        yield return(base.GameController.StartCoroutine(coroutine3));
                    }
                    else
                    {
                        base.GameController.ExhaustCoroutine(coroutine3);
                    }
                }
                if (base.Game.IsOblivAeonMode)
                {
                    IEnumerable <Card> enumerable2 = FindCardsWhere((Card c) => c.IsObjective && c.IsInLocation(base.TurnTakerControllerWithoutReplacements.TurnTaker.PlayArea));
                    Log.Debug("Objectives: " + enumerable2.ToRecursiveString());
                    if (enumerable2.Count() > 0)
                    {
                        TurnTaker   turnTaker  = FindTurnTakersWhere((TurnTaker tt) => tt.Identifier == "OblivAeon", ignoreBattleZone: true).FirstOrDefault();
                        IEnumerator coroutine4 = base.GameController.BulkMoveCards(base.TurnTakerController, enumerable2, turnTaker.FindSubDeck("MissionDeck"), toBottom: true, performBeforeDestroyActions: true, null, isDiscard: false, GetCardSource());
                        if (base.UseUnityCoroutines)
                        {
                            yield return(base.GameController.StartCoroutine(coroutine4));
                        }
                        else
                        {
                            base.GameController.ExhaustCoroutine(coroutine4);
                        }
                    }
                    IEnumerable <Card> enumerable3 = FindCardsWhere((Card c) => c.DoKeywordsContain("reward", evenIfUnderCard: true, evenIfFaceDown: true) && !c.IsOutOfGame && c.Owner == base.TurnTakerControllerWithoutReplacements.TurnTaker && (!c.IsUnderCard || !c.Location.OwnerCard.IsIncapacitated), realCardsOnly: false, null, ignoreBattleZone: true);
                    if (enumerable3.Count() > 0)
                    {
                        IEnumerator coroutine5 = base.GameController.BulkMoveCards(base.TurnTakerController, enumerable3, base.Card.UnderLocation);
                        if (base.UseUnityCoroutines)
                        {
                            yield return(base.GameController.StartCoroutine(coroutine5));
                        }
                        else
                        {
                            base.GameController.ExhaustCoroutine(coroutine5);
                        }
                    }
                }
                IEnumerator coroutine6 = RemoveCardsFromGame(cards);
                if (base.UseUnityCoroutines)
                {
                    yield return(base.GameController.StartCoroutine(coroutine6));
                }
                else
                {
                    base.GameController.ExhaustCoroutine(coroutine6);
                }

                IEnumerator coroutine7 = base.GameController.UpdateTurnPhasesForTurnTaker(base.TurnTakerControllerWithoutReplacements, incapacitated: true);
                if (base.UseUnityCoroutines)
                {
                    yield return(base.GameController.StartCoroutine(coroutine7));
                }
                else
                {
                    base.GameController.ExhaustCoroutine(coroutine7);
                }
            }
            else
            {
                RemoveAllTriggers();
            }
        }
Пример #25
0
        public override IEnumerator Play()
        {
            // "Reveal the top card of a deck, then replace it."
            List <SelectLocationDecision> storedResults = new List <SelectLocationDecision>();
            IEnumerator selectCoroutine = base.GameController.SelectADeck(base.HeroTurnTakerController, SelectionType.RevealTopCardOfDeck, (Location deck) => true, storedResults, cardSource: base.GetCardSource());

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

            if (DidSelectLocation(storedResults))
            {
                Location    selectedLocation = GetSelectedLocation(storedResults);
                List <Card> list             = new List <Card>();
                //Reveal the top card of 1 deck, then replace it.
                IEnumerator revealCoroutine = base.GameController.RevealCards(base.TurnTakerController, selectedLocation, 1, list, revealedCardDisplay: RevealedCardDisplay.ShowRevealedCards, cardSource: base.GetCardSource());
                if (base.UseUnityCoroutines)
                {
                    yield return(base.GameController.StartCoroutine(revealCoroutine));
                }
                else
                {
                    base.GameController.ExhaustCoroutine(revealCoroutine);
                }

                IEnumerator replaceCoroutine = base.CleanupRevealedCards(selectedLocation.OwnerTurnTaker.Revealed, selectedLocation);
                if (base.UseUnityCoroutines)
                {
                    yield return(base.GameController.StartCoroutine(replaceCoroutine));
                }
                else
                {
                    base.GameController.ExhaustCoroutine(replaceCoroutine);
                }
            }
            // "Draw 2 cards."
            IEnumerator drawCoroutine = base.GameController.DrawCards(base.HeroTurnTakerController, 2, cardSource: GetCardSource());

            if (base.UseUnityCoroutines)
            {
                yield return(base.GameController.StartCoroutine(drawCoroutine));
            }
            else
            {
                base.GameController.ExhaustCoroutine(drawCoroutine);
            }
            // "You may discard 2 cards. If you do, one player may draw a card and play a card."
            List <DiscardCardAction> discards = new List <DiscardCardAction>();
            IEnumerator discardCoroutine      = base.GameController.SelectAndDiscardCards(base.HeroTurnTakerController, 2, true, 2, storedResults: discards, responsibleTurnTaker: base.TurnTaker, cardSource: GetCardSource());

            if (base.UseUnityCoroutines)
            {
                yield return(base.GameController.StartCoroutine(discardCoroutine));
            }
            else
            {
                base.GameController.ExhaustCoroutine(discardCoroutine);
            }
            if (DidDiscardCards(discards, numberExpected: 2))
            {
                List <SelectTurnTakerDecision> playerChoice = new List <SelectTurnTakerDecision>();
                IEnumerator chooseCoroutine = base.GameController.SelectHeroTurnTaker(base.HeroTurnTakerController, SelectionType.DrawCard, false, false, playerChoice, cardSource: GetCardSource());
                if (base.UseUnityCoroutines)
                {
                    yield return(base.GameController.StartCoroutine(chooseCoroutine));
                }
                else
                {
                    base.GameController.ExhaustCoroutine(chooseCoroutine);
                }
                if (DidSelectTurnTaker(playerChoice))
                {
                    HeroTurnTaker chosenPlayer = playerChoice.FirstOrDefault((SelectTurnTakerDecision dec) => DidSelectTurnTaker(dec.ToEnumerable())).SelectedTurnTaker.ToHero();
                    drawCoroutine = base.GameController.DrawCard(chosenPlayer, optional: true, cardSource: GetCardSource());
                    if (base.UseUnityCoroutines)
                    {
                        yield return(base.GameController.StartCoroutine(drawCoroutine));
                    }
                    else
                    {
                        base.GameController.ExhaustCoroutine(drawCoroutine);
                    }
                    IEnumerator playCoroutine = base.GameController.SelectAndPlayCardFromHand(base.GameController.FindHeroTurnTakerController(chosenPlayer), true, cardSource: GetCardSource());
                    if (base.UseUnityCoroutines)
                    {
                        yield return(base.GameController.StartCoroutine(playCoroutine));
                    }
                    else
                    {
                        base.GameController.ExhaustCoroutine(playCoroutine);
                    }
                }
            }
            yield break;
        }