Esempio n. 1
0
 public IEnumerator BuddyUpResponse(MoveCardAction mca)
 {
     Log.Debug(base.Card.Title + " moved to " + mca.Destination.GetFriendlyName() + ".");
     if (mca.Destination.Cards.Any((Card c) => c.IsCharacter && c.IsActive))
     {
         // "When this card enters a play area with an active character card, move it next to that character."
         Log.Debug(base.Card.Title + " moved to " + mca.Destination.GetFriendlyName() + ", which has an active character. Moving it next to someone...");
         List <MoveCardDestination> storedResultsPlace = new List <MoveCardDestination>();
         IEnumerator buddyCoroutine = base.SelectCardThisCardWillMoveNextTo(new LinqCardCriteria((Card c) => c.IsActive && c.IsCharacter && c.Location.HighestRecursiveLocation == mca.Destination), storedResultsPlace, false, null);
         if (base.UseUnityCoroutines)
         {
             yield return(base.GameController.StartCoroutine(buddyCoroutine));
         }
         else
         {
             base.GameController.ExhaustCoroutine(buddyCoroutine);
         }
         if (storedResultsPlace != null && storedResultsPlace.Count() > 0)
         {
             IEnumerator moveCoroutine = base.GameController.MoveCard(base.TurnTakerController, base.Card, storedResultsPlace.FirstOrDefault().Location, playCardIfMovingToPlayArea: false, showMessage: true, responsibleTurnTaker: base.TurnTaker, evenIfIndestructible: true, actionSource: mca, doesNotEnterPlay: true, cardSource: GetCardSource());
             if (base.UseUnityCoroutines)
             {
                 yield return(base.GameController.StartCoroutine(moveCoroutine));
             }
             else
             {
                 base.GameController.ExhaustCoroutine(moveCoroutine);
             }
             Log.Debug(base.Card.Title + " moved to " + storedResultsPlace.FirstOrDefault().Location.GetFriendlyName() + ".");
         }
     }
     yield break;
 }
        private IEnumerator RemoveVigilarKey(MoveCardAction mc)
        {
            GameController.AddCardPropertyJournalEntry(mc.CardToMove, VigilarKey, (Card)null);
            yield return(null);

            yield break;
        }
Esempio n. 3
0
        private IEnumerator MoveCardResponse(MoveCardAction mca)
        {
            //target we are moving away from, reduce his phase count
            IEnumerator coroutine = ReducePhaseActionCountIfInPhase((TurnTaker tt) => mca.Origin.IsHero && tt == mca.Origin.OwnerTurnTaker, _phaseToIncrease, 1);

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

            //target we are moving to, increase his phase count
            coroutine = IncreasePhaseActionCountIfInPhase((TurnTaker tt) => mca.Destination.IsHero && tt == mca.Destination.OwnerTurnTaker, _phaseToIncrease, 1);
            if (base.UseUnityCoroutines)
            {
                yield return(base.GameController.StartCoroutine(coroutine));
            }
            else
            {
                base.GameController.ExhaustCoroutine(coroutine);
            }
        }
