public override IEnumerator UsePower(int index = 0)
        {
            int hpGain = GetPowerNumeral(0, 2);

            int[] powerNumerals = { hpGain };

            // "The next time another hero would be dealt damage, redirect it to {ImpulseCharacter}. If {ImpulseCharacter} takes damage this way, he regains 2 HP."
            OnDealDamageStatusEffect redirect = new OnDealDamageStatusEffect(CardWithoutReplacements, nameof(RedirectDamageToMe), "The next time another hero would be dealt damage, redirect it to " + base.Card.Title + ". If " + base.Card.Title + " takes damage this way, he regains 2 HP.", new TriggerType[] { TriggerType.RedirectDamage, TriggerType.GainHP }, base.TurnTaker, base.Card, powerNumerals);

            redirect.CardFlippedExpiryCriteria.Card     = base.Card;
            redirect.TargetCriteria.IsHeroCharacterCard = true;
            redirect.TargetCriteria.IsNotSpecificCard   = base.Card;
            redirect.NumberOfUses = 1;
            IEnumerator redirectCoroutine = AddStatusEffect(redirect);

            if (base.UseUnityCoroutines)
            {
                yield return(base.GameController.StartCoroutine(redirectCoroutine));
            }
            else
            {
                base.GameController.ExhaustCoroutine(redirectCoroutine);
            }
            yield break;
        }
        public override IEnumerator UsePower(int index = 0)
        {
            int numDamage = GetPowerNumeral(0, 3);

            //"Once before your next turn, when a hero target is dealt damage, {Echelon} may deal the source of that damage 3 melee damage"
            var statusEffect = new OnDealDamageStatusEffect(CardWithoutReplacements, nameof(MaybeCounterDamageResponse), $"Once before their next turn, when a hero target is dealt damage {DecisionMaker.Name} may deal the source of that damage {numDamage} melee damage.", new TriggerType[] { TriggerType.DealDamage }, DecisionMaker.TurnTaker, this.Card, new int[] { numDamage });

            statusEffect.TargetCriteria.IsHero            = true;
            statusEffect.DamageAmountCriteria.GreaterThan = 0;
            statusEffect.UntilStartOfNextTurn(DecisionMaker.TurnTaker);
            statusEffect.UntilTargetLeavesPlay(CharacterCard);
            statusEffect.BeforeOrAfter  = BeforeOrAfter.After;
            statusEffect.DoesDealDamage = true;
            statusEffect.CanEffectStack = true;

            IEnumerator coroutine = AddStatusEffect(statusEffect);

            if (base.UseUnityCoroutines)
            {
                yield return(base.GameController.StartCoroutine(coroutine));
            }
            else
            {
                base.GameController.ExhaustCoroutine(coroutine);
            }
            yield break;
        }
        private IEnumerator ApplyStatusEffects(DealDamageAction dd)
        {
            OnDealDamageStatusEffect onDealDamageStatusEffect = new OnDealDamageStatusEffect(CardWithoutReplacements, nameof(RedirectAndReduceResponse), "Redirect the next damage dealt by " + dd.Target.Title + " to " + CharacterCard.Title + ". Reduce that damage by {EFFECT_VALUE}.", new TriggerType[2]
            {
                TriggerType.RedirectDamage,
                TriggerType.ReduceDamage
            }, TurnTaker, Card);
            List <Card> list = new List <Card>();

            list.Add(CharacterCard);
            list.Add(dd.Target);
            onDealDamageStatusEffect.TargetLeavesPlayExpiryCriteria.IsOneOfTheseCards = list;
            onDealDamageStatusEffect.NumberOfUses  = 1;
            onDealDamageStatusEffect.BeforeOrAfter = BeforeOrAfter.Before;
            onDealDamageStatusEffect.SourceCriteria.IsSpecificCard = dd.Target;
            onDealDamageStatusEffect.EffectValue = 2;
            IEnumerator coroutine = AddStatusEffect(onDealDamageStatusEffect);

            if (base.UseUnityCoroutines)
            {
                yield return(base.GameController.StartCoroutine(coroutine));
            }
            else
            {
                base.GameController.ExhaustCoroutine(coroutine);
            }
        }
        public IEnumerator RedirectAndReduceResponse(DealDamageAction dd, TurnTaker tt, StatusEffect effect, int[] powerNumerals = null)
        {
            IEnumerator coroutine;

            if (dd.Target != tt.CharacterCard)
            {
                coroutine = GameController.RedirectDamage(dd, tt.CharacterCard, cardSource: GetCardSource());
                if (base.UseUnityCoroutines)
                {
                    yield return(base.GameController.StartCoroutine(coroutine));
                }
                else
                {
                    base.GameController.ExhaustCoroutine(coroutine);
                }
            }
            OnDealDamageStatusEffect onDealDamageStatusEffect = (OnDealDamageStatusEffect)effect;

            coroutine = GameController.ReduceDamage(dd, onDealDamageStatusEffect.EffectValue, null, cardSource: GetCardSource());
            if (base.UseUnityCoroutines)
            {
                yield return(base.GameController.StartCoroutine(coroutine));
            }
            else
            {
                base.GameController.ExhaustCoroutine(coroutine);
            }
        }
        public override IEnumerator UseIncapacitatedAbility(int index)
        {
            switch (index)
            {
            case 0:
            {
                //"Until the start of your next turn, prevent all damage that would be dealt to or by the target with the lowest HP.",
                OnDealDamageStatusEffect lowestTargetImmunity = new OnDealDamageStatusEffect(Card, "LowestTargetImmunity", "The target with the lowest HP is immune to damage and cannot deal damage.", new TriggerType[] { TriggerType.MakeImmuneToDamage }, TurnTaker, Card);
                lowestTargetImmunity.UntilStartOfNextTurn(TurnTaker);
                lowestTargetImmunity.CardSource = Card;
                lowestTargetImmunity.SourceCriteria.IsTarget = true;
                lowestTargetImmunity.BeforeOrAfter           = BeforeOrAfter.Before;
                IEnumerator coroutine = AddStatusEffect(lowestTargetImmunity);
                if (UseUnityCoroutines)
                {
                    yield return(GameController.StartCoroutine(coroutine));
                }
                else
                {
                    GameController.ExhaustCoroutine(coroutine);
                }
                break;
            }

            case 1:
            {
                //"1 player may use a power now.",
                IEnumerator coroutine2 = GameController.SelectHeroToUsePower(HeroTurnTakerController, optionalSelectHero: false, optionalUsePower: true, allowAutoDecide: false, null, null, null, omitHeroesWithNoUsablePowers: true, canBeCancelled: true, GetCardSource());
                if (UseUnityCoroutines)
                {
                    yield return(GameController.StartCoroutine(coroutine2));
                }
                else
                {
                    GameController.ExhaustCoroutine(coroutine2);
                }
                break;
            }

            case 2:
            {
                //"1 hero target regains 2 HP."
                IEnumerator coroutine3 = GameController.SelectAndGainHP(HeroTurnTakerController, 2, optional: false, (Card c) => c.IsInPlay && c.IsHero && c.IsTarget, 1, null, allowAutoDecide: false, null, GetCardSource());
                if (UseUnityCoroutines)
                {
                    yield return(GameController.StartCoroutine(coroutine3));
                }
                else
                {
                    GameController.ExhaustCoroutine(coroutine3);
                }
                break;
            }
            }


            yield break;
        }
        public override IEnumerator UsePower(int index = 0)
        {
            // Add 2 tokens to your element pool.
            int       tokensToAdd         = GetPowerNumeral(0, 2);
            bool      otherHeroUsingPower = false;
            TokenPool elementPool         = base.CharacterCard.FindTokenPool(LadyOfTheWoodElementPoolIdentifier);

            if (elementPool == null || !base.TurnTaker.IsHero)
            {
                //TODO: Engine limitation currently prevents us from Dynamic pool generation, but once that exists this should
                //		create a token pool on the other character card, and then allow for spending tokens from their
                //		own token poool for the second part of the effect
                otherHeroUsingPower = true;
                TurnTaker turnTaker = FindTurnTakersWhere((TurnTaker tt) => tt.Identifier == "LadyOfTheWood").FirstOrDefault();
                if (turnTaker != null)
                {
                    elementPool = turnTaker.CharacterCard.FindTokenPool(LadyOfTheWoodElementPoolIdentifier);
                }
            }
            IEnumerator coroutine = base.GameController.AddTokensToPool(elementPool, tokensToAdd, GetCardSource());

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

            if (otherHeroUsingPower)
            {
                OnDealDamageStatusEffect effect = new OnDealDamageStatusEffect(CardWithoutReplacements, nameof(ChangeDamageTypeResponse), "When " + base.Card.Title + " would deal damage, you may change its type by spending a token", new TriggerType[]
                {
                    TriggerType.ModifyTokens,
                    TriggerType.ChangeDamageType
                }, base.TurnTaker, base.Card);
                effect.SourceCriteria.IsSpecificCard = base.Card;
                effect.UntilTargetLeavesPlay(base.Card);
                effect.BeforeOrAfter  = BeforeOrAfter.Before;
                effect.CanEffectStack = true;
                coroutine             = AddStatusEffect(effect);
                if (base.UseUnityCoroutines)
                {
                    yield return(base.GameController.StartCoroutine(coroutine));
                }
                else
                {
                    base.GameController.ExhaustCoroutine(coroutine);
                }
            }
            yield break;
        }
        public override IEnumerator UsePower(int index = 0)
        {
            IEnumerator coroutine;
            int         powerNumeral = GetPowerNumeral(0, 1);
            string      turnTakerName;

            // Draw a card.
            coroutine = this.GameController.DrawCard(this.HeroTurnTaker);
            if (this.UseUnityCoroutines)
            {
                yield return(this.GameController.StartCoroutine(coroutine));
            }
            else
            {
                this.GameController.ExhaustCoroutine(coroutine);
            }

            // Set up response.
            if (base.TurnTaker.IsHero)
            {
                turnTakerName = this.TurnTaker.Name;
            }
            else
            {
                turnTakerName = this.Card.Title;
            }

            // ReduceDamage isn't technically an accurate trigger, but CancelAction alone causes the numbers to not work well when boosting or reducing, so it has to be kept.
            OnDealDamageStatusEffect onDealDamageStatusEffect = new OnDealDamageStatusEffect(this.CardWithoutReplacements, "PreventResponse", "Whenever " + turnTakerName + " is dealt exactly " + powerNumeral + " damage, prevent that damage.", new TriggerType[] { TriggerType.ReduceDamage, TriggerType.CancelAction }, this.HeroTurnTaker, this.Card, new int[] { powerNumeral });

            onDealDamageStatusEffect.TargetCriteria.IsSpecificCard = this.CharacterCard;
            onDealDamageStatusEffect.CanEffectStack = false;
            onDealDamageStatusEffect.BeforeOrAfter  = BeforeOrAfter.Before;
            onDealDamageStatusEffect.DamageAmountCriteria.EqualTo = powerNumeral;
            onDealDamageStatusEffect.UntilEndOfNextTurn(this.HeroTurnTaker);

            coroutine = this.AddStatusEffect(onDealDamageStatusEffect);
            if (this.UseUnityCoroutines)
            {
                yield return(this.GameController.StartCoroutine(coroutine));
            }
            else
            {
                this.GameController.ExhaustCoroutine(coroutine);
            }
        }
        public override IEnumerator UsePower(int index = 0)
        {
            string      turnTakerName;
            IEnumerator coroutine;
            int         powerNumeral = this.GetPowerNumeral(0, 1);

            // Draw a card.
            coroutine = this.GameController.DrawCard(this.HeroTurnTaker);
            if (this.UseUnityCoroutines)
            {
                yield return(this.GameController.StartCoroutine(coroutine));
            }
            else
            {
                this.GameController.ExhaustCoroutine(coroutine);
            }

            // Set up heal response.
            if (base.TurnTaker.IsHero)
            {
                turnTakerName = this.TurnTaker.Name;
            }
            else
            {
                turnTakerName = this.Card.Title;
            }
            OnDealDamageStatusEffect onDealDamageStatusEffect = new OnDealDamageStatusEffect(this.CardWithoutReplacements, "HealResponse", "Whenever " + turnTakerName + " is dealt damage, they regain " + powerNumeral + " HP.", new TriggerType[] { TriggerType.DealDamage }, this.HeroTurnTaker, this.Card, new int[] { powerNumeral });

            onDealDamageStatusEffect.TargetCriteria.IsSpecificCard = this.CharacterCard;
            onDealDamageStatusEffect.SourceCriteria.IsSpecificCard = this.CharacterCard;
            onDealDamageStatusEffect.CanEffectStack = true;
            onDealDamageStatusEffect.BeforeOrAfter  = BeforeOrAfter.After;
            onDealDamageStatusEffect.UntilEndOfNextTurn(this.HeroTurnTaker);

            coroutine = this.AddStatusEffect(onDealDamageStatusEffect);
            if (this.UseUnityCoroutines)
            {
                yield return(this.GameController.StartCoroutine(coroutine));
            }
            else
            {
                this.GameController.ExhaustCoroutine(coroutine);
            }
        }
        public IEnumerator CreatePreventStatus(DealDamageAction dda)
        {
            OnDealDamageStatusEffect preventStatus = new OnDealDamageStatusEffect(base.Card, "PreventDamage", "Prevent all damage that would be dealt to " + base.CharacterCard.Title + " this turn.", new TriggerType[] { TriggerType.CancelAction }, base.TurnTaker, base.Card);

            preventStatus.TargetCriteria.IsSpecificCard = base.CharacterCard;
            preventStatus.UntilThisTurnIsOver(base.Game);
            preventStatus.UntilCardLeavesPlay(base.CharacterCard);
            IEnumerator statusCoroutine = AddStatusEffect(preventStatus);

            if (base.UseUnityCoroutines)
            {
                yield return(base.GameController.StartCoroutine(statusCoroutine));
            }
            else
            {
                base.GameController.ExhaustCoroutine(statusCoroutine);
            }
            yield break;
        }
