public TargetingRuleParameters(TargetsCandidates candidates, AI.ActivationContext context, Game game)
        {
            _candidates = candidates;
            _context    = context;

            Game = game;
        }
Esempio n. 2
0
        public void Process(ActivationContext c)
        {
            if (c.HasTargets == false)
            {
                var p = new RepetitionRuleParameters(c.Card, c.MaxRepetitions.Value);
                c.Repeat = Math.Min(p.MaxRepetitions, GetRepetitionCount(p));

                if (c.Repeat == 0)
                {
                    c.CancelActivation = true;
                }

                return;
            }

            var targetsCombinations = c.TargetsCombinations().ToList();

            foreach (var targetsCombination in targetsCombinations)
            {
                var p = new RepetitionRuleParameters(c.Card, c.MaxRepetitions.Value, targetsCombination.Targets);
                targetsCombination.Repeat = Math.Min(p.MaxRepetitions, GetRepetitionCount(p));

                if (targetsCombination.Repeat == 0)
                {
                    c.RemoveTargetCombination(targetsCombination);
                }
            }
        }
Esempio n. 3
0
        public void Process(ActivationContext c)
        {
            if (c.HasTargets == false)
              {
            var p = new RepetitionRuleParameters(c.Card, c.MaxRepetitions.Value);
            c.Repeat = Math.Min(p.MaxRepetitions, GetRepetitionCount(p));

            if (c.Repeat == 0)
              c.CancelActivation = true;

            return;
              }

              var targetsCombinations = c.TargetsCombinations().ToList();

              foreach (var targetsCombination in targetsCombinations)
              {
            var p = new RepetitionRuleParameters(c.Card, c.MaxRepetitions.Value, targetsCombination.Targets);
            targetsCombination.Repeat = Math.Min(p.MaxRepetitions, GetRepetitionCount(p));

            if (targetsCombination.Repeat == 0)
            {
              c.RemoveTargetCombination(targetsCombination);
            }
              }
        }
Esempio n. 4
0
        public void Process(ActivationContext c)
        {
            var excludeSelf = ConsiderTargetingSelf ? null : c.Card;
            var candidates  = c.Selector.GenerateCandidates(c.TriggerMessage, excludeSelf);

            var parameters = new TargetingRuleParameters(candidates, c, Game);

            var targetsCombinations = (TargetLimit.HasValue
        ? SelectTargets(parameters).Take(TargetLimit.Value)
        : SelectTargets(parameters))
                                      .ToList();

            if (targetsCombinations.Count == 0)
            {
                if (c.CanCancel)
                {
                    c.CancelActivation = true;
                    return;
                }

                targetsCombinations = ForceSelectTargets(parameters)
                                      .Take(Ai.CurrentTargetCount)
                                      .ToList();
            }


            c.SetPossibleTargets(targetsCombinations);
        }
Esempio n. 5
0
        public override bool Process(int pass, ActivationContext c)
        {
            if (pass == 2)
            {
                Process(c);
                return(true);
            }

            return(false);
        }
Esempio n. 6
0
        public override bool Process(int pass, ActivationContext c)
        {
            if (pass == 2)
              {
            Process(c);
            return true;
              }

              return false;
        }