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


C# Mobile.GetMobilesInRange方法代码示例

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


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

示例1: GetDifficulty

        public static int GetDifficulty(Mobile m)
        {
            int counter = 0;
            foreach (Mobile mob in m.GetMobilesInRange(8))
            {
                if (mob.BodyValue == 400 || mob.BodyValue == 401)
                {
                    //Chaque PJ ou NPC compte pour 1
                    if (mob != m && mob.Alive && mob.AccessLevel == AccessLevel.Player && mob.InLOS(m))
                    {
                        counter++;

                        //Un garde compte pour 2
                        if (mob is VivreGuard)
                            counter++;

                        //Un petit ajout pour le tracker
                        if (mob.Skills[SkillName.Tracking].Value > 80)
                            counter++;

                        //Petit bonus pour DH
                        if (mob.Skills[SkillName.DetectHidden].Value > (m.Skills[SkillName.Hiding].Value - 10))
                            counter += Utility.Random (1, 5);
                    }
                }
            }
            
            //Pour aider les Wraith Form
            if (m.BodyValue == 747 || m.BodyValue == 748)
                counter = (int)Math.Round(counter / 2.0);
            
            return counter; 
        }
开发者ID:greeduomacro,项目名称:vivre-uo,代码行数:33,代码来源:Stealth.cs

示例2: Target

        public void Target( Mobile m )
        {
            /*
             * Puts one or more Targets within a radius around the Target's Location
             * into a temporary Sleep state. In this state, Slept Targets will be
             * unable to attack or cast spells, and will move at a much slower speed.
             * They will awaken if harmed or after a set amount of time. The Sleep
             * duration is determined by a comparison between the Caster's Mysticism
             * and either Focus or Imbuing (whichever is greater) skills and the
             * Target's Resisting Spells skill.
             */

            if ( CheckSequence() )
            {
                SpellHelper.Turn( Caster, m );

                Map map = Caster.Map;

                if ( map != null )
                {
                    foreach ( Mobile target in m.GetMobilesInRange( 2 ) )
                    {
                        if ( Caster != target && Caster.InLOS( target ) && SpellHelper.ValidIndirectTarget( Caster, target ) && Caster.CanBeHarmful( target, false ) && !target.Hidden )
                        {
                            if ( SleepSpell.CheckSleep( Caster, target ) )
                                SleepSpell.DoSleep( Caster, target );
                        }
                    }
                }
            }

            FinishSequence();
        }
开发者ID:Ravenwolfe,项目名称:xrunuo,代码行数:33,代码来源:MassSleepSpell.cs

示例3: Target

		public void Target( Mobile m )
		{
			if( CheckHSequence( m ) )
			{
				SpellHelper.Turn( Caster, m );

				/* Creates a blast of poisonous energy centered on the target.
				 * The main target is inflicted with a large amount of Poison damage, and all valid targets in a radius of 2 tiles around the main target are inflicted with a lesser effect.
				 * One tile from main target receives 50% damage, two tiles from target receives 33% damage.
				 */

				//CheckResisted( m ); // Check magic resist for skill, but do not use return value	//reports from OSI:  Necro spells don't give Resist gain

				Effects.SendLocationParticles( EffectItem.Create( m.Location, m.Map, EffectItem.DefaultDuration ), 0x36B0, 1, 14, 63, 7, 9915, 0 );
				Effects.PlaySound( m.Location, m.Map, 0x229 );

				double damage = Utility.RandomMinMax( (Core.ML ? 32 : 36), 40 ) * ((300 + (GetDamageSkill( Caster ) * 9)) / 1000);
				
				double sdiBonus = (double)AosAttributes.GetValue( Caster, AosAttribute.SpellDamage )/100;
				double pvmDamage = damage * (1 + sdiBonus);
				
				if ( Core.ML && sdiBonus > 0.15 )
					sdiBonus = 0.15;
				double pvpDamage = damage * (1 + sdiBonus);

				Map map = m.Map;

				if( map != null )
				{
					List<Mobile> targets = new List<Mobile>();
			
					if ( Caster.CanBeHarmful(m, false ) )
						targets.Add( m );

                    foreach (Mobile targ in m.GetMobilesInRange(2))
                        if (!(Caster is BaseCreature && targ is BaseCreature))
                            if ((targ != Caster && m != targ) && (SpellHelper.ValidIndirectTarget(Caster, targ) && Caster.CanBeHarmful(targ, false)))
                                targets.Add(targ);

					for( int i = 0; i < targets.Count; ++i )
					{
						Mobile targ = targets[i];

						int num;

						if( targ.InRange( m.Location, 0 ) )
							num = 1;
						else if( targ.InRange( m.Location, 1 ) )
							num = 2;
						else
							num = 3;

						Caster.DoHarmful( targ );
						SpellHelper.Damage( this, targ, ((m.Player && Caster.Player) ? pvpDamage : pvmDamage) / num, 0, 0, 0, 100, 0 );
					}
				}
			}

			FinishSequence();
		}
