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


C# Mobile.GetMobilesInRange方法代码示例

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


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

示例1: Use

		public override bool Use( Mobile from ) {
			Faction ourFaction = Faction.Find( from );

			bool used = false;

			foreach ( Mobile mob in from.GetMobilesInRange( 8 ) ) {
				if ( mob.Player && !mob.Alive && from.InLOS( mob ) ) {
					if ( Faction.Find( mob ) != ourFaction ) {
						continue;
					}

					BaseHouse house = BaseHouse.FindHouseAt( mob );

					if ( house == null || ( house.IsFriend( from ) || house.IsFriend( mob ) ) ) {
						Faction.ClearSkillLoss( mob );

						mob.SendGump( new ResurrectGump( mob, from, ResurrectMessage.Generic ) );
						used = true;
					}
				}
			}

			if ( used ) {
				from.LocalOverheadMessage( Server.Network.MessageType.Regular, 2219, false, "The urn shatters as you invoke its power." );
				from.PlaySound( 64 );

				Effects.PlaySound( from.Location, from.Map, 1481 );
			}

			return used;
		}
开发者ID:greeduomacro,项目名称:last-wish,代码行数:31,代码来源:UrnOfAscension.cs

示例2: LightCombo

		// Healing Ki
		// Activate to heal all nearby allies for 1d4 (1 to 4), plus an additional 
		// 1d4 (1 to 4) for every two monk levels. (Does not harm undead)
		public static void LightCombo( Mobile from )
		{
			from.SendMessage( 2075, "You execute the maneuver: Healing Ki" );

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

			foreach ( Mobile m in from.GetMobilesInRange( 4 ) )
			{
				if ( m != null )
					if ( NotorietyHandlers.Mobile_AllowBeneficial( from, m ) )
						mobiles.Add( m );
			}

			MonkFists mf = from.FindItemOnLayer( Layer.Gloves ) as MonkFists;
			int amount = 0;	

			if ( mf != null )
				amount = Utility.Dice( mf.Teir, 3, (3 * mf.Teir) );
			else
				amount = Utility.Dice( 2, 6, 0 );

			for ( int i = 0; i < mobiles.Count; i++ )
			{
				mobiles[i].FixedParticles( 0x3967, 10, 30, 5013, 36, 4, EffectLayer.CenterFeet, 0 );
				mobiles[i].Heal( amount, from );
			}

			if ( from.Female )
				from.PlaySound( 0x339 );
			else
				from.PlaySound( 0x44B );
		}
开发者ID:greeduomacro,项目名称:cov-shard-svn-1,代码行数:35,代码来源:MonkCombos+Light.cs

示例3: OnDoubleClick

        public override void OnDoubleClick( Mobile from )
        {
            if ( !IsChildOf( from.Backpack ) )
            {
                from.SendLocalizedMessage( 1042001 ); // That must be in your pack for you to use it.
            }
            else if ( from.AccessLevel >= AccessLevel.GameMaster )
            {
                from.SendLocalizedMessage( 503248 );//Your godly powers allow you to place this vendor whereever you wish.

                Mobile v = new PlayerVendor( from );
                v.Location = from.Location;
                v.Direction = from.Direction & Direction.Mask;
                v.Map = from.Map;
                v.SayTo( from, 503246 ); // Ah! it feels good to be working again.

                this.Delete();
            }
            else
            {
                BaseHouse house = BaseHouse.FindHouseAt( from );
                if ( house == null && from.Region is HouseRegion )
                {
                    //allow placement in tents
                    house = ((HouseRegion)from.Region).House;
                    if ( house != null && !(house is Tent) )
                        house = null;
                }

                if ( house == null )
                {
                    from.SendLocalizedMessage( 503240 );//Vendors can only be placed in houses.
                }
                else if ( !house.IsOwner( from ) )
                {
                    from.SendLocalizedMessage( 503242 ); // You must ask the owner of this house to make you a friend in order to place this vendor here,
                }
                else
                {
                    IPooledEnumerable eable = from.GetMobilesInRange( 0 );
                    foreach ( Mobile m in eable )
                    {
                        if ( !m.Player )
                        {
                            from.SendAsciiMessage( "There is something blocking that location." );
                            eable.Free();
                            return;
                        }
                    }

                    Mobile v = new PlayerVendor( from );
                    v.Location = from.Location;
                    v.Direction = from.Direction & Direction.Mask;
                    v.Map = from.Map;
                    v.SayTo( from, 503246 ); // Ah! it feels good to be working again.

                    this.Delete();
                }
            }
        }
开发者ID:FreeReign,项目名称:Rebirth-Repack,代码行数:60,代码来源:PlayerVendorDeed.cs

