コード例 #1
0
        public override IEnumerator UsePower(int index = 0)
        {
            //"Once before your next turn when a non-hero card enters play, one hero target may deal a non-hero target 2 damage of a type of their choosing. You may destroy this card to increase that damage by 2."

            //There is no way to set up a status effect that triggers when any card enters play.
            //The actual mechanical function of this effect lives on MaraUtilityCharacter,
            //this just notifies it that it's time to start working.


            ActivateEffectStatusEffect dowsingTrigger = new ActivateEffectStatusEffect(TurnTaker, TurnTaker.CharacterCard, "Dowsing Crystal trigger");

            dowsingTrigger.UntilStartOfNextTurn(TurnTaker);
            IEnumerator coroutine = GameController.AddStatusEffect(dowsingTrigger, false, GetCardSource());

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

            //Log.Debug($"Dowsing Crystal trigger effects allowed? {CanActivateEffect((TurnTaker.CharacterCard), "Dowsing Crystal trigger")}");

            yield break;
        }
コード例 #2
0
        public override IEnumerator UsePower(int index = 0)
        {
            IEnumerator           coroutine;
            List <PlayCardAction> storedResultsPlay = new List <PlayCardAction>();

            // Draw a card.
            coroutine = this.DrawCards(this.DecisionMaker, 1);
            if (this.UseUnityCoroutines)
            {
                yield return(this.GameController.StartCoroutine(coroutine));
            }
            else
            {
                this.GameController.ExhaustCoroutine(coroutine);
            }

            // Play a card.
            coroutine = this.GameController.SelectAndPlayCardFromHand(this.HeroTurnTakerController, false, storedResults: storedResultsPlay, cardSource: this.GetCardSource());
            if (this.UseUnityCoroutines)
            {
                yield return(this.GameController.StartCoroutine(coroutine));
            }
            else
            {
                this.GameController.ExhaustCoroutine(coroutine);
            }

            // A successful play means performing check logic for each of the three symbols on text.
            if (storedResultsPlay.Count > 0 && storedResultsPlay.FirstOrDefault().IsSuccessful)
            {
                Card card = storedResultsPlay.FirstOrDefault().CardToPlay;
                if (card != null)
                {
                    List <string> options = new string[] { "{gazelle}", "{rhinoceros}", "{crocodile}" }.Where((string i) => this.CardHasIconText(card, i)).ToList();
                    string        selectedWord = null;
                    if (options.Count > 1)
                    {
                        List <SelectWordDecision> storedResultsWord = new List <SelectWordDecision>();
                        coroutine = this.GameController.SelectWord(this.DecisionMaker, options, SelectionType.NaturalistForm, storedResultsWord, false, null, this.GetCardSource());
                        if (this.UseUnityCoroutines)
                        {
                            yield return(this.GameController.StartCoroutine(coroutine));
                        }
                        else
                        {
                            this.GameController.ExhaustCoroutine(coroutine);
                        }

                        selectedWord = this.GetSelectedWord(storedResultsWord);
                    }
                    else if (options.Count == 1)
                    {
                        selectedWord = options.FirstOrDefault();
                    }

                    if (selectedWord != null)
                    {
                        // If we reach this, we've searched and confirm we have the icon, so run the add icon status!
                        ActivateEffectStatusEffect activateEffectStatusEffect = new ActivateEffectStatusEffect(this.HeroTurnTaker, card, selectedWord);

                        // Lasts until the next power use!
                        if (this.TurnTaker.IsHero)
                        {
                            activateEffectStatusEffect.UsePowerExpiryCriteria.HeroUsingPower = this.HeroTurnTaker;
                        }
                        else
                        {
                            activateEffectStatusEffect.UsePowerExpiryCriteria.IsSpecificCard = this.Card;
                        }

                        coroutine = this.AddStatusEffect(activateEffectStatusEffect, true);
                        if (this.UseUnityCoroutines)
                        {
                            yield return(this.GameController.StartCoroutine(coroutine));
                        }
                        else
                        {
                            this.GameController.ExhaustCoroutine(coroutine);
                        }
                    }
                    else
                    {
                        this.GameController.SendMessageAction("The played card does not contain {gazelle}, {rhinoceros}, or {crocodile}.", Priority.Medium, this.GetCardSource());
                        if (this.UseUnityCoroutines)
                        {
                            yield return(this.GameController.StartCoroutine(coroutine));
                        }
                        else
                        {
                            this.GameController.ExhaustCoroutine(coroutine);
                        }
                    }
                }
            }
        }