开发者ID:greeduomacro,项目名称:vivre-uo,代码行数:60,代码来源:PoisonStrike.cs

示例4: Spawn

        public static void Spawn( Mobile caller, Mobile target, int amount, bool onlyAdditional )
        {
            if ( target == null || target.Deleted )
                return;

            foreach ( Mobile m in target.GetMobilesInRange( 15 ) )
            {
                if ( m is BaseGuard )
                {
                    BaseGuard g = (BaseGuard)m;

                    if ( g.Focus == null ) // idling
                    {
                        g.Focus = target;

                        --amount;
                    }
                    else if ( g.Focus == target && !onlyAdditional )
                    {
                        --amount;
                    }
                }
            }

            while ( amount-- > 0 )
                caller.Region.MakeGuard( target );
        }
开发者ID:FreeReign,项目名称:Rebirth-Repack,代码行数:27,代码来源:BaseGuard.cs

示例5: OnPickedInstrument

        public static void OnPickedInstrument(Mobile from, BaseInstrument instrument)
        {
            from.RevealingAction();
            if (!BaseInstrument.CheckMusicianship(from))
            {
                from.SendLocalizedMessage(500612); // You play poorly, and there is no effect.
                instrument.PlayInstrumentBadly(from);
                instrument.ConsumeUse(from);
            }
            else if (!from.CheckSkill(SkillName.Peacemaking, 0.0, 100.0))
            {
                from.SendLocalizedMessage(500613); // You attempt to calm everyone, but fail.
                instrument.PlayInstrumentBadly(from);
                instrument.ConsumeUse(from);
            }
            else
            {
                instrument.PlayInstrumentWell(from);
                instrument.ConsumeUse(from);

                Map map = from.Map;

                if (map != null)
                {
                    int range = BaseInstrument.GetBardRange(from, SkillName.Peacemaking);

                    bool calmed = false;

                    foreach (Mobile m in from.GetMobilesInRange(range))
                    {
                        #region Dueling
                        if (m.Region is Engines.ConPVP.SafeZone)
                            continue;
                        #endregion

                        BaseCreature bc = m as BaseCreature;
                        if ((bc != null && bc.Uncalmable) || m == from || !m.Alive)
                            continue;

                        calmed = true;

                        m.SendLocalizedMessage(500616); // You hear lovely music, and forget to continue battling!
                        m.Combatant = null;
                        if (!m.Player)
                            m.Warmode = false;

                        if (bc != null && !bc.BardPacified)
                            bc.Pacify(from, DateTime.Now + TimeSpan.FromSeconds(2.5));
                    }

                    if (!calmed)
                        from.SendLocalizedMessage(1049648); // You play hypnotic music, but there is nothing in range for you to calm.
                    else
                        from.SendLocalizedMessage(500615); // You play your hypnotic music, stopping the battle.
                }
            }
        }
开发者ID:greeduomacro,项目名称:divinity,代码行数:57,代码来源:Peacemaking.cs

