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

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

            aspect.PlaySound(1230);

            var delay = 500;

            for (var range = 4; range <= aspect.RangePerception; range++, delay += 500)
            {
                Timer.DelayCall(
                    TimeSpan.FromMilliseconds(delay),
                    loc =>
                {
                    SpellHelper.Turn(aspect, loc);

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

                    CaveInBoulder(aspect, loc);
                },
                    aspect.Location.GetRandomPoint2D(range, range).GetSurfaceTop(aspect.Map));
            }
        }
        protected override void OnInvoke(BaseAspect aspect)
        {
            if (aspect == null || aspect.Deleted)
            {
                return;
            }

            Point3D loc;
            var     tries = 30;

            do
            {
                loc = aspect.GetRandomPoint3D(4, 8, aspect.Map, true, true);
            }while (loc.FindEntitiesInRange <IAspectSpawn>(aspect.Map, 8).Any() && --tries >= 0);

            if (tries < 0)
            {
                return;
            }

            var s = CreateSpawn(aspect);

            if (s == null)
            {
                return;
            }

            Register(s);

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

                aspect.TryParalyze(
                    TimeSpan.FromSeconds(1.5),
                    m =>
                {
                    SpellHelper.Turn(m, loc);

                    s.OnBeforeSpawn(loc, m.Map);
                    s.MoveToWorld(loc, m.Map);
                    s.OnAfterSpawn();
                });
            }
            else
            {
                SpellHelper.Turn(aspect, loc);

                s.OnBeforeSpawn(loc, aspect.Map);
                s.MoveToWorld(loc, aspect.Map);
                s.OnAfterSpawn();
            }
        }
Пример #3
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);
        }
Пример #4
0
        protected override void OnInvoke(BaseAspect aspect)
        {
            if (aspect == null || aspect.Deleted)
            {
                return;
            }

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

            foreach (var t in AcquireTargets <Mobile>(aspect))
            {
                ScreenFX.LightFlash.Send(t);

                t.PlaySound(1230);
                Damage(aspect, t);
                t.Paralyze(TimeSpan.FromSeconds(2.0));
            }
        }
Пример #5
0
        protected override void OnInvoke(BaseAspect aspect)
        {
            if (aspect == null || aspect.Deleted)
            {
                return;
            }

            var t =
                AcquireTargets <Mobile>(aspect).Where(m => aspect.GetDistanceToSqrt(m) >= aspect.RangePerception * 0.25).GetRandom();

            if (t == null || t.Deleted || !t.Alive)
            {
                return;
            }

            aspect.CantWalk = true;

            SpellHelper.Turn(aspect, t);

            int x = 0, y = 0;

            Movement.Movement.Offset(aspect.Direction & Direction.Mask, ref x, ref y);

            var loc = aspect.Location.Clone3D(x, y, 5);

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

            new MovingEffectInfo(loc, t.Location, aspect.Map, 4534)
            {
                SoundID = 541
            }.MovingImpact(
                e =>
            {
                BoulderImpact(aspect, e.Target.Location, 4);
                aspect.CantWalk = false;
            });
        }
Пример #6
0
        protected override void OnInvoke(BaseAspect aspect)
        {
            if (aspect == null || aspect.Deleted)
            {
                return;
            }

            var map = aspect.Map;
            var x   = aspect.X;
            var y   = aspect.Y;
            var z   = aspect.Z;

            var count = Utility.RandomMinMax(5, 10);
            var sect  = 360 / count;

            var shift = Utility.RandomMinMax(0, sect);
            var range = Math.Max(3, aspect.RangePerception - 3);

            for (var i = 0; i < count; i++)
            {
                var t = Angle.GetPoint3D(x, y, z, shift + (i * sect), range);
                var l = aspect.PlotLine3D(t).TakeWhile(p => map.HasLand(p) && !map.HasWater(p));

                var q = new EffectQueue(range);

                var c = -1;

                foreach (var p in l)
                {
                    q.Add(
                        new EffectInfo(p, map, 14089, 0, 8, 15, EffectRender.Darken)
                    {
                        QueueIndex = ++c
                    });
                }

                if (q.Count == 0)
                {
                    q.Dispose();
                    continue;
                }

                q.Handler = fx =>
                {
                    var isEnd = fx.QueueIndex >= c;

                    if (!TryBurst(aspect, fx, ref isEnd) || isEnd)
                    {
                        q.Clear();
                    }
                };

                q.Callback = q.Dispose;

                Timer.DelayCall(
                    TimeSpan.FromSeconds(0.2 * i),
                    () =>
                {
                    aspect.Direction = aspect.GetDirection(t);

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

                    q.Process();
                });
            }
        }