private IEnumerator MayReturnDestroyedResponse(DestroyCardAction dc)
        {
            Card toReturn = dc.CardToDestroy.Card;

            var decisionResult    = new List <YesNoCardDecision> {
            };
            IEnumerator coroutine = GameController.MakeYesNoCardDecision(DecisionMaker, SelectionType.MoveCardToHand, toReturn, storedResults: decisionResult, cardSource: GetCardSource());

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

            if (DidPlayerAnswerYes(decisionResult))
            {
                dc.SetPostDestroyDestination(dc.CardToDestroy.Card.Owner.ToHero().Hand);
                dc.AddAfterDestroyedAction(() => DestroyThisCardIfMovedResponse(dc), this);
            }

            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;
 }
        private IEnumerator MayReturnDestroyedResponse(DestroyCardAction dca)
        {
            List <DestroyCardAction> storedResults = new List <DestroyCardAction>();
            List <Card> cardToSave = new List <Card> {
                dca.CardToDestroy.Card
            };
            IEnumerator coroutine = base.GameController.DestroyCard(DecisionMaker, this.Card, optional: true, storedResults, associatedCards: cardToSave, cardSource: GetCardSource());

            if (base.UseUnityCoroutines)
            {
                yield return(base.GameController.StartCoroutine(coroutine));
            }
            else
            {
                base.GameController.ExhaustCoroutine(coroutine);
            }
            if (DidDestroyCard(storedResults))
            {
                dca.PostDestroyDestinationCanBeChanged = false;
                dca.AddAfterDestroyedAction(() => GameController.PlayCard(TurnTakerController, dca.CardToDestroy.Card, isPutIntoPlay: true, optional: false, evenIfAlreadyInPlay: true, cardSource: GetCardSource()), this);
            }
        }
#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);
                }
            }
        }
Esempio n. 5
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;
 }