示例6: OnHit

        public override void OnHit(Mobile attacker, Mobile defender, int damage)
        {
            if (!this.CheckMana(attacker, true) && defender != null)
                return;

            BaseThrown weapon = attacker.Weapon as BaseThrown;

            if (weapon == null)
                return;

            List<Mobile> targets = new List<Mobile>();

            foreach (Mobile m in attacker.GetMobilesInRange(weapon.MaxRange))
            {
                if (m == defender)
                    continue;

                if (m.Combatant != attacker)
                    continue;

                targets.Add(m);
            }

            if (targets.Count > 0)
                this.m_Target = targets[Utility.Random(targets.Count)];

            /*
            Mobile m = null;

            foreach( DamageEntry de in attacker.DamageEntries )
            {
            m = Mobile.GetDamagerFrom( de );

            if ( m != null )
            {
            if ( defender != m && defender.InRange( m, 3 ) )
            {
            m_Target = m;
            break;
            }
            }
            }
            */

            AOS.Damage(defender, attacker, this.m_Damage, 0, 0, 0, 0, 100);

            if (this.m_Target != null)
            {
                defender.MovingEffect(this.m_Target, weapon.ItemID, 18, 1, false, false);
                Timer.DelayCall(TimeSpan.FromMilliseconds(333.0), new TimerCallback(ThrowAgain));
                this.m_Mobile = attacker;
            }

            ClearCurrentAbility(attacker);
        }
开发者ID:Crome696,项目名称:ServUO,代码行数:55,代码来源:MysticArc.cs

示例7: OnPickedInstrument

		public static void OnPickedInstrument( Mobile from, BaseInstrument instrument )
		{
			from.RevealingAction();

      if ( !BaseInstrument.CheckMusicianship( from ) )
      { 
        from.SendLocalizedMessage( 500612 ); // You play poorly, and there is no effect.
        instrument.PlayInstrumentBadly( from );
        instrument.ConsumeUse( from );
      }
      else if ( !from.CheckSkill( SkillName.Peacemaking, 0.0, 100.0 ) )
      {
        from.SendLocalizedMessage( 500613 ); // You attempt to calm everyone, but fail.
        instrument.PlayInstrumentBadly( from );
        instrument.ConsumeUse( from );
      }
      else
      {
        instrument.PlayInstrumentWell( from );
        instrument.ConsumeUse( from );

        Map map = from.Map;

        if ( map != null )
        {
          int range = BaseInstrument.GetBardRange( from, SkillName.Peacemaking );

          bool calmed = false;

          foreach ( Mobile m in from.GetMobilesInRange( range ) )
          {
            if ( (m is BaseCreature && ((BaseCreature)m).Uncalmable) || m == from || !from.CanBeHarmful( m, false ) )
              continue;

            calmed = true;

            m.SendLocalizedMessage( 500616 ); // You hear lovely music, and forget to continue battling!
            m.Combatant = null;
            m.Warmode = false;

            if ( m is BaseCreature && !((BaseCreature)m).BardPacified )
              ((BaseCreature)m).Pacify( from, DateTime.Now + TimeSpan.FromSeconds( 1.0 ) );
          }

          if ( !calmed )
            from.SendLocalizedMessage( 1049648 ); // You play hypnotic music, but there is nothing in range...
          else
            from.SendLocalizedMessage( 500615 ); // You play your hypnotic music, stopping the battle.
            
        }
      }
		}
开发者ID:greeduomacro,项目名称:unknown-shard-1,代码行数:52,代码来源:Peacemaking.cs

