Пример #1
0
        public override void OnThink()
        {
            Mobile master = ControlMaster;

            if (Deleted)
            {
                return;
            }

            if (master == null || master.Deleted)
            {
                DropPackContents();
                EndRelease(null);
                return;
            }

            RangeCheck();

            if (m_LastHidden != master.Hidden)
            {
                Hidden = m_LastHidden = master.Hidden;
            }

            if (AIObject != null && AIObject.WalkMobileRange(master, 5, true, 1, 1))
            {
                if ((master.Combatant != null) && (InRange(master.Combatant, 1)))
                {
                    Warmode   = master.Warmode;
                    Combatant = master.Combatant;

                    CurrentSpeed = 0.10;
                }

                if ((master.Combatant != null) && (!InRange(master.Combatant, 1)))
                {
                    Warmode      = false;
                    FocusMob     = null;
                    Combatant    = null;
                    CurrentSpeed = 0.01;
                }

                if (master.Combatant == null)
                {
                    Warmode      = false;
                    FocusMob     = null;
                    Combatant    = null;
                    CurrentSpeed = 0.01;
                }
            }
            else
            {
                Warmode   = false;
                FocusMob  = null;
                Combatant = null;

                CurrentSpeed = .01;
            }
        }
Пример #2
0
        public override void OnThink()
        {
            var master = ControlMaster;

            if (Deleted)
            {
                return;
            }

            if (master?.Deleted != false)
            {
                DropPackContents();
                EndRelease(null);
                return;
            }

            RangeCheck();

            if (m_LastHidden != master.Hidden)
            {
                Hidden = m_LastHidden = master.Hidden;
            }

            if (AIObject?.WalkMobileRange(master, 5, true, 1, 1) == true)
            {
                Warmode   = master.Warmode;
                Combatant = master.Combatant;

                CurrentSpeed = 0.10;
            }
            else
            {
                Warmode  = false;
                FocusMob = Combatant = null;

                CurrentSpeed = .01;
            }
        }
Пример #3
0
        public override void OnThink()
        {
            if (Deleted || Map == null)
            {
                return;
            }

            Mobile master = ControlMaster;

            if (master == null || master.Deleted)
            {
                DropPackContents();
                EndRelease(null);
                return;
            }

            if (m_LastHidden != master.Hidden)
            {
                Hidden = m_LastHidden = master.Hidden;
            }

            if (RangeCheck())
            {
                if (AIObject != null && AIObject.WalkMobileRange(master, 5, true, 1, 1))
                {
                    if (master.Combatant != null && master.InRange(master.Combatant, 1) && Core.TickCount > m_NextMove)
                    {
                        IDamageable combatant = master.Combatant;

                        if (!InRange(combatant.Location, 1))
                        {
                            for (int x = combatant.X - 1; x <= combatant.X + 1; x++)
                            {
                                for (int y = combatant.Y - 1; y <= combatant.Y + 1; y++)
                                {
                                    if (x == combatant.X && y == combatant.Y)
                                    {
                                        continue;
                                    }

                                    Point2D p = new Point2D(x, y);

                                    if (InRange(p, 1) && master.InRange(p, 1) && Map != null)
                                    {
                                        CurrentSpeed = .01;
                                        AIObject.MoveTo(new Point3D(x, y, Map.GetAverageZ(x, y)), false, 0);
                                        m_NextMove = Core.TickCount + 500;
                                    }
                                }
                            }
                        }
                        else
                        {
                            CurrentSpeed = .1;
                        }
                    }
                    else if (master.Combatant == null)
                    {
                        CurrentSpeed = .1;
                    }
                }
                else
                {
                    CurrentSpeed = .1;
                }
            }
        }