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.",
                //Secretly set a property on this card that is checked by triggers, in order to apply the effect.
                base.AddCardPropertyJournalEntry(PreventDamageViaIncapPropertyKey, true);
                //This status effect displays UI text but provides no behavior on its own.
                //The method name is fake. Another trigger clears the above property when this status effect is removed.
                OnPhaseChangeStatusEffect displayEffect = new OnPhaseChangeStatusEffect(CardWithoutReplacements, nameof(DoNothing), "The target with the lowest HP is immune to damage and cannot deal damage.", new TriggerType[] { }, base.Card);
                displayEffect.UntilStartOfNextTurn(base.TurnTaker);
                displayEffect.CanEffectStack = true;
                IEnumerator coroutine = base.AddStatusEffect(displayEffect);

                if (base.UseUnityCoroutines)
                {
                    yield return(base.GameController.StartCoroutine(coroutine));
                }
                else
                {
                    base.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 IEnumerator DestroyMarkedTarget(PhaseChangeAction action, OnPhaseChangeStatusEffect sourceEffect)
        {
            //the target to be destroyed will be in the target leaves play criteria, and have the marked card prop.
            var card = sourceEffect.TargetLeavesPlayExpiryCriteria.IsOneOfTheseCards?.First() ?? sourceEffect.TargetLeavesPlayExpiryCriteria.Card;

            if (card != null && Journal.GetCardPropertiesBoolean(card, "MarkedForDestruction") == true)
            {
                if (IsRealAction())
                {
                    Journal.RecordCardProperties(card, "MarkedForDestruction", (bool?)null);
                }

                if (card.IsInPlay)
                {
                    var coroutine = GameController.DestroyCard(DecisionMaker, card,
                                                               actionSource: action,
                                                               cardSource: GetCardSource(sourceEffect));
                    if (base.UseUnityCoroutines)
                    {
                        yield return(base.GameController.StartCoroutine(coroutine));
                    }
                    else
                    {
                        base.GameController.ExhaustCoroutine(coroutine);
                    }
                }
            }
        }
        //Power: The next time Vikral would be dealt three or more damage, prevent that damage. Then, the source of that damage deals up to X targets 1 damage of that type each, where X is the amount of damage prevented this way. This power can not stack.
        public override IEnumerator UsePower(int index = 0)
        {
            int         powerNumeral = base.GetPowerNumeral(0, 1);
            IEnumerator coroutine;

            if (base.GetCardPropertyJournalEntryBoolean(PreventAndScatterPropertyKey) == true)
            {
                coroutine = base.GameController.SendMessageAction("This power is already active!", Priority.High, base.GetCardSource(null), null, true);
                if (UseUnityCoroutines)
                {
                    yield return(base.GameController.StartCoroutine(coroutine));
                }
                else
                {
                    base.GameController.ExhaustCoroutine(coroutine);
                }
                yield break;
            }
            base.AddCardPropertyJournalEntry(PreventAndScatterPropertyKey, true);
            OnPhaseChangeStatusEffect opcse = new OnPhaseChangeStatusEffect(CardWithoutReplacements, nameof(DoNothing), $"Prevent the next damage of 3 or more that would be dealt to {base.TurnTaker.Name}, and have the source of that damage deal damage.", new TriggerType[] { TriggerType.WouldBeDealtDamage }, this.Card);

            opcse.CardDestroyedExpiryCriteria.Card = base.CharacterCard;
            opcse.NumberOfUses = powerNumeral;
            coroutine          = AddStatusEffect(opcse, true);
            if (UseUnityCoroutines)
            {
                yield return(base.GameController.StartCoroutine(coroutine));
            }
            else
            {
                base.GameController.ExhaustCoroutine(coroutine);
            }
        }
Example #4
0
        public IEnumerator StartOfTurnDealDamageResponse(PhaseChangeAction _, OnPhaseChangeStatusEffect sourceEffect)
        {
            var target = sourceEffect.TargetLeavesPlayExpiryCriteria.IsOneOfTheseCards.FirstOrDefault();

            int powerNumeral = sourceEffect.PowerNumeralsToChange[0];

            if (!CharacterCard.IsIncapacitatedOrOutOfGame && target.IsTarget && target.IsInPlayAndNotUnderCard)
            {
                if (GameController.IsCardVisibleToCardSource(target, GetCardSource(sourceEffect)) != true)
                {
                    var coroutine = GameController.SendMessageAction($"{CharacterCard.Title} misses! {target.Title} is no longer visible!", Priority.Medium, GetCardSource(), new[] { target });
                    if (base.UseUnityCoroutines)
                    {
                        yield return(base.GameController.StartCoroutine(coroutine));
                    }
                    else
                    {
                        base.GameController.ExhaustCoroutine(coroutine);
                    }
                }
                else
                {
                    IEnumerator dealDamageRoutine = this.DealDamage(CharacterCard, target, powerNumeral, DamageType.Projectile, cardSource: GetCardSource(sourceEffect));
                    if (base.UseUnityCoroutines)
                    {
                        yield return(base.GameController.StartCoroutine(dealDamageRoutine));
                    }
                    else
                    {
                        base.GameController.ExhaustCoroutine(dealDamageRoutine);
                    }
                }
            }
        }
Example #5
0
        public IEnumerator PreventDrawsThisTurnEffect(PhaseChangeAction _, OnPhaseChangeStatusEffect sourceEffect)
        {
            System.Console.WriteLine("### DEBUG ### - ChokingInspiration.PreventDrawsThisTurnEffect triggered");

            //The status effect must last slightly longer than the triggering phase action, or the effect will not fire.
            HeroTurnTaker             htt    = sourceEffect.TurnTakerCriteria.IsSpecificTurnTaker.ToHero();
            OnPhaseChangeStatusEffect effect = new OnPhaseChangeStatusEffect(CardWithoutReplacements, nameof(ResumeDrawEffect), $"{htt.Name} cannot draw cards.", new TriggerType[] { TriggerType.Hidden }, base.Card);

            effect.TurnTakerCriteria.IsSpecificTurnTaker = htt;
            effect.TurnPhaseCriteria.Phase = Phase.End;
            effect.CanEffectStack          = true;
            effect.UntilThisTurnIsOver(Game);

            //We secretly set a property on the victim's character card to indicate that they can't draw cards.
            //A CannotDrawCards query on DendronCharacterCardController actually makes this happen
            GameController.AddCardPropertyJournalEntry(htt.CharacterCards.First(), PreventDrawPropertyKey, true);

            IEnumerator coroutine = base.AddStatusEffect(effect);

            if (base.UseUnityCoroutines)
            {
                yield return(base.GameController.StartCoroutine(coroutine));
            }
            else
            {
                base.GameController.ExhaustCoroutine(coroutine);
            }
            yield break;
        }
Example #6
0
        public IEnumerator DiscardReorderResponse(PhaseChangeAction pca)
        {
            // "... discard the top card of [the active player's] deck."
            TurnTaker             currentPlayer    = pca.ToPhase.TurnTaker;
            List <MoveCardAction> discardResults   = new List <MoveCardAction>();
            IEnumerator           discardCoroutine = base.GameController.DiscardTopCard(currentPlayer.Deck, discardResults, (Card c) => true, responsibleTurnTaker: base.TurnTaker, cardSource: GetCardSource());

            if (base.UseUnityCoroutines)
            {
                yield return(base.GameController.StartCoroutine(discardCoroutine));
            }
            else
            {
                base.GameController.ExhaustCoroutine(discardCoroutine);
            }
            // "If a One-Shot is discarded this way, that player skips their power phase this turn and uses a power immediately."
            MoveCardAction discard = discardResults.FirstOrDefault();

            if (discard != null && discard.CardToMove != null && discard.WasCardMoved && discard.CardToMove.DoKeywordsContain("one-shot"))
            {
                IEnumerator messageCoroutine = base.GameController.SendMessageAction("Reverberations are at high levels! " + currentPlayer.Name + " had their turn shuffled in the Reverb!", Priority.Medium, GetCardSource(), discard.CardToMove.ToEnumerable(), true);
                if (base.UseUnityCoroutines)
                {
                    yield return(base.GameController.StartCoroutine(messageCoroutine));
                }
                else
                {
                    base.GameController.ExhaustCoroutine(messageCoroutine);
                }
                OnPhaseChangeStatusEffect skipsPower = new OnPhaseChangeStatusEffect(base.Card, nameof(SkipPowerPhaseResponse), currentPlayer.Name + " skips their power phase this turn.", new TriggerType[] { TriggerType.SkipPhase }, base.Card);
                skipsPower.TurnTakerCriteria.IsSpecificTurnTaker = currentPlayer;
                skipsPower.TurnIndexCriteria.EqualTo             = base.Game.TurnIndex;
                skipsPower.TurnPhaseCriteria.Phase = Phase.UsePower;
                IEnumerator statusCoroutine = base.GameController.AddStatusEffect(skipsPower, true, GetCardSource());
                if (base.UseUnityCoroutines)
                {
                    yield return(base.GameController.StartCoroutine(statusCoroutine));
                }
                else
                {
                    base.GameController.ExhaustCoroutine(statusCoroutine);
                }
                IEnumerator powerCoroutine = base.GameController.SelectAndUsePower(base.GameController.FindHeroTurnTakerController(currentPlayer.ToHero()), optional: false, cardSource: GetCardSource());
                if (base.UseUnityCoroutines)
                {
                    yield return(base.GameController.StartCoroutine(powerCoroutine));
                }
                else
                {
                    base.GameController.ExhaustCoroutine(powerCoroutine);
                }
            }
            yield break;
        }
        public IEnumerator ResumeDrawEffect(PhaseChangeAction _, OnPhaseChangeStatusEffect _2)
        {
            System.Console.WriteLine("### DEBUG ### - ElementOfLightning.ResumeDrawEffect triggered");

            //Clear the secret property from all Character Cards
            foreach (HeroTurnTaker hero in Game.HeroTurnTakers)
            {
                GameController.AddCardPropertyJournalEntry(hero.CharacterCard, PreventDrawPropertyKey, (bool?)null);
            }

            yield break;
        }
Example #8
0
        public override IEnumerator UsePower(int index = 0)
        {
            //==============================================================
            // Select a target, at the start of your next turn,
            // {TangoOne} deals that target 3 projectile damage.
            //==============================================================
            int numDamage = GetPowerNumeral(0, PowerDamageToDeal);
            IEnumerable <Card>          targets       = GameController.FindTargetsInPlay();
            List <SelectTargetDecision> storedResults = new List <SelectTargetDecision>();
            IEnumerator coroutine = GameController.SelectTargetAndStoreResults(DecisionMaker, targets, storedResults,
                                                                               damageSource: CharacterCard, damageAmount: card => numDamage, damageType: DamageType.Projectile,
                                                                               selectionType: SelectionType.SelectTargetNoDamage, cardSource: GetCardSource());

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

            Card target = storedResults.FirstOrDefault()?.SelectedCard;

            if (target != null)
            {
                OnPhaseChangeStatusEffect effect = new OnPhaseChangeStatusEffect(this.CardWithoutReplacements,
                                                                                 nameof(StartOfTurnDealDamageResponse),
                                                                                 $"{base.Card.Title} will deal {PowerDamageToDeal} projectile damage to {target.Title} at the start of her next turn",
                                                                                 new[] { TriggerType.DealDamage }, this.Card);
                effect.UntilEndOfNextTurn(base.HeroTurnTaker);
                effect.TurnTakerCriteria.IsSpecificTurnTaker = base.HeroTurnTaker;
                effect.UntilTargetLeavesPlay(target);
                effect.TurnPhaseCriteria.Phase = Phase.Start;
                effect.BeforeOrAfter           = BeforeOrAfter.After;
                effect.CanEffectStack          = true;
                effect.CardSource     = this.Card;
                effect.NumberOfUses   = 1;
                effect.DoesDealDamage = true;
                effect.SetPowerNumeralsArray(new int[] { numDamage });

                IEnumerator addStatusEffectRoutine = base.GameController.AddStatusEffect(effect, true, GetCardSource());
                if (base.UseUnityCoroutines)
                {
                    yield return(base.GameController.StartCoroutine(addStatusEffectRoutine));
                }
                else
                {
                    base.GameController.ExhaustCoroutine(addStatusEffectRoutine);
                }
            }
        }
Example #9
0
        public IEnumerator ResumeDrawEffect(PhaseChangeAction _, OnPhaseChangeStatusEffect sourceEffect)
        {
            System.Console.WriteLine("### DEBUG ### - ChokingInspiration.ResumeDrawEffect triggered");

            HeroTurnTaker htt = sourceEffect.TurnTakerCriteria.IsSpecificTurnTaker.ToHero();

            //Clear the secret property from all Character Cards of the victim, just to be sure
            foreach (var ch in htt.CharacterCards)
            {
                GameController.AddCardPropertyJournalEntry(ch, PreventDrawPropertyKey, (bool?)null);
            }

            return(DoNothing());
        }
Example #10
0
        public IEnumerator SkipPowerPhaseResponse(PhaseChangeAction pca, OnPhaseChangeStatusEffect sourceEffect)
        {
            Log.Debug("ReverbCardController.SkipPowerPhaseResponse activated");
            IEnumerator skipCoroutine = base.GameController.PreventPhaseAction(pca.ToPhase, showMessage: false, GetCardSource());

            if (base.UseUnityCoroutines)
            {
                yield return(base.GameController.StartCoroutine(skipCoroutine));
            }
            else
            {
                base.GameController.ExhaustCoroutine(skipCoroutine);
            }
        }
        private OnPhaseChangeStatusEffect MakeTurntakerStartPhaseEffect(string methodToCall, TurnTaker target, TriggerType triggerType, string description)
        {
            OnPhaseChangeStatusEffect effect = new OnPhaseChangeStatusEffect(this.CardWithoutReplacements,
                                                                             methodToCall,
                                                                             description, new[] { triggerType }, this.Card);

            GameController.AddCardPropertyJournalEntry(Card, IncapTurnTakerKey, target);

            effect.UntilEndOfNextTurn(base.HeroTurnTaker);
            effect.TurnTakerCriteria.IsSpecificTurnTaker = base.HeroTurnTaker;
            effect.TurnPhaseCriteria.Phase = Phase.Start;
            effect.BeforeOrAfter           = BeforeOrAfter.After;
            effect.UntilCardLeavesPlay(base.Card);

            return(effect);
        }
        public IEnumerator DealToxicToSelfResponse(PhaseChangeAction _, OnPhaseChangeStatusEffect effect)
        {
            var target = effect.TargetLeavesPlayExpiryCriteria.IsOneOfTheseCards.FirstOrDefault();

            if (target.IsTarget && target.IsInPlayAndNotUnderCard)
            {
                IEnumerator coroutine = this.DealDamage(target, target, 1, DamageType.Toxic, false, false, false, null, null, null, false, GetCardSource(effect));
                if (base.UseUnityCoroutines)
                {
                    yield return(base.GameController.StartCoroutine(coroutine));
                }
                else
                {
                    base.GameController.ExhaustCoroutine(coroutine);
                }
                yield break;
            }
        }
        public override IEnumerator UsePower(int index = 0)
        {
            //Power: "Until the end of your next turn, reduce the first damage dealt to Vikral each turn by X, where X is the number of Microstorms in play."
            //Check Scatter Deflector and Energized Chassis (Kyoss) for referencing on ways to make it variable amount per turn and once per turn?
            base.AddCardPropertyJournalEntry(MicrostormReducePropertyKey, true);
            OnPhaseChangeStatusEffect opcse = new OnPhaseChangeStatusEffect(CardWithoutReplacements, nameof(DoNothing), $"Until the end of your next turn, reduce the first damage dealt to {base.TurnTaker.Name} by X, where X is the number of Microstorms in play.", new TriggerType[] { TriggerType.ReduceDamage }, this.Card);

            opcse.CardDestroyedExpiryCriteria.Card = base.CharacterCard;
            opcse.UntilEndOfNextTurn(base.TurnTaker);
            IEnumerator coroutine = AddStatusEffect(opcse, true);

            if (UseUnityCoroutines)
            {
                yield return(base.GameController.StartCoroutine(coroutine));
            }
            else
            {
                base.GameController.ExhaustCoroutine(coroutine);
            }
        }
        public IEnumerator IncreaseDamageResponse(PhaseChangeAction _, OnPhaseChangeStatusEffect sourceEffect)
        {
            int increaseNumeral = sourceEffect.PowerNumeralsToChange[0];

            IncreaseDamageStatusEffect statusEffect = new IncreaseDamageStatusEffect(increaseNumeral);

            statusEffect.UntilThisTurnIsOver(Game);
            statusEffect.UntilTargetLeavesPlay(base.CharacterCard);
            IEnumerator coroutine = base.AddStatusEffect(statusEffect);

            if (base.UseUnityCoroutines)
            {
                yield return(base.GameController.StartCoroutine(coroutine));
            }
            else
            {
                base.GameController.ExhaustCoroutine(coroutine);
            }
            yield break;
        }
        public override IEnumerator UsePower(int index = 0)
        {
            //Increase damage dealt by {Cricket} during your next turn by 1. {Cricket} may deal 1 target 1 sonic damage.
            int increaseNumeral = GetPowerNumeral(0, 1);
            int targetNumeral   = GetPowerNumeral(1, 1);
            int damageNumeral   = GetPowerNumeral(2, 1);

            //Increase damage dealt by {Cricket} during your next turn by 1.
            OnPhaseChangeStatusEffect statusEffect = new OnPhaseChangeStatusEffect(CardWithoutReplacements, nameof(IncreaseDamageResponse), "Increase damage dealt by {Cricket} during your next turn by 1", new TriggerType[] { TriggerType.IncreaseDamage }, base.Card);

            statusEffect.TurnTakerCriteria.IsSpecificTurnTaker = base.TurnTaker;
            statusEffect.TurnIndexCriteria.GreaterThan         = Game.TurnIndex;
            statusEffect.TurnPhaseCriteria.TurnTaker           = base.TurnTaker;
            statusEffect.NumberOfUses   = 1;
            statusEffect.CanEffectStack = true;
            statusEffect.UntilTargetLeavesPlay(base.CharacterCard);
            statusEffect.SetPowerNumeralsArray(new int[] { increaseNumeral });

            IEnumerator coroutine = base.AddStatusEffect(statusEffect);

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

            //{Cricket} may deal 1 target 1 sonic damage.
            coroutine = base.GameController.SelectTargetsAndDealDamage(base.HeroTurnTakerController, new DamageSource(base.GameController, base.CharacterCard), damageNumeral, DamageType.Sonic, targetNumeral, false, 0, cardSource: base.GetCardSource());
            if (base.UseUnityCoroutines)
            {
                yield return(base.GameController.StartCoroutine(coroutine));
            }
            else
            {
                base.GameController.ExhaustCoroutine(coroutine);
            }
            yield break;
        }
Example #16
0
        public IEnumerator StartOfTurnDrawCardsResponse(PhaseChangeAction _, OnPhaseChangeStatusEffect sourceEffect)
        {
            var tt = GetCardPropertyJournalEntryTurnTaker(IncapTurnTakerKey);

            if (tt != null && !tt.IsIncapacitatedOrOutOfGame)
            {
                IEnumerator drawCardRoutine = base.DrawCards(FindHeroTurnTakerController(tt.ToHero()), Incapacitate1CardsToDraw, true, allowAutoDraw: false);
                if (base.UseUnityCoroutines)
                {
                    yield return(base.GameController.StartCoroutine(drawCardRoutine));
                }
                else
                {
                    base.GameController.ExhaustCoroutine(drawCardRoutine);
                }
                //clear the last card prop
                GameController.AddCardPropertyJournalEntry(Card, IncapTurnTakerKey, (TurnTaker)null);
            }

            GameController.StatusEffectManager.RemoveStatusEffect(sourceEffect);
        }
        public IEnumerator PreventPlaysThisTurnEffect(PhaseChangeAction action, OnPhaseChangeStatusEffect sourceEffect)
        {
            System.Console.WriteLine("### DEBUG ### - ChokingInspiration.PreventPlaysThisTurnEffect triggered");

            CannotPlayCardsStatusEffect effect = new CannotPlayCardsStatusEffect();

            effect.CardSource = sourceEffect.CardSource;
            effect.TurnTakerCriteria.IsSpecificTurnTaker = base.Game.ActiveTurnTaker;
            effect.UntilThisTurnIsOver(base.Game);
            IEnumerator coroutine = base.AddStatusEffect(effect);

            if (base.UseUnityCoroutines)
            {
                yield return(base.GameController.StartCoroutine(coroutine));
            }
            else
            {
                base.GameController.ExhaustCoroutine(coroutine);
            }
            yield break;
        }
        private IEnumerator ApplyStatusEffects(DealDamageAction dd)
        {
            OnPhaseChangeStatusEffect opcse = new OnPhaseChangeStatusEffect(this.CardWithoutReplacements, nameof(DealToxicToSelfResponse), $"{dd.Target.Title} will deal itself one Toxic damage at the end of this turn!", new TriggerType[] { TriggerType.PhaseChange, TriggerType.DealDamage }, this.Card);

            opcse.NumberOfUses = 1;
            opcse.UntilTargetLeavesPlay(dd.Target);
            opcse.TurnPhaseCriteria.Phase     = Phase.End;
            opcse.TurnPhaseCriteria.TurnTaker = base.GameController.ActiveTurnTaker;
            opcse.BeforeOrAfter = BeforeOrAfter.After;
            opcse.CardSource    = this.Card;
            opcse.UntilStartOfNextTurn(base.GameController.FindNextTurnTaker());
            IEnumerator coroutine = base.AddStatusEffect(opcse, true);

            if (base.UseUnityCoroutines)
            {
                yield return(base.GameController.StartCoroutine(coroutine));
            }
            else
            {
                base.GameController.ExhaustCoroutine(coroutine);
            }
            yield break;
        }
Example #19
0
        public IEnumerator StartOfTurnPlayCardsResponse(PhaseChangeAction _, OnPhaseChangeStatusEffect sourceEffect)
        {
            var tt = GetCardPropertyJournalEntryTurnTaker(IncapTurnTakerKey);

            if (tt != null && !tt.IsIncapacitatedOrOutOfGame)
            {
                var httc = FindHeroTurnTakerController(tt.ToHero());

                IEnumerator playCardsRoutine = base.GameController.SelectAndPlayCardsFromHand(httc, 2, true, requiredCards: 0, cardSource: GetCardSource());
                if (base.UseUnityCoroutines)
                {
                    yield return(base.GameController.StartCoroutine(playCardsRoutine));
                }
                else
                {
                    base.GameController.ExhaustCoroutine(playCardsRoutine);
                }


                //clear the last card prop
                GameController.AddCardPropertyJournalEntry(Card, IncapTurnTakerKey, (TurnTaker)null);
            }
            GameController.StatusEffectManager.RemoveStatusEffect(sourceEffect);
        }
        public override IEnumerator UsePower(int index = 0)
        {
            //"Play an equipment target next to a hero. Treat {TheKnight}'s name on that equipment as the name of the hero it is next to."

            //"..an equipment target..."
            List <SelectCardDecision> storedEquipment = new List <SelectCardDecision> {
            };
            IEnumerator coroutine = GameController.SelectCardAndStoreResults(DecisionMaker, SelectionType.PlayCard, new LinqCardCriteria((Card c) => c.Location == this.HeroTurnTaker.Hand && IsEquipment(c) && c.IsTarget && GameController.CanPlayCard(FindCardController(c)) == CanPlayCardResult.CanPlay, "", false, singular: "playable equipment target", plural: "playable equipment targets"), storedEquipment, false, cardSource: GetCardSource());

            if (base.UseUnityCoroutines)
            {
                yield return(base.GameController.StartCoroutine(coroutine));
            }
            else
            {
                base.GameController.ExhaustCoroutine(coroutine);
            }
            if (!DidSelectCard(storedEquipment))
            {
                yield break;
            }
            Card equipment = storedEquipment.FirstOrDefault().SelectedCard;
            //"...next to a hero"
            List <SelectCardDecision> storedHero = new List <SelectCardDecision> {
            };

            coroutine = GameController.SelectCardAndStoreResults(DecisionMaker, SelectionType.HeroCharacterCard, new LinqCardCriteria((Card c) => c.IsInPlayAndHasGameText && c.IsTarget && c.IsHeroCharacterCard && !c.IsIncapacitated, "hero character"), storedHero, false, cardSource: GetCardSource());
            if (base.UseUnityCoroutines)
            {
                yield return(base.GameController.StartCoroutine(coroutine));
            }
            else
            {
                base.GameController.ExhaustCoroutine(coroutine);
            }
            if (!DidSelectCard(storedHero))
            {
                yield break;
            }
            Card hero = storedHero.FirstOrDefault().SelectedCard;

            //...Treat {TheKnight}'s name on that equipment as the name of the hero it is next to."
            GameController.AddCardPropertyJournalEntry(equipment, VigilarKey, hero);

            //"Play an equipment target next to a hero."
            List <bool> wasCardPlayed = new List <bool> {
            };

            coroutine = GameController.PlayCard(DecisionMaker, equipment, wasCardPlayed: wasCardPlayed, overridePlayLocation: hero.Owner.PlayArea, cardSource: GetCardSource());
            if (base.UseUnityCoroutines)
            {
                yield return(base.GameController.StartCoroutine(coroutine));
            }
            else
            {
                base.GameController.ExhaustCoroutine(coroutine);
            }

            if (wasCardPlayed.Any() && wasCardPlayed.FirstOrDefault())
            {
                coroutine = GameController.SendMessageAction($"{this.Card.Title} lends {equipment.Title} to {hero.Title}", Priority.Medium, GetCardSource(), new Card[] { equipment });
                if (base.UseUnityCoroutines)
                {
                    yield return(base.GameController.StartCoroutine(coroutine));
                }
                else
                {
                    base.GameController.ExhaustCoroutine(coroutine);
                }

                OnPhaseChangeStatusEffect messageStatusEffect = new OnPhaseChangeStatusEffect(CardWithoutReplacements, nameof(DoNothing), $"{Card.Title}'s name is treated as {hero.Title} on {equipment.Title}", new TriggerType[] { TriggerType.Other }, equipment);
                messageStatusEffect.UntilCardLeavesPlay(equipment);
                messageStatusEffect.CanEffectStack = true;
                coroutine = GameController.AddStatusEffect(messageStatusEffect, false, GetCardSource());
                if (base.UseUnityCoroutines)
                {
                    yield return(base.GameController.StartCoroutine(coroutine));
                }
                else
                {
                    base.GameController.ExhaustCoroutine(coroutine);
                }
            }
            else
            {
                GameController.AddCardPropertyJournalEntry(equipment, VigilarKey, (Card)null);
            }

            yield break;
        }
        public override IEnumerator UseIncapacitatedAbility(int index)
        {
            /*
             * "One player may use a power now.",
             * "Destroy 1 ongoing card.",
             * "Select 1 environment target in play. Destroy it at the start of your next turn. Until then, it is immune to damage."
             */

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

            case 1:
            {
                //"Destroy 1 ongoing card.",
                var coroutine = GameController.SelectAndDestroyCard(DecisionMaker, new LinqCardCriteria(c => c.IsOngoing, "ongoing"), false, cardSource: GetCardSource());
                if (base.UseUnityCoroutines)
                {
                    yield return(base.GameController.StartCoroutine(coroutine));
                }
                else
                {
                    base.GameController.ExhaustCoroutine(coroutine);
                }
                break;
            }

            case 2:
            {
                //"Select 1 environment target in play. Destroy it at the start of your next turn. Until then, it is immune to damage."
                List <SelectCardDecision> storedResults = new List <SelectCardDecision>();
                var coroutine = GameController.SelectCardAndStoreResults(DecisionMaker, SelectionType.DestroyCard, new LinqCardCriteria(c => c.IsEnvironmentTarget, "environment target", false), storedResults, false,
                                                                         allowAutoDecide: true,
                                                                         cardSource: GetCardSource());
                if (base.UseUnityCoroutines)
                {
                    yield return(base.GameController.StartCoroutine(coroutine));
                }
                else
                {
                    base.GameController.ExhaustCoroutine(coroutine);
                }

                if (DidSelectCard(storedResults))
                {
                    var card = GetSelectedCard(storedResults);
                    if (IsRealAction())
                    {
                        Journal.RecordCardProperties(card, "MarkedForDestruction", true);
                    }
                    var immune = new ImmuneToDamageStatusEffect();
                    immune.CardSource = CharacterCard;
                    immune.TargetCriteria.IsSpecificCard = card;
                    immune.UntilCardLeavesPlay(card);

                    coroutine = base.AddStatusEffect(immune, true);
                    if (base.UseUnityCoroutines)
                    {
                        yield return(base.GameController.StartCoroutine(coroutine));
                    }
                    else
                    {
                        base.GameController.ExhaustCoroutine(coroutine);
                    }

                    var effect = new OnPhaseChangeStatusEffect(CardWithoutReplacements, nameof(DestroyMarkedTarget), $"{card.Title} will be destroyed at the start of {CharacterCard.Title}'s next turn.", new[] { TriggerType.DestroyCard }, CharacterCard);
                    effect.TurnPhaseCriteria.TurnTaker = TurnTaker;
                    effect.TurnPhaseCriteria.Phase     = Phase.Start;
                    effect.NumberOfUses   = 1;
                    effect.CanEffectStack = true;
                    effect.CardSource     = CharacterCard;
                    effect.UntilTargetLeavesPlay(card);

                    coroutine = base.AddStatusEffect(effect, true);
                    if (base.UseUnityCoroutines)
                    {
                        yield return(base.GameController.StartCoroutine(coroutine));
                    }
                    else
                    {
                        base.GameController.ExhaustCoroutine(coroutine);
                    }
                }
                break;
            }
            }
            yield break;
        }
        public override IEnumerator UseIncapacitatedAbility(int index)
        {
            IEnumerator coroutine = null;

            switch (index)
            {
            case 0:
            {
                //One hero may use a power now.
                coroutine = base.GameController.SelectHeroToUsePower(base.HeroTurnTakerController, cardSource: base.GetCardSource());
                if (base.UseUnityCoroutines)
                {
                    yield return(base.GameController.StartCoroutine(coroutine));
                }
                else
                {
                    base.GameController.ExhaustCoroutine(coroutine);
                }
                break;
            }

            case 1:
            {
                //Select a power on a card in play. The next time a hero uses it. They may immediately use it again.
                List <SelectCardDecision> decision = new List <SelectCardDecision>();
                //Select a power on a card in play.
                coroutine = base.GameController.SelectCardAndStoreResults(base.HeroTurnTakerController, SelectionType.UsePowerTwice, new LinqCardCriteria((Card c) => c.HasPowers && c.IsInPlayAndHasGameText), decision, false, cardSource: base.GetCardSource());
                if (base.UseUnityCoroutines)
                {
                    yield return(base.GameController.StartCoroutine(coroutine));
                }
                else
                {
                    base.GameController.ExhaustCoroutine(coroutine);
                }

                if (DidSelectCard(decision))
                {
                    int    powerIndex   = 0;
                    string powerString  = "power on ";
                    Card   selectedCard = decision.FirstOrDefault().SelectedCard;
                    if (selectedCard.NumberOfPowers > 1)
                    {
                        List <SelectNumberDecision> number = new List <SelectNumberDecision>();
                        coroutine = base.GameController.SelectNumber(base.HeroTurnTakerController, SelectionType.UsePowerTwice, 0, selectedCard.NumberOfPowers - 1, storedResults: number, cardSource: base.GetCardSource());
                        if (base.UseUnityCoroutines)
                        {
                            yield return(base.GameController.StartCoroutine(coroutine));
                        }
                        else
                        {
                            base.GameController.ExhaustCoroutine(coroutine);
                        }
                        if (number != null && number.FirstOrDefault().SelectedNumber != null)
                        {
                            powerIndex = number.FirstOrDefault().SelectedNumber ?? default;
                            if (powerIndex == 0)
                            {
                                powerString = "first power on ";
                            }
                            else if (powerIndex == 1)
                            {
                                powerString = "second power on ";
                            }
                            else if (powerIndex == 2)
                            {
                                powerString = "third power on ";
                            }
                            else
                            {
                                powerString = "nth power on ";
                            }
                        }
                    }

                    //The next time a hero uses it. They may immediately use it again.
                    OnPhaseChangeStatusEffect statusEffect = new OnPhaseChangeStatusEffect(CardWithoutReplacements, nameof(DoNothing), "The " + powerString + selectedCard.Title + " will be used twice next time it is used by a hero.", new TriggerType[] { TriggerType.UsePower }, base.CharacterCard);
                    statusEffect.CardDestroyedExpiryCriteria.Card = selectedCard;
                    statusEffect.NumberOfUses   = powerIndex + 1;       //cheat to store the powerIndex in the statusEffect
                    statusEffect.CanEffectStack = true;
                    coroutine = base.AddStatusEffect(statusEffect);
                    if (base.UseUnityCoroutines)
                    {
                        yield return(base.GameController.StartCoroutine(coroutine));
                    }
                    else
                    {
                        base.GameController.ExhaustCoroutine(coroutine);
                    }
                }
                break;
            }

            case 2:
            {
                List <SelectLocationDecision> storedLocation = new List <SelectLocationDecision>();
                //Move the bottom card of a deck to the top.
                coroutine = base.GameController.SelectADeck(base.HeroTurnTakerController, SelectionType.RevealTopCardOfDeck, (Location deck) => true, storedLocation, cardSource: base.GetCardSource());
                if (base.UseUnityCoroutines)
                {
                    yield return(base.GameController.StartCoroutine(coroutine));
                }
                else
                {
                    base.GameController.ExhaustCoroutine(coroutine);
                }
                if (DidSelectLocation(storedLocation))
                {
                    Location selectedDeck = GetSelectedLocation(storedLocation);
                    coroutine = base.GameController.MoveCard(base.TurnTakerController, selectedDeck.BottomCard, selectedDeck, showMessage: true, cardSource: base.GetCardSource());
                    if (base.UseUnityCoroutines)
                    {
                        yield return(base.GameController.StartCoroutine(coroutine));
                    }
                    else
                    {
                        base.GameController.ExhaustCoroutine(coroutine);
                    }
                }
                break;
            }
            }
            yield break;
        }
