当前位置: 首页>>代码示例>>C#>>正文


C# Map.GetMobilesInRange方法代码示例

本文整理汇总了C#中Map.GetMobilesInRange方法的典型用法代码示例。如果您正苦于以下问题:C# Map.GetMobilesInRange方法的具体用法?C# Map.GetMobilesInRange怎么用?C# Map.GetMobilesInRange使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Map的用法示例。


在下文中一共展示了Map.GetMobilesInRange方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: Explode

        public virtual void Explode(Mobile from, Point3D loc, Map map)
        {
            if (this.Deleted || map == null)
                return;

            this.Consume();

            // Check if any other players are using this potion
            for (int i = 0; i < this.m_Users.Count; i ++)
            {
                ThrowTarget targ = this.m_Users[i].Target as ThrowTarget;

                if (targ != null && targ.Potion == this)
                    Target.Cancel(from);
            }

            // Effects
            Effects.PlaySound(loc, map, 0x207);

            Geometry.Circle2D(loc, map, this.Radius, new DoEffect_Callback(BlastEffect), 270, 90);

            Timer.DelayCall(TimeSpan.FromSeconds(0.3), new TimerStateCallback(CircleEffect2), new object[] { loc, map });

            foreach (Mobile mobile in map.GetMobilesInRange(loc, this.Radius))
            {
                if (mobile is BaseCreature)
                {
                    BaseCreature mon = (BaseCreature)mobile;

                    if (mon.Controlled || mon.Summoned)
                        continue;

                    mon.Pacify(from, DateTime.UtcNow + TimeSpan.FromSeconds(5.0)); // TODO check
                }
            }
        }
开发者ID:Crome696,项目名称:ServUO,代码行数:36,代码来源:BaseConfusionBlastPotion.cs

示例2: Acquire

        public static FillableContent Acquire(Point3D loc, Map map)
        {
            if (map == null || map == Map.Internal)
                return null;

            if (m_AcquireTable == null)
            {
                m_AcquireTable = new Hashtable();

                for (int i = 0; i < m_ContentTypes.Length; ++i)
                {
                    FillableContent fill = m_ContentTypes[i];

                    for (int j = 0; j < fill.m_Vendors.Length; ++j)
                        m_AcquireTable[fill.m_Vendors[j]] = fill;
                }
            }

            Mobile nearest = null;
            FillableContent content = null;

            foreach (Mobile mob in map.GetMobilesInRange(loc, 20))
            {
                if (nearest != null && mob.GetDistanceToSqrt(loc) > nearest.GetDistanceToSqrt(loc) && !(nearest is Cobbler && mob is Provisioner))
                    continue;

                FillableContent check = m_AcquireTable[mob.GetType()] as FillableContent;

                if (check != null)
                {
                    nearest = mob;
                    content = check;
                }
            }

            return content;
        }
开发者ID:Ziden,项目名称:ServUO-EC-Test-Fork,代码行数:37,代码来源:FillableContainers.cs

