Server.Items.BaseExplosionPotion.Explode C# (CSharp) Method

Explode() public method

public Explode ( Server.Mobile from, bool direct, Server.Point3D loc, Server.Map map ) : void
from Server.Mobile
direct bool
loc Server.Point3D
map Server.Map
return void
		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 / 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 && (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 = MinDamage;
			int max = 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 ( damage > 40 )
						damage = 40;

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

					pot.Explode( from, false, pot.GetWorldLocation(), pot.Map );
				}
			}
		}
	}

Usage Example

Example #1
0
		public override bool DelayedDamage{ get{ return false; } }//XUO insta damage

        public void iTarget(BaseExplosionPotion pot) //Taran: When casted on explosion pots they explode
        {
            if (!Caster.CanSee(pot))
                Caster.SendLocalizedMessage(500237); // Target can not be seen.
            else
            {
                Mobile source = Caster;

                pot.Explode(source, true, pot.GetWorldLocation(), pot.Map);

                //pot.FixedParticles(0x3709, 10, 30, 5052, EffectLayer.LeftFoot);
                source.PlaySound(Sound);
            }
            CheckSequence();
            FinishSequence();
        }
All Usage Examples Of Server.Items.BaseExplosionPotion::Explode