Ejemplo n.º 1
0
        public CanPayResult CanPay()
        {
            var result = new CanPayResult();
              CanPay(result);

              return result;
        }
Ejemplo n.º 2
0
        public CanPayResult CanPay()
        {
            var result = new CanPayResult();

            CanPay(result);

            return(result);
        }
Ejemplo n.º 3
0
        protected override void CanPay(CanPayResult result)
        {
            result.CanPay(() => _getAmount(Card) <= Card.Controller.Life);

              if (_supportsRepetitions)
              {
            result.MaxRepetitions(() => Card.Controller.Life - 1);
              }
        }
Ejemplo n.º 4
0
        protected override void CanPay(CanPayResult result)
        {
            result.CanPay(() => _getAmount(Card) <= Card.Controller.Life);

            if (_supportsRepetitions)
            {
                result.MaxRepetitions(() => Card.Controller.Life - 1);
            }
        }
Ejemplo n.º 5
0
        protected override void CanPay(CanPayResult result)
        {
            if (Validator != null)
              {
            result.CanPay(Card.Controller.Battlefield.Any(
              permanent => Validator.IsTargetValid(permanent, Card)));

            return;
              }

              result.CanPay(() => Card.IsPermanent);
        }
Ejemplo n.º 6
0
        protected override void CanPay(CanPayResult result)
        {
            if (Validator != null)
            {
                result.CanPay(Card.Controller.Battlefield.Any(
                                  permanent => Validator.IsTargetValid(permanent, Card)));

                return;
            }

            result.CanPay(() => Card.IsPermanent);
        }
Ejemplo n.º 7
0
        protected override void CanPay(CanPayResult result)
        {
            if (Validator != null)
            {
                result.CanPay(() => Card.Controller.Battlefield.Any(
                                  x => x.CanBeTapped && Validator.IsTargetValid(x, Card)));

                return;
            }

            result.CanPay(() => Card.CanTap);
        }
Ejemplo n.º 8
0
        protected override void CanPay(CanPayResult result)
        {
            if (Validator != null)
              {
            result.CanPay(() => Card.Controller.Battlefield.Any(
              x => x.CanBeTapped && Validator.IsTargetValid(x, Card)));

            return;
              }

              result.CanPay(() => Card.CanTap);
        }
Ejemplo n.º 9
0
        protected override void CanPay(CanPayResult result)
        {
            var childResults = new List <CanPayResult>();

            foreach (var cost in _costs)
            {
                childResults.Add(cost.CanPay());
            }

            result.CanPay(() =>
            {
                foreach (var childResult in childResults)
                {
                    if (!childResult.CanPay().Value)
                    {
                        return(false);
                    }
                }

                return(true);
            });

            result.MaxX(() =>
            {
                int?maxX = null;

                foreach (var childResult in childResults)
                {
                    maxX = childResult.MaxX().Value;

                    if (maxX.HasValue)
                    {
                        break;
                    }
                }

                return(maxX);
            });

            result.MaxRepetitions(() =>
            {
                var maxRepetitions = 1;

                foreach (var childResult in childResults)
                {
                    maxRepetitions = childResult.MaxRepetitions().Value;
                }

                return(maxRepetitions);
            });
        }
Ejemplo n.º 10
0
        protected override void CanPay(CanPayResult result)
        {
            // mana checking is an expensive operation
              // so it should only be done when nessesary
              // the following lazy evaluation allows ai
              // to only check mana costs when all the cheaper
              // timing tests are successful

              var evaluator = new PayManaEvaluator(this);

              result.CanPay(evaluator.CanPay);
              result.MaxX(evaluator.MaxX);
              result.MaxRepetitions(evaluator.MaxRepetitions);
        }
Ejemplo n.º 11
0
        protected override void CanPay(CanPayResult result)
        {
            // mana checking is an expensive operation
            // so it should only be done when nessesary
            // the following lazy evaluation allows ai
            // to only check mana costs when all the cheaper
            // timing tests are successful

            var evaluator = new PayManaEvaluator(this);

            result.CanPay(evaluator.CanPay);
            result.MaxX(evaluator.MaxX);
            result.MaxRepetitions(evaluator.MaxRepetitions);
        }
Ejemplo n.º 12
0
        protected override void CanPay(CanPayResult result)
        {
            var childResults = new List<CanPayResult>();

              foreach (var cost in _costs)
              {
            childResults.Add(cost.CanPay());
              }

              result.CanPay(() =>
            {
              foreach (var childResult in childResults)
              {
            if (!childResult.CanPay().Value)
              return false;
              }

              return true;
            });

              result.MaxX(() =>
            {
              int? maxX = null;

              foreach (var childResult in childResults)
              {
            maxX = childResult.MaxX().Value;

            if (maxX.HasValue)
            {
              break;
            }
              }

              return maxX;
            });

              result.MaxRepetitions(() =>
            {
              var maxRepetitions = 1;

              foreach (var childResult in childResults)
              {
            maxRepetitions = childResult.MaxRepetitions().Value;
              }

              return maxRepetitions;
            });
        }
Ejemplo n.º 13
0
 protected override void CanPay(CanPayResult result)
 {
     result.CanPay(() => Card.Controller.Hand.Count > 0);
 }
Ejemplo n.º 14
0
 protected override void CanPay(CanPayResult result)
 {
     result.CanPay(() => Card.Controller.Hand.Count > 0);
 }
Ejemplo n.º 15
0
 protected abstract void CanPay(CanPayResult result);
Ejemplo n.º 16
0
 protected abstract void CanPay(CanPayResult result);