public override void Invoke(CardHolder executor, ICollection <CardHolder> targets)
 {
     if (targets != null && targets.Count == 1)
     {
         foreach (var item in Enumerable.Range(0, AttackTargetCount))
         {
             executor.Attack(targets.GetEnumerator().Current, AttackDamage);
         }
     }
     else
     {
         throw new InvalidOperationException();
     }
 }
Ejemplo n.º 2
0
 public override void Invoke(CardHolder executor, ICollection <CardHolder> targets)
 {
     if (targets != null && targets.Count > 0)
     {
         Random rnd = new Random();
         IEnumerator <CardHolder> enumerator = targets.GetEnumerator();
         foreach (var item in Enumerable.Range(0, AttackTargetCount))
         {
             int i = rnd.Next(targets.Count);
             while (i-- != 0)
             {
                 enumerator.MoveNext();
             }
             executor.Attack(enumerator.Current, AttackDamage);
             enumerator.Reset();
         }
     }
     else
     {
         throw new InvalidOperationException();
     }
 }