Esempio n. 4
0
        public IEnumerator HealPitchWeatherResponse(GameAction ga)
        {
            // "... discard cards from the top of the villain deck until you discard a Weather Effect. Put that Weather Effect into play."
            // The reveal cards -> play some -> discard others helper methods will stop if they run out of cards to reveal, so we can't use those
            List <MoveCardAction> moves = new List <MoveCardAction>();

            while (!moves.Where((MoveCardAction mca) => mca.IsDiscard && mca.CardToMove != null && mca.CardToMove.DoKeywordsContain("weather effect", true, true)).Any())
            {
                IEnumerator discardCoroutine = base.GameController.DiscardTopCard(base.TurnTaker.Deck, moves, responsibleTurnTaker: base.TurnTaker, cardSource: GetCardSource());
                if (base.UseUnityCoroutines)
                {
                    yield return(base.GameController.StartCoroutine(discardCoroutine));
                }
                else
                {
                    base.GameController.ExhaustCoroutine(discardCoroutine);
                }
            }
            List <MoveCardAction> relevantDiscards = moves.Where((MoveCardAction mca) => mca.IsDiscard && mca.CardToMove != null && mca.CardToMove.DoKeywordsContain("weather effect", true, true)).ToList();
            MoveCardAction        first            = relevantDiscards.FirstOrDefault();

            if (first != null)
            {
                IEnumerator messageCoroutine = base.GameController.SendMessageAction(base.Card.Title + " brings about a change in the weather!", Priority.Medium, GetCardSource(), showCardSource: true);
                if (base.UseUnityCoroutines)
                {
                    yield return(base.GameController.StartCoroutine(messageCoroutine));
                }
                else
                {
                    base.GameController.ExhaustCoroutine(messageCoroutine);
                }
                Card toPlay = first.CardToMove;
                if (toPlay != null)
                {
                    IEnumerator putCoroutine = base.GameController.PlayCard(base.TurnTakerController, toPlay, isPutIntoPlay: true, responsibleTurnTaker: base.TurnTaker, cardSource: GetCardSource());
                    if (base.UseUnityCoroutines)
                    {
                        yield return(base.GameController.StartCoroutine(putCoroutine));
                    }
                    else
                    {
                        base.GameController.ExhaustCoroutine(putCoroutine);
                    }
                }
            }
            // "Then, {TheShelledOne} regains HP equal to the number of non-character villain targets in play."
            IEnumerator healCoroutine = base.GameController.GainHP(base.Card, base.GameController.FindCardsWhere((Card c) => c.IsVillainTarget && c.IsInPlayAndHasGameText && !c.IsCharacter).Count(), cardSource: GetCardSource());

            if (base.UseUnityCoroutines)
            {
                yield return(base.GameController.StartCoroutine(healCoroutine));
            }
            else
            {
                base.GameController.ExhaustCoroutine(healCoroutine);
            }
            yield break;
        }
        private IEnumerator AbsorbResponse(MoveCardAction action)
        {
            CardController absorbed = base.FindCardController(action.CardToMove);

            absorbed.RemoveAllTriggers();
            base.GameController.RemoveInhibitor(absorbed);
            absorbed.AddAllTriggers();
            yield break;
        }
Esempio n. 6
0
 private bool MoveCriteria(MoveCardAction mca)
 {
     //your are my requiredIdentifer
     //me and you are both in play
     //you are moving to the hand or trash
     return((mca.CardToMove.Identifier == _requiredIdentifier || mca.CardToMove.Identifier == _attachIdentifier) &&
            mca.Origin.IsHeroPlayAreaRecursive &&
            (mca.Destination.IsHand || mca.Destination.IsTrash));
 }
        public override IEnumerator UsePower(int index = 0)
        {
            IEnumerator           dealFire;
            int                   powerNumeral   = base.GetPowerNumeral(0, 1);
            List <MoveCardAction> storedResults  = new List <MoveCardAction>();
            IEnumerator           discardTopCard = base.GameController.DiscardTopCard(this.TurnTaker.Deck, storedResults, null, base.TurnTaker, GetCardSource(null));

            if (base.UseUnityCoroutines)
            {
                yield return(base.GameController.StartCoroutine(discardTopCard));
            }
            else
            {
                base.GameController.ExhaustCoroutine(discardTopCard);
            }
            MoveCardAction moveCard = storedResults.FirstOrDefault <MoveCardAction>();

            if (moveCard != null && moveCard.CardToMove != null && moveCard.CardToMove.IsOneShot)
            {
                List <PlayCardAction> playedCard  = new List <PlayCardAction>();
                IEnumerator           mayPlayCard = base.GameController.PlayCard(this.DecisionMaker, moveCard.CardToMove, true, null, true, null, null, false, null, playedCard, null, false, false, true, GetCardSource(null));
                if (base.UseUnityCoroutines)
                {
                    yield return(base.GameController.StartCoroutine(mayPlayCard));
                }
                else
                {
                    base.GameController.ExhaustCoroutine(mayPlayCard);
                }
                PlayCardAction playCard = playedCard.FirstOrDefault <PlayCardAction>();
                if (playCard == null)
                {
                    dealFire = base.GameController.DealDamage(this.DecisionMaker, base.CharacterCard, (Card c) => !c.IsHero && c.IsTarget && c.IsInPlayAndHasGameText, powerNumeral, DamageType.Fire, false, false, null, null, null, false, null, null, false, false, GetCardSource(null));
                    if (base.UseUnityCoroutines)
                    {
                        yield return(base.GameController.StartCoroutine(dealFire));
                    }
                    else
                    {
                        base.GameController.ExhaustCoroutine(dealFire);
                    }
                }
            }
            else
            {
                dealFire = base.GameController.DealDamage(this.DecisionMaker, base.CharacterCard, (Card c) => !c.IsHero && c.IsTarget && c.IsInPlayAndHasGameText, powerNumeral, DamageType.Fire, false, false, null, null, null, false, null, null, false, false, GetCardSource(null));
                if (base.UseUnityCoroutines)
                {
                    yield return(base.GameController.StartCoroutine(dealFire));
                }
                else
                {
                    base.GameController.ExhaustCoroutine(dealFire);
                }
            }
            yield break;
        }
