public CanPayResult CanPay() { var result = new CanPayResult(); CanPay(result); return result; }
public CanPayResult CanPay() { var result = new CanPayResult(); CanPay(result); return(result); }
protected override void CanPay(CanPayResult result) { result.CanPay(() => _getAmount(Card) <= Card.Controller.Life); if (_supportsRepetitions) { result.MaxRepetitions(() => Card.Controller.Life - 1); } }
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); }
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); }
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); }); }
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); }
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; }); }
protected override void CanPay(CanPayResult result) { result.CanPay(() => Card.Controller.Hand.Count > 0); }
protected abstract void CanPay(CanPayResult result);