示例4: Effect

        public static void Effect( Mobile attacker, Mobile defender, int featlevel )
        {
            IKhaerosMobile featuser = attacker as IKhaerosMobile;
            ArrayList list = new ArrayList();

            foreach( Mobile m in defender.GetMobilesInRange( featlevel + 2 ) )
            {
                if( m == null || m.Deleted || m.Map != attacker.Map || !m.Alive || !attacker.CanSee( m ) || !attacker.CanBeHarmful( m ) || featuser.IsAllyOf( m ) )
                    continue;

                if( !attacker.InRange( m, ((BaseWeapon)attacker.Weapon).MaxRange ) )
                    continue;

                if( m != attacker && Spells.SpellHelper.ValidIndirectTarget( attacker, m ) )
                {
                    if( attacker.InLOS( m ) )
                        list.Add( m );
                }
            }

            for( int i = 0; i < Math.Min( list.Count, featlevel + 1 ); ++i )
            {
                int random = Utility.Random( list.Count );
                Mobile m = (Mobile)list[random];

                featuser.CleaveAttack = true;
                ((BaseWeapon)attacker.Weapon).OnSwing( attacker, m, 0.5, true );

            }
        }
开发者ID:justdanofficial,项目名称:khaeros,代码行数:30,代码来源:HailOfArrows.cs

示例5: OnHit

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

            ClearCurrentAbility( attacker );

            Map map = attacker.Map;

            if ( map == null )
                return;

            BaseWeapon weapon = attacker.Weapon as BaseWeapon;

            if ( weapon == null )
                return;

            if ( !CheckMana( attacker, true ) )
                return;

            attacker.FixedEffect( 0x3728, 10, 15 );
            attacker.PlaySound( 0x2A1 );

            ArrayList list = new ArrayList();

            foreach ( Mobile m in attacker.GetMobilesInRange( 1 ) )
                list.Add( m );

            Party p = Party.Get( attacker );

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

                if (m != defender && m != attacker &&
                    SpellHelper.ValidIndirectTarget(attacker, m) &&
                    attacker.CanBeHarmful(m, false) &&
                    (p == null || !p.Contains(m)))
                {
                    if ( m == null || m.Deleted || attacker.Deleted || m.Map != attacker.Map || !m.Alive || !attacker.Alive || !attacker.CanSee( m ) )
                        continue;

                    if ( !attacker.InRange( m, weapon.MaxRange ) )
                        continue;

                    if ( attacker.InLOS( m ) )
                    {
                        attacker.RevealingAction();

                        attacker.SendLocalizedMessage( 1060161 ); // The whirling attack strikes a target!
                        m.SendLocalizedMessage( 1060162 ); // You are struck by the whirling attack and take damage!

                        weapon.OnHit( attacker, m );
                    }
                }
            }
        }
开发者ID:BackupTheBerlios,项目名称:sunuo-svn,代码行数:57,代码来源:WhirlwindAttack.cs

示例6: OnHit

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

            ClearCurrentAbility( attacker );

            /*
             * - Upon striking the primary target with full force the projectile is deflected to one additional target which is struck for half damage.
             * - The primary target receives a 100% damage and the secondary target receives 50% damage strike.
             * - Additional chaos damage is dealt to each target, modified by the player’s Mysticism or Imbuing skill
             *     o The chaos damage is a random roll between 15-27
             *     o If the character has Mysticism or Imbuing above 80, they will receive additional bonus to the range of their potential chaos damage of 1% per point above 80, up to a maximum 40% increase to the minimum and maximums in the range
             *          + The range 15 - 27 can be raised up to 21 – 38
             * - Player must already have established combat with the secondary target: either by attacking or having been a victim of the target
             *     o Will not initiate combat with otherwise valid targets who aren’t already in combat with you
             */

            double imbuing = attacker.Skills[SkillName.Imbuing].Value;
            double mysticism = attacker.Skills[SkillName.Mysticism].Value;

            double skillBonus = Math.Max( 0, Math.Max( imbuing, mysticism ) - 80.0 );

            int additionalDamage = AOS.Scale( Utility.RandomMinMax( 15, 27 ), (int) skillBonus );

            int[] types = new int[4];
            types[Utility.Random( types.Length )] = 100;

            AOS.Damage( defender, attacker, additionalDamage, 0, types[0], types[1], types[2], types[3] );

            BaseWeapon weapon = attacker.Weapon as BaseWeapon;
            Mobile secondTarget = null;

            foreach ( Mobile m in attacker.GetMobilesInRange( weapon.MaxRange ) )
            {
                if ( m != defender && m.Combatant == attacker )
                {
                    secondTarget = m;
                    break;
                }
            }

            if ( secondTarget != null )
            {
                int phys, fire, cold, pois, nrgy;
                weapon.GetDamageTypes( attacker, out phys, out fire, out cold, out pois, out nrgy );

                AOS.Damage( secondTarget, attacker, damage / 2, phys, fire, cold, pois, nrgy );

                additionalDamage = AOS.Scale( Utility.RandomMinMax( 15, 27 ), (int) skillBonus );

                types = new int[4];
                types[Utility.Random( types.Length )] = 100;

                AOS.Damage( secondTarget, attacker, additionalDamage, 0, types[0], types[1], types[2], types[3] );
            }
        }