Esempio n. 8
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;
        }
Esempio n. 9
0
    public async static Task MoveCard(MoveCardAction action)
    {
        var values = new
        {
            GameState.gameId,
            playerId = GameState.mainPlayerId,
            action.cardId,
            action.x,
            action.y
        };

        await HttpRequest.Post(Config.GAME_SERVER_URL + "moveCard", values);
    }
        private IEnumerator RefillRiverbankResponse(MoveCardAction m)
        {
            IEnumerator coroutine = RefillRiverbankResponseHelper();

            if (this.UseUnityCoroutines)
            {
                yield return(this.GameController.StartCoroutine(coroutine));
            }
            else
            {
                this.GameController.ExhaustCoroutine(coroutine);
            }
        }
Esempio n. 11
0
        public IEnumerator DontTouchThatResponse(MoveCardAction mca)
        {
            // "Whenever an environment card enters a villain play area, this card deals the character or Device with the highest HP in that play area 2 projectile damage."
            // Identify the play area that the card moved to
            Location targetPlayArea = mca.Destination.HighestRecursiveLocation;
            // Deal damage to the character or Device target in that play area with the highest HP
            IEnumerator shootCoroutine = base.DealDamageToHighestHP(base.Card, 1, (Card c) => (c.IsCharacter || c.IsDevice) && c.Location.HighestRecursiveLocation == targetPlayArea, (Card c) => 2, DamageType.Projectile, isIrreducible: false, optional: false);

            if (base.UseUnityCoroutines)
            {
                yield return(base.GameController.StartCoroutine(shootCoroutine));
            }
            else
            {
                base.GameController.ExhaustCoroutine(shootCoroutine);
            }
            yield break;
        }
        private IEnumerator FlipVectorResponse(MoveCardAction mca)
        {
            // A virus card was moved under this card, check for flip condition
            if (!ShouldVectorFlip())
            {
                yield break;
            }

            // Flip Vector
            if (base.UseUnityCoroutines)
            {
                yield return(base.GameController.StartCoroutine(FlipVector()));
            }
            else
            {
                base.GameController.ExhaustCoroutine(FlipVector());
            }

            yield break;
        }