示例8: Target

        public void Target( Mobile m )
        {
            if ( CheckHSequence( m ) )
            {
                SpellHelper.Turn( Caster, m );

                /* Creates a blast of poisonous energy centered on the target.
                 * The main target is inflicted with a large amount of Poison damage, and all valid targets in a radius of 2 tiles around the main target are inflicted with a lesser effect.
                 * One tile from main target receives 50% damage, two tiles from target receives 33% damage.
                 */

                CheckResisted( m ); // Check magic resist for skill, but do not use return value

                Effects.SendLocationParticles( EffectItem.Create( m.Location, m.Map, EffectItem.DefaultDuration ), 0x36B0, 1, 14, 63, 7, 9915, 0 );
                Effects.PlaySound( m.Location, m.Map, 0x229 );

                double damage = Utility.RandomMinMax( 36, 40 ) * ((300 + (GetDamageSkill( Caster ) * 9)) / 1000);

                Map map = m.Map;

                if ( map != null )
                {
                    ArrayList targets = new ArrayList();

                    foreach ( Mobile targ in m.GetMobilesInRange( 2 ) )
                    {
                        if ( (Caster == targ || SpellHelper.ValidIndirectTarget( Caster, targ )) && Caster.CanBeHarmful( targ, false ) )
                            targets.Add( targ );
                    }

                    for ( int i = 0; i < targets.Count; ++i )
                    {
                        Mobile targ = (Mobile)targets[i];

                        int num;

                        if ( targ.InRange( m.Location, 0 ) )
                            num = 1;
                        else if ( targ.InRange( m.Location, 1 ) )
                            num = 2;
                        else
                            num = 3;

                        Caster.DoHarmful( targ );
                        SpellHelper.Damage( this, targ, damage / num, 0, 0, 0, 100, 0 );
                    }
                }
            }

            FinishSequence();
        }
开发者ID:justdanofficial,项目名称:khaeros,代码行数:51,代码来源:PoisonStrike.cs

示例9: TextDefinition

		public override TextDefinition AbilityMessage{ get{ return new TextDefinition( 1070757 ); } } // You prepare to strike two enemies with one blow.

		public override void OnHit( Mobile attacker, Mobile defender, int damage )
		{
			if ( !Validate( attacker ) || !CheckMana( attacker, false ) )
				return;

			ClearCurrentMove( attacker );

			BaseWeapon weapon = attacker.Weapon as BaseWeapon;

			List<Mobile> targets = new List<Mobile>();

			foreach ( Mobile m in attacker.GetMobilesInRange( weapon.MaxRange ) )
			{
				if ( m == defender )
					continue;

				if ( m.Combatant != attacker )
					continue;

				targets.Add( m );
			}

			if ( targets.Count > 0 )
			{
				if ( !CheckMana( attacker, true ) )
					return;

				Mobile target = targets[Utility.Random( targets.Count )];

				double damageBonus = attacker.Skills[SkillName.Bushido].Value / 100.0;

				if ( !defender.Alive )
					damageBonus *= 1.5;

				attacker.SendLocalizedMessage( 1063171 ); // You transfer the momentum of your weapon into another enemy!
				target.SendLocalizedMessage( 1063172 ); // You were hit by the momentum of a Samurai's weapon!

				target.FixedParticles( 0x37B9, 1, 4, 0x251D, 0, 0, EffectLayer.Waist );

                attacker.PlaySound( 0x510 );

				weapon.OnSwing( attacker, target, damageBonus );

				CheckGain( attacker );
			}
			else
			{
				attacker.SendLocalizedMessage( 1063123 ); // There are no valid targets to attack!
			}
		}
开发者ID:Godkong,项目名称:Origins,代码行数:52,代码来源:MomentumStrike.cs

示例10: GetNearbyMobiles

		// List<Mobile> list = BlueMonster.GetNearbyMobiles( this, 3, true );
		public static List<Mobile> GetNearbyMobiles( Mobile from, int range, bool harm )
		{
			List<Mobile> list = new List<Mobile>();

			foreach( Mobile m in from.GetMobilesInRange( range ) )
			{
				if ( harm && from == m )
					continue;
				else if ( m != null && BlueSpell.CanTarget( from, m, true ) )
					list.Add( m );
			}

			return list;
		}
开发者ID:greeduomacro,项目名称:cov-shard-svn-1,代码行数:15,代码来源:BlueMonster.cs

