コード例 #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);
        }
コード例 #2
0
ファイル: CastRule.cs プロジェクト: callumhutchy/grove
        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);
        }
コード例 #3
0
ファイル: ActivatedAbility.cs プロジェクト: longde123/grove
        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);
        }
コード例 #4
0
ファイル: CastRule.cs プロジェクト: leloulight/magicgrove
        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;
        }
コード例 #5
0
ファイル: CastRule.cs プロジェクト: longde123/grove
        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);
        }
コード例 #6
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;
        }