Example #10
0
        private IEnumerator ApplyStatusEffects(DealDamageAction dd)
        {
            var target = dd.Target;
            OnDealDamageStatusEffect oddse = new OnDealDamageStatusEffect(this.CardWithoutReplacements, nameof(this.RedirectDamageResponse), $"You may redirect the next damage dealt by {target.Title}.", new TriggerType[] { TriggerType.RedirectDamage }, this.TurnTaker, base.Card, null);

            oddse.SourceCriteria.IsSpecificCard = target;
            oddse.NumberOfUses  = 1;
            oddse.BeforeOrAfter = BeforeOrAfter.Before;
            oddse.UntilTargetLeavesPlay(target);
            IEnumerator coroutine = AddStatusEffect(oddse, true);

            if (base.UseUnityCoroutines)
            {
                yield return(base.GameController.StartCoroutine(coroutine));
            }
            else
            {
                base.GameController.ExhaustCoroutine(coroutine);
            }
        }
Example #11
0
        public IEnumerator AddTackleEffect(DealDamageAction dda)
        {
            // "Until the start of your next turn, whenever that target would deal damage, reduce that damage to 1."
            Card pinned = dda.Target;
            OnDealDamageStatusEffect tackleEffect = new OnDealDamageStatusEffect(base.Card, "ReduceToOne", "Until the start of " + base.CharacterCard.Title + "'s next turn, whenever " + pinned.Title + " would deal damage, reduce that damage to 1.", new TriggerType[] { TriggerType.ReduceDamage }, base.TurnTaker, base.Card);

            tackleEffect.SourceCriteria.IsSpecificCard = pinned;
            tackleEffect.UntilStartOfNextTurn(base.TurnTaker);
            tackleEffect.DamageAmountCriteria.GreaterThan = 1;
            tackleEffect.UntilCardLeavesPlay(pinned);

            IEnumerator statusCoroutine = base.GameController.AddStatusEffect(tackleEffect, true, GetCardSource());

            if (base.UseUnityCoroutines)
            {
                yield return(base.GameController.StartCoroutine(statusCoroutine));
            }
            else
            {
                base.GameController.ExhaustCoroutine(statusCoroutine);
            }
            yield break;
        }
