private IEnumerator DamagePreventionResponse(DealDamageAction dd) { List <YesNoCardDecision> storedResults = new List <YesNoCardDecision>(); List <Card> list = new List <Card>(); list.Add(base.Card); IEnumerator coroutine2 = base.GameController.MakeYesNoCardDecision(this.DecisionMaker, SelectionType.PreventDamage, base.Card, dd, storedResults, list, base.GetCardSource()); if (base.UseUnityCoroutines) { yield return(base.GameController.StartCoroutine(coroutine2)); } else { base.GameController.ExhaustCoroutine(coroutine2); } YesNoCardDecision yesNoCardDecision = storedResults.FirstOrDefault(); if (yesNoCardDecision.Answer != null && yesNoCardDecision.Answer.Value) { base.SetCardPropertyToTrueIfRealAction("PreventionUsed"); coroutine2 = base.CancelAction(dd, true, true, null, true); if (base.UseUnityCoroutines) { yield return(base.GameController.StartCoroutine(coroutine2)); } else { base.GameController.ExhaustCoroutine(coroutine2); } } yield break; }
private IEnumerator IncreaseDamageDecision(DealDamageAction dd) { //Offer the player a yes/no decision if they want to increase that damage by 2 //This currently doesn't have any text on the decision other than yes/no, room for improvement this.DealDamageAction = dd; List <YesNoCardDecision> storedResults = new List <YesNoCardDecision>(); IEnumerator coroutine = base.GameController.MakeYesNoCardDecision(this.DecisionMaker, SelectionType.IncreaseNextDamage, base.Card, storedResults: storedResults, cardSource: base.GetCardSource()); if (base.UseUnityCoroutines) { yield return(base.GameController.StartCoroutine(coroutine)); } else { base.GameController.ExhaustCoroutine(coroutine); } if (storedResults != null) { YesNoCardDecision yesNo = storedResults.First(); //if player said yes, set BuffUsed to true and Increase Damage if (yesNo.Answer.Value == true) { base.CharacterCardController.SetCardPropertyToTrueIfRealAction("BuffUsed"); IEnumerator coroutine2 = this.IncreaseFunction(); if (base.UseUnityCoroutines) { yield return(base.GameController.StartCoroutine(coroutine2)); } else { base.GameController.ExhaustCoroutine(coroutine2); } } } yield break; }
private IEnumerator SkipToPlayResponse(PhaseChangeAction pca) { SkipToTurnPhaseAction skipAction = new SkipToTurnPhaseAction(GetCardSource(), TurnTaker.GetNextTurnPhase(TurnTaker.TurnPhases.Where(tp => tp.Phase == Phase.DrawCard).FirstOrDefault()), false, goImmediatelyToPhase: true, interruptActions: true); YesNoCardDecision decision = new YesNoCardDecision(GameController, DecisionMaker, SelectionType.SkipTurn, Card, action: skipAction, cardSource: GetCardSource()); IEnumerator coroutine = GameController.MakeDecisionAction(decision); if (UseUnityCoroutines) { yield return(GameController.StartCoroutine(coroutine)); } else { GameController.ExhaustCoroutine(coroutine); } if (DidPlayerAnswerYes(decision)) { coroutine = DoAction(skipAction); if (UseUnityCoroutines) { yield return(GameController.StartCoroutine(coroutine)); } else { GameController.ExhaustCoroutine(coroutine); } coroutine = GameController.SelectAndPlayCardFromHand(DecisionMaker, true, cardCriteria: new LinqCardCriteria(c => IsMomentum(c), "momentum"), cardSource: GetCardSource()); if (UseUnityCoroutines) { yield return(GameController.StartCoroutine(coroutine)); } else { GameController.ExhaustCoroutine(coroutine); } } }
//Reveal the top card of a deck, then replace it or discard it. If you replaced it, one player may use a power now. public override IEnumerator Play() { List <SelectLocationDecision> storedResults = new List <SelectLocationDecision>(); IEnumerator coroutine = base.GameController.SelectADeck(this.DecisionMaker, SelectionType.RevealTopCardOfDeck, (Location l) => true, storedResults, true, null, base.GetCardSource(null)); if (base.UseUnityCoroutines) { yield return(base.GameController.StartCoroutine(coroutine)); } else { base.GameController.ExhaustCoroutine(coroutine); } Location deck = base.GetSelectedLocation(storedResults); if (deck != null) { List <Card> storedResultsCard = new List <Card>(); coroutine = base.GameController.RevealCards(base.TurnTakerController, deck, 1, storedResultsCard, true, RevealedCardDisplay.None, null, base.GetCardSource(null)); if (base.UseUnityCoroutines) { yield return(base.GameController.StartCoroutine(coroutine)); } else { base.GameController.ExhaustCoroutine(coroutine); } Card card = storedResultsCard.FirstOrDefault <Card>(); if (card != null) { YesNoDecision yesNo = new YesNoCardDecision(GameController, base.HeroTurnTakerController, SelectionType.DiscardCard, card); List <IDecision> decisionSources = new List <IDecision> { yesNo }; IEnumerator coroutine2 = GameController.MakeDecisionAction(yesNo); if (UseUnityCoroutines) { yield return(GameController.StartCoroutine(coroutine2)); } else { GameController.ExhaustCoroutine(coroutine2); } if (DidPlayerAnswerYes(yesNo)) { IEnumerator coroutine3 = GameController.DiscardCard(base.HeroTurnTakerController, card, decisionSources, null, null, GetCardSource()); if (UseUnityCoroutines) { yield return(GameController.StartCoroutine(coroutine3)); } else { GameController.ExhaustCoroutine(coroutine3); } } if (!DidPlayerAnswerYes(yesNo)) { IEnumerator coroutine5 = base.GameController.SelectHeroToUsePower(base.HeroTurnTakerController, optionalSelectHero: false, optionalUsePower: true, allowAutoDecide: false, null, null, null, omitHeroesWithNoUsablePowers: true, canBeCancelled: true, GetCardSource()); if (base.UseUnityCoroutines) { yield return(base.GameController.StartCoroutine(coroutine5)); } else { base.GameController.ExhaustCoroutine(coroutine5); } } if (yesNo != null && yesNo.Completed && yesNo.Answer.HasValue) { decisionSources.Add(yesNo); if (!yesNo.Answer.Value) { IEnumerator coroutine4 = GameController.MoveCard(TurnTakerController, card, deck, toBottom: false, isPutIntoPlay: false, playCardIfMovingToPlayArea: true, null, showMessage: false, decisionSources, null, null, evenIfIndestructible: false, flipFaceDown: false, null, isDiscard: false, evenIfPretendGameOver: false, shuffledTrashIntoDeck: false, doesNotEnterPlay: false, GetCardSource()); if (UseUnityCoroutines) { yield return(GameController.StartCoroutine(coroutine4)); } else { GameController.ExhaustCoroutine(coroutine4); } } } /*List<MoveCardDestination> list = new List<MoveCardDestination> * { * new MoveCardDestination(deck, false, false, false), * new MoveCardDestination(deck, true, false, false) * }; * coroutine = base.GameController.SelectLocationAndMoveCard(this.DecisionMaker, card, list, false, true, null, null, null, false, false, null, false, base.GetCardSource(null)); * if (base.UseUnityCoroutines) * { * yield return base.GameController.StartCoroutine(coroutine); * } * else * { * base.GameController.ExhaustCoroutine(coroutine); * }*/ } coroutine = base.CleanupCardsAtLocations(new List <Location> { deck.OwnerTurnTaker.Revealed }, deck, false, true, false, false, false, true, storedResultsCard); if (base.UseUnityCoroutines) { yield return(base.GameController.StartCoroutine(coroutine)); } else { base.GameController.ExhaustCoroutine(coroutine); } storedResultsCard = null; } yield break; }
public IEnumerator HitTorrentInsteadResponse(DealDamageAction dda) { // "... you may prevent that daamge. If you do, the source of that damage deals {TorrentCharacter} 1 damage of that type." if (dda.IsPretend) { IEnumerator cancelCoroutine = base.GameController.CancelAction(dda, isPreventEffect: true, cardSource: GetCardSource()); if (base.UseUnityCoroutines) { yield return(base.GameController.StartCoroutine(cancelCoroutine)); } else { base.GameController.ExhaustCoroutine(cancelCoroutine); } yield break; } List <Card> associated = new List <Card>(); associated.Add(dda.Target); List <YesNoCardDecision> choice = new List <YesNoCardDecision>(); IEnumerator chooseCoroutine = base.GameController.MakeYesNoCardDecision(base.HeroTurnTakerController, SelectionType.PreventDamage, base.Card, action: dda, storedResults: choice, associatedCards: associated, cardSource: GetCardSource()); if (base.UseUnityCoroutines) { yield return(base.GameController.StartCoroutine(chooseCoroutine)); } else { base.GameController.ExhaustCoroutine(chooseCoroutine); } YesNoCardDecision answer = choice.FirstOrDefault(); if (answer.Answer.HasValue && answer.Answer.Value) { IEnumerator preventCoroutine = base.GameController.CancelAction(dda, isPreventEffect: true, cardSource: GetCardSource()); if (base.UseUnityCoroutines) { yield return(base.GameController.StartCoroutine(preventCoroutine)); } else { base.GameController.ExhaustCoroutine(preventCoroutine); } DealDamageAction ddaPrime = new DealDamageAction(dda); ddaPrime.Target = base.CharacterCard; ddaPrime.Amount = 1; Card source = null; if (ddaPrime.DamageSource != null && ddaPrime.DamageSource.Card != null) { source = ddaPrime.DamageSource.Card; } IEnumerator damageCoroutine = DealDamage(source, base.CharacterCard, 1, ddaPrime.DamageType, cardSource: GetCardSource()); if (base.UseUnityCoroutines) { yield return(base.GameController.StartCoroutine(damageCoroutine)); } else { base.GameController.ExhaustCoroutine(damageCoroutine); } } yield break; }