Exemplo n.º 1
0
 public override void Run(Sprite caster, Scene scene, MagicArgs args)
 {
     Animation magic = new Animation() { Code = args.Code, Coordinate = args.Coordinate, Z = args.Z };
     EventHandler handler = null;
     magic.Disposed += handler = delegate {
         magic.Disposed -= handler;
         scene.RemoveAnimation(magic);
     };
     scene.AddAnimation(magic);
     scene.Wave(args.Coordinate);
     for (int i = 0; i < scene.sprites.Count; i++) {
         if (scene.sprites[i].IsVisible && caster.IsHostileTo(scene.sprites[i].Camp)) {
             if (scene.sprites[i].InCircle(Scene.GetGameCoordinate(args.Coordinate), args.Radius)) {
                 Targets.Add(scene.sprites[i]);
             }
         }
     }
     //对精灵表中所有精灵进行魔法/技能伤害
     foreach (Sprite sprite in Targets) {
         caster.CastingToHurt(sprite, args);
     }
     Targets.Clear();
 }