Example #12
0
        private IEnumerator ApplyStatusEffects(DealDamageAction dd)
        {
            var target = dd.Target;
            OnDealDamageStatusEffect oddse = new OnDealDamageStatusEffect(this.CardWithoutReplacements, nameof(DealDamageToSelfResponse), $"Until the end of your next turn, when {target.Title} deals another target damage, {target.Title} deals itself 1 psychic damage.", new TriggerType[] { TriggerType.DealDamage }, base.TurnTaker, this.Card);

            oddse.UntilTargetLeavesPlay(target);
            oddse.SourceCriteria.IsSpecificCard    = target;
            oddse.TargetCriteria.IsNotSpecificCard = target;
            oddse.UntilEndOfNextTurn(base.TurnTaker);
            oddse.BeforeOrAfter  = BeforeOrAfter.After;
            oddse.DoesDealDamage = true;
            oddse.DamageAmountCriteria.GreaterThan = 0;
            IEnumerator coroutine = AddStatusEffect(oddse, true);

            if (UseUnityCoroutines)
            {
                yield return(base.GameController.StartCoroutine(coroutine));
            }
            else
            {
                base.GameController.ExhaustCoroutine(coroutine);
            }
        }
        public override IEnumerator UsePower(int index = 0)
        {
            //"The next time {Vanish} is dealt damage, draw or play a card."
            var effect = new OnDealDamageStatusEffect(CardWithoutReplacements, nameof(DrawOrPlayResponse), $"The next time {CharacterCard.Title} is dealt damage, draw or play a card.", new[] { TriggerType.DrawCard, TriggerType.PlayCard }, TurnTaker, CharacterCard);

            effect.NumberOfUses = 1;
            effect.TargetCriteria.IsSpecificCard = CharacterCard;
            effect.CardSource     = CharacterCard;
            effect.BeforeOrAfter  = BeforeOrAfter.After;
            effect.CanEffectStack = true;
            effect.UntilTargetLeavesPlay(CharacterCard);

            var coroutine = AddStatusEffect(effect);

            if (base.UseUnityCoroutines)
            {
                yield return(base.GameController.StartCoroutine(coroutine));
            }
            else
            {
                base.GameController.ExhaustCoroutine(coroutine);
            }
        }
