Server.Mobiles.BaseAI.DoActionWander C# (CSharp) Méthode

DoActionWander() public méthode

public DoActionWander ( ) : bool
Résultat bool
		public virtual bool DoActionWander()
		{
			if (CheckHerding())
			{
				m_Mobile.DebugSay("Praise the shepherd!");
			}
			else if (m_Mobile.CurrentWayPoint != null)
			{
				WayPoint point = m_Mobile.CurrentWayPoint;
				if ((point.X != m_Mobile.Location.X || point.Y != m_Mobile.Location.Y) && point.Map == m_Mobile.Map && point.Parent == null && !point.Deleted)
				{
					m_Mobile.DebugSay("I will move towards my waypoint.");
					DoMove(m_Mobile.GetDirectionTo(m_Mobile.CurrentWayPoint));
				}
				else if (OnAtWayPoint())
				{
					m_Mobile.DebugSay("I will go to the next waypoint");
					m_Mobile.CurrentWayPoint = point.NextPoint;
					if (point.NextPoint != null && point.NextPoint.Deleted)
						m_Mobile.CurrentWayPoint = point.NextPoint = point.NextPoint.NextPoint;
				}
			}
			else if (m_Mobile.IsAnimatedDead)
			{
				// animated dead follow their master
				Mobile master = m_Mobile.SummonMaster;

				if (master != null && master.Map == m_Mobile.Map && master.InRange(m_Mobile, m_Mobile.RangePerception))
					MoveTo(master, false, 1);
				else
					WalkRandomInHome(2, 2, 1);
			}
			else if (CheckMove())
			{
				if (!m_Mobile.CheckIdle())
					WalkRandomInHome(2, 2, 1);
			}

			if (m_Mobile.Combatant != null && !m_Mobile.Combatant.Deleted && m_Mobile.Combatant.Alive && !m_Mobile.Combatant.IsDeadBondedPet)
			{
				m_Mobile.Direction = m_Mobile.GetDirectionTo(m_Mobile.Combatant);
			}

			return true;
		}