示例3: Explode

		public void Explode(Mobile from, bool direct, Point3D loc, Map map)
		{
			if (Deleted)
			{
				return;
			}

			Consume();

			for (int i = 0; m_Users != null && i < m_Users.Count; ++i)
			{
				Mobile m = (Mobile)m_Users[i];
				ThrowTarget targ = m.Target as ThrowTarget;

				if (targ != null && targ.Potion == this)
				{
					Target.Cancel(m);
				}
			}

			if (map == null)
			{
				return;
			}

			Effects.PlaySound(loc, map, 0x307);

			Effects.SendLocationEffect(loc, map, 0x36B0, 9, 10, 0, 0);
			int alchemyBonus = 0;

			if (direct)
			{
				alchemyBonus = (int)(from.Skills.Alchemy.Value / (Core.AOS ? 5 : 10));
			}

			IPooledEnumerable eable = LeveledExplosion
										  ? map.GetObjectsInRange(loc, ExplosionRange)
										  : (IPooledEnumerable)map.GetMobilesInRange(loc, ExplosionRange);
			ArrayList toExplode = new ArrayList();

			int toDamage = 0;

			foreach (object o in eable)
			{
				if (o is Mobile &&
					(from == null || (SpellHelper.ValidIndirectTarget(from, (Mobile)o) && from.CanBeHarmful((Mobile)o, false))))
				{
					toExplode.Add(o);
					++toDamage;
				}
				else if (o is BaseExplosionPotion && o != this)
				{
					toExplode.Add(o);
				}
			}

			eable.Free();

			int min = Scale(from, MinDamage);
			int max = Scale(from, MaxDamage);

			for (int i = 0; i < toExplode.Count; ++i)
			{
				object o = toExplode[i];

				if (o is Mobile)
				{
					Mobile m = (Mobile)o;

					if (from != null)
					{
						from.DoHarmful(m);
					}

					int damage = Utility.RandomMinMax(min, max);

					damage += alchemyBonus;

					if (!Core.AOS && damage > 40)
					{
						damage = 40;
					}
					else if (Core.AOS && toDamage > 2)
					{
						damage /= toDamage - 1;
					}

					AOS.Damage(m, from, damage, 0, 100, 0, 0, 0);
				}
				else if (o is BaseExplosionPotion)
				{
					BaseExplosionPotion pot = (BaseExplosionPotion)o;

					pot.Explode(from, false, pot.GetWorldLocation(), pot.Map);
				}
			}
		}
开发者ID:aj9251,项目名称:ServUO,代码行数:97,代码来源:BaseExplosionPotion.cs