Example #14
0
        public IEnumerator AddCrashEffect(DealDamageAction dda)
        {
            // "The next time that target would deal damage, prevent that damage and you may destroy an environment card."
            Card provoked = dda.Target;
            OnDealDamageStatusEffect crashEffect = new OnDealDamageStatusEffect(base.Card, "PreventAndDestroy", "The next time " + provoked.Title + " would deal damage, prevent that damage and " + base.CharacterCard.Title + " may destroy an environment card.", new TriggerType[] { TriggerType.CancelAction, TriggerType.DestroyCard }, base.TurnTaker, base.Card);

            crashEffect.SourceCriteria.IsSpecificCard    = provoked;
            crashEffect.DamageAmountCriteria.GreaterThan = 0;
            crashEffect.NumberOfUses = 1;
            crashEffect.UntilCardLeavesPlay(provoked);
            crashEffect.CanEffectStack = true;

            IEnumerator statusCoroutine = base.GameController.AddStatusEffect(crashEffect, true, GetCardSource());

            if (base.UseUnityCoroutines)
            {
                yield return(base.GameController.StartCoroutine(statusCoroutine));
            }
            else
            {
                base.GameController.ExhaustCoroutine(statusCoroutine);
            }
            yield break;
        }
Example #15
0
        private IEnumerator AddFallResponse()
        {
            //Whenever a hero deals lightning damage to a target, reduce damage dealt by that target by 1 until the start of your next turn.
            OnDealDamageStatusEffect effect = new OnDealDamageStatusEffect(CardWithoutReplacements, nameof(FallReduceDamageReponse), "Whenever a hero deals lightning damage to a target, reduce damage dealt by that target by 1 until the start of your next turn.", new TriggerType[]
            {
                TriggerType.ReduceDamage
            }, base.TurnTaker, base.Card);

            effect.SourceCriteria.IsHeroCharacterCard = true;
            effect.DamageTypeCriteria.AddType(DamageType.Lightning);
            effect.UntilStartOfNextTurn(base.TurnTaker);
            effect.BeforeOrAfter  = BeforeOrAfter.After;
            effect.CanEffectStack = true;
            IEnumerator coroutine = AddStatusEffect(effect);

            if (base.UseUnityCoroutines)
            {
                yield return(base.GameController.StartCoroutine(coroutine));
            }
            else
            {
                base.GameController.ExhaustCoroutine(coroutine);
            }
        }