Esempio n. 13
0
        private IEnumerator ChangeRoomPostLeaveResponse(MoveCardAction mc)
        {
            //Whenever a room card would leave play, instead place it face up beneath this card.
            //Then choose a different room beneath this card and put it into play.
            IEnumerator cancel  = base.CancelAction(mc);
            IEnumerator under   = base.GameController.MoveCard(base.TurnTakerController, mc.CardToMove, Catacombs.UnderLocation, cardSource: base.GetCardSource());
            IEnumerator shuffle = base.GameController.ShuffleLocation(Catacombs.UnderLocation, cardSource: base.GetCardSource());

            if (base.UseUnityCoroutines)
            {
                yield return(base.GameController.StartCoroutine(cancel));

                yield return(base.GameController.StartCoroutine(under));

                yield return(base.GameController.StartCoroutine(shuffle));
            }
            else
            {
                base.GameController.ExhaustCoroutine(cancel);
                base.GameController.ExhaustCoroutine(under);
                base.GameController.ExhaustCoroutine(shuffle);
            }

            //only do immediate play action if its not living geometry, which will take care of room response
            if (mc.ActionSource == null || mc.ActionSource.CardSource == null || mc.ActionSource.CardSource.Card.Identifier != LivingGeometryCardController.Identifier)
            {
                //Then choose a different room beneath this card and put it into play.
                IEnumerator play = base.GameController.SelectAndPlayCard(this.DecisionMaker, Catacombs.UnderLocation.Cards.Where(c => c != mc.CardToMove), isPutIntoPlay: true);

                if (base.UseUnityCoroutines)
                {
                    yield return(base.GameController.StartCoroutine(play));
                }
                else
                {
                    base.GameController.ExhaustCoroutine(play);
                }
            }
            yield break;
        }
        private IEnumerator MoveOutOfPlayResponse(MoveCardAction action)
        {
            action.SetDestination(TurnTaker.OutOfGame);
            var coroutine = ResetFlagAfterLeavesPlay(PendingTriggersKey);

            if (base.UseUnityCoroutines)
            {
                yield return(base.GameController.StartCoroutine(coroutine));
            }
            else
            {
                base.GameController.ExhaustCoroutine(coroutine);
            }
            coroutine = ResetFlagAfterLeavesPlay(CompletedTriggersKey);
            if (base.UseUnityCoroutines)
            {
                yield return(base.GameController.StartCoroutine(coroutine));
            }
            else
            {
                base.GameController.ExhaustCoroutine(coroutine);
            }
        }
 public IEnumerator PutIntoPlayIfDiscarded(MoveCardAction mca)
 {
     // "When this card is discarded from the environment deck, put it into play."
     if (mca.IsDiscard)
     {
         MoveCardJournalEntry entry = (from mc in base.Journal.MoveCardEntriesThisTurn() where mc.Card == base.Card && mc.ToLocation.IsTrash select mc).LastOrDefault();
         bool accepted = false;
         if (entry != null && entry.FromLocation.IsEnvironment)
         {
             if (entry.FromLocation.IsDeck)
             {
                 accepted = true;
             }
             else if (entry.FromLocation.IsRevealed)
             {
                 MoveCardJournalEntry revealEntry = (from mc in base.Journal.MoveCardEntriesThisTurn() where mc.Card == base.Card && mc.ToLocation.IsRevealed select mc).LastOrDefault();
                 if (revealEntry != null && revealEntry.FromLocation.IsDeck)
                 {
                     accepted = true;
                 }
             }
         }
         if (accepted)
         {
             IEnumerator moveCoroutine = base.GameController.MoveCard(base.TurnTakerController, base.Card, base.TurnTaker.PlayArea, isPutIntoPlay: true, showMessage: false, responsibleTurnTaker: base.TurnTaker, actionSource: mca, cardSource: GetCardSource());
             if (base.UseUnityCoroutines)
             {
                 yield return(base.GameController.StartCoroutine(moveCoroutine));
             }
             else
             {
                 base.GameController.ExhaustCoroutine(moveCoroutine);
             }
         }
     }
     yield break;
 }
Esempio n. 16
0
        public IEnumerator ShuffleInsteadResponse(MoveCardAction mca)
        {
            // "... shuffle it into its deck instead."
            base.SetCardPropertyToTrueIfRealAction(OncePerTurn);
            Card        target          = mca.CardToMove;
            IEnumerator cancelCoroutine = base.GameController.CancelAction(mca, cardSource: GetCardSource());

            if (base.UseUnityCoroutines)
            {
                yield return(base.GameController.StartCoroutine(cancelCoroutine));
            }
            else
            {
                base.GameController.ExhaustCoroutine(cancelCoroutine);
            }
            IEnumerator messageCoroutine = base.GameController.SendMessageAction(target.Title + " is preserved by " + base.Card.Title + "...", Priority.Medium, GetCardSource(), associatedCards: new Card[] { target }, showCardSource: true);

            if (base.UseUnityCoroutines)
            {
                yield return(base.GameController.StartCoroutine(messageCoroutine));
            }
            else
            {
                base.GameController.ExhaustCoroutine(messageCoroutine);
            }
            IEnumerator shuffleCoroutine = base.GameController.ShuffleCardIntoLocation(DecisionMaker, target, target.Owner.Deck, false, cardSource: GetCardSource());

            if (base.UseUnityCoroutines)
            {
                yield return(base.GameController.StartCoroutine(shuffleCoroutine));
            }
            else
            {
                base.GameController.ExhaustCoroutine(shuffleCoroutine);
            }
            yield break;
        }
