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

			if ( map == null )
				return;

			int spawned = 0;

			foreach ( Mobile m in this.GetMobilesInRange( 10 ) )
			{
if ( m is WhiteMage || m is IceSerpent || m is IceSerpent )
					++spawned;
			}

			if ( spawned < 10 )
			{
				int newSpawned = Utility.RandomMinMax( 1, 2 );

				for ( int i = 0; i < newSpawned; ++i )
				{
					BaseCreature spawn;

					switch ( Utility.Random( 3 ) )
					{
						default:
						case 0: case 1:	spawn = new EtherealWarrior(); break;
						case 2: case 3:	spawn = new EvilMage(); break;
						case 4:			spawn = new EtherealWarrior(); break;
					}

					spawn.Team = this.Team;
					spawn.Map = map;

					bool validLocation = false;

					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 ) )
							spawn.Location = new Point3D( x, y, Z );
						else if ( validLocation = map.CanFit( x, y, z, 16, false, false ) )
							spawn.Location = new Point3D( x, y, z );
					}

					if ( !validLocation )
						spawn.Location = this.Location;

					spawn.Combatant = target;
				}
			}
		}
コード例 #2
0
////
        public void SpawnEvil(Mobile target)
        {
            Map map = this.Map;

            if (map == null)
            {
                return;
            }

            int spawned = 0;

            foreach (Mobile m in this.GetMobilesInRange(10))
            {
                if (m is WhiteMage || m is IceSerpent || m is IceSerpent)
                {
                    ++spawned;
                }
            }

            if (spawned < 10)
            {
                int newSpawned = Utility.RandomMinMax(1, 2);

                for (int i = 0; i < newSpawned; ++i)
                {
                    BaseCreature spawn;

                    switch (Utility.Random(3))
                    {
                    default:
                    case 0:
                    case 1: spawn = new EtherealWarrior(); break;

                    case 2:
                    case 3: spawn = new EvilMage(); break;

                    case 4:                 spawn = new EtherealWarrior(); break;
                    }

                    spawn.Team = this.Team;
                    spawn.Map  = map;

                    bool validLocation = false;

                    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))
                        {
                            spawn.Location = new Point3D(x, y, Z);
                        }
                        else if (validLocation = map.CanFit(x, y, z, 16, false, false))
                        {
                            spawn.Location = new Point3D(x, y, z);
                        }
                    }

                    if (!validLocation)
                    {
                        spawn.Location = this.Location;
                    }

                    spawn.Combatant = target;
                }
            }
        }