示例4: Explode

		public void Explode( Mobile from, bool direct, Point3D loc, Map map )
		{
			if ( Deleted )
				return;

            if (from != null)
            {
                CustomRegion cR = from.Region as CustomRegion;
                CustomRegion cR2 = Region.Find(loc, map) as CustomRegion;

                if ((cR != null && !cR.Controller.CanUsePotExplosion) || (cR2 != null && !cR2.Controller.CanUsePotExplosion))
                    return;
            }
            else
            {
                CustomRegion cR = Region.Find(loc, map) as CustomRegion;

                if ((cR != null && !cR.Controller.CanUsePotExplosion))
                    return;
            }

		    if (!EventItem || (EventItem && EventItemConsume))
                Consume();
            else
            {
                Mobile m;
                if (m_Users != null && m_Users[0] is Mobile)
                    m = (Mobile)m_Users[0];
                else
                    m = from;

                if (m != null && RootParentEntity != m)
                    m.AddToBackpack(this);

                m_Timer = null;
            }

		    for ( int i = 0; m_Users != null && i < m_Users.Count; ++i )
			{
				Mobile m = (Mobile)m_Users[i];
				ThrowTarget targ = m.Target as ThrowTarget;

				if ( targ != null && targ.Potion == this )
					Target.Cancel( m );
			}

			if ( map == null )
				return;

			Effects.PlaySound( loc, map, 0x207 );
			Effects.SendLocationEffect( loc, map, 0x36BD, 20 );

			int alchemyBonus = 0;

            if (direct && from != null)
			    alchemyBonus = (int)(from.Skills.Alchemy.Value / (Core.AOS ? 5 : 10));

			IPooledEnumerable eable = LeveledExplosion ? map.GetObjectsInRange( loc, ExplosionRange ) : map.GetMobilesInRange( loc, ExplosionRange );
			ArrayList toExplode = new ArrayList();

			int toDamage = 0;

			foreach ( object o in eable )
			{
				if ( o is Mobile )
				{
					toExplode.Add( o );
					++toDamage;
				}
				else if ( o is BaseExplosionPotion && o != this )
				{
					toExplode.Add( o );
				}
			}

			eable.Free();

			int min = Scale( from, MinDamage );
			int max = Scale( from, MaxDamage );
		    int count = 1;

			for ( int i = 0; i < toExplode.Count; ++i )
			{
				object o = toExplode[i];

				if ( o is Mobile )
				{
				    Mobile m = (Mobile)o;
                    GuardedRegion reg = (GuardedRegion)Region.Find(m.Location, m.Map).GetRegion(typeof(GuardedRegion));

                    //Taran: Don't hurt mobiles in guarded
                    if (reg == null || reg.Disabled)
                    {
                        if (from != null && from.CanBeHarmful(m, false))
                        {
                            from.DoHarmful(m);

                            int damage = Utility.RandomMinMax(min, max);

                            damage += alchemyBonus;
//.........这里部分代码省略.........
开发者ID:FreeReign,项目名称:imaginenation,代码行数:101,代码来源:BaseExplosionPotion.cs

示例5: Concuss

			public static ArrayList Concuss(IPoint2D p, Map map, int distance, int range)
			{
				var effected = map.GetMobilesInRange(new Point3D(p.X, p.Y, 0), range);

				var effectedMobOutput = effected.OfType<Mobile>().Where(mob => !mob.Blessed && !(mob is Reaper)).ToList();

				effected.Free();

				foreach (Mobile mob in effectedMobOutput)
				{
					Direction direction = GETDIRECTIONTO(null, p, mob);

					int startX = mob.X;
					int startY = mob.Y;

					switch (direction)
					{
						case Direction.North:
							startY -= distance;
							break;
						case Direction.Right:
							startY -= distance;
							startX += distance;
							break;
						case Direction.East:
							startX += distance;
							break;
						case Direction.Down:
							startY += distance;
							startX += distance;
							break;
						case Direction.South:
							startY += distance;
							break;
						case Direction.Left:
							startY += distance;
							startX -= distance;
							break;
						case Direction.West:
							startX -= distance;
							break;
						case Direction.Up:
							startY -= distance;
							startX -= distance;
							break;
					}

					int newZ;
					Point3D newPosition = new Point3D(startX, startY, mob.Z);

					if (!mob.CheckMovement(direction, out newZ))
					{
						continue;
					}

					newPosition.Z = newZ;
					mob.MoveToWorld(newPosition, mob.Map);
				}

				return new ArrayList(effectedMobOutput);
			}
开发者ID:greeduomacro,项目名称:UO-Forever,代码行数:61,代码来源:UberScriptFunctions.cs

示例6: GETNEARBYMOBS

			public static ArrayList GETNEARBYMOBS(TriggerObject trigObject, IPoint3D from, int range, Map map)
			{
				if (from == null || map == null || map == Map.Internal)
				{
					return new ArrayList();
				}

				var enumerator = map.GetMobilesInRange(new Point3D(from), range);

				ArrayList output = new ArrayList(50);

				foreach (Mobile nearby in enumerator)
				{
					output.Add(nearby);
				}

				enumerator.Free();
				return output;
			}
开发者ID:greeduomacro,项目名称:UO-Forever,代码行数:19,代码来源:UberScriptFunctions.cs

示例7: Explode

        public virtual void Explode(Mobile from, Point3D loc, Map map)
        {
            if (Deleted || map == null)
                return;

            Consume();

            // Check if any other players are using this potion
            for (var i = 0; i < m_Users.Count; i ++)
            {
                var targ = m_Users[i].Target as ThrowTarget;

                if (targ != null && targ.Potion == this)
                    Target.Cancel(from);
            }

            // Effects
            Effects.PlaySound(loc, map, 0x207);

            Geometry.Circle2D(loc, map, Radius, TarEffect, 270, 90);

            Timer.DelayCall(TimeSpan.FromSeconds(1), new TimerStateCallback(CircleEffect2), new object[] {loc, map});

            foreach (var mobile in map.GetMobilesInRange(loc, Radius))
            {
                if (mobile != from)
                {
                    if (mobile is PlayerMobile)
                    {
                        var player = (PlayerMobile) mobile;

                        player.SendLocalizedMessage(1095151);
                    }

                    mobile.Send(SpeedControl.WalkSpeed);

                    Timer.DelayCall(TimeSpan.FromMinutes(1.0), delegate { mobile.Send(SpeedControl.Disable); });
                }
            }
        }
开发者ID:rokann,项目名称:JustUO,代码行数:40,代码来源:BaseExplodingTarPotion.cs

示例8: REVEALHIDDEN

			public static void REVEALHIDDEN(TriggerObject trigObject, IPoint3D target, int range, Map map)
			{
				var inRange = map.GetMobilesInRange(new Point3D(target), range);

				foreach (Mobile trg in inRange.OfType<Mobile>().Where(trg => trg.Hidden && trg.AccessLevel == AccessLevel.Player))
				{
					trg.RevealingAction();
					trg.SendLocalizedMessage(500814); // You have been revealed
				}

				inRange.Free();
			}
开发者ID:greeduomacro,项目名称:UO-Forever,代码行数:12,代码来源:UberScriptFunctions.cs

示例9: Explode

		public void Explode(Mobile from, bool direct, Point3D loc, Map map)
		{
			if (Deleted)
			{
				return;
			}

			for (int i = 0; m_Users != null && i < m_Users.Count; ++i)
			{
				Mobile m = m_Users[i];
				var targ = m.Target as ThrowTarget;

				if (targ != null && targ.Potion == this)
				{
					Targeting.Target.Cancel(m);
				}
			}

			Consume();

			if (map == null)
			{
				return;
			}

			Effects.PlaySound(loc, map, 0x307);
			Effects.SendLocationEffect(loc, map, 0x36BD, 9, 10, 0, 0);

			int alchemyBonus = 0;

			if (direct)
			{
				alchemyBonus = (int)(from.Skills.Alchemy.Value * ExplosionPotionController._AlchemyBonusPercentageOfSkill * 0.01);
			}
			if (alchemyBonus > ExplosionPotionController._AlchemyBonusMax)
			{
				alchemyBonus = ExplosionPotionController._AlchemyBonusMax;
			}

			IPooledEnumerable eable = LeveledExplosion
										  ? map.GetObjectsInRange(loc, ExplosionRange)
										  : map.GetMobilesInRange(loc, ExplosionRange);
			var toExplode = new ArrayList();

			int toDamage = 0;

			foreach (IEntity o in eable)
			{
				if (o is Mobile &&
					(from == null || (SpellHelper.ValidIndirectTarget(from, (Mobile)o) && from.CanBeHarmful((Mobile)o, false))))
				{
					toExplode.Add(o);
					++toDamage;
				}
				else if (o is BaseExplosionPotion && o != this)
				{
					toExplode.Add(o);
				}
			}

			eable.Free();

			//			int min = Scale( from, MinDamage );
			//			int max = Scale( from, MaxDamage );

			for (int i = 0; i < toExplode.Count; ++i)
			{
				object o = toExplode[i];

				if (o is Mobile)
				{
					var m = (Mobile)o;

					if (from != null)
					{
						from.DoHarmful(m);

						double damage = Scale(from, Damage);

						damage += alchemyBonus;

						if (damage > 30)
						{
							damage = 15;
						}

						if (toDamage > 2)
						{
							damage /= toDamage - 1;
						}

						if (m is BaseCreature && !((BaseCreature)m).TakesNormalDamage)
						{
							damage *= 1.4;
						}

						var iDamage = (int)damage;
						if ((XmlScript.HasTrigger(from, TriggerName.onGivenHit) &&
							 UberScriptTriggers.Trigger(from, m, TriggerName.onGivenHit, this, null, null, iDamage)) ||
							(XmlScript.HasTrigger(m, TriggerName.onTakenHit) &&
//.........这里部分代码省略.........
开发者ID:greeduomacro,项目名称:UO-Forever,代码行数:101,代码来源:BaseExplosionPotion.cs

示例10: CheckForMobileVictims

        public void CheckForMobileVictims(Point3D location, Map map, BombBag sourcebag)
        {
            IPooledEnumerable ie = map.GetMobilesInRange(location, 0);

            var tomove = new List<Mobile>();

            foreach (Mobile m in ie)
            {
                if (Players.IndexOf(m) > -1)
                {
                    if (m != sourcebag.Owner)
                    {
                        m.SendMessage("You've been blown up by " + sourcebag.Owner.Name + "'s blast!");

                        sourcebag.Owner.SendMessage("You've blown " + m.Name + "!");

                        //handle scoring
                        BoardGameData.ChangeScore(GameName, sourcebag.Owner, BombermanSettings.KILL_SCORE);

                        BoardGameData.ChangeScore(GameName, m, BombermanSettings.DEATH_SCORE);

                        PublicOverheadMessage(MessageType.Regular, 1153, false,
                            sourcebag.Owner.Name + " has blown up " + m.Name + "!");
                    }
                    else
                    {
                        m.SendMessage("You just blew yourself up!!");

                        PublicOverheadMessage(MessageType.Regular, 1153, false, m.Name + " has just blown themself up!");

                        BoardGameData.ChangeScore(GameName, m, BombermanSettings.SUICIDE_SCORE);
                    }
                    BoardGameData.AddLose(GameName, m);


                    m.PlaySound(m.Female ? 0x32E : 0x549);
                    //0x54A - yelp1 

                    tomove.Add(m);
                }
            }
            ie.Free();

            foreach (Mobile m in tomove)
            {
                m.MoveToWorld(new Point3D(X - 1, Y - 1, Z), Map);
                m.SendGump(new BoardGameLostGump(m, this));

                Players.Remove(m);

                var bag = (BombBag) m.Backpack.FindItemByType(typeof(BombBag));

                if (bag != null)
                {
                    //don't let players run around blowing stuff up outside the game while they wait for others to finish
                    bag.Active = false;
                }

                //start the timer to check for endgame, delay for 1s
            }
            //test big bomb chain!
            StartEndGameTimer(TimeSpan.FromSeconds(1));
        }
开发者ID:greeduomacro,项目名称:UO-Forever,代码行数:63,代码来源:BombermanControlItem.cs

示例11: Acquire

		public static FillableContent Acquire(Point3D loc, Map map)
		{
			if (map == null || map == Map.Internal)
			{
				return null;
			}

			if (m_AcquireTable == null)
			{
				m_AcquireTable = new Dictionary<Type, FillableContent>();

				foreach (FillableContent fill in m_ContentTypes)
				{
					foreach (Type t in fill.m_Vendors)
					{
						m_AcquireTable[t] = fill;
					}
				}
			}

			Mobile nearest = null;
			FillableContent content = null;

			var mobs = map.GetMobilesInRange(loc, 20);

			foreach (Mobile m in
				mobs.OfType<Mobile>()
					.Where(
						m =>
						nearest == null || !(m.GetDistanceToSqrt(loc) > nearest.GetDistanceToSqrt(loc)) ||
						nearest is Cobbler && m is Provisioner))
			{
				FillableContent check;

				if (!m_AcquireTable.TryGetValue(m.GetType(), out check) || check == null)
				{
					continue;
				}

				nearest = m;
				content = check;
			}

			mobs.Free();

			return content;
		}
开发者ID:greeduomacro,项目名称:UO-Forever,代码行数:47,代码来源:FillableContainers.cs

示例12: Explode

		public virtual void Explode(Mobile from, Point3D loc, Map map)
		{
			if (Deleted || map == null)
			{
				return;
			}

			Consume();

			// Check if any other players are using this potion
			for (int i = 0; i < m_Users.Count; i ++)
			{
				var targ = m_Users[i].Target as ThrowTarget;

				if (targ != null && targ.Potion == this)
				{
					Target.Cancel(from);
				}
			}

			// Effects
			Effects.PlaySound(loc, map, 0x207);

			Geometry.Circle2D(loc, map, Radius, BlastEffect, 270, 90);

			Timer.DelayCall(
				TimeSpan.FromSeconds(0.3), new TimerStateCallback<IEntity>(CircleEffect2), new Entity(Serial.Zero, loc, map));

			foreach (Mobile mobile in map.GetMobilesInRange(loc, Radius))
			{
				if (mobile is BaseCreature)
				{
					var mon = (BaseCreature)mobile;

					mon.Pacify(from, DateTime.UtcNow + TimeSpan.FromSeconds(5.0)); // TODO check
				}
			}
		}
开发者ID:greeduomacro,项目名称:UO-Forever,代码行数:38,代码来源:BaseConfusionBlastPotion.cs

示例13: Explode


//.........这里部分代码省略.........
                                    MinDamage = m_TargetItemMinDamage,
                                    MaxDamage = m_TargetItemMaxDamage,
                                    Location = new Point3D(p.X, p.Y, loc.Z + 2),
                                    Map = Map
                                };
                        }
                        if (m_MoveOnUse)
                            Location = new Point3D(X, Y, loc.Z + 2);
                    }
                    else
                    {
                        PublicOverheadMessage(MessageType.Regular, 0x3B2, true, "Too big blast radius to create target items");
                        return;
                    }

                    effects.Clear();
                }
                else
                {
                    new ThrowableItemTargetItem(m_TargetItemDuration, m_TargetItemID)
                    {
                        Name = m_TargetItemName,
                        Hue = m_TargetItemHue,
                        MinDamage = m_TargetItemMinDamage,
                        MaxDamage = m_TargetItemMaxDamage,
                        Location = loc,
                        Map = Map
                    };
                }

                
            }

            IPooledEnumerable eable = m_DetonateNearby ? map.GetObjectsInRange(loc, BlastRadius) : map.GetMobilesInRange(loc, BlastRadius);
            ArrayList toExplode = new ArrayList();

            foreach (object o in eable)
            {
                if (o is Mobile)
                {
                    toExplode.Add(o);
                }
                else if (o is ThrowableItem && o != this)
                {
                    toExplode.Add(o);
                }
            }

            eable.Free();

            int min = m_MinDamage;
            int max = m_MaxDamage;

            for (int i = 0; i < toExplode.Count; ++i)
            {
                object o = toExplode[i];

                if (o is Mobile)
                {
                    Mobile m = (Mobile)o;

                    if (m_MaxDamage > 0)
                    {
                        GuardedRegion reg = (GuardedRegion)Region.Find(m.Location, m.Map).GetRegion(typeof(GuardedRegion));

                        if (m_CheckGuarded && reg != null && !reg.Disabled)
开发者ID:FreeReign,项目名称:imaginenation,代码行数:67,代码来源:ThrowableItem.cs

示例14: Explode

        public virtual void Explode(Mobile from, Point3D loc, Map map)
        {
            if (Deleted || map == null)
                return;

            Consume();

            // Check if any other players are using this potion
            for (int i = 0; i < m_Users.Count; i++)
            {
                ThrowTarget targ = m_Users[i].Target as ThrowTarget;

                if (targ != null && targ.Potion == this)
                    Target.Cancel(from);
            }

            // Effects
            Effects.PlaySound(loc, map, 0x207);

            Geometry.Circle2D(loc, map, Radius, new DoEffect_Callback(BlastEffect), 270, 90);

            Timer.DelayCall(TimeSpan.FromSeconds(0.3), new TimerStateCallback(CircleEffect2), new object[] { loc, map });

            foreach (Mobile mobile in map.GetMobilesInRange(loc, Radius))
            {
                this.DoClumsy(from);
            }
        }
开发者ID:greeduomacro,项目名称:vivre-uo,代码行数:28,代码来源:BaseClumsyPotion.cs

示例15: NearbyMobile

		private static string NearbyMobile(Map map, Point3D location)
		{
			string lastResort = null;

			// use "my" RangeHome which is set to be the same as the homerange of the spawner
			//	where we were spawned. This should give us a better chance in finding a nearby mob
			IPooledEnumerable eable = map.GetMobilesInRange( location, 12 );
			foreach (Mobile m in eable)
			{	
				// ignore staff
				if (m.AccessLevel > AccessLevel.Player)
					continue;

				// prefer a creature by returning it now
				if (m is BaseCreature)
				{
					eable.Free();
					return m.Name;
				}

				// last resort may be a player
				lastResort = m.Name;
			}
			eable.Free();

			// maybe a player
			return lastResort;
		}
开发者ID:zerodowned,项目名称:angelisland,代码行数:28,代码来源:BaseOverland.cs


注:本文中的Map.GetMobilesInRange方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。