Пример #1
0
            public override void OnThink()
            {
                base.OnThink();

                if (Deleted || !Alive || !Aspect.InCombat())
                {
                    return;
                }

                if (!this.InCombat() && Utility.RandomDouble() < 0.01)
                {
                    var t = Aspect.AcquireRandomTarget(Aspect.RangePerception);

                    if (t != null)
                    {
                        if (this.PlayAttackAnimation())
                        {
                            this.PlayAttackSound();
                        }

                        MoveToWorld(t.Location, t.Map);
                    }
                }

                if (_Aura == null)
                {
                    _Aura = new EnergyExplodeEffect(Location, Map, 3)
                    {
                        AverageZ      = false,
                        Reversed      = true,
                        Interval      = TimeSpan.FromMilliseconds(500.0),
                        EffectMutator = e =>
                        {
                            if (e.ProcessIndex == 0 && Utility.RandomDouble() < 0.33)
                            {
                                e.SoundID = 252;
                            }

                            e.Hue = Hue;
                        },
                        EffectHandler = HandleAura,
                        Callback      = () =>
                        {
                            if (this.PlayAttackAnimation())
                            {
                                this.PlayAttackSound();
                            }
                        }
                    };
                }

                if (_Aura.Sending || Core.TickCount < _NextAura)
                {
                    return;
                }

                _NextAura = Core.TickCount + 5000;

                _Aura.Start = Location;
                _Aura.Map   = Map;
                _Aura.Send();
            }
Пример #2
0
            public override void OnThink()
            {
                base.OnThink();

                if (Deleted || !Alive || Aspect == null || !Aspect.InCombat() || Core.TickCount < _NextHeal)
                {
                    return;
                }

                if (ControlMaster != Aspect)
                {
                    ControlMaster = Aspect;
                }

                if (ControlTarget != Aspect)
                {
                    ControlTarget = Aspect;
                }

                if (ControlOrder != OrderType.Follow)
                {
                    ControlOrder = OrderType.Follow;
                }

                if (!InRange(Aspect, Aspect.RangePerception))
                {
                    AIObject.MoveTo(Aspect, true, Aspect.RangePerception);

                    return;
                }

                _NextHeal = Core.TickCount + 5000;

                var q = new MovingEffectQueue();

                q.Callback = q.Dispose;

                for (var i = 0; i < 5; i++)
                {
                    var fx = new MovingEffectInfo(
                        this,
                        Aspect,
                        Map,
                        0x36F4,
                        1150,
                        10,
                        EffectRender.LightenMore,
                        TimeSpan.FromMilliseconds(200));

                    fx.ImpactCallback += HealAspect;

                    q.Add(fx);
                }

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

                    this.TryParalyze(
                        TimeSpan.FromSeconds(1.5),
                        m =>
                    {
                        SpellHelper.Turn(m, Aspect);

                        q.Process();
                    });
                }
                else
                {
                    SpellHelper.Turn(this, Aspect);

                    q.Process();
                }
            }