示例#1
0
        private IEnumerator Learn(DrawCardAction arg)
        {
            List <YesNoCardDecision> cardDecisions = new List <YesNoCardDecision>();
            var doIt = this.GameController.MakeYesNoCardDecision(DecisionMaker, SelectionType.CardFromHand, Card, arg, cardDecisions, null, GetCardSource());

            if (UseUnityCoroutines)
            {
                yield return(this.GameController.StartCoroutine(doIt));
            }
            else
            {
                this.GameController.ExhaustCoroutine(doIt);
            }
            if (DidPlayerAnswerYes(cardDecisions))
            {
                List <MoveCardDestination> UnderDragons = new List <MoveCardDestination>();
                foreach (Card dragon in FindCardsWhere(c => c.DoKeywordsContain("dragon") && c.IsInPlayAndHasGameText))
                {
                    UnderDragons.Add(new MoveCardDestination(dragon.UnderLocation));
                }
                var move = this.GameController.SelectCardFromLocationAndMoveIt(DecisionMaker, HeroTurnTaker.Hand, new LinqCardCriteria(c => true), UnderDragons, false, false, false, true, cardSource: GetCardSource());
                if (UseUnityCoroutines)
                {
                    yield return(this.GameController.StartCoroutine(move));
                }
                else
                {
                    this.GameController.ExhaustCoroutine(move);
                }
                SetCardPropertyToTrueIfRealAction("LearningExperience");
            }
        }
        private IEnumerator DrawCardDamageResponse(DrawCardAction dca)
        {
            var result    = new List <Card>();
            var coroutine = FindCharacterCardToTakeDamage(dca.HeroTurnTaker, result, CharacterCard, 1, DamageType.Projectile);

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

            var card = result.First();

            if (card != null)
            {
                coroutine = DealDamage(CharacterCard, card, 1, DamageType.Projectile, cardSource: GetCardSource());
                if (base.UseUnityCoroutines)
                {
                    yield return(base.GameController.StartCoroutine(coroutine));
                }
                else
                {
                    base.GameController.ExhaustCoroutine(coroutine);
                }
            }
        }
示例#3
0
        private IEnumerator SuperimposeDrawResponse(DrawCardAction action)
        {
            var         superImposed = FindHeroTurnTakerController(superimposedTurnTaker);
            IEnumerator coroutine    = CancelAction(action);

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

            System.Console.WriteLine($"### Canceled - {action.CardToDraw}");

            coroutine = base.DrawCards(superImposed, 1, false);
            if (base.UseUnityCoroutines)
            {
                yield return(base.GameController.StartCoroutine(coroutine));
            }
            else
            {
                base.GameController.ExhaustCoroutine(coroutine);
            }
            yield break;
        }
示例#4
0
        public void CreateDrawCardAction()
        {
            CardType       card     = CardType.PotLuck;
            DrawCardAction drawCard = new DrawCardAction(card);

            // correct card name stored
            Assert.AreEqual(card, drawCard.GetCardType());
            // implements IAction
            Assert.IsTrue(drawCard is IAction);
        }
示例#5
0
        public void CreateChoiceAction()
        {
            IAction      drawCard   = new DrawCardAction(CardType.PotLuck);
            IAction      payBank    = new PayAction(50, Recipient.Bank);
            ChoiceAction choiceCard = new ChoiceAction(drawCard, payBank);

            // correct IActions stored
            Assert.AreEqual(drawCard, choiceCard.GetChoice1());
            Assert.AreEqual(payBank, choiceCard.GetChoice2());

            // implements IAction
            Assert.IsTrue(choiceCard is IAction);
        }
示例#6
0
        private IEnumerator DiscardCardResponse(DrawCardAction action)
        {
            IEnumerator coroutine = base.GameController.SelectHeroToDiscardCard(this.DecisionMaker, optionalDiscardCard: false, cardSource: base.GetCardSource());

            if (base.UseUnityCoroutines)
            {
                yield return(base.GameController.StartCoroutine(coroutine));
            }
            else
            {
                base.GameController.ExhaustCoroutine(coroutine);
            }
            yield break;
        }
        public IEnumerator CheckDestructResponse(DrawCardAction dca)
        {
            // Determine whether this is the player's 3rd (or more) draw this round
            IEnumerable <DrawCardJournalEntry> drawsThisRound = (from e in base.Journal.DrawCardEntries() where e.Round == Game.Round && e.Hero == dca.HeroTurnTaker select e);

            if (drawsThisRound.Count() >= 3)
            {
                // If so, destroy this card and play the top card of the environment deck
                IEnumerator destroyCoroutine = base.GameController.DestroyCard(DecisionMaker, base.Card, showOutput: true, actionSource: dca, responsibleCard: base.Card, postDestroyAction: PlayEnvironmentCardResponse, cardSource: GetCardSource());
                if (base.UseUnityCoroutines)
                {
                    yield return(base.GameController.StartCoroutine(destroyCoroutine));
                }
                else
                {
                    base.GameController.ExhaustCoroutine(destroyCoroutine);
                }
            }
            yield break;
        }
        private IEnumerator Meditate(DrawCardAction arg)
        {
            var search = SearchForCards(HeroTurnTakerController, true, false, 1, 1, new LinqCardCriteria(c => true), false, true, false, shuffleAfterwards: true);

            if (UseUnityCoroutines)
            {
                yield return(this.GameController.StartCoroutine(search));
            }
            else
            {
                this.GameController.ExhaustCoroutine(search);
            }
            var cancel = CancelAction(arg, false);

            if (UseUnityCoroutines)
            {
                yield return(this.GameController.StartCoroutine(cancel));
            }
            else
            {
                this.GameController.ExhaustCoroutine(cancel);
            }
        }
示例#9
0
 public void SendCardDrawn(DrawCardAction action)
 {
     client.client.getConnection.SendUserDefinedData(DrawPacketId, Helper.GetBytesFromObject(action));
 }
示例#10
0
    void DrawCard(PlayerModel player, bool shouldReveal)
    {
        var drawCardAction = new DrawCardAction(Model.Deck.DrawCard(), player, shouldReveal);

        ActionSystem.Instance.PerformAction(drawCardAction);
    }