Server.Items.TreasureMap.Spawn C# (CSharp) Method

Spawn() public static method

public static Spawn ( int level, Server.Point3D p, Server.Map map, Server.Mobile target, bool guardian ) : BaseCreature
level int
p Server.Point3D
map Server.Map
target Server.Mobile
guardian bool
return BaseCreature
		public static BaseCreature Spawn( int level, Point3D p, Map map, Mobile target, bool guardian )
		{
			if ( map == null )
				return null;

			BaseCreature c = Spawn( level, p, guardian );

			if ( c != null )
			{
				bool spawned = false;

				for ( int i = 0; !spawned && i < 10; ++i )
				{
					int x = p.X - 3 + Utility.Random( 7 );
					int y = p.Y - 3 + Utility.Random( 7 );

					if ( map.CanSpawnMobile( x, y, p.Z ) )
					{
						c.MoveToWorld( new Point3D( x, y, p.Z ), map );
						spawned = true;
					}
					else
					{
						int z = map.GetAverageZ( x, y );

						if ( map.CanSpawnMobile( x, y, z ) )
						{
							c.MoveToWorld( new Point3D( x, y, z ), map );
							spawned = true;
						}
					}
				}

				if ( !spawned )
				{
					c.Delete();
					return null;
				}

				if ( target != null )
					c.Combatant = target;

				return c;
			}

			return null;
		}

Same methods

TreasureMap::Spawn ( int level, Server.Point3D p, bool guardian ) : BaseCreature

Usage Example

コード例 #1
0
ファイル: TreasureMapChest.cs プロジェクト: Wattamaker/ServUO
        public void SpawnAncientGuardian(Mobile from)
        {
            ExecuteTrap(from);

            if (!AncientGuardians.Any(g => g != null && g.Alive))
            {
                BaseCreature spawn = TreasureMap.Spawn(Level, GetWorldLocation(), Map, from, false);

                if (spawn != null)
                {
                    spawn.NoLootOnDeath = true;

                    spawn.Name    = "Ancient Chest Guardian";
                    spawn.Title   = "(Guardian)";
                    spawn.Tamable = false;

                    if (spawn.HitsMaxSeed >= 0)
                    {
                        spawn.HitsMaxSeed = (int)(spawn.HitsMaxSeed * Paragon.HitsBuff);
                    }

                    spawn.RawStr = (int)(spawn.RawStr * Paragon.StrBuff);
                    spawn.RawInt = (int)(spawn.RawInt * Paragon.IntBuff);
                    spawn.RawDex = (int)(spawn.RawDex * Paragon.DexBuff);

                    spawn.Hits = spawn.HitsMax;
                    spawn.Mana = spawn.ManaMax;
                    spawn.Stam = spawn.StamMax;

                    spawn.Hue = 1960;

                    for (int i = 0; i < spawn.Skills.Length; i++)
                    {
                        Skill skill = spawn.Skills[i];

                        if (skill.Base > 0.0)
                        {
                            skill.Base *= Paragon.SkillsBuff;
                        }
                    }

                    AncientGuardians.Add(spawn);
                }
            }
        }
All Usage Examples Of Server.Items.TreasureMap::Spawn