Example #16
0
        private IEnumerator AddWinterResponse()
        {
            //Whenever a hero deals cold damage to a target, they draw a card.
            OnDealDamageStatusEffect effect = new OnDealDamageStatusEffect(CardWithoutReplacements, nameof(WinterDrawCardReponse), "Whenever a hero deals cold damage to a target, they draw a card.", new TriggerType[]
            {
                TriggerType.DrawCard
            }, base.TurnTaker, base.Card);

            effect.SourceCriteria.IsHeroCharacterCard = true;
            effect.UntilStartOfNextTurn(base.TurnTaker);
            effect.DamageTypeCriteria.AddType(DamageType.Cold);
            effect.BeforeOrAfter  = BeforeOrAfter.After;
            effect.CanEffectStack = true;
            IEnumerator coroutine = AddStatusEffect(effect);

            if (base.UseUnityCoroutines)
            {
                yield return(base.GameController.StartCoroutine(coroutine));
            }
            else
            {
                base.GameController.ExhaustCoroutine(coroutine);
            }
        }
Example #17
0
        public override IEnumerator UseIncapacitatedAbility(int index)
        {
            switch (index)
            {
            case 0:
            {
                //One player may draw a card now.
                IEnumerator coroutine = base.GameController.SelectHeroToDrawCard(base.HeroTurnTakerController, cardSource: base.GetCardSource());
                if (base.UseUnityCoroutines)
                {
                    yield return(base.GameController.StartCoroutine(coroutine));
                }
                else
                {
                    base.GameController.ExhaustCoroutine(coroutine);
                }
                break;
            }

            case 1:
            {
                //The next time a hero is dealt damage, they may play a card.
                OnDealDamageStatusEffect statusEffect = new OnDealDamageStatusEffect(CardWithoutReplacements, nameof(PlayCardResponse), "The next time a hero is dealt damage, they may play a card.", new TriggerType[] { TriggerType.PlayCard }, base.TurnTaker, base.Card);
                statusEffect.NumberOfUses   = 1;
                statusEffect.CanEffectStack = true;

                if (IsRealAction())
                {
                    var uses = GetCardPropertyJournalEntryInteger("Incap2Effect") ?? 0;
                    Journal.RecordCardProperties(CharacterCard, "Incap2Effect", uses + 1);
                }

                IEnumerator coroutine2 = base.AddStatusEffect(statusEffect, true);
                if (base.UseUnityCoroutines)
                {
                    yield return(base.GameController.StartCoroutine(coroutine2));
                }
                else
                {
                    base.GameController.ExhaustCoroutine(coroutine2);
                }
                break;
            }

            case 2:
            {
                //Increase all damage dealt by 1 until the start of your next turn.
                IncreaseDamageStatusEffect increaseDamageStatusEffect = new IncreaseDamageStatusEffect(1);
                increaseDamageStatusEffect.UntilStartOfNextTurn(base.TurnTaker);
                IEnumerator coroutine3 = base.AddStatusEffect(increaseDamageStatusEffect, true);
                if (base.UseUnityCoroutines)
                {
                    yield return(base.GameController.StartCoroutine(coroutine3));
                }
                else
                {
                    base.GameController.ExhaustCoroutine(coroutine3);
                }
                break;
            }
            }
            yield break;
        }
        public override IEnumerator UsePower(int index = 0)
        {
            int targetNumeral = base.GetPowerNumeral(0, 2);
            int damageNumeral = base.GetPowerNumeral(1, 2);

            List <SelectCardDecision> storedSelect = new List <SelectCardDecision>();
            //{Titan} deals up to 2 non-hero targets 2 infernal damage each.
            IEnumerator coroutine = base.GameController.SelectTargetsAndDealDamage(base.HeroTurnTakerController, new DamageSource(base.GameController, base.CharacterCard), damageNumeral, DamageType.Infernal, targetNumeral, false, 0, storedResultsDecisions: storedSelect, cardSource: base.GetCardSource());

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

            //Until the start of your next turn, when those targets would deal damage, you may redirect that damage to {Titan}.
            if (storedSelect.FirstOrDefault() != null)
            {
                List <StatusEffect> redirects = new List <StatusEffect> {
                };

                foreach (SelectCardDecision decision in storedSelect)
                {
                    if (decision.SelectedCard != null && decision.SelectedCard.IsInPlayAndHasGameText)
                    {
                        OnDealDamageStatusEffect onDealDamageStatusEffect = new OnDealDamageStatusEffect(CardWithoutReplacements,
                                                                                                         nameof(MaybeRedirectDamageResponse),
                                                                                                         $"When {decision.SelectedCard.Title} would deal damage, {DecisionMaker.Name} may redirect it to themselves.",
                                                                                                         new TriggerType[] { TriggerType.RedirectDamage, TriggerType.WouldBeDealtDamage },
                                                                                                         this.TurnTaker,
                                                                                                         this.Card);

                        //Until the start of your next turn...
                        onDealDamageStatusEffect.UntilStartOfNextTurn(base.TurnTaker);
                        //...when those targets would deal damage...
                        onDealDamageStatusEffect.SourceCriteria.IsSpecificCard    = decision.SelectedCard;
                        onDealDamageStatusEffect.DamageAmountCriteria.GreaterThan = 0;

                        //prevent it from asking to redirect from Titan to Titan
                        onDealDamageStatusEffect.TargetCriteria.IsNotSpecificCard = this.CharacterCard;

                        onDealDamageStatusEffect.UntilTargetLeavesPlay(decision.SelectedCard);
                        onDealDamageStatusEffect.BeforeOrAfter  = BeforeOrAfter.Before;
                        onDealDamageStatusEffect.CanEffectStack = true;

                        redirects.Add(onDealDamageStatusEffect);
                    }
                }

                foreach (StatusEffect effect in redirects)
                {
                    coroutine = base.AddStatusEffect(effect);
                    if (base.UseUnityCoroutines)
                    {
                        yield return(base.GameController.StartCoroutine(coroutine));
                    }
                    else
                    {
                        base.GameController.ExhaustCoroutine(coroutine);
                    }
                }
            }
            yield break;
        }
