Пример #1
0
        private IEnumerator AddOngoingDestructionTrigger()
        {
            var statusEffect = new WhenCardIsDestroyedStatusEffect(CardWithoutReplacements, nameof(PlayDestroyedOngoing), $"The next time one of {this.TurnTaker.Name}'s ongoings is destroyed, they play it again.", new TriggerType[] { TriggerType.PlayCard }, DecisionMaker.HeroTurnTaker, this.Card);

            statusEffect.NumberOfUses = 1;
            statusEffect.CardDestroyedCriteria.OwnedBy = this.TurnTaker;
            statusEffect.CardDestroyedCriteria.HasAnyOfTheseKeywords = new List <string> {
                "ongoing"
            };
            statusEffect.PostDestroyDestinationMustBeChangeable = true;
            statusEffect.CanEffectStack = true;
            statusEffect.CardSource     = CharacterCard;

            IEnumerator coroutine = AddStatusEffect(statusEffect);

            if (base.UseUnityCoroutines)
            {
                yield return(base.GameController.StartCoroutine(coroutine));
            }
            else
            {
                base.GameController.ExhaustCoroutine(coroutine);
            }
            yield break;
        }
Пример #2
0
        public override IEnumerator UsePower(int index = 0)
        {
            HeroTurnTaker hero = null;
            string        turnTakerName;

            if (this.TurnTaker.IsHero)
            {
                hero          = this.TurnTaker.ToHero();
                turnTakerName = this.TurnTaker.Name;
            }
            else
            {
                turnTakerName = this.Card.Title;
            }

            // The next time a hero target is destroyed, you may move it to the owner's hand.
            WhenCardIsDestroyedStatusEffect effect = new WhenCardIsDestroyedStatusEffect(this.CardWithoutReplacements, "MoveItToTheBottomOfItsDeckResponse", "The next time a hero target is destroyed, " + turnTakerName + " may move it to its owner's hand.", new TriggerType[] { TriggerType.MoveCard, TriggerType.ChangePostDestroyDestination }, hero, this.Card);

            effect.CardDestroyedCriteria.IsHero   = true;
            effect.CardDestroyedCriteria.IsTarget = true;
            effect.CanEffectStack = false;
            effect.Priority       = StatusEffectPriority.Medium;
            effect.PostDestroyDestinationMustBeChangeable = true;
            effect.NumberOfUses = 1;

            return(AddStatusEffect(effect));
        }
        public override IEnumerator UsePower(int index = 0)
        {
            string      turnTakerName;
            IEnumerator coroutine;

            if (this.TurnTaker.IsHero)
            {
                turnTakerName = this.TurnTaker.Name;
            }
            else
            {
                turnTakerName = this.Card.Title;
            }

            // Flip a card face-up.
            coroutine = this.GameController.SelectAndFlipCards(this.DecisionMaker, new LinqCardCriteria((Card c) => c.Location == this.HeroTurnTaker.PlayArea && c.IsFaceDownNonCharacter && !c.IsMissionCard, "face-down cards in " + turnTakerName + "'s play area"), 1, false, false, 1, null, true, cardSource: this.GetCardSource());
            if (this.UseUnityCoroutines)
            {
                yield return(this.GameController.StartCoroutine(coroutine));
            }
            else
            {
                this.GameController.ExhaustCoroutine(coroutine);
            }

            // Set up an effect to respond when your equipment is destroyed
            WhenCardIsDestroyedStatusEffect whenCardIsDestroyedStatusEffect = new WhenCardIsDestroyedStatusEffect(this.CardWithoutReplacements, "WhenEquipIsDestroyed", "Whenever one of " + turnTakerName + "'s Equipment would be destroyed, they may put it in their play area face-down.", new TriggerType[]
                                                                                                                  { TriggerType.FlipCard }, this.HeroTurnTaker, this.Card, null);

            whenCardIsDestroyedStatusEffect.CardDestroyedCriteria.HasAnyOfTheseKeywords = new List <string> {
                "equipment"
            };
            whenCardIsDestroyedStatusEffect.CardDestroyedCriteria.OwnedBy = this.HeroTurnTaker;
            whenCardIsDestroyedStatusEffect.UntilEndOfNextTurn(this.HeroTurnTaker);
            whenCardIsDestroyedStatusEffect.Priority       = new StatusEffectPriority?(StatusEffectPriority.High);
            whenCardIsDestroyedStatusEffect.CanEffectStack = false;
            coroutine = this.AddStatusEffect(whenCardIsDestroyedStatusEffect, true);
            if (this.UseUnityCoroutines)
            {
                yield return(this.GameController.StartCoroutine(coroutine));
            }
            else
            {
                this.GameController.ExhaustCoroutine(coroutine);
            }
        }