Esempio n. 17
0
        public IEnumerator DiscardDamageOrPowerResponse(GameAction ga)
        {
            // "... each player discards the top card of their deck in turn order."
            IEnumerable <HeroTurnTaker> heroDeckOwners = base.GameController.AllHeroes;

            foreach (HeroTurnTaker player in heroDeckOwners)
            {
                List <MoveCardAction> moveResults      = new List <MoveCardAction>();
                IEnumerator           discardCoroutine = base.GameController.DiscardTopCard(player.Deck, moveResults, (Card c) => true, responsibleTurnTaker: base.TurnTaker, cardSource: GetCardSource());
                if (base.UseUnityCoroutines)
                {
                    yield return(base.GameController.StartCoroutine(discardCoroutine));
                }
                else
                {
                    base.GameController.ExhaustCoroutine(discardCoroutine);
                }
                MoveCardAction discard = moveResults.FirstOrDefault();
                if (discard != null && discard.CardToMove != null)
                {
                    // "... If the discarded card is a One-Shot, that player's hero may use a power now. Otherwise, this card deals that player's hero 2 projectile damage."
                    Card discarded = discard.CardToMove;
                    if (discarded.DoKeywordsContain("one-shot"))
                    {
                        // "... that player's hero may use a power now."
                        IEnumerator powerCoroutine = base.GameController.SelectHeroToUsePower(DecisionMaker, additionalCriteria: new LinqTurnTakerCriteria((TurnTaker tt) => tt == player), cardSource: GetCardSource());
                        if (base.UseUnityCoroutines)
                        {
                            yield return(base.GameController.StartCoroutine(powerCoroutine));
                        }
                        else
                        {
                            base.GameController.ExhaustCoroutine(powerCoroutine);
                        }
                    }
                    else
                    {
                        // "... this card deals that player's hero 2 projectile damage."
                        List <Card> storedCharacter = new List <Card>();
                        IEnumerator findCoroutine   = FindCharacterCardToTakeDamage(player, storedCharacter, base.Card, 2, DamageType.Projectile);
                        if (base.UseUnityCoroutines)
                        {
                            yield return(base.GameController.StartCoroutine(findCoroutine));
                        }
                        else
                        {
                            base.GameController.ExhaustCoroutine(findCoroutine);
                        }
                        if (storedCharacter != null && storedCharacter.FirstOrDefault() != null)
                        {
                            Card        character       = storedCharacter.FirstOrDefault();
                            IEnumerator damageCoroutine = base.GameController.DealDamage(DecisionMaker, base.Card, (Card c) => c == character, 2, DamageType.Projectile, cardSource: GetCardSource());
                            if (base.UseUnityCoroutines)
                            {
                                yield return(base.GameController.StartCoroutine(damageCoroutine));
                            }
                            else
                            {
                                base.GameController.ExhaustCoroutine(damageCoroutine);
                            }
                        }
                    }
                }
            }
            yield break;
        }
