Пример #1
0
        protected override void OnInvoke(BaseAspect aspect)
        {
            if (aspect == null || aspect.Deleted)
            {
                return;
            }

            if (aspect.PlayAttackAnimation())
            {
                aspect.PlayAttackSound();
            }

            var targets = ListPool <Mobile> .AcquireObject();

            targets.AddRange(AcquireTargets <Mobile>(aspect));

            if (targets.Count > 0)
            {
                using (var fx = new EffectInfo(aspect, aspect.Map, 14120, 0, 10, 10, EffectRender.Lighten))
                {
                    fx.SoundID = 510;

                    Mobile t;

                    var i = targets.Count;

                    foreach (var p in targets.Select(o => o.Location))
                    {
                        t = targets[--i];

                        fx.SetSource(t);

                        fx.Send();
                        t.Location = p;
                        fx.Send();
                    }

                    var l = aspect.Location;

                    t = targets.GetRandom();

                    fx.SetSource(aspect);

                    fx.Send();
                    aspect.Location = t.Location;
                    fx.Send();

                    t.Location = l;
                }
            }

            ObjectPool.Free(targets);
        }