Example #1
0
        public ActivationPrerequisites GetPrerequisites()
        {
            var prerequisites = new ActivationPrerequisites
            {
                CanBePlayedAtThisTime = CanBeActivatedAtThisTime(),
            };

            // mana check is rather expensive, if
            // card cant be cast we can skip it
            if (!prerequisites.CanBePlayed)
            {
                return(prerequisites);
            }

            var canPay = CanPay();

            prerequisites.CanBePayed       = canPay.CanPay;
            prerequisites.Description      = _p.Text;
            prerequisites.Selector         = _p.TargetSelector;
            prerequisites.MaxX             = canPay.MaxX;
            prerequisites.DistributeAmount = _p.DistributeAmount;
            prerequisites.Card             = OwningCard;
            prerequisites.Rules            = _p.Rules;
            prerequisites.MaxRepetitions   = canPay.MaxRepetitions;

            return(prerequisites);
        }
Example #2
0
        public ActivationPrerequisites GetPrerequisites(bool payManaCost,
                                                        bool shouldFullyEvaluateEventIfCannotBePlayed)
        {
            var prerequisites = new ActivationPrerequisites
            {
                CanBePlayedAtThisTime       = CanBeCastAtThisTime(),
                CanBePlayedRegardlessofTime = CanCastCardType() && _p.Condition(_card, Game),
            };

            // mana check is rather expensive, if
            // card cant be cast we can skip it
            if (!prerequisites.CanBePlayed && !shouldFullyEvaluateEventIfCannotBePlayed)
            {
                return(prerequisites);
            }

            var canPay = _p.Cost.CanPay(payManaCost);

            prerequisites.CanBePayed       = canPay.CanPay;
            prerequisites.Description      = _p.Text;
            prerequisites.Selector         = _p.TargetSelector;
            prerequisites.MaxX             = canPay.MaxX;
            prerequisites.DistributeAmount = _p.DistributeAmount;
            prerequisites.Card             = _card;
            prerequisites.Rules            = _p.Rules;

            return(prerequisites);
        }
Example #3
0
        public virtual bool CanActivate(out ActivationPrerequisites activationPrerequisites)
        {
            activationPrerequisites = null;

            if (IsEnabled && CanBeActivatedAtThisTime())
            {
                var result = CanPay();

                activationPrerequisites = new ActivationPrerequisites
                {
                    CanPay           = result.CanPay(),
                    Card             = OwningCard,
                    Description      = Text,
                    Selector         = _p.TargetSelector,
                    DistributeAmount = _p.DistributeAmount,
                    MaxX             = result.MaxX(),
                    Rules            = _p.Rules,
                    MaxRepetitions   = result.MaxRepetitions(),
                };

                return(true);
            }
            return(false);
        }
Example #4
0
        public bool CanCast(out ActivationPrerequisites prerequisites)
        {
            prerequisites = null;

              if (CanCastCardType() == false)
              {
            return false;
              }

              var result = _p.Cost.CanPay();

              prerequisites = new ActivationPrerequisites
            {
              CanPay = result.CanPay(),
              Description = _p.Text,
              Selector = _p.TargetSelector,
              MaxX = result.MaxX(),
              DistributeAmount = _p.DistributeAmount,
              Card = _card,
              Rules = _p.Rules
            };

              return true;
        }
Example #5
0
        public bool CanCast(out ActivationPrerequisites prerequisites)
        {
            prerequisites = null;

            if (CanCastCardType() == false)
            {
                return(false);
            }

            var result = _p.Cost.CanPay();

            prerequisites = new ActivationPrerequisites
            {
                CanPay           = result.CanPay(),
                Description      = _p.Text,
                Selector         = _p.TargetSelector,
                MaxX             = result.MaxX(),
                DistributeAmount = _p.DistributeAmount,
                Card             = _card,
                Rules            = _p.Rules
            };

            return(true);
        }
        public virtual bool CanActivate(out ActivationPrerequisites activationPrerequisites)
        {
            activationPrerequisites = null;

              if (IsEnabled && CanBeActivatedAtThisTime())
              {
            var result = CanPay();

            activationPrerequisites = new ActivationPrerequisites
              {
            CanPay = result.CanPay(),
            Card = OwningCard,
            Description = Text,
            Selector = _p.TargetSelector,
            DistributeAmount = _p.DistributeAmount,
            MaxX = result.MaxX(),
            Rules = _p.Rules,
            MaxRepetitions = result.MaxRepetitions(),
              };

            return true;
              }
              return false;
        }