Example #23
0
        public override IEnumerator Play()
        {
            // Find hero with the most cards in hand
            List <TurnTaker> excludedTurnTakers             = new List <TurnTaker>();
            List <TurnTaker> mostCardsInHandResults         = new List <TurnTaker>();
            IEnumerator      heroWithMostCardsInHandRoutine = base.FindHeroWithMostCardsInHand(mostCardsInHandResults);

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

            if (mostCardsInHandResults.Any())
            {
                var biggestHandTurnTaker = mostCardsInHandResults.First();
                excludedTurnTakers.Add(biggestHandTurnTaker);

                //The status effect must last slightly longer than the triggering phase action, or the effect will not fire.
                OnPhaseChangeStatusEffect effect = new OnPhaseChangeStatusEffect(CardWithoutReplacements, nameof(PreventDrawsThisTurnEffect), $"{biggestHandTurnTaker.Name} cannot draw cards on their turn.", new TriggerType[] { TriggerType.CreateStatusEffect }, base.Card);
                effect.TurnTakerCriteria.IsSpecificTurnTaker = biggestHandTurnTaker;
                effect.TurnPhaseCriteria.Phase = Phase.Start;
                effect.UntilEndOfNextTurn(biggestHandTurnTaker);
                effect.CanEffectStack = true;
                IEnumerator onPhaseChangeRoutine = base.AddStatusEffect(effect);

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

            // Find hero with most cards in play
            List <TurnTaker> mostCardsInPlayResults         = new List <TurnTaker>();
            IEnumerator      heroWithMostCardsInPlayRoutine = base.FindHeroWithMostCardsInPlay(mostCardsInPlayResults);

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

            if (mostCardsInPlayResults.Any())
            {
                var mostCardsTurnTaker = mostCardsInPlayResults.First();
                excludedTurnTakers.Add(mostCardsTurnTaker);

                //The status effect must last slightly longer than the triggering phase action, or the effect will not fire.
                // This hero may not play cards during their next turn.
                OnPhaseChangeStatusEffect effect = new OnPhaseChangeStatusEffect(CardWithoutReplacements, nameof(PreventPlaysThisTurnEffect), $"{mostCardsTurnTaker.Name} cannot play cards on their turn.", new TriggerType[] { TriggerType.CreateStatusEffect }, base.Card);
                effect.TurnTakerCriteria.IsSpecificTurnTaker = mostCardsTurnTaker;
                effect.TurnPhaseCriteria.Phase = Phase.Start;
                effect.UntilEndOfNextTurn(mostCardsTurnTaker);
                effect.CanEffectStack = true;
                IEnumerator onPhaseChangeRoutine = base.AddStatusEffect(effect);

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

            // All other heroes shuffle their trash into their decks
            IEnumerator shuffleRoutine = base.DoActionToEachTurnTakerInTurnOrder(ttc => ttc.IsHero && !ttc.IsIncapacitatedOrOutOfGame && !excludedTurnTakers.Contains(ttc.TurnTaker), ShuffleTrashResponse);

            if (base.UseUnityCoroutines)
            {
                yield return(base.GameController.StartCoroutine(shuffleRoutine));
            }
            else
            {
                base.GameController.ExhaustCoroutine(shuffleRoutine);
            }
        }
Example #24
0
        public override IEnumerator UseIncapacitatedAbility(int index)
        {
            IEnumerator coroutine;

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

            case 1:
            {
                //"Environment cards cannot be played during the next environment turn.",
                var holderEffect = new OnPhaseChangeStatusEffect(CardWithoutReplacements, nameof(EnvironmentCannotPlayEffect), "During the next environment turn, environment cards cannot be played.", new TriggerType[] { TriggerType.Hidden }, this.Card);
                holderEffect.NumberOfUses = 1;
                holderEffect.TurnTakerCriteria.IsEnvironment = true;
                holderEffect.TurnPhaseCriteria.IsEphemeral   = false;
                holderEffect.CardSource     = CharacterCard;
                holderEffect.CanEffectStack = true;

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

            case 2:
            {
                //"Select a target. The next damage it deals is irreducible."
                var storedTarget = new List <SelectCardDecision> {
                };
                coroutine = GameController.SelectCardAndStoreResults(DecisionMaker, SelectionType.SelectTargetFriendly, FindCardsWhere((Card c) => c.IsInPlayAndHasGameText && c.IsTarget && AskIfCardIsVisibleToCardSource(c, GetCardSource()) != false), storedTarget, cardSource: GetCardSource());
                if (base.UseUnityCoroutines)
                {
                    yield return(base.GameController.StartCoroutine(coroutine));
                }
                else
                {
                    base.GameController.ExhaustCoroutine(coroutine);
                }

                if (storedTarget.FirstOrDefault() != null && storedTarget.FirstOrDefault().SelectedCard != null)
                {
                    var target            = storedTarget.FirstOrDefault().SelectedCard;
                    var irreducibleEffect = new MakeDamageIrreducibleStatusEffect();
                    irreducibleEffect.SourceCriteria.IsSpecificCard = target;
                    irreducibleEffect.NumberOfUses = 1;
                    irreducibleEffect.CardSource   = CharacterCard;
                    irreducibleEffect.CreateImplicitExpiryConditions();

                    coroutine = AddStatusEffect(irreducibleEffect);
                    if (base.UseUnityCoroutines)
                    {
                        yield return(base.GameController.StartCoroutine(coroutine));
                    }
                    else
                    {
                        base.GameController.ExhaustCoroutine(coroutine);
                    }
                }
                break;
            }
            }
            yield break;
        }
        public override IEnumerator UseIncapacitatedAbility(int index)
        {
            /*
             * "One player may play a card now.",
             *  "The next time a target enters play, it deals itself 1 energy damage.",
             *  "Shuffle up to 2 non-target environment cards into their deck."
             */

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

            case 1:
            {
                AddIncap2Use();

                var messageEffect = new OnPhaseChangeStatusEffect(this.CardWithoutReplacements, "PastVanishIncap2Message", "The next time a target enters play, it deals itself 1 energy damage.", new TriggerType[] { TriggerType.DealDamage }, this.Card);
                messageEffect.TurnTakerCriteria.IsHero    = false;
                messageEffect.TurnPhaseCriteria.TurnTaker = this.TurnTaker;
                messageEffect.CanEffectStack = true;
                messageEffect.CardSource     = this.Card;
                //impossible to activate - non-hero turns with a phase belonging to this hero

                IEnumerator coroutine = GameController.AddStatusEffect(messageEffect, true, GetCardSource());
                if (base.UseUnityCoroutines)
                {
                    yield return(base.GameController.StartCoroutine(coroutine));
                }
                else
                {
                    base.GameController.ExhaustCoroutine(coroutine);
                }

                break;
            }

            case 2:
            {
                //"Shuffle up to 2 non-target environment cards into their deck."
                List <SelectCardDecision> storedResults = new List <SelectCardDecision>();

                var env = GameController.FindEnvironmentTurnTakerController();

                var coroutine = GameController.SelectCardsFromLocationAndMoveThem(DecisionMaker, env.TurnTaker.PlayArea, 0, 2,
                                                                                  new LinqCardCriteria(c => c.IsEnvironment && !c.IsTarget, "non-environment target"),
                                                                                  new[] { new MoveCardDestination(env.TurnTaker.Deck) },
                                                                                  storedResults: storedResults,
                                                                                  shuffleAfterwards: false,
                                                                                  selectionType: SelectionType.ShuffleCardIntoDeck,
                                                                                  cardSource: GetCardSource());
                if (base.UseUnityCoroutines)
                {
                    yield return(base.GameController.StartCoroutine(coroutine));
                }
                else
                {
                    base.GameController.ExhaustCoroutine(coroutine);
                }

                if (DidSelectCard(storedResults))
                {
                    coroutine = GameController.ShuffleLocation(env.TurnTaker.Deck, cardSource: GetCardSource());
                    if (base.UseUnityCoroutines)
                    {
                        yield return(base.GameController.StartCoroutine(coroutine));
                    }
                    else
                    {
                        base.GameController.ExhaustCoroutine(coroutine);
                    }
                }
                break;
            }
            }
            yield break;
        }
        public override IEnumerator Play()
        {
            IEnumerator coroutine;
            Card        characterCard = null;

            if (base.CharacterCard.PromoIdentifierOrIdentifier == "WinterTiamatCharacter")
            {
                characterCard = base.TurnTaker.FindCard("StormTiamatCharacter");
            }
            else if (base.CharacterCard.PromoIdentifierOrIdentifier == "HydraWinterTiamatCharacter")
            {
                characterCard = base.TurnTaker.FindCard("HydraStormTiamatCharacter");
            }
            ;
            //If {Tiamat}, The Eye of the Storm is active, she deals each hero target 2+X lightning damage, where X is the number of Element of Lightning cards in the villain trash.
            if (characterCard.IsInPlayAndHasGameText && !characterCard.IsFlipped)
            {
                coroutine = base.DealDamage(characterCard, (Card c) => c.IsHero, (Card c) => PlusNumberOfThisCardInTrash(2), DamageType.Lightning);

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

            //The hero with the most cards in hand...
            List <TurnTaker> storedResults = new List <TurnTaker>();

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

            if (storedResults.Any())
            {
                TurnTaker biggestHandTurnTaker = storedResults.First();
                //...may not draw cards until the start of the next villain turn.
                //We secretly set a property on the victim's character card to indicate that they can't draw cards.
                //A CannotDrawCards query on TiamatCharacterCardController actually makes this happen
                GameController.AddCardPropertyJournalEntry(biggestHandTurnTaker.CharacterCard, PreventDrawPropertyKey, true);

                //This status effect makes them able to draw again at start of next villain
                OnPhaseChangeStatusEffect effect = new OnPhaseChangeStatusEffect(CardWithoutReplacements, nameof(DoNothing), $"{biggestHandTurnTaker.Name} cannot draw cards.", new TriggerType[] { TriggerType.CreateStatusEffect }, base.Card);
                effect.UntilStartOfNextTurn(base.TurnTaker);
                effect.TurnTakerCriteria.IsSpecificTurnTaker = base.TurnTaker;
                effect.TurnPhaseCriteria.Phase = Phase.Start;
                effect.CanEffectStack          = true;
                coroutine = base.AddStatusEffect(effect);
                if (base.UseUnityCoroutines)
                {
                    yield return(base.GameController.StartCoroutine(coroutine));
                }
                else
                {
                    base.GameController.ExhaustCoroutine(coroutine);
                }
            }
            yield break;
        }