开发者ID:Ravenwolfe,项目名称:xrunuo,代码行数:57,代码来源:MysticArc.cs

示例7: OnHit

		public override void OnHit( Mobile attacker, Mobile defender, int damage )
		{
			if ( !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 )
				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, m_Damage, 0, 0, 0, 0, 100 );

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

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

示例8: RingBell

 public virtual void RingBell( Mobile from )
 {
     foreach ( Mobile m in from.GetMobilesInRange( 200 ) )
     {
         if ( m.Player )
         {
             if ( m == from )
                 m.SendMessage( "You ring the bell." );
             else
                 m.SendMessage( "You hear the ringing of alarm bells!" );
         }
     }
 }
开发者ID:jsrn,项目名称:ZUOmbies,代码行数:13,代码来源:BellOfTheLiving.cs

示例9: GetDeadPets

		public static BaseCreature[] GetDeadPets(Mobile from)
		{
			List<BaseCreature> pets = new List<BaseCreature>();

			foreach (Mobile m in from.GetMobilesInRange(12))
			{
				BaseCreature bc = m as BaseCreature;

				if (bc != null && bc.IsDeadBondedPet && bc.ControlMaster == from && from.InLOS(bc))
					pets.Add(bc);
			}

			return pets.ToArray();
		}
开发者ID:Crome696,项目名称:ServUO,代码行数:14,代码来源:Veterinarian.cs

示例10: Target

        public static void Target(IPoint3D p, Mobile from)
        {
            if ( !m_Table.Contains( from ))
            {
                new InternalTimer( from ).Start();
                SpellHelper.Turn( from, p );
                string text = string.Format( "* {0} points here *", from.Name );
                Point3D point = new Point3D( p );
                Map map = from.Map;
                EffectItem ei;
                Effects.SendLocationParticles( ei = EffectItem.Create( point, map, EffectItem.DefaultDuration ), 0x376A, 1, 29, 0x47D, 2, 9962, 0 );

                foreach (Mobile m in from.GetMobilesInRange(18))
                        if (m != null && m.Player)
                            MessageHelper.SendLocalizedMessageTo((Item)ei, m, 1070722, text, 18);
            }
            else from.SendMessage("You must wait a few seconds until you can point again.");
        }
开发者ID:kamronbatman,项目名称:Defiance-AOS-Pre-2012,代码行数:18,代码来源:Point.cs

示例11: Effect

        public static void Effect( Mobile attacker, Mobile defender, int featlevel )
        {
            if( !BaseCustomSpell.HasEnoughMana( attacker, ( featlevel * 5 ) ) )
                return;

            ArrayList list = new ArrayList();
            IKhaerosMobile featuser = attacker as IKhaerosMobile;

            foreach( Mobile m in attacker.GetMobilesInRange( 5 ) )
                list.Add( m );

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

                if( ((IKhaerosMobile)attacker).IsAllyOf( m ) )
                {
                    if( m == null || m.Deleted || m.Map != attacker.Map || !m.Alive || !attacker.CanSee( m ) )
                        continue;

                    if( attacker.InLOS( m ) && m.Hits < m.HitsMax )
                    {
                        double heal = ( 0.10 * featlevel ) * attacker.Skills[SkillName.Faith].Base;

                        if( m is PlayerMobile && attacker is PlayerMobile && ((PlayerMobile)m).ChosenDeity != ChosenDeity.None &&
                           ((PlayerMobile)m).ChosenDeity == ((PlayerMobile)attacker).ChosenDeity &&
                           ((PlayerMobile)m).Backgrounds.BackgroundDictionary[BackgroundList.Faithful].Level > 0 )
                            heal = heal + ( heal * 0.1 );

                        m.PlaySound( 0x1F2 );
                        m.FixedEffect( 0x376A, 9, 32 );
                        m.Hits += Convert.ToInt32( heal );
                        attacker.Mana -= ( 5 * featlevel );
                        m.LocalOverheadMessage( Network.MessageType.Regular, 170, false, "+" + Convert.ToInt32( heal ) );

                        if( attacker.Target != null && attacker.Target is BaseCustomSpell.CustomSpellTarget )
                            attacker.Target = null;

                        break;
                    }
                }
            }
        }
开发者ID:justdanofficial,项目名称:khaeros,代码行数:43,代码来源:HolyStrike.cs

