示例#1
0
        public void SpawnStone(Mobile target)
        {
            Map map = this.Map;

            if (map == null)
            {
                return;
            }

            if (DateTime.UtcNow > this.m_DelayTwo)
            {
                int stones = 0;

                foreach (Mobile m in this.GetMobilesInRange(40))
                {
                    if (m is StoneMonster)
                    {
                        ++stones;
                    }
                }

                if (stones >= 3)
                {
                    return;
                }
                else
                {
                    BaseCreature stone = new StoneMonster();

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

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

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

                    stone.MoveToWorld(loc, target.Map);
                    stone.Frozen           = stone.Blessed = true;
                    stone.SolidHueOverride = 761;
                    stone.Combatant        = null;
                }

                this.m_DelayTwo = DateTime.UtcNow + TimeSpan.FromSeconds(Utility.RandomMinMax(30, 150));
            }
        }
示例#2
0
        public void SpawnStone( Mobile target)
        {
             Map map = this.Map;

	     if ( map == null )
		  return;
	
          if (DateTime.Now > m_DelayTwo)
          {
             
	     int stones = 0;	
 
             foreach ( Mobile m in this.GetMobilesInRange( 40 ) )
             {
		   if ( m is StoneMonster )
			       ++stones;
	     }

             if ( stones >= 3 )
             {
                      return;
             }
             else
             {  
                  BaseCreature stone = new StoneMonster();
                 
		  bool validLocation = false;
                  Point3D loc = this.Location;
       
		  for ( int j = 0; !validLocation && j < 10; ++j )
                  {
			int x = X + Utility.Random( 10 ) - 1;
			int y = Y + Utility.Random( 10 ) - 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 );
                  }

			            stone.MoveToWorld( loc, target.Map );
                        stone.Frozen = stone.Blessed = true;
                        stone.SolidHueOverride = 761; 
                        stone.Combatant = null; 
               } 

               m_DelayTwo = DateTime.Now + TimeSpan.FromSeconds(Utility.RandomMinMax(30, 150)); 
            }   
        }