private IEnumerator RevealTopCardFromDeckResponse(DealDamageAction dda) { List <YesNoCardDecision> storedYesNoResults = new List <YesNoCardDecision>(); // Ask if player wants to discard off the top of their deck IEnumerator coroutine = base.GameController.MakeYesNoCardDecision(DecisionMaker, SelectionType.RevealTopCardOfDeck, this.Card, dda, storedYesNoResults, null, GetCardSource()); if (base.UseUnityCoroutines) { yield return(base.GameController.StartCoroutine(coroutine)); } else { base.GameController.ExhaustCoroutine(coroutine); } // Return if they chose not to discard from their deck if (!base.DidPlayerAnswerYes(storedYesNoResults)) { yield break; } // Move card from top of their deck to the trash List <MoveCardAction> moveCardActions = new List <MoveCardAction>(); coroutine = base.GameController.DiscardTopCard(this.TurnTaker.Deck, moveCardActions, card => true, this.TurnTaker, base.GetCardSource()); if (base.UseUnityCoroutines) { yield return(base.GameController.StartCoroutine(coroutine)); } else { base.GameController.ExhaustCoroutine(coroutine); } if (DidMoveCard(moveCardActions)) { Card discardedCard = moveCardActions.First().CardToMove; if (IsCritical(discardedCard)) { // Card had the "critical" keyword, increase the damage ModifyDealDamageAction mdda = new IncreaseDamageAction(this.GameController, dda, DamageIncrease, false); dda.AddDamageModifier(mdda); coroutine = base.GameController.SendMessageAction(discardedCard.Title + " is a critical card, so damage is increased by 3!", Priority.Medium, base.GetCardSource(), associatedCards: new Card[] { discardedCard }); if (base.UseUnityCoroutines) { yield return(base.GameController.StartCoroutine(coroutine)); } else { base.GameController.ExhaustCoroutine(coroutine); } } } yield break; }
private IEnumerator RetroactiveIrreducibilityResponse(DealDamageAction dd) { IEnumerator coroutine = GameController.MakeDamageIrreducible(dd, GetCardSource()); if (base.UseUnityCoroutines) { yield return(GameController.StartCoroutine(coroutine)); } else { GameController.ExhaustCoroutine(coroutine); } var reduceActions = dd.DamageModifiers.Where((ModifyDealDamageAction mdd) => mdd is ReduceDamageAction).ToList(); foreach (ReduceDamageAction mod in reduceActions) { IncreaseDamageAction restoreDamage = new IncreaseDamageAction(mod.CardSource, dd, mod.AmountToReduce, false); //we do our best to make it have as little interaction as possible with things that respond to increasing damage //since it's supposed to be retroactive undoing of damage decreases restoreDamage.AllowTriggersToRespond = false; restoreDamage.CanBeCancelled = false; var wasUnincreasable = dd.IsUnincreasable; dd.IsUnincreasable = false; coroutine = GameController.DoAction(restoreDamage); if (base.UseUnityCoroutines) { yield return(GameController.StartCoroutine(coroutine)); } else { GameController.ExhaustCoroutine(coroutine); } dd.IsUnincreasable = wasUnincreasable; } yield break; }