Esempio n. 18
0
        public IEnumerator CheckForDiscardedPodResponse(MoveCardAction mca)
        {
            //Log.Debug("TheShelledOneCharacterCardController.CheckForDiscardedPodResponse activated");
            //Log.Debug("CheckForDiscardedPodResponse: mca.WasCardMoved: " + mca.WasCardMoved.ToString());
            //Log.Debug("CheckForDiscardedPodResponse: mca.CardToMove == null: " + (mca.CardToMove == null).ToString());
            // "... put that Pod into play."
            if (mca.WasCardMoved && mca.CardToMove != null)
            {
                Card discarded = mca.CardToMove;
                // Make sure the Pod was discarded from the villain deck or the villain revealed zone
                bool flag = false;
                MoveCardJournalEntry mostRecent = (from mc in base.Journal.MoveCardEntriesThisTurn() where mc.Card == discarded && mc.ToLocation.IsTrash select mc).LastOrDefault();

                /*Log.Debug("CheckForDiscardedPodResponse: mostRecent == null: " + (mostRecent == null).ToString());
                 * if (mostRecent != null)
                 * {
                 *  Log.Debug("CheckForDiscardedPodResponse: mostRecent.FromLocation.IsVillain: " + mostRecent.FromLocation.IsVillain.ToString());
                 * }*/
                if (mostRecent != null && mostRecent.FromLocation.IsVillain)
                {
                    //Log.Debug("CheckForDiscardedPodResponse: mostRecent.FromLocation.IsDeck: " + mostRecent.FromLocation.IsDeck.ToString());
                    //Log.Debug("CheckForDiscardedPodResponse: mostRecent.FromLocation.IsRevealed: " + mostRecent.FromLocation.IsRevealed.ToString());
                    if (mostRecent.FromLocation.IsDeck)
                    {
                        flag = true;
                    }
                    else if (mostRecent.FromLocation.IsRevealed)
                    {
                        MoveCardJournalEntry mostRecentReveal = (from mc in base.Journal.MoveCardEntriesThisTurn() where mc.Card == discarded && mc.ToLocation.IsRevealed select mc).LastOrDefault();

                        /*Log.Debug("CheckForDiscardedPodResponse: mostRecentReveal == null: " + (mostRecentReveal == null).ToString());
                         * if (mostRecentReveal != null)
                         * {
                         *  Log.Debug("CheckForDiscardedPodResponse: mostRecentReveal.FromLocation.IsDeck: " + mostRecentReveal.FromLocation.IsDeck.ToString());
                         * }*/
                        if (mostRecentReveal != null && mostRecentReveal.FromLocation.IsDeck)
                        {
                            flag = true;
                        }
                    }
                }
                //Log.Debug("CheckForDiscardedPodResponse: flag: " + flag.ToString());
                //Log.Debug("CheckForDiscardedPodResponse: discarded.DoKeyWordsContain(\"pod\", true, true): " + discarded.DoKeywordsContain("pod", true, true).ToString());
                // If so, set the "did this already this turn" CardProperty and put it into play
                if (flag && discarded.DoKeywordsContain("pod", true, true))
                {
                    SetCardPropertyToTrueIfRealAction(OnePodPerTurn);
                    IEnumerator messageCoroutine = base.GameController.SendMessageAction(base.Card.Title + " plays the first discarded Pod!", Priority.Medium, GetCardSource(), associatedCards: discarded.ToEnumerable(), showCardSource: true);
                    if (base.UseUnityCoroutines)
                    {
                        yield return(base.GameController.StartCoroutine(messageCoroutine));
                    }
                    else
                    {
                        base.GameController.ExhaustCoroutine(messageCoroutine);
                    }
                    IEnumerator putCoroutine = base.GameController.PlayCard(base.TurnTakerController, discarded, isPutIntoPlay: true, responsibleTurnTaker: base.TurnTaker, actionSource: mca, cardSource: GetCardSource());
                    if (base.UseUnityCoroutines)
                    {
                        yield return(base.GameController.StartCoroutine(putCoroutine));
                    }
                    else
                    {
                        base.GameController.ExhaustCoroutine(putCoroutine);
                    }
                }
            }
            yield break;
        }