Example #19
0
        public override IEnumerator UseIncapacitatedAbility(int index)
        {
            switch (index)
            {
            case 0:
            {
                IEnumerator healHeroTarget = base.GameController.SelectAndGainHP(this.DecisionMaker, 2, false, (Card c) => c.IsHero && c.IsTarget && c.IsInPlayAndHasGameText, 1, null, false, null, GetCardSource(null));
                if (base.UseUnityCoroutines)
                {
                    yield return(base.GameController.StartCoroutine(healHeroTarget));
                }
                else
                {
                    base.GameController.ExhaustCoroutine(healHeroTarget);
                }
                break;
            }

            case 1:
            {
                OnDealDamageStatusEffect oddse = new OnDealDamageStatusEffect(CardWithoutReplacements, nameof(AnotherHeroHealsResponse), "Until the start of your next turn, whenever a hero deals damage, another hero regains 1 HP.", new TriggerType[] { TriggerType.GainHP }, base.HeroTurnTaker, this.Card);
                oddse.SourceCriteria.IsHeroCharacterCard = true;
                oddse.BeforeOrAfter = BeforeOrAfter.After;
                IEnumerator damageMeansHealing = base.AddStatusEffect(oddse, true);
                if (base.UseUnityCoroutines)
                {
                    yield return(base.GameController.StartCoroutine(damageMeansHealing));
                }
                else
                {
                    base.GameController.ExhaustCoroutine(damageMeansHealing);
                }
                break;
            }

            case 2:
            {
                List <SelectCardDecision> storedResults = new List <SelectCardDecision>();
                IEnumerator coroutine = base.GameController.SelectCardAndStoreResults(base.HeroTurnTakerController, SelectionType.SelectTargetNoDamage, new LinqCardCriteria((Card c) => c.IsTarget && c.IsInPlay, "targets in play", false, false, null, null, false), storedResults, false, false, null, true, base.GetCardSource(null));
                if (base.UseUnityCoroutines)
                {
                    yield return(base.GameController.StartCoroutine(coroutine));
                }
                else
                {
                    base.GameController.ExhaustCoroutine(coroutine);
                }
                Card card = storedResults.FirstOrDefault()?.SelectedCard;
                if (card != null)
                {
                    coroutine = base.AddMakeDamageIrreducibleStatusEffect(card, base.TurnTaker, Phase.Start);
                    if (base.UseUnityCoroutines)
                    {
                        yield return(base.GameController.StartCoroutine(coroutine));
                    }
                    else
                    {
                        base.GameController.ExhaustCoroutine(coroutine);
                    }
                }
                break;
            }
            }
        }
        public override IEnumerator UseIncapacitatedAbility(int index)
        {
            switch (index)
            {
            case 0:
            {
                //"One player may play a card now.",
                var coroutine = GameController.SelectHeroToPlayCard(HeroTurnTakerController, cardSource: GetCardSource());
                if (UseUnityCoroutines)
                {
                    yield return(GameController.StartCoroutine(coroutine));
                }
                else
                {
                    GameController.ExhaustCoroutine(coroutine);
                }
                break;
            }

            case 1:
            {
                //"One play may use a power now.",
                IEnumerator coroutine2 = GameController.SelectHeroToUsePower(HeroTurnTakerController, cardSource: GetCardSource());
                if (UseUnityCoroutines)
                {
                    yield return(GameController.StartCoroutine(coroutine2));
                }
                else
                {
                    GameController.ExhaustCoroutine(coroutine2);
                }
                break;
            }

            case 2:
            {
                //"The next time a hero target deals damage, choose the type of that damage."
                OnDealDamageStatusEffect chooseNextHeroDamageType = new OnDealDamageStatusEffect(CardWithoutReplacements,
                                                                                                 nameof(ChooseDamageTypeResponse),
                                                                                                 "The next time a hero target deals damage, Starlight chooses the type of that damage.",
                                                                                                 new TriggerType[1] {
                        TriggerType.ChangeDamageType
                    },
                                                                                                 TurnTaker,
                                                                                                 this.Card);
                chooseNextHeroDamageType.NumberOfUses            = 1;
                chooseNextHeroDamageType.SourceCriteria.IsHero   = true;
                chooseNextHeroDamageType.SourceCriteria.IsTarget = true;
                chooseNextHeroDamageType.BeforeOrAfter           = BeforeOrAfter.Before;
                chooseNextHeroDamageType.CanEffectStack          = true;
                IEnumerator coroutine3 = AddStatusEffect(chooseNextHeroDamageType);
                if (UseUnityCoroutines)
                {
                    yield return(GameController.StartCoroutine(coroutine3));
                }
                else
                {
                    GameController.ExhaustCoroutine(coroutine3);
                }
                break;
            }
            }


            yield break;
        }
        public override IEnumerator UseIncapacitatedAbility(int index)
        {
            switch (index)
            {
            case 0:
            {
                //"Select a hero target. Reduce damage dealt to that target by 1 until the start of your next turn."
                List <SelectCardDecision> storedResult = new List <SelectCardDecision>();
                IEnumerator reduceDamage = base.GameController.SelectCardAndStoreResults(this.DecisionMaker, SelectionType.SelectTargetFriendly, new LinqCardCriteria((Card c) => c.IsInPlayAndHasGameText && c.IsTarget && c.IsHero, "hero target in play", false, false, null, null, false), storedResult, false, false, null, true, GetCardSource());
                if (base.UseUnityCoroutines)
                {
                    yield return(base.GameController.StartCoroutine(reduceDamage));
                }
                else
                {
                    base.GameController.ExhaustCoroutine(reduceDamage);
                }
                Card selectedCard             = base.GetSelectedCard(storedResult);
                ReduceDamageStatusEffect rdse = new ReduceDamageStatusEffect(1);
                rdse.TargetCriteria.IsSpecificCard = selectedCard;
                rdse.UntilStartOfNextTurn(base.TurnTaker);
                rdse.UntilCardLeavesPlay(selectedCard);
                reduceDamage = base.AddStatusEffect(rdse, true);
                if (base.UseUnityCoroutines)
                {
                    yield return(base.GameController.StartCoroutine(reduceDamage));
                }
                else
                {
                    base.GameController.ExhaustCoroutine(reduceDamage);
                }
                break;
            }

            case 1:
            {
                //"Until the start of your next turn, whenever a hero is dealt damage, that hero’s player may draw a card."
                OnDealDamageStatusEffect oddse = new OnDealDamageStatusEffect(CardWithoutReplacements, nameof(DrawCardResponse), "Until the start of your next turn, whenever a hero is dealt damage, their player may draw a card.", new TriggerType[] { TriggerType.DrawCard }, base.TurnTaker, this.Card);
                oddse.TargetCriteria.IsHeroCharacterCard = true;
                oddse.BeforeOrAfter = BeforeOrAfter.After;
                oddse.UntilStartOfNextTurn(base.TurnTaker);
                IEnumerator dealtDamage = base.AddStatusEffect(oddse, true);
                if (base.UseUnityCoroutines)
                {
                    yield return(base.GameController.StartCoroutine(dealtDamage));
                }
                else
                {
                    base.GameController.ExhaustCoroutine(dealtDamage);
                }
                break;
            }

            case 2:
            {
                //"Destroy any number of non-character hero cards.  For each card destroyed this way, a hero regains 2 HP."
                WhenCardIsDestroyedStatusEffect wcidse = new WhenCardIsDestroyedStatusEffect(CardWithoutReplacements, nameof(GainHPResponse), null, new TriggerType[] { TriggerType.GainHP }, base.HeroTurnTaker, this.Card);
                wcidse.CardDestroyedCriteria.IsHero = true;
                wcidse.BeforeOrAfter = BeforeOrAfter.After;
                wcidse.UntilEndOfPhase(base.TurnTaker, Phase.End);
                IEnumerator cardDestroyed = base.AddStatusEffect(wcidse, true);
                if (base.UseUnityCoroutines)
                {
                    yield return(base.GameController.StartCoroutine(cardDestroyed));
                }
                else
                {
                    base.GameController.ExhaustCoroutine(cardDestroyed);
                }
                int         value        = base.FindCardsWhere((Card c) => c.IsHero && !c.IsHeroCharacterCard && c.IsInPlay, false, null, false).Count <Card>();
                IEnumerator destroyCards = base.GameController.SelectAndDestroyCards(this.DecisionMaker, new LinqCardCriteria((Card c) => c.IsHero && !c.IsHeroCharacterCard, "non-character hero card", true, false, null, null, false), new int?(value), false, new int?(0), null, null, null, false, null, null, null, GetCardSource(null));
                if (base.UseUnityCoroutines)
                {
                    yield return(base.GameController.StartCoroutine(destroyCards));
                }
                else
                {
                    base.GameController.ExhaustCoroutine(destroyCards);
                }
                break;
            }
            }
        }
        private IEnumerator AssignBlocked(PhaseChangeAction pca)
        {
            // "At the end of the villain turn, each hero except the 2 heroes with the lowest HP become [b]BLOCKED[/b] until the start of the villain turn."
            // Find exactly 2 hero character cards with lowest HP
            List <Card> currentLowestHeroes = new List <Card>();
            IEnumerator findLowestCoroutine = GameController.FindTargetsWithLowestHitPoints(1, 2, (Card c) => c.IsHeroCharacterCard, currentLowestHeroes, cardSource: GetCardSource());

            if (base.UseUnityCoroutines)
            {
                yield return(this.GameController.StartCoroutine(findLowestCoroutine));
            }
            else
            {
                this.GameController.ExhaustCoroutine(findLowestCoroutine);
            }
            string lowestNames = "";

            if (currentLowestHeroes.Any())
            {
                lowestNames += currentLowestHeroes.First().Title;
                if (currentLowestHeroes.Count() > 1)
                {
                    lowestNames += ", " + currentLowestHeroes.ElementAt(1).Title;
                }
            }
            Log.Debug("Found 2 heroes with lowest HP: " + lowestNames);

            // All OTHER active hero characters become BLOCKED
            LinqCardCriteria criteria = new LinqCardCriteria((Card c) => c.IsHeroCharacterCard && c.IsActive && !currentLowestHeroes.Contains(c));
            List <Card>      toBlock  = base.GameController.FindCardsWhere(criteria).ToList();

            foreach (Card hero in toBlock)
            {
                //Log.Debug("Creating status effects for " + hero.Title);
                // BLOCKED comprises 2 status effects, both expiring at the start of the villain turn, when the hero leaves play, or when this card leaves play:
                // The hero cannot deal damage to non-Terrain villain targets
                OnDealDamageStatusEffect cantHitNonTerrain = new OnDealDamageStatusEffect(cardWithMethod: this.Card, methodToExecute: nameof(this.PreventDamage), description: hero.Title + " cannot deal damage to non-Terrain villain targets.", triggerTypes: new TriggerType[] { TriggerType.CancelAction }, decisionMaker: base.TurnTaker, cardSource: this.Card, powerNumerals: null);
                //Log.Debug("Initialized cantHitNonTerrain");
                cantHitNonTerrain.UntilStartOfNextTurn(this.TurnTaker);
                cantHitNonTerrain.UntilTargetLeavesPlay(hero);
                cantHitNonTerrain.UntilCardLeavesPlay(this.Card);
                cantHitNonTerrain.SourceCriteria.IsSpecificCard = hero;
                cantHitNonTerrain.TargetCriteria.IsVillain      = true;
                cantHitNonTerrain.BeforeOrAfter = BeforeOrAfter.Before;
                IEnumerator addCantHitCoroutine = AddStatusEffect(cantHitNonTerrain);
                //Log.Debug("Built cantHitNonTerrain for " + hero.Title);
                // When the hero would be dealt damage by a villain target, redirect it to a non-BLOCKED hero
                OnDealDamageStatusEffect redirectWhenHit = new OnDealDamageStatusEffect(cardWithMethod: this.Card, methodToExecute: nameof(this.RedirectDamage), description: "When " + hero.Title + " would be dealt damage by a villain target, redirect it to a non-BLOCKED hero.", triggerTypes: new TriggerType[] { TriggerType.RedirectDamage }, decisionMaker: base.TurnTaker, cardSource: this.Card, powerNumerals: null);
                redirectWhenHit.UntilStartOfNextTurn(this.TurnTaker);
                redirectWhenHit.UntilTargetLeavesPlay(hero);
                redirectWhenHit.UntilCardLeavesPlay(this.Card);
                redirectWhenHit.SourceCriteria.IsVillain      = true;
                redirectWhenHit.TargetCriteria.IsSpecificCard = hero;
                redirectWhenHit.BeforeOrAfter = BeforeOrAfter.Before;
                IEnumerator addRedirectCoroutine = AddStatusEffect(redirectWhenHit);
                //Log.Debug("Built redirectWhenHit for " + hero.Title);
                if (base.UseUnityCoroutines)
                {
                    yield return(this.GameController.StartCoroutine(addCantHitCoroutine));

                    yield return(this.GameController.StartCoroutine(addRedirectCoroutine));
                }
                else
                {
                    this.GameController.ExhaustCoroutine(addCantHitCoroutine);
                    this.GameController.ExhaustCoroutine(addRedirectCoroutine);
                }
            }

            string escapedNames = "";

            if (currentLowestHeroes.Any())
            {
                escapedNames = currentLowestHeroes.First().Title;
                if (currentLowestHeroes.Count > 1)
                {
                    escapedNames += " and " + currentLowestHeroes.ElementAt(1).Title;
                }
            }
            string blockedAnnouncement = escapedNames + " slip through Narrow Escape!";

            if (blockedHeroes.Any())
            {
                blockedAnnouncement += " All other heroes are BLOCKED!";
            }
            IEnumerator messageCoroutine = base.GameController.SendMessageAction(blockedAnnouncement, Priority.High, cardSource: GetCardSource(), showCardSource: true);

            if (base.UseUnityCoroutines)
            {
                yield return(this.GameController.StartCoroutine(messageCoroutine));
            }
            else
            {
                this.GameController.ExhaustCoroutine(messageCoroutine);
            }
            yield break;
        }