示例11: OnUse

        public static TimeSpan OnUse(Mobile m)
        {
            bool releaseLock = true;

            if (m.BeginAction(typeof(IAction)))
            {
                int range = Math.Min((int)((100 - m.Skills[SkillName.Meditation].Value) / 2) + 8, 18);
                bool badCombat = (m.Combatant != null && m.InRange(m.Combatant.Location, range) && m.Combatant.InLOS(m));

                foreach (Mobile check in m.GetMobilesInRange(range))
                {
                    if (check.InLOS(m) && check.Combatant == m)
                    {
                        badCombat = true;
                        break;
                    }
                }

                if (m.Mana >= m.ManaMax)
                    m.SendLocalizedMessage(501846); // You are at peace.

                else if (badCombat || m.Warmode || (m is PlayerMobile && (((PlayerMobile)m).LastAttackTime + TimeSpan.FromSeconds(5.0)) >= DateTime.Now))
                    m.SendAsciiMessage("You are preoccupied with thoughts of battle.");

                else
                {
                    new InternalTimer(m).Start();

                    m.RevealingAction();
                    m.SendAsciiMessage("You begin meditating...");
                    //m.SendLocalizedMessage(501851); // You enter a meditative trance.
                    releaseLock = false;

                    if (m.Player)
                        m.PlaySound(0xF9);
                }
            }

            else
            {
                m.SendAsciiMessage("You must wait to perform another action.");
                releaseLock = false;    
            }

            if (m is PlayerMobile && releaseLock)
                ((PlayerMobile)m).EndPlayerAction();

            return TimeSpan.Zero;
        }
开发者ID:FreeReign,项目名称:imaginenation,代码行数:49,代码来源:Meditation.cs

示例12: OnUse

        public static TimeSpan OnUse( Mobile m )
        {
            if ( !m.Hidden )
            {
                m.SendLocalizedMessage( 502725 ); // You must hide first
            }
            else if ( m.Skills[SkillName.Hiding].Base < ((Core.SE) ? 50.0 : 80.0) )
            {
                m.SendLocalizedMessage( 502726 ); // You are not hidden well enough.  Become better at hiding.
                m.RevealingAction();
            }
            else if( m is PlayerMobile )
            {
                PlayerMobile pm = m as PlayerMobile;

                if( pm.HeavyPenalty > 0 || ((pm.Feats.GetFeatLevel(FeatList.ArmouredStealth) * 3) < pm.TotalPenalty) ||
                   (pm.Feats.GetFeatLevel(FeatList.ArmouredStealth) < 1 && (pm.MediumPieces > 0 || pm.LightPieces > 0)) )
                {
                    m.SendLocalizedMessage( 502727 ); // You could not hope to move quietly wearing this much armor.
                    m.RevealingAction();
                }
                else if ( m.CheckSkill( SkillName.Stealth, -20.0 + (pm.TotalPenalty * 3), (Core.AOS ? 60.0 : 80.0) + (pm.TotalPenalty * 3) ) )
                {
                    int steps = (int)(m.Skills[SkillName.Stealth].Value / (Core.AOS ? 5.0 : 10.0));

                    if ( steps < 1 )
                        steps = 1;

                    m.AllowedStealthSteps = steps;

                    foreach( Mobile mob in m.GetMobilesInRange( 3 ) )
                        if( mob.Hidden && (mob is Wolf || mob is Dog) && ((BaseCreature)mob).ControlMaster == m )
                            mob.AllowedStealthSteps = steps;

                    //m.SendLocalizedMessage( 502730 ); // You begin to move quietly.

                    return TimeSpan.FromSeconds( 10.0 );
                }
                else
                {
                    m.SendLocalizedMessage( 502731 ); // You fail in your attempt to move unnoticed.
                    m.RevealingAction();
                }
            }

            return TimeSpan.FromSeconds( 10.0 );
        }
开发者ID:justdanofficial,项目名称:khaeros,代码行数:47,代码来源:Stealth.cs

