Server.Effects.SendBoltEffect C# (CSharp) Méthode

SendBoltEffect() public static méthode

public static SendBoltEffect ( IEntity e, bool sound, int hue ) : void
e IEntity
sound bool
hue int
Résultat void
		public static void SendBoltEffect( IEntity e, bool sound, int hue )
		{
			Map map = e.Map;

			if ( map == null )
				return;

			e.ProcessDelta();

			Packet preEffect = null, boltEffect = null, playSound = null;

			IPooledEnumerable eable = map.GetClientsInRange( e.Location );

			foreach ( NetState state in eable )
			{
				if ( state.Mobile.CanSee( e ) )
				{
					if ( SendParticlesTo( state ) )
					{
						if ( preEffect == null )
							preEffect = Packet.Acquire( new TargetParticleEffect( e, 0, 10, 5, 0, 0, 5031, 3, 0 ) );

						state.Send( preEffect );
					}

					if ( boltEffect == null )
						boltEffect = Packet.Acquire( new BoltEffect( e, hue ) );

					state.Send( boltEffect );

					if ( sound )
					{
						if ( playSound == null )
							playSound = Packet.Acquire( new PlaySound( 0x29, e ) );

						state.Send( playSound );
					}
				}
			}

			Packet.Release( preEffect );
			Packet.Release( boltEffect );
			Packet.Release( playSound );

			eable.Free();
		}

Same methods

Effects::SendBoltEffect ( IEntity e ) : void
Effects::SendBoltEffect ( IEntity e, bool sound ) : void

Usage Example

Exemple #1
0
        /* Echo Strike
         * The Dark Knight teleports to one of the platforms in
         * the room, and calls down lightning several times to
         * strike you or your pets. The lightning is slightly
         * displaced, allowing you a chance to escape, or even
         * give him a taste of his own medicine.
         */

        public static void EchoStrike(Mobile from, int min, int max)
        {
            from.Paralyze(TimeSpan.FromSeconds(1));
            from.Animate(17, 5, 1, true, false, 0);

            List <Mobile>     mobiles = new List <Mobile>();
            Point3D           point;
            IPooledEnumerable eable = from.GetMobilesInRange(14);

            foreach (Mobile m in eable)
            {
                if (m != from && CanTarget(from, m, true, false, false))
                {
                    mobiles.Add(m);
                }
            }
            eable.Free();

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

                if (Utility.Random(5) == 0)
                {
                    Effects.SendBoltEffect(m);
                    AOS.Damage(m, from, Utility.RandomMinMax(min, max), 0, 0, 0, 0, 100);
                    m.SendMessage("You get hit by a lightning bolt");
                }
                else
                {
                    point = RandomCloseLocation(from, 1);

                    if (from.Location == point)
                    {
                        AOS.Damage(from, from, Utility.RandomMinMax(min, max), 0, 0, 0, 0, 100);
                        Effects.SendBoltEffect(from);
                    }
                    else
                    {
                        Effects.SendBoltEffect(new Entity(Serial.Zero, point, from.Map));
                    }
                }
            }
        }
All Usage Examples Of Server.Effects::SendBoltEffect