Esempio n. 19
0
        public IEnumerator UnusualMoveResponse(MoveCardAction mca)
        {
            // "Whenever a villain card would go anywhere except the villain trash, deck, or play area, first reveal that card."
            // "If {TheClient} is revealed this way, flip {Breakaway}."
            if (mca.CardToMove != null)
            {
                Card        revealedCard              = mca.CardToMove;
                IEnumerator clientMessageCoroutine    = DoNothing();
                IEnumerator breakawayMessageCoroutine = DoNothing();
                IEnumerator resultCoroutine           = DoNothing();
                if (revealedCard == this.TurnTaker.FindCard("TheClient"))
                {
                    // Show the card to the players (with a note on what happened to The Client in game terms)
                    string clientFate = this.Card.Title + " can't find " + revealedCard.Title + " anywhere!";
                    if (mca.CardSource.Card.IsHero)
                    {
                        // One of the good guys scared the Client away or captured them
                        TurnTaker responsibleHero = mca.CardSource.TurnTakerController.TurnTaker;
                        if (!mca.Destination.IsInGame)
                        {
                            clientFate = responsibleHero.NameRespectingVariant + " scared " + revealedCard.Title + " away!";
                        }
                        else if (mca.Destination.IsHeroPlayAreaRecursive || mca.Destination.IsUnderCard)
                        {
                            clientFate = responsibleHero.NameRespectingVariant + " captured " + revealedCard.Title + "!";
                        }
                        clientMessageCoroutine = base.GameController.SendMessageAction(clientFate, Priority.High, cardSource: mca.CardSource, showCardSource: true);
                    }
                    else if (mca.CardSource.Card.IsEnvironment)
                    {
                        // The environment is too hostile
                        TurnTaker responsiblePlace = mca.CardSource.TurnTakerController.TurnTaker;
                        if (!mca.Destination.IsInGame)
                        {
                            clientFate = revealedCard.Title + " is nowhere to be found in " + responsiblePlace.Name + "!";
                        }
                        else if (mca.Destination.IsEnvironment || mca.Destination.IsUnderCard)
                        {
                            clientFate = revealedCard.Title + " is lost somewhere in " + responsiblePlace.Name + "!";
                        }
                        clientMessageCoroutine = base.GameController.SendMessageAction(clientFate, Priority.High, cardSource: mca.CardSource, showCardSource: true);
                    }
                    else
                    {
                        // The Client booked it because the heroes are too close
                        // TheClientCardController notifies the players before removing the card, so no special message is needed here
                    }
                    string breakawayReaction = this.Card.Title + " is still on the loose, but his heist is ruined! Frustrated, he turns on the heroes...";
                    breakawayMessageCoroutine = base.GameController.SendMessageAction(breakawayReaction, Priority.High, cardSource: GetCardSource());
                    // Flip Breakaway
                    resultCoroutine = base.GameController.FlipCard(this, cardSource: GetCardSource());
                }
                else
                {
                    // Show the card to the players, but then go on with the move as normal
                    clientMessageCoroutine = base.GameController.SendMessageAction(this.Card.Title + " reveals " + revealedCard.Title + ".", Priority.High, cardSource: GetCardSource(), associatedCards: revealedCard.ToEnumerable(), showCardSource: true);
                    resultCoroutine        = DoNothing();
                }

                if (base.UseUnityCoroutines)
                {
                    yield return(this.GameController.StartCoroutine(clientMessageCoroutine));

                    yield return(this.GameController.StartCoroutine(breakawayMessageCoroutine));

                    yield return(this.GameController.StartCoroutine(resultCoroutine));
                }
                else
                {
                    this.GameController.ExhaustCoroutine(clientMessageCoroutine);
                    this.GameController.ExhaustCoroutine(breakawayMessageCoroutine);
                    this.GameController.ExhaustCoroutine(resultCoroutine);
                }
            }
            yield break;
        }
Esempio n. 20
0
 async void OnCardMove(MoveCardAction action)
 {
     await ServerApi.MoveCard(action);
 }
 private bool ImmediateFlipRamCriteria(MoveCardAction mc)
 {
     return(mc.Destination == ram.UnderLocation && mc.CardToMove.DoKeywordsContain("one-shot", true) && mc.CardToMove.Location == ram.UnderLocation);
 }
        public override IEnumerator Play()
        {
            // "Search the villain deck and trash for {TheClient} and put it into play."
            List <Card> clientsActive = TurnTaker.GetCardsWhere((Card c) => c.IsInPlayAndNotUnderCard && c.Identifier == "TheClient").ToList();
            int         clientsInPlay = clientsActive.Count();

            if (clientsInPlay > 0)
            {
                // If The Client is in play, we can skip all of this.

                IEnumerator coroutine1 = GameController.SendMessageAction("The Client is already in play.", Priority.High, cardSource: GetCardSource());
                if (base.UseUnityCoroutines)
                {
                    yield return(this.GameController.StartCoroutine(coroutine1));
                }
                else
                {
                    this.GameController.ExhaustCoroutine(coroutine1);
                }
            }
            else
            {
                List <Card> clientsFound = TurnTaker.GetCardsWhere((Card c) => (c.IsInDeck || c.IsInTrash) && c.Identifier == "TheClient").ToList();
                int         numClients   = clientsFound.Count();
                if (numClients < 1)
                {
                    // If The Client is not in play OR in the deck or trash, display a failure message.
                    IEnumerator coroutine2 = GameController.SendMessageAction("The Client was not found in the villain deck or trash.", Priority.High, cardSource: GetCardSource());
                    if (base.UseUnityCoroutines)
                    {
                        yield return(this.GameController.StartCoroutine(coroutine2));
                    }
                    else
                    {
                        this.GameController.ExhaustCoroutine(coroutine2);
                    }
                }
                else
                {
                    var         locations  = new Location[] { base.TurnTaker.Deck, base.TurnTaker.Trash };
                    IEnumerator coroutine3 = base.PlayCardFromLocations(locations, "TheClient", isPutIntoPlay: true, showMessageIfFailed: false, shuffleAfterwardsIfDeck: false);
                    if (base.UseUnityCoroutines)
                    {
                        yield return(this.GameController.StartCoroutine(coroutine3));
                    }
                    else
                    {
                        this.GameController.ExhaustCoroutine(coroutine3);
                    }
                }
            }

            // "Shuffle the villain deck."
            IEnumerator coroutine4 = base.GameController.ShuffleLocation(base.TurnTaker.Deck, cardSource: GetCardSource());

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

            clientsActive = TurnTaker.GetCardsWhere((Card c) => c.IsInPlayAndNotUnderCard && c.Identifier == "TheClient").ToList();
            clientsInPlay = clientsActive.Count();

            if (clientsInPlay > 0)
            {
                // "If {TheClient} is in play, they regain {H + 1} HP."

                Card        activeClient = clientsActive.FirstOrDefault();
                IEnumerator coroutine5   = base.GameController.GainHP(activeClient, H + 1, cardSource: GetCardSource());
                if (base.UseUnityCoroutines)
                {
                    yield return(this.GameController.StartCoroutine(coroutine5));
                }
                else
                {
                    this.GameController.ExhaustCoroutine(coroutine5);
                }
            }
            else
            {
                // "Otherwise, discard cards from the top of the villain deck until you discard a One-Shot."

                // As long as a One-Shot hasn't been discarded, discard the next card
                // There has to be an easier way (see Shifting Biomes) but I don't know what yet
                bool oneShotFound = false;
                List <MoveCardAction> storedMoves = new List <MoveCardAction>();
                Card        discarded             = null;
                IEnumerator coroutine6            = base.GameController.DiscardTopCard(base.TurnTaker.Deck, storedMoves, responsibleTurnTaker: base.TurnTaker, cardSource: GetCardSource());
                while (!oneShotFound)
                {
                    if (base.UseUnityCoroutines)
                    {
                        yield return(this.GameController.StartCoroutine(coroutine6));
                    }
                    else
                    {
                        this.GameController.ExhaustCoroutine(coroutine6);
                    }
                    MoveCardAction lastMove = storedMoves.FirstOrDefault();
                    if (lastMove != null)
                    {
                        discarded = lastMove.CardToMove;
                        if (discarded != null)
                        {
                            oneShotFound = base.GameController.DoesCardContainKeyword(discarded, "one-shot");
                        }
                    }
                }

                // "Put that card into play."
                IEnumerator coroutine7 = base.GameController.PlayCard(base.TurnTakerController, discarded, isPutIntoPlay: true, responsibleTurnTaker: base.TurnTaker, cardSource: GetCardSource());
                if (base.UseUnityCoroutines)
                {
                    yield return(this.GameController.StartCoroutine(coroutine7));
                }
                else
                {
                    this.GameController.ExhaustCoroutine(coroutine7);
                }
            }

            yield break;
        }