public override IEnumerator UsePower(int index = 0) { IEnumerator coroutine; List <int> powerNumerals = new List <int>() { GetPowerNumeral(0, 3), GetPowerNumeral(1, 1) }; List <DiscardCardAction> storedResults = new List <DiscardCardAction>(); string spacedPrefixTitle = ""; string spacedSuffixTitle = ""; CardSource cardSource = this.GetCardSource(); // Only fetch once to pass through all references. // Discard prefix. coroutine = this.GameController.SelectAndDiscardCards(this.DecisionMaker, 1, false, 0, storedResults, false, cardCriteria: new LinqCardCriteria((Card c) => c.DoKeywordsContain("prefix"), "prefix"), cardSource: cardSource); if (this.UseUnityCoroutines) { yield return(this.GameController.StartCoroutine(coroutine)); } else { this.GameController.ExhaustCoroutine(coroutine); } if (storedResults.Count > 0 && storedResults.FirstOrDefault().IsSuccessful) { Card c = storedResults.FirstOrDefault().CardToDiscard; CardController cc = this.FindCardController(c); if (cc is SpellforgeSharedModifierCardController) { // Type matches, everything should be implemented now! SpellforgeSharedModifierCardController wcc = (SpellforgeSharedModifierCardController)this.FindCardController(c); this.AddToTemporaryTriggerList(wcc.AddModifierTrigger(cardSource)); spacedPrefixTitle = c.Definition.AlternateTitle + " "; } } // Discard suffix. storedResults.Clear(); coroutine = this.GameController.SelectAndDiscardCards(this.DecisionMaker, 1, false, 0, storedResults, false, cardCriteria: new LinqCardCriteria((Card c) => c.DoKeywordsContain("suffix"), "suffix"), cardSource: cardSource); if (this.UseUnityCoroutines) { yield return(this.GameController.StartCoroutine(coroutine)); } else { this.GameController.ExhaustCoroutine(coroutine); } if (storedResults.Count > 0 && storedResults.FirstOrDefault().IsSuccessful) { Card c = storedResults.FirstOrDefault().CardToDiscard; CardController cc = this.FindCardController(c); if (cc is SpellforgeSharedModifierCardController) { // Type matches, everything should be implemented now! SpellforgeSharedModifierCardController wcc = (SpellforgeSharedModifierCardController)this.FindCardController(c); this.AddToTemporaryTriggerList(wcc.AddModifierTrigger(cardSource)); spacedSuffixTitle = " " + c.Definition.AlternateTitle; } } if (spacedPrefixTitle.Length > 0 || spacedSuffixTitle.Length > 0) { coroutine = this.GameController.SendMessageAction("{Spellforge} uses " + spacedPrefixTitle + this.CharacterCard.Definition.Body.FirstOrDefault() + spacedSuffixTitle + "!", Priority.Low, cardSource); if (this.UseUnityCoroutines) { yield return(this.GameController.StartCoroutine(coroutine)); } else { this.GameController.ExhaustCoroutine(coroutine); } } // Deal up to 3 targets 1 infernal (as a base). coroutine = this.GameController.SelectTargetsAndDealDamage(this.DecisionMaker, new DamageSource(this.GameController, this.CharacterCard), powerNumerals[1], DamageType.Infernal, powerNumerals[0], false, 0, false, false, false, null, null, null, null, null, false, null, null, false, null, cardSource); if (this.UseUnityCoroutines) { yield return(this.GameController.StartCoroutine(coroutine)); } else { this.GameController.ExhaustCoroutine(coroutine); } // Clear all temporary triggers created by this card. this.RemoveTemporaryTriggers(); }
public override IEnumerator Play() { IEnumerator coroutine; List <DiscardCardAction> storedResults = new List <DiscardCardAction>(); string spacedPrefixTitle = ""; string spacedSuffixTitle = ""; CardSource cardSource = this.GetCardSource(); // Fetch once so comparisons work properly, rather than generating new instances. // Discard prefix. coroutine = this.GameController.SelectAndDiscardCards(this.DecisionMaker, 1, false, 0, storedResults, false, cardCriteria: new LinqCardCriteria((Card c) => c.DoKeywordsContain("prefix"), "prefix"), cardSource: cardSource); if (this.UseUnityCoroutines) { yield return(this.GameController.StartCoroutine(coroutine)); } else { this.GameController.ExhaustCoroutine(coroutine); } if (storedResults.Count > 0 && storedResults.FirstOrDefault().IsSuccessful) { Card c = storedResults.FirstOrDefault().CardToDiscard; CardController cc = this.FindCardController(c); if (cc is SpellforgeSharedModifierCardController) { // Type matches, everything should be implemented now! SpellforgeSharedModifierCardController wcc = (SpellforgeSharedModifierCardController)this.FindCardController(c); this.AddToTemporaryTriggerList(wcc.AddModifierTrigger(cardSource)); spacedPrefixTitle = c.Definition.AlternateTitle + " "; } } // Discard suffix. storedResults.Clear(); coroutine = this.GameController.SelectAndDiscardCards(this.DecisionMaker, 1, false, 0, storedResults, false, cardCriteria: new LinqCardCriteria((Card c) => c.DoKeywordsContain("suffix"), "suffix"), cardSource: cardSource); if (this.UseUnityCoroutines) { yield return(this.GameController.StartCoroutine(coroutine)); } else { this.GameController.ExhaustCoroutine(coroutine); } if (storedResults.Count > 0 && storedResults.FirstOrDefault().IsSuccessful) { Card c = storedResults.FirstOrDefault().CardToDiscard; CardController cc = this.FindCardController(c); if (cc is SpellforgeSharedModifierCardController) { // Type matches, everything should be implemented now! SpellforgeSharedModifierCardController wcc = (SpellforgeSharedModifierCardController)this.FindCardController(c); this.AddToTemporaryTriggerList(wcc.AddModifierTrigger(cardSource)); spacedSuffixTitle = " " + c.Definition.AlternateTitle; } } if (spacedPrefixTitle.Length > 0 || spacedSuffixTitle.Length > 0) { coroutine = this.GameController.SendMessageAction("{Spellforge} uses " + spacedPrefixTitle + this.Card.AlternateTitleOrTitle + spacedSuffixTitle + "!", Priority.Low, cardSource); if (this.UseUnityCoroutines) { yield return(this.GameController.StartCoroutine(coroutine)); } else { this.GameController.ExhaustCoroutine(coroutine); } } coroutine = this.PerformModifiedAction(cardSource); if (this.UseUnityCoroutines) { yield return(this.GameController.StartCoroutine(coroutine)); } else { this.GameController.ExhaustCoroutine(coroutine); } // Clear all temporary triggers created by this card. this.RemoveTemporaryTriggers(); }