示例12: OnHit

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

            ClearCurrentAbility( attacker );

            Map map = attacker.Map;

            if ( map != null )
            {
                defender.PlaySound( 0x5BF );

                ArrayList targets = new ArrayList();

                foreach ( Mobile m in defender.GetMobilesInRange( 5 ) )
                {
                    if ( SpellHelper.ValidIndirectTarget( attacker, m ) && attacker.CanBeHarmful( m, false ) && defender.InLOS( m ) && defender.CanSee( m ) )
                        targets.Add( m );
                }

                double dm;

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

                    if ( attacker.CanBeHarmful( m ) && attacker != m )
                    {
                        attacker.DoHarmful( m );

                        Effects.SendBoltEffect( m, false, 0 );

                        // TODO: Revisar formula del daño

                        dm = Utility.RandomMinMax( 25, 30 );

                        SpellHelper.Damage( TimeSpan.Zero, m, attacker, dm, 0, 0, 0, 0, 100 );
                    }
                }
            }
        }
开发者ID:Ravenwolfe,项目名称:xrunuo,代码行数:42,代码来源:LightningArrow.cs

示例13: GetAllAttackers

		public static ArrayList GetAllAttackers( Mobile m, int range )
		{
			ArrayList targets = new ArrayList(); 

			if ( m.Combatant != null && m.InLOS( m.Combatant ) )
			{
				if ( m.GetDistanceToSqrt( m.Combatant ) <= range )
				{
					targets.Add( m.Combatant );
				}
			}

// Current combatant has double chance to get an attack because of the above code

			foreach ( Mobile t in m.GetMobilesInRange( range ) )
			{
				if (t.Combatant == m && m.InLOS(t) && !t.Hidden )										
				{
					targets.Add( t );
				}
			}

			return targets;
		}
开发者ID:ITLongwell,项目名称:aedilis2server,代码行数:24,代码来源:BaseAttackHelperSE.cs

示例14: TeleportPets

        public static void TeleportPets( Mobile master, Point3D loc, Map map, bool onlyBonded )
        {
            ArrayList move = new ArrayList();

            foreach ( Mobile m in master.GetMobilesInRange( 3 ) )
            {
                if ( m is BaseCreature )
                {
                    BaseCreature pet = (BaseCreature)m;

                    if ( pet.Controled && pet.ControlMaster == master )
                    {
                        if ( !onlyBonded || pet.IsBonded )
                        {
                            if ( pet.ControlOrder == OrderType.Guard || pet.ControlOrder == OrderType.Follow || pet.ControlOrder == OrderType.Come )
                                move.Add( pet );
                        }
                    }
                }
            }

            foreach ( Mobile m in move )
                m.MoveToWorld( loc, map );
        }
开发者ID:cynricthehun,项目名称:UOLegends,代码行数:24,代码来源:BaseCreature.cs

示例15: CheckGuardCandidate

        public void CheckGuardCandidate( Mobile m )
        {
            if ( IsDisabled() )
                return;

            if ( IsGuardCandidate( m ) )
            {
                GuardTimer timer = null;
                m_GuardCandidates.TryGetValue( m, out timer );

                if ( timer == null )
                {
                    timer = new GuardTimer( m, m_GuardCandidates );
                    timer.Start();

                    m_GuardCandidates[m] = timer;
                    m.SendLocalizedMessage( 502275 ); // Guards can now be called on you!

                    Map map = m.Map;

                    if ( map != null )
                    {
                        Mobile fakeCall = null;
                        double prio = 0.0;

                        foreach ( Mobile v in m.GetMobilesInRange( 8 ) )
                        {
                            if( !v.Player && v != m  && !IsGuardCandidate( v ) && !(v is CharacterStatue) && ((v is BaseCreature)? ((BaseCreature)v).IsHumanInTown() : (v.Body.IsHuman && v.Region.IsPartOf( this ))) )
                            {
                                double dist = m.GetDistanceToSqrt( v );

                                if ( fakeCall == null || dist < prio )
                                {
                                    fakeCall = v;
                                    prio = dist;
                                }
                            }
                        }

                        if ( fakeCall != null )
                        {
                            fakeCall.Say( Utility.RandomList( 1007037, 501603, 1013037, 1013038, 1013039, 1013041, 1013042, 1013043, 1013052 ) );
                            MakeGuard( m );
                            timer.Stop();
                            m_GuardCandidates.Remove( m );
                            m.SendLocalizedMessage( 502276 ); // Guards can no longer be called on you.
                        }
                    }
                }
                else
                {
                    timer.Stop();
                    timer.Start();
                }
            }
        }
开发者ID:kamronbatman,项目名称:Defiance-AOS-Pre-2012,代码行数:56,代码来源:GuardedRegion.cs


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