示例13: CheckCombat

        public static bool CheckCombat( Mobile m, int range )
        {
            if ( m.Combatant != null && !m.Combatant.Deleted && m.Combatant.Alive && m.CanSee( m.Combatant ) && m.InRange( m.Combatant, (int)(range*1.5) ) && m.Combatant.InLOS( m ) )
                return true;

            IPooledEnumerable eable = m.GetMobilesInRange( range );
            foreach ( Mobile check in eable )
            {
                if ( check.Combatant == m && check.InLOS( m ) )
                {
                    eable.Free();
                    return true;
                }
            }

            eable.Free();
            return false;
        }
开发者ID:FreeReign,项目名称:Rebirth-Repack,代码行数:18,代码来源:Hiding.cs

示例14: OnDoubleClick

		public override void OnDoubleClick( Mobile from )
		{
			if ( !IsChildOf( from.Backpack ) ) from.SendLocalizedMessage( 1042001 );
			else if ( from.Region is TownRegion ) { from.SendMessage( "You are not allowed to do that in town" ); }
			else if ( from.Region.Name == "Tele Center Tram" || from.Region.Name == "Tele Center Fel" ) { from.SendMessage( "You are not allowed to do that in the Tele Center" ); }
			else
			{
				from.SendMessage("You throw the pumpkin at your feet lett off a clound of smoke through out the area");
				foreach ( Mobile mobile in from.GetMobilesInRange( 12 ) )
				{
					if ( mobile != null && mobile.AccessLevel < AccessLevel.GameMaster && from.CanBeHarmful(mobile) )
					{
						mobile.Say("*cough cough*");
						mobile.Poison = Poison.Greater;
					}
				}
				this.Delete();
			}
		}
开发者ID:ITLongwell,项目名称:aedilis2server,代码行数:19,代码来源:SmellyPumpkinBombs.cs

示例15: OnUse

        public static TimeSpan OnUse( Mobile m )
        {
            if ( m.Spell != null )
            {
                m.SendLocalizedMessage( 501238 ); // You are busy doing something else and cannot hide.
                return TimeSpan.FromSeconds( 1.0 );
            }

            if ( Core.ML && m.Target != null )
            {
                Targeting.Target.Cancel( m );
            }

            //int range = 18 - (int)(m.Skills[SkillName.Hiding].Value / 10);
            int range = Math.Min( (int)((100 - m.Skills[SkillName.Hiding].Value)/2) + 8, 18 );	//Cap of 18 not OSI-exact, intentional difference

            bool badCombat = ( !m_CombatOverride && m.Combatant != null && m.InRange( m.Combatant.Location, range ) && m.Combatant.InLOS( m ) );
            bool ok = ( !badCombat /*&& m.CheckSkill( SkillName.Hiding, 0.0 - bonus, 100.0 - bonus )*/ );

            if ( ok )
            {
                if ( !m_CombatOverride )
                {
                    foreach ( Mobile check in m.GetMobilesInRange( range ) )
                    {
                        if ( check.InLOS( m ) && check.Combatant == m )
                        {
                            badCombat = true;
                            ok = false;
                            break;
                        }
                    }
                }

                ok = ( !badCombat && m.CheckSkill( SkillName.Hiding, 0.0, 100.0 ) );
            }

            if ( badCombat )
            {
                m.RevealingAction();

                m.LocalOverheadMessage( MessageType.Regular, 0x22, 501237 ); // You can't seem to hide right now.

                return TimeSpan.FromSeconds( 1.0 );
            }
            else
            {
                if ( ok )
                {
                    m.Hidden = true;
                    m.Warmode = false;
                    m.LocalOverheadMessage( MessageType.Regular, 0x1F4, 501240 ); // You have hidden yourself well.
                }
                else
                {
                    m.RevealingAction();

                    m.LocalOverheadMessage( MessageType.Regular, 0x22, 501241 ); // You can't seem to hide here.
                }

                return TimeSpan.FromSeconds( 10.0 );
            }
        }
开发者ID:jsrn,项目名称:MidnightWatchServer,代码行数:63,代码来源:Hiding.cs


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