Пример #4
0
        private IEnumerator UseIncapOption3()
        {
            // "The next time a target is destroyed, 1 hero target regains 3 HP."
            WhenCardIsDestroyedStatusEffect healTrigger = new WhenCardIsDestroyedStatusEffect(base.CardWithoutReplacements, "HealResponse", "The next time a target is destroyed, 1 hero target regains 3 HP.", new TriggerType[] { TriggerType.GainHP }, base.HeroTurnTaker, base.CardWithoutReplacements);

            healTrigger.CardDestroyedCriteria.IsTarget = true;
            healTrigger.NumberOfUses   = 1;
            healTrigger.CanEffectStack = false;
            IEnumerator statusCoroutine = AddStatusEffect(healTrigger);

            if (base.UseUnityCoroutines)
            {
                yield return(base.GameController.StartCoroutine(statusCoroutine));
            }
            else
            {
                base.GameController.ExhaustCoroutine(statusCoroutine);
            }
            yield break;
        }
Пример #5
0
        public override IEnumerator UsePower(int index = 0)
        {
            //PowerNumerals Required on powers
            int target = GetPowerNumeral(0, 1);
            int amount = GetPowerNumeral(1, 1);

            int[] powerNumerals = new int[]
            {
                target, amount
            };

            //The next time an undead target is destroyed, 1 hero deals a target 1 fire damage and draws a card.
            WhenCardIsDestroyedStatusEffect effect = new WhenCardIsDestroyedStatusEffect(base.Card, "DealDamageAndDrawResponse", "The next time an undead target is destroyed, 1 hero deals a target 1 fire damage and draws a card", new TriggerType[] { TriggerType.DealDamage, TriggerType.DrawCard }, DecisionMaker.HeroTurnTaker, base.Card, powerNumerals);

            effect.CanEffectStack = true;
            effect.CardDestroyedCriteria.IsTarget = true;
            effect.CardDestroyedCriteria.HasAnyOfTheseKeywords = new List <string>()
            {
                "undead"
            };
            effect.CanEffectStack = true;
            effect.DoesDealDamage = true;
            //numberOfUses = 1 means the status effect expires before power modifiers get to see the damage
            //instead we'll expire it in the response

            IEnumerator coroutine3 = AddStatusEffect(effect);

            if (base.UseUnityCoroutines)
            {
                yield return(base.GameController.StartCoroutine(coroutine3));
            }
            else
            {
                base.GameController.ExhaustCoroutine(coroutine3);
            }
            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;
            }
            }
        }
        public override IEnumerator UseIncapacitatedAbility(int index)
        {
            IEnumerator coroutine;

            switch (index)
            {
            case (0):
            {
                //"One player may draw a card now.",
                coroutine = GameController.SelectHeroToDrawCard(DecisionMaker, cardSource: GetCardSource());
                if (base.UseUnityCoroutines)
                {
                    yield return(base.GameController.StartCoroutine(coroutine));
                }
                else
                {
                    base.GameController.ExhaustCoroutine(coroutine);
                }
                break;
            }

            case (1):
            {
                //"Reduce the next damage dealt to a hero target by 2.",
                var reduceEffect = new ReduceDamageStatusEffect(2);
                reduceEffect.NumberOfUses          = 1;
                reduceEffect.TargetCriteria.IsHero = true;
                coroutine = AddStatusEffect(reduceEffect);
                if (base.UseUnityCoroutines)
                {
                    yield return(base.GameController.StartCoroutine(coroutine));
                }
                else
                {
                    base.GameController.ExhaustCoroutine(coroutine);
                }
                break;
            }

            case (2):
            {
                //"The next time a hero ongoing card is destroyed, put that card in its owner's hand."
                var rescueEffect = new WhenCardIsDestroyedStatusEffect(CardWithoutReplacements, nameof(RescueOngoingResponse), "The next time a hero ongoing card is destroyed, put that card in its owner's hand.", new TriggerType[] { TriggerType.MoveCard }, DecisionMaker.HeroTurnTaker, this.Card);
                rescueEffect.NumberOfUses = 1;
                rescueEffect.CardDestroyedCriteria.IsHero = true;
                rescueEffect.CardDestroyedCriteria.HasAnyOfTheseKeywords = new List <string> {
                    "ongoing"
                };

                coroutine = AddStatusEffect(rescueEffect);
                if (base.UseUnityCoroutines)
                {
                    yield return(base.GameController.StartCoroutine(coroutine));
                }
                else
                {
                    base.GameController.ExhaustCoroutine(coroutine);
                }
                break;
            }
            }
            yield break;
        }
Пример #8
0
        public IEnumerator DealDamageAndDrawResponse(DestroyCardAction dca, HeroTurnTaker htt, WhenCardIsDestroyedStatusEffect effect, int[] powerNumerals = null)
        {
            int target = powerNumerals?[0] ?? 1;
            int amount = powerNumerals?[1] ?? 1;

            if (dca.WasCardDestroyed && effect.NumberOfUses == null)
            {
                effect.NumberOfUses = 1;

                //1 hero deals a target 1 fire damage and draws a card.
                List <SelectCardDecision> storedResults = new List <SelectCardDecision>();
                IEnumerator coroutine = base.GameController.SelectCardAndStoreResults(DecisionMaker, SelectionType.CardToDealDamage,
                                                                                      new LinqCardCriteria((Card c) => c.IsInPlay && c.IsHeroCharacterCard && !c.IsIncapacitatedOrOutOfGame && GameController.IsCardVisibleToCardSource(c, GetCardSource()), "hero character", useCardsSuffix: false),
                                                                                      storedResults, false,
                                                                                      cardSource: GetCardSource());
                if (base.UseUnityCoroutines)
                {
                    yield return(base.GameController.StartCoroutine(coroutine));
                }
                else
                {
                    base.GameController.ExhaustCoroutine(coroutine);
                }

                if (DidSelectCard(storedResults))
                {
                    Card selectedCard = GetSelectedCard(storedResults);
                    coroutine = base.GameController.SelectTargetsAndDealDamage(DecisionMaker, new DamageSource(base.GameController, selectedCard), amount, DamageType.Fire, target, optional: false, target, cardSource: GetCardSource(effect));
                    if (base.UseUnityCoroutines)
                    {
                        yield return(base.GameController.StartCoroutine(coroutine));
                    }
                    else
                    {
                        base.GameController.ExhaustCoroutine(coroutine);
                    }

                    coroutine = DrawCard(selectedCard.Owner.ToHero());
                    if (base.UseUnityCoroutines)
                    {
                        yield return(base.GameController.StartCoroutine(coroutine));
                    }
                    else
                    {
                        base.GameController.ExhaustCoroutine(coroutine);
                    }
                }

                coroutine = GameController.ExpireStatusEffect(effect, GetCardSource());
                if (base.UseUnityCoroutines)
                {
                    yield return(base.GameController.StartCoroutine(coroutine));
                }
                else
                {
                    base.GameController.ExhaustCoroutine(coroutine);
                }
            }
            yield break;
        }
        public override IEnumerator UseIncapacitatedAbility(int index)
        {
            switch (index)
            {
            case 0:
            {
                List <Card> selectedTargets = new List <Card>();
                for (int i = 0; i < 2; i++)
                {
                    List <SelectCardDecision> storedResults = new List <SelectCardDecision>();
                    IEnumerable <Card>        choices       = base.FindCardsWhere((Card c) => !c.IsHero && c.IsInPlay && c.IsTarget && !selectedTargets.Contains(c), false, null, false);
                    IEnumerator coroutine = base.GameController.SelectCardAndStoreResults(base.HeroTurnTakerController, SelectionType.SelectTarget, choices, storedResults, false, false, null, null, null, null, null, false, false, null);
                    if (base.UseUnityCoroutines)
                    {
                        yield return(base.GameController.StartCoroutine(coroutine));
                    }
                    else
                    {
                        base.GameController.ExhaustCoroutine(coroutine);
                    }
                    Card card = (from d in storedResults select d.SelectedCard).FirstOrDefault <Card>();
                    if (card != null)
                    {
                        selectedTargets.Add(card);
                        coroutine = base.DealDamage(card, card, 1, DamageType.Radiant, false, false, false, null, null, null, false, GetCardSource());
                        if (base.UseUnityCoroutines)
                        {
                            yield return(base.GameController.StartCoroutine(coroutine));
                        }
                        else
                        {
                            base.GameController.ExhaustCoroutine(coroutine);
                        }
                    }
                    else
                    {
                        yield break;
                    }
                }
                break;
            }

            case 1:
            {
                IEnumerator coroutine3 = base.GameController.SelectHeroToUsePower(base.HeroTurnTakerController, optionalSelectHero: false, optionalUsePower: true, allowAutoDecide: false, null, null, null, omitHeroesWithNoUsablePowers: true, canBeCancelled: true, (CardSource)GetCardSource());
                if (base.UseUnityCoroutines)
                {
                    yield return(base.GameController.StartCoroutine(coroutine3));
                }
                else
                {
                    base.GameController.ExhaustCoroutine(coroutine3);
                }
                break;
            }

            //Until the start of your next turn, whenever a target is destroyed, one target deals itself 2 Radiant damage.
            case 2:
            {
                WhenCardIsDestroyedStatusEffect wcidse = new WhenCardIsDestroyedStatusEffect(base.CardWithoutReplacements, nameof(WhenCardIsDestroyedChooseTargetToDealSelfDamage), "Until the start of your next turn, whenever a target is destroyed, one target deals itself 2 Radiant damage.", new TriggerType[] { TriggerType.DealDamage }, base.TurnTaker.ToHero(), base.Card, null);
                wcidse.CardDestroyedCriteria.IsTarget = true;
                wcidse.UntilStartOfNextTurn(base.TurnTaker);
                wcidse.DoesDealDamage = true;
                IEnumerator coroutine = base.AddStatusEffect(wcidse, true);
                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 hero may put a random card from their trash into play.
                List <SelectTurnTakerDecision> storedResults = new List <SelectTurnTakerDecision>();
                IEnumerator coroutine = base.GameController.SelectHeroTurnTaker(DecisionMaker, SelectionType.PutIntoPlay, false, false, storedResults, cardSource: GetCardSource());
                if (base.UseUnityCoroutines)
                {
                    yield return(base.GameController.StartCoroutine(coroutine));
                }
                else
                {
                    base.GameController.ExhaustCoroutine(coroutine);
                }
                if (DidSelectTurnTaker(storedResults))
                {
                    TurnTaker tt = GetSelectedTurnTaker(storedResults);
                    HeroTurnTakerController  httc = FindHeroTurnTakerController(tt.ToHero());
                    List <YesNoCardDecision> storedYesNoResults = new List <YesNoCardDecision>();
                    coroutine = GameController.MakeYesNoCardDecision(httc, SelectionType.PlayCard, base.Card, storedResults: storedYesNoResults, cardSource: GetCardSource());
                    if (base.UseUnityCoroutines)
                    {
                        yield return(base.GameController.StartCoroutine(coroutine));
                    }
                    else
                    {
                        base.GameController.ExhaustCoroutine(coroutine);
                    }
                    if (DidPlayerAnswerYes(storedYesNoResults))
                    {
                        coroutine = base.RevealCards_MoveMatching_ReturnNonMatchingCards(base.TurnTakerController, tt.Trash, false, true, false, new LinqCardCriteria((Card c) => true), 1, shuffleBeforehand: true);
                        if (base.UseUnityCoroutines)
                        {
                            yield return(base.GameController.StartCoroutine(coroutine));
                        }
                        else
                        {
                            base.GameController.ExhaustCoroutine(coroutine);
                        }
                    }
                }

                break;
            }

            case 1:
            {
                //Destroy 1 ongoing card.
                IEnumerator coroutine2 = base.GameController.SelectAndDestroyCard(base.HeroTurnTakerController,
                                                                                  new LinqCardCriteria((Card c) => c.IsOngoing && GameController.IsCardVisibleToCardSource(c, GetCardSource()), "ongoing"),
                                                                                  optional: false,
                                                                                  cardSource: GetCardSource());
                if (base.UseUnityCoroutines)
                {
                    yield return(base.GameController.StartCoroutine(coroutine2));
                }
                else
                {
                    base.GameController.ExhaustCoroutine(coroutine2);
                }
                break;
            }

            case 2:
            {
                //The next time a target is destroyed, 1 player may draw 2 cards.
                WhenCardIsDestroyedStatusEffect effect = new WhenCardIsDestroyedStatusEffect(base.Card, "DrawTwoCardsResponse", "The next time a target is destroyed, 1 player may draw 2 cards", new TriggerType[] { TriggerType.DrawCard }, DecisionMaker.HeroTurnTaker, base.Card);
                effect.NumberOfUses   = 1;
                effect.CanEffectStack = true;
                effect.CardDestroyedCriteria.IsTarget = true;
                effect.CanEffectStack = true;
                IEnumerator coroutine3 = AddStatusEffect(effect);
                if (base.UseUnityCoroutines)
                {
                    yield return(base.GameController.StartCoroutine(coroutine3));
                }
                else
                {
                    base.GameController.ExhaustCoroutine(coroutine3);
                }
                break;
            }
            }
            yield break;
        }
 public IEnumerator DrawTwoCardsResponse(DestroyCardAction dca, HeroTurnTaker htt, WhenCardIsDestroyedStatusEffect _, int[] _2 = null)
 {
     if (dca.WasCardDestroyed)
     {
         //1 player may draw 2 cards.
         HeroTurnTakerController httc      = FindHeroTurnTakerController(htt);
         IEnumerator             coroutine = GameController.SelectHeroToDrawCards(httc, 2, cardSource: GetCardSource());
         if (base.UseUnityCoroutines)
         {
             yield return(base.GameController.StartCoroutine(coroutine));
         }
         else
         {
             base.GameController.ExhaustCoroutine(coroutine);
         }
     }
     yield break;
 }