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

WalkRandomInHome() public méthode

public WalkRandomInHome ( int iChanceToNotMove, int iChanceToDir, int iSteps ) : void
iChanceToNotMove int
iChanceToDir int
iSteps int
Résultat void
		public virtual void WalkRandomInHome(int iChanceToNotMove, int iChanceToDir, int iSteps)
		{
			if (m_Mobile.Deleted || m_Mobile.DisallowAllMoves)
				return;

			if (m_Mobile.Home == Point3D.Zero)
			{
				if (m_Mobile.Spawner is SpawnEntry)
				{
					Region region = ((SpawnEntry)m_Mobile.Spawner).Region;

					if (m_Mobile.Region.AcceptsSpawnsFrom(region))
					{
						m_Mobile.WalkRegion = region;
						WalkRandom(iChanceToNotMove, iChanceToDir, iSteps);
						m_Mobile.WalkRegion = null;
					}
					else
					{
						if (region.GoLocation != Point3D.Zero && Utility.Random(10) > 5)
						{
							DoMove(m_Mobile.GetDirectionTo(region.GoLocation));
						}
						else
						{
							WalkRandom(iChanceToNotMove, iChanceToDir, 1);
						}
					}
				}
				else
				{
					WalkRandom(iChanceToNotMove, iChanceToDir, iSteps);
				}
			}
			else
			{
				for (int i = 0; i < iSteps; i++)
				{
					if (m_Mobile.RangeHome != 0)
					{
						int iCurrDist = (int)m_Mobile.GetDistanceToSqrt(m_Mobile.Home);

						if (iCurrDist < m_Mobile.RangeHome * 2 / 3)
						{
							WalkRandom(iChanceToNotMove, iChanceToDir, 1);
						}
						else if (iCurrDist > m_Mobile.RangeHome)
						{
							DoMove(m_Mobile.GetDirectionTo(m_Mobile.Home));
						}
						else
						{
							if (Utility.Random(10) > 5)
							{
								DoMove(m_Mobile.GetDirectionTo(m_Mobile.Home));
							}
							else
							{
								WalkRandom(iChanceToNotMove, iChanceToDir, 1);
							}
						}
					}
					else
					{
						if (m_Mobile.Location != m_Mobile.Home)
						{
							DoMove(m_Mobile.GetDirectionTo(m_Mobile.Home));
						}
					}
				}
			}
		}