本文整理汇总了C#中Server.Map.GetMobilesInRange方法的典型用法代码示例。如果您正苦于以下问题:C# Map.GetMobilesInRange方法的具体用法?C# Map.GetMobilesInRange怎么用?C# Map.GetMobilesInRange使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Server.Map
的用法示例。
在下文中一共展示了Map.GetMobilesInRange方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: OnExplode
public override void OnExplode( Mobile source, Item itemSource, int intensity, Point3D loc, Map map )
{
//Server.Effects.PlaySound( loc, map, 0x3B9 );
foreach ( Mobile m in map.GetMobilesInRange( loc, ((BombPotion)itemSource).ExplosionRange ) )
if ( m != null )
if ( map.LineOfSight( loc, m ) )
m.MovingEffect( new Entity( Serial.Zero, loc, map ), 10244, 18, 1, false, false );
}
示例2: FindMobile
public static bool FindMobile( Map map, Point3D p )
{
IPooledEnumerable eable = map.GetMobilesInRange( p, 0 );
foreach ( Mobile mob in eable )
{
if ( mob is BaseQuester )
{
int delta = mob.Z - p.Z;
if ( delta >= -12 && delta <= 12 )
m_Queue.Enqueue( mob );
}
}
eable.Free();
while ( m_Queue.Count > 0 )
((Mobile)m_Queue.Dequeue()).Delete();
return false;
}
示例3: Explode
public void Explode( bool direct, Point3D loc, Map map)
{
if (Deleted)
return;
Delete();
if (map == null)
return;
Effects.PlaySound(loc, map, 0x207);
for (int i = 0; i < 20; i++)
{
Point3D temp1 = new Point3D(loc.X, loc.Y, (loc.Z + i));
Effects.SendLocationEffect(temp1, map, 0x3709, 60);
}
IPooledEnumerable eable = LeveledExplosion ? map.GetObjectsInRange(loc, ExplosionRange) : map.GetMobilesInRange(loc, ExplosionRange);
ArrayList toExplode = new ArrayList();
foreach (object o in eable)
{
if (o is Mobile)
{
if(o is ElementalChamp) { }
else
toExplode.Add(o);
}
else if (o is Atomic && o != this)
{
toExplode.Add(o);
}
}
eable.Free();
for (int i = 0; i < toExplode.Count; ++i)
{
object o = toExplode[i];
if (o is Mobile)
{
Mobile m = (Mobile)o;
Spells.SpellHelper.Damage(TimeSpan.FromTicks(0), m, 40);
}
else if (o is Atomic)
{
Atomic pot = (Atomic)o;
pot.Explode( false, pot.GetWorldLocation(), pot.Map);
}
}
if (map != null)
{
for (int x = -8; x <= 8; ++x)
{
for (int y = -8; y <= 8; ++y)
{
double dist = Math.Sqrt(x * x + y * y);
if (dist <= 8)
{
Explotion(loc, map, X + x, Y + y);
}
}
}
}
}
示例4: 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 ) )
{
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
}
}
}
示例5: Explode
public void Explode( Mobile from, bool direct, Point3D loc, Map map )
{
if ( Deleted )
return;
BrotherMaynard.SellBomb = true;
BrotherMaynard.Attempts = BrotherMaynard.Attempts + 1;
Delete();
if ( map == null )
return;
Effects.PlaySound( loc, map, 0x207 );
Effects.SendLocationEffect( loc, map, 0x36BD, 20 );
ArrayList list = new ArrayList();
foreach ( Mobile m in map.GetMobilesInRange( loc, 2 ) )
{
if ( m is BigTeethRabbit )
{
list.Add( m );
}
}
foreach ( Mobile m in list )
{
m.Kill();
}
}
示例6: 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 );
}
// Add delay
AddDelay( from );
// Effects
Effects.PlaySound( loc, map, 0x207 );
EffectCircle( loc, map, Radius );
foreach ( Mobile mobile in map.GetMobilesInRange( loc, Radius ) )
{
if ( mobile is BaseCreature )
{
BaseCreature mon = (BaseCreature) mobile;
mon.Pacify( from, DateTime.Now + TimeSpan.FromSeconds( 5.0 ) ); // TODO check
}
}
}
示例7: CheckForMobileVictims
public void CheckForMobileVictims( Point3D location, Map map, BombBag sourcebag )
{
IPooledEnumerable ie = map.GetMobilesInRange( location, 0 );
List<Mobile> 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!" );
//handle scoring
BoardGameData.ChangeScore( GameName, sourcebag.Owner, BombermanSettings.KILL_SCORE );
BoardGameData.ChangeScore( GameName, m, BombermanSettings.DEATH_SCORE );
BoardGameData.AddLose( GameName, m );
}
else
{
m.SendMessage( "You just blew yourself up!!" );
BoardGameData.ChangeScore( GameName, m, BombermanSettings.SUICIDE_SCORE );
}
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 );
BombBag 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 ) );
}
示例8: CheckHint
private void CheckHint(Map map)
{
IPooledEnumerable eable = map.GetMobilesInBounds(new Rectangle2D(735, 2135, 24, 24));
foreach (Mobile m in eable)
{
if (m is BaseVendor)
{
IPooledEnumerable players = map.GetMobilesInRange(m.Location, 3);
foreach (Mobile player in players)
{
if (player is PlayerMobile && ((PlayerMobile)player).NpcGuild == NpcGuild.RangersGuild && !player.Hidden)
{
GiveHint(player, m);
eable.Free();
players.Free();
return;
}
}
players.Free();
}
}
eable.Free();
}
示例9: 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.SendLocationParticles( EffectItem.Create( loc, map, EffectItem.DefaultDuration ), 0x36B0, 1, 14, 63, 7, 9915, 0 );
Effects.PlaySound( loc, map, 0x229 );
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 BasePoisonExplosionPotion && o != this )
{
toExplode.Add( o );
}
}
eable.Free();
for ( int i = 0; i < toExplode.Count; ++i )
{
object o = toExplode[i];
if ( o is Mobile )
{
Mobile m = (Mobile)o;
if ( from == null || (SpellHelper.ValidIndirectTarget( from, m ) && from.CanBeHarmful( m, false )) )
{
if ( from != null )
from.DoHarmful( m );
int level = 0;
if( this.PotionEffect == PotionEffect.ExplosionLesser )
{
level = 1;
}
else if ( this.PotionEffect == PotionEffect.Explosion )
{
level = 2;
}
else if ( this.PotionEffect == PotionEffect.ExplosionGreater )
{
level = 3;
}
m.ApplyPoison( from, Poison.GetPoison(level) );
}
}
else if ( o is BasePoisonExplosionPotion )
{
BasePoisonExplosionPotion pot = (BasePoisonExplosionPotion)o;
pot.Explode( from, false, pot.GetWorldLocation(), pot.Map );
}
}
}
示例10: 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( TarEffect ), 270, 90 );
Timer.DelayCall( TimeSpan.FromSeconds( 1 ), new TimerStateCallback( CircleEffect2 ), new object[] { loc, map } );
foreach ( Mobile mobile in map.GetMobilesInRange( loc, Radius ) )
{
if ( mobile != from )
{
if ( mobile is PlayerMobile )
{
PlayerMobile player = (PlayerMobile) mobile;
player.SendLocalizedMessage(1095151);
}
mobile.Send( SpeedControl.WalkSpeed );
Timer.DelayCall(TimeSpan.FromMinutes(1.0), delegate()
{
mobile.Send( SpeedControl.Disable );
});
}
}
}
示例11: Explode
public void Explode( Mobile from, bool direct, Point3D loc, Map map )
{
PBGrenade nade = this;
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.Nade == this )
Target.Cancel( m );
}
if ( map == null )
return;
Effects.PlaySound( loc, map, 0x207 );
Effects.SendLocationEffect( loc, map, 0x36BD, 35, this.Hue, 0 );
int alchemyBonus = 0;
if ( direct )
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 PBGrenade && o != this )
{
toExplode.Add( o );
}
}
eable.Free();
for ( int i = 0; i < toExplode.Count; ++i )
{
object o = toExplode[i];
if ( o is Mobile )
{
Mobile m = (Mobile)o;
if ( from == null || (SpellHelper.ValidIndirectTarget( from, m ) && from.CanBeHarmful( m, false )) )
{
if ( from != null )
//from.DoHarmful( m );
if ( m_PBGI.Players.Contains(m) || m_PBGI.NpcPlayers.Contains(m) )
{
DoDamage( nade, from, m );
}
else
{
from.SendMessage( "You cannot attack someone that is not playing!" );
m.SendMessage( "You are not playing Paintball, please leave the area." );
}
/*
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 PBGrenade )
{
PBGrenade pot = (PBGrenade)o;
pot.Explode( from, false, pot.GetWorldLocation(), pot.Map );
}
else
{
DoDamage( nade, from );
}
}
}
示例12: Explode
public void Explode( Mobile from, bool direct, Point3D loc, Map map )
{
if ( Deleted )
return;
Delete();
if ( map == null )
return;
Effects.PlaySound( loc, map, 0x207 );
Effects.SendLocationEffect( loc, map, 0x36BD, 20 );
ArrayList list = new ArrayList();
foreach ( Mobile m in map.GetMobilesInRange( loc, 0 ) )
{
if ( m is HojanKing )
{
list.Add( m );
}
}
foreach ( Mobile m in list )
{
m.Kill();
}
}
示例13: FindMobiles
public List<Mobile> FindMobiles(Mobile shooter, Point3D pnt, Map map, bool player, bool pet, bool monsters, bool seacreature)
{
List<Mobile> list = new List<Mobile>();
if (map == null || map == Map.Internal || m_Galleon == null)
return list;
IPooledEnumerable eable = map.GetMobilesInRange(pnt, 0);
foreach (Mobile mob in eable)
{
if (!shooter.CanBeHarmful(mob, false) || m_Galleon.Contains(mob))
continue;
if (player && mob is PlayerMobile)
list.Add(mob);
if (monsters && mob is BaseCreature && !((BaseCreature)mob).Controlled && !((BaseCreature)mob).Summoned)
list.Add(mob);
if (pet && mob is BaseCreature && (((BaseCreature)mob).Controlled || ((BaseCreature)mob).Summoned))
list.Add(mob);
if (seacreature && mob is BaseSeaChampion)
list.Add(mob);
}
eable.Free();
return list;
}
示例14: 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;
}
示例15: Explode
public void Explode( Mobile from, bool direct, Point3D loc, Map map )
{
if ( Deleted )
return;
Delete();
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;
}
IPooledEnumerable eable = LeveledExplosion ? map.GetObjectsInRange( loc, m_ExplosionRange ) : map.GetMobilesInRange( loc, m_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 BombPotion && o != this )
{
toExplode.Add( o );
}
}
eable.Free();
foreach ( KeyValuePair<CustomEffect, int> kvp in Effects )
{
CustomPotionEffect effect = CustomPotionEffect.GetEffect( kvp.Key );
if ( effect != null )
effect.OnExplode( from, this, kvp.Value, loc, map );
}
Point3D eye = new Point3D( loc );
eye.Z += 14;
for ( int i = 0; i < toExplode.Count; ++i )
{
object o = toExplode[i];
if ( o is Mobile )
{
Mobile m = (Mobile)o;
Point3D target = new Point3D( m.Location );
target.Z += 14;
if ( from == null || (SpellHelper.ValidIndirectTarget( from, m ) && from.CanBeHarmful( m, false )) )
{
if ( o != null && map.LineOfSight( eye, target ) )
{
foreach ( KeyValuePair<CustomEffect, int> kvp in Effects )
{
CustomPotionEffect effect = CustomPotionEffect.GetEffect( kvp.Key );
if ( effect != null )
effect.ApplyEffect( m, from, kvp.Value, this );
}
}
}
}
else if ( o is BombPotion )
{
BombPotion pot = (BombPotion)o;
Point3D target = new Point3D( pot.Location );
target.Z += 14;
if ( o != null && map.LineOfSight( eye, target ) )
pot.Explode( from, false, pot.GetWorldLocation(), pot.Map );
}
}
}