Пример #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);
        }
Пример #2
0
        protected void Fail(Mobile m)
        {
            if (FailEffectID > 0)
            {
                var fx = new EffectInfo(
                    GetWorldLocation(),
                    Map,
                    FailEffectID,
                    FailEffectHue,
                    FailEffectSpeed,
                    FailEffectDuration,
                    FailEffectRender);

                fx.Send();
            }

            if (FailEffectSound > 0)
            {
                Effects.PlaySound(GetWorldLocation(), Map, 1488);
            }

            Movable = Visible = true;

            OnFail(m);
        }
Пример #3
0
        protected virtual void WeatherImpactHandler(MovingEffectInfo info)
        {
            if (info == null || Deleted || !Options.Weather.Impacts || Options.Weather.ImpactEffectID <= 0 ||
                Options.Weather.ImpactEffectSpeed <= 0 || Options.Weather.ImpactEffectDuration <= 0)
            {
                return;
            }

            OnWeatherImpact(info);

            if (Options.Weather.ImpactEffectID <= 0)
            {
                return;
            }

            var effect = new EffectInfo(
                info.Target,
                info.Map,
                Options.Weather.ImpactEffectID,
                Options.Weather.ImpactEffectHue,
                Options.Weather.ImpactEffectSpeed,
                Options.Weather.ImpactEffectDuration,
                Options.Weather.ImpactEffectRender);

            effect.Send();

            OnWeatherImpact(effect);
        }
Пример #4
0
        protected void Explode(Mobile m, Point3D p)
        {
            if (m == null || m.Deleted)
            {
                return;
            }

            if (ExplodeID > 0)
            {
                var fx = new EffectInfo(p, Map, ExplodeID, ExplodeHue, ExplodeSpeed, ExplodeDuration, ExplodeRender);

                fx.Send();
            }

            if (ExplodeSound >= 0)
            {
                Effects.PlaySound(p, Map, ExplodeSound);
            }

            ExplodeStars(
                m,
                StarsEffect,
                p,
                Utility.RandomMinMax(StarsRangeMin, StarsRangeMax),
                StarsSound,
                Stars.ToArray(),
                StarsHue > 0 ? new[] { StarsHue } : StarHues.ToArray());
        }
Пример #5
0
        protected override void OnDamage(BaseAspect aspect, Mobile target, ref int damage)
        {
            base.OnDamage(aspect, target, ref damage);

            using (var fx = new EffectInfo(target, target.Map, 14000, 0, 10, 30))
            {
                fx.SoundID = 519;
                fx.Send();
            }

            target.TryParalyze(TimeSpan.FromSeconds(1.0));
            target.Z = Math.Max(target.Z, Math.Min(aspect.Z + 40, target.Z + 5));
        }
Пример #6
0
        protected void LaunchTrail(Point3D p)
        {
            if (TrailID > 0)
            {
                var fx = new EffectInfo(p, Map, TrailID, TrailHue, TrailSpeed, TrailDuration, TrailRender);

                fx.Send();
            }

            if (TrailSound > 0)
            {
                Effects.PlaySound(p, Map, TrailSound);
            }
        }
Пример #7
0
        protected void IgniteFuse(Mobile m)
        {
            if (m == null || m.Deleted || FuseLit)
            {
                return;
            }

            if (!OnIgnite(m))
            {
                return;
            }

            if (IgniteEffectID > 0)
            {
                var fx = new EffectInfo(
                    GetWorldLocation(),
                    Map,
                    IgniteEffectID,
                    IgniteEffectHue,
                    IgniteEffectSpeed,
                    (int)Math.Ceiling(FuseDelay.TotalMilliseconds / 100.0),
                    IgniteEffectRender);

                fx.Send();
            }

            if (IgniteEffectSound > 0)
            {
                Effects.PlaySound(GetWorldLocation(), Map, IgniteEffectSound);
            }

            _FuseTimer = Timer.DelayCall(
                FuseDelay,
                () =>
            {
                _FuseTimer = null;

                InvalidateProperties();

                if (!OnFuseBurned(m))
                {
                    Fail(m);
                }
            });
        }
Пример #8
0
            private void HealAspect()
            {
                if (Deleted || !Alive || Aspect == null || Aspect.Deleted || !Aspect.Alive)
                {
                    return;
                }

                var amount = Aspect.HitsMax * 0.01;

                amount = Math.Max(1, amount);

                Aspect.Heal((int)amount, this);

                using (var fx = new EffectInfo(Aspect, Aspect.Map, 0x373A, 1150, 10, 20, EffectRender.LightenMore))
                {
                    fx.Send();
                }
            }
Пример #9
0
        protected void Explode(Mobile m, Point3D p)
        {
            if (m == null || m.Deleted)
            {
                return;
            }

            if (!OnExplode(m, p))
            {
                return;
            }

            if (ExplodeID > 0)
            {
                var fx = new EffectInfo(p, Map, ExplodeID, ExplodeHue, ExplodeSpeed, ExplodeDuration, ExplodeRender);

                fx.Send();
            }

            if (ExplodeSound >= 0)
            {
                Effects.PlaySound(p, Map, ExplodeSound);
            }

            ExplodeStars(
                m,
                StarsEffect,
                p,
                Utility.RandomMinMax(StarsRangeMin, StarsRangeMax),
                StarsSound,
                Stars.ToArray(),
                StarsHue > 0 ? new[] { StarsHue } : StarHues.ToArray());

            Movable = false;

            Timer.DelayCall(
                TimeSpan.FromSeconds(1.0),
                () =>
            {
                Movable = true;
                Consume();
            });
        }