private IEnumerator PreventDamageDecision(DealDamageAction dd)
        {
            //Offer the player a yes/no decision if they want to prevent the damage
            //This currently doesn't have any text on the decision other than yes/no, room for improvement
            List <Card> list = new List <Card>();

            list.Add(base.Card);
            YesNoDecision yesNo     = new YesNoDecision(base.GameController, base.HeroTurnTakerController, SelectionType.PreventDamage, false, dd, list, base.GetCardSource(null));
            IEnumerator   coroutine = base.GameController.MakeDecisionAction(yesNo, true);

            if (base.UseUnityCoroutines)
            {
                yield return(base.GameController.StartCoroutine(coroutine));
            }
            else
            {
                base.GameController.ExhaustCoroutine(coroutine);
            }
            //if player said yes, set BuffUsed to true and prevent the damage
            if (yesNo.Answer != null && yesNo.Answer.Value)
            {
                base.CharacterCardController.SetCardPropertyToTrueIfRealAction("PreventionUsed", null);
                IEnumerator coroutine2 = base.CancelAction(dd, true, true, null, true);
                if (base.UseUnityCoroutines)
                {
                    yield return(base.GameController.StartCoroutine(coroutine2));
                }
                else
                {
                    base.GameController.ExhaustCoroutine(coroutine2);
                }
            }
            yield break;
        }
示例#2
0
        public FormularBuilder IsOngoing(YesNoDecision isOngoing)
        {
            if (isOngoing == YesNoDecision.Unknown)
            {
                throw new ArgumentException($"Unknown is not an allowed value for {nameof(isOngoing)}!");
            }

            _isOngoing = isOngoing;
            return(this);
        }
示例#3
0
        public FormularBuilder IsSystemComprehesive(YesNoDecision isSystemComprehesive)
        {
            if (isSystemComprehesive == YesNoDecision.Unknown)
            {
                throw new ArgumentException($"Unknown is not an allowed value for {nameof(isSystemComprehesive)}!");
            }

            _isSystemComprehesive = isSystemComprehesive;
            return(this);
        }
        private IEnumerator DiscardAndDrawResponse(TurnTaker turnTaker)
        {
            HeroTurnTakerController heroTurnTakerController = base.FindHeroTurnTakerController(turnTaker.ToHero());

            //ask the selected player if they want to discard and draw
            YesNoDecision yesNo     = new YesNoDecision(base.GameController, heroTurnTakerController, SelectionType.DiscardAndDrawCard, cardSource: GetCardSource());
            IEnumerator   coroutine = base.GameController.MakeDecisionAction(yesNo);

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

            //discard hand
            List <DiscardCardAction> storedResults = new List <DiscardCardAction>();

            coroutine = base.GameController.DiscardHand(heroTurnTakerController, false, storedResults, turnTaker, GetCardSource());
            if (base.UseUnityCoroutines)
            {
                yield return(base.GameController.StartCoroutine(coroutine));
            }
            else
            {
                base.GameController.ExhaustCoroutine(coroutine);
            }

            //draw same number of cards
            int numberOfCardsDiscarded = base.GetNumberOfCardsDiscarded(storedResults);

            if (numberOfCardsDiscarded > 0)
            {
                coroutine = base.DrawCards(heroTurnTakerController, numberOfCardsDiscarded);
            }
            else
            {
                coroutine = base.GameController.SendMessageAction(base.TurnTaker.Name + " did not discard any cards, so no cards will be drawn.", Priority.High, base.GetCardSource());
            }
            if (base.UseUnityCoroutines)
            {
                yield return(base.GameController.StartCoroutine(coroutine));
            }
            else
            {
                base.GameController.ExhaustCoroutine(coroutine);
            }
            yield break;
        }
示例#5
0
        private IEnumerator YesAction(HeroTurnTakerController hero, YesNoDecision decision, List <DrawCardAction> storedDraw)
        {
            IEnumerator coroutine = base.DrawCards(hero, 2, storedResults: storedDraw);

            if (this.UseUnityCoroutines)
            {
                yield return(this.GameController.StartCoroutine(coroutine));
            }
            else
            {
                this.GameController.ExhaustCoroutine(coroutine);
            }
            yield break;
        }
示例#6
0
        private Tuple <Decision, int> ChooseYesOrNo(Duel duel, int numberOfChoicesMade, List <Tuple <Decision, int> > decisions, YesNoChoice yesNo)
        {
            var options = new List <bool> {
                true, false
            };

            foreach (var option in options)
            {
                var currentChoice = new YesNoDecision(option);
                using var duelCopy = new Duel(duel);
                var newChoice = duelCopy.Continue(currentChoice);
                _optionsRemaining -= options.Count;
                decisions.Add(new Tuple <Decision, int>(currentChoice, Choose(newChoice, duelCopy, currentChoice, numberOfChoicesMade + 1).Item2));
            }
            return(Choose(yesNo, decisions));
        }
示例#7
0
 public FormularBuilder()
 {
     _sourceFileName         = StringNotSet;
     _targetFileName         = StringNotSet;
     _company                = StringNotSet;
     _sector                 = StringNotSet;
     _affectedSite           = StringNotSet;
     _affectedService        = StringNotSet;
     _contactName            = StringNotSet;
     _contactEmail           = StringNotSet;
     _contactPhone           = StringNotSet;
     _situationAssessment    = SituationAssessments.Unknown;
     _functionalityAffection = StringNotSet;
     _isSystemComprehesive   = YesNoDecision.Unknown;
     _affectedItSystem       = StringNotSet;
     _cause     = StringNotSet;
     _startTime = _dateTimeNotSet;
     _endTime   = _dateTimeNotSet;
     _isOngoing = YesNoDecision.Unknown;
 }
示例#8
0
        private IEnumerator AddTokensResponse(DealDamageAction dd)
        {
            TokenPool     nukePool  = base.TurnTaker.FindCard("EmpowermentOfFriendship").FindTokenPool("NukePool");
            int           tokenGain = dd.Amount;
            YesNoDecision yesNo     = new YesNoDecision(base.GameController, this.HeroTurnTakerController, SelectionType.PreventDamage, false, dd, null, base.GetCardSource(null));
            IEnumerator   coroutine = base.GameController.MakeDecisionAction(yesNo, true);

            if (base.UseUnityCoroutines)
            {
                yield return(base.GameController.StartCoroutine(coroutine));
            }
            else
            {
                base.GameController.ExhaustCoroutine(coroutine);
            }
            if (yesNo.Answer != null && yesNo.Answer.Value)
            {
                coroutine = base.CancelAction(dd, true, true, null, false);
                if (base.UseUnityCoroutines)
                {
                    yield return(base.GameController.StartCoroutine(coroutine));
                }
                else
                {
                    base.GameController.ExhaustCoroutine(coroutine);
                }
                coroutine = base.GameController.AddTokensToPool(nukePool, tokenGain, base.GetCardSource());
                if (base.UseUnityCoroutines)
                {
                    yield return(base.GameController.StartCoroutine(coroutine));
                }
                else
                {
                    base.GameController.ExhaustCoroutine(coroutine);
                }
            }
        }
示例#9
0
        private IEnumerator PlayCardsToDestroyResponse(PhaseChangeAction phaseChange)
        {
            //you may play the top 2 cards of the environment deck. If you do, this card is destroyed.
            YesNoDecision yesNo     = new YesNoDecision(base.GameController, this.DecisionMaker, SelectionType.PlayTopCardOfEnvironmentDeck, requireUnanimous: true, cardSource: GetCardSource());
            IEnumerator   coroutine = base.GameController.MakeDecisionAction(yesNo);

            if (base.UseUnityCoroutines)
            {
                yield return(base.GameController.StartCoroutine(coroutine));
            }
            else
            {
                base.GameController.ExhaustCoroutine(coroutine);
            }
            if (base.DidPlayerAnswerYes(yesNo))
            {
                //play the top 2 cards of the environment deck
                List <Card> playedCards = new List <Card>();
                coroutine = base.GameController.PlayTopCard(this.DecisionMaker, base.FindEnvironment(), numberOfCards: 2, playedCards: playedCards, cardSource: GetCardSource());
                if (base.UseUnityCoroutines)
                {
                    yield return(base.GameController.StartCoroutine(coroutine));
                }
                else
                {
                    base.GameController.ExhaustCoroutine(coroutine);
                }
                //if you did destroy this card
                if (playedCards.Count() >= 2)
                {
                    coroutine = base.GameController.DestroyCard(this.DecisionMaker, base.Card, cardSource: GetCardSource());
                    if (base.UseUnityCoroutines)
                    {
                        yield return(base.GameController.StartCoroutine(coroutine));
                    }
                    else
                    {
                        base.GameController.ExhaustCoroutine(coroutine);
                    }
                }
                else
                {
                    //send message to indicate no destruction
                    string message;
                    if (playedCards.Count <Card>() == 1)
                    {
                        message = $"The environment only played 1 card, so {base.Card.Title} will not be destroyed.";
                    }
                    else
                    {
                        message = $"The environment did not play a card, so {base.Card.Title} will not be destroyed.";
                    }
                    coroutine = base.GameController.SendMessageAction(message, Priority.High, base.GetCardSource(), showCardSource: true);
                    if (base.UseUnityCoroutines)
                    {
                        yield return(base.GameController.StartCoroutine(coroutine));
                    }
                    else
                    {
                        base.GameController.ExhaustCoroutine(coroutine);
                    }
                }
            }
            yield break;
        }