コード例 #1
0
		public void SpawnOrcs( Mobile target )
		{
			Map map = this.Map;

			if ( map == null )
				return;

			int orcs = 0;

			foreach ( Mobile m in this.GetMobilesInRange( 10 ) )
			{
				if ( m is OrcSoldier || m is OrcSoldier || m is OrcSoldier )
					++orcs;
			}

			if ( orcs < 16 )
			{
				PlaySound( 0x3D );

				int newOrcs = Utility.RandomMinMax( 3, 6 );

				for ( int i = 0; i < newOrcs; ++i )
				{
					BaseCreature orc;

					switch ( Utility.Random( 5 ) )
					{
						default:
						case 0: case 1:	orc = new OrcSoldier(); break;
						case 2: case 3:	orc = new OrcSoldier(); break;
						case 4:			orc = new OrcSoldier(); break;
					}

					orc.Team = this.Team;

					bool validLocation = false;
					Point3D loc = this.Location;

					for ( int j = 0; !validLocation && j < 10; ++j )
					{
						int x = X + Utility.Random( 3 ) - 1;
						int y = Y + Utility.Random( 3 ) - 1;
						int z = map.GetAverageZ( x, y );

						if ( validLocation = map.CanFit( x, y, this.Z, 16, false, false ) )
							loc = new Point3D( x, y, Z );
						else if ( validLocation = map.CanFit( x, y, z, 16, false, false ) )
							loc = new Point3D( x, y, z );
					}

					orc.MoveToWorld( loc, map );
					orc.Combatant = target;
				}
			}
		}
コード例 #2
0
        public void SpawnOrcs(Mobile target)
        {
            Map map = this.Map;

            if (map == null)
            {
                return;
            }

            int orcs = 0;

            foreach (Mobile m in this.GetMobilesInRange(10))
            {
                if (m is OrcSoldier || m is OrcSoldier || m is OrcSoldier)
                {
                    ++orcs;
                }
            }

            if (orcs < 16)
            {
                PlaySound(0x3D);

                int newOrcs = Utility.RandomMinMax(3, 6);

                for (int i = 0; i < newOrcs; ++i)
                {
                    BaseCreature orc;

                    switch (Utility.Random(5))
                    {
                    default:
                    case 0:
                    case 1: orc = new OrcSoldier(); break;

                    case 2:
                    case 3: orc = new OrcSoldier(); break;

                    case 4:                 orc = new OrcSoldier(); break;
                    }

                    orc.Team = this.Team;

                    bool    validLocation = false;
                    Point3D loc           = this.Location;

                    for (int j = 0; !validLocation && j < 10; ++j)
                    {
                        int x = X + Utility.Random(3) - 1;
                        int y = Y + Utility.Random(3) - 1;
                        int z = map.GetAverageZ(x, y);

                        if (validLocation = map.CanFit(x, y, this.Z, 16, false, false))
                        {
                            loc = new Point3D(x, y, Z);
                        }
                        else if (validLocation = map.CanFit(x, y, z, 16, false, false))
                        {
                            loc = new Point3D(x, y, z);
                        }
                    }

                    orc.MoveToWorld(loc, map);
                    orc.Combatant = target;
                }
            }
        }