public override IEnumerator Play() { // Heal. IEnumerator coroutine; coroutine = this.GameController.GainHP(this.DecisionMaker, (Card card) => card.IsHeroCharacterCard, 1, null, false, null, null, null, this.GetCardSource()); if (this.UseUnityCoroutines) { yield return(this.GameController.StartCoroutine(coroutine)); } else { this.GameController.ExhaustCoroutine(coroutine); } // Yes/No question to determine reset-move! YesNoAmountDecision yesNoDecision = new YesNoAmountDecision(this.GameController, this.DecisionMaker, SelectionType.MoveCard, Riverbank().UnderLocation.Cards.Count(), cardSource: this.GetCardSource()); coroutine = this.GameController.MakeDecisionAction(yesNoDecision); if (this.UseUnityCoroutines) { yield return(this.GameController.StartCoroutine(coroutine)); } else { this.GameController.ExhaustCoroutine(coroutine); } if (this.DidPlayerAnswerYes(yesNoDecision)) { // Reset river into Deck. Card remainingCard = Riverbank().UnderLocation.Cards.FirstOrDefault(); while (remainingCard != null) { coroutine = this.GameController.MoveCard(this.DecisionMaker, remainingCard, RiverDeck(), toBottom: true, evenIfIndestructible: true); if (this.UseUnityCoroutines) { yield return(this.GameController.StartCoroutine(coroutine)); } else { this.GameController.ExhaustCoroutine(coroutine); } remainingCard = Riverbank().UnderLocation.Cards.FirstOrDefault(); } // Then, move the top four river cards to the riverbank. That should already exist due to being a non-real card. coroutine = this.GameController.MoveCards(this.DecisionMaker, RiverDeck().GetTopCards(4), Riverbank().UnderLocation); if (this.UseUnityCoroutines) { yield return(this.GameController.StartCoroutine(coroutine)); } else { this.GameController.ExhaustCoroutine(coroutine); } } }
// TODO: Change to Select Cards and Move if appropriate. // TODO: Validate if DecisionMaker should be this.DecisionMaker, or if this.DecisionMaker works well. private IEnumerator MoveOrDestroyResponse(PhaseChangeAction phaseChange) { IEnumerator coroutine; // If enough cards exist if (this.HeroTurnTaker.Trash.Cards.Count <Card>() >= 3) { // Ask if we should move the top two cards of the trash to the bottom of the deck for things. YesNoAmountDecision yesNoDecision = new YesNoAmountDecision(this.GameController, this.DecisionMaker, SelectionType.MoveCard, 3, associatedCards: new List <Card> { this.Card }, cardSource: this.GetCardSource()); coroutine = this.GameController.MakeDecisionAction(yesNoDecision); if (this.UseUnityCoroutines) { yield return(this.GameController.StartCoroutine(coroutine)); } else { this.GameController.ExhaustCoroutine(coroutine); } if (this.DidPlayerAnswerYes(yesNoDecision)) { List <MoveCardAction> storedResults = new List <MoveCardAction>(); // Move the top three cards. coroutine = this.GameController.MoveCards(this.DecisionMaker, this.HeroTurnTaker.Trash.GetTopCards(3), this.HeroTurnTaker.Deck, true, storedResultsAction: storedResults, cardSource: this.GetCardSource()); if (this.UseUnityCoroutines) { yield return(this.GameController.StartCoroutine(coroutine)); } else { this.GameController.ExhaustCoroutine(coroutine); } if (storedResults.Count != 3 || storedResults.Any((MoveCardAction mca) => !mca.WasCardMoved)) { // Failed Movement - destroy. coroutine = this.GameController.DestroyCard(this.DecisionMaker, this.Card, false, null, null, null, null, null, null, null, null, this.GetCardSource()); if (this.UseUnityCoroutines) { yield return(this.GameController.StartCoroutine(coroutine)); } else { this.GameController.ExhaustCoroutine(coroutine); } } } else { // No movement - destroy. coroutine = this.GameController.DestroyCard(this.DecisionMaker, this.Card, false, null, null, null, null, null, null, null, null, this.GetCardSource()); if (this.UseUnityCoroutines) { yield return(this.GameController.StartCoroutine(coroutine)); } else { this.GameController.ExhaustCoroutine(coroutine); } } } else { // Not enough cards - automatically destroy. // TODO: Add message if appropriate. coroutine = this.GameController.DestroyCard(this.DecisionMaker, this.Card, false, null, null, null, null, null, null, null, null, this.GetCardSource(null)); if (this.UseUnityCoroutines) { yield return(this.GameController.StartCoroutine(coroutine)); } else { this.GameController.ExhaustCoroutine(coroutine); } } }