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();
        }
Exemple #2
0
        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 if (CheckSequence())
            {
                Mobile source = Caster;

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

                source.MovingParticles(pot, 0x36D4, 7, 0, false, true, 9502, 4019, 0x160);
                source.PlaySound(Sound);
            }

            FinishSequence();
        }
 public ThrowTarget(BaseExplosionPotion potion)
     : base(12, true, TargetFlags.None)
 {
     this.m_Potion = potion;
 }
        public void Explode(Mobile from, bool direct, Point3D loc, Map map)
        {
            if (this.Deleted)
            {
                return;
            }

            this.Consume();

            for (int i = 0; this.m_Users != null && i < this.m_Users.Count; ++i)
            {
                Mobile      m    = (Mobile)this.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 / (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 && (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 = Scale(from, this.MinDamage);
            int max = Scale(from, this.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 (!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 BaseExplosionPotion)
                {
                    BaseExplosionPotion pot = (BaseExplosionPotion)o;

                    pot.Explode(from, false, pot.GetWorldLocation(), pot.Map);
                }
            }
        }
 public ThrowTarget( BaseExplosionPotion potion )
     : base(12, true, TargetFlags.None)
 {
     m_Potion = potion;
 }
Exemple #6
0
        public void Explode(Mobile from, bool direct, Point3D loc, Map map)
        {
            if (Deleted)
            {
                return;
            }

            Consume();

            ThrowTarget targ = from.Target as ThrowTarget;

            if (targ != null && targ.Potion == this)               //Blew yourself up without throwing it, cancel target now
            {
                Target.Cancel(from);
            }

            if (map == null)
            {
                return;
            }

            Effects.PlaySound(loc, map, 0x307);
            Effects.SendLocationEffect(loc, map, 0x36BD, 9, 10, 0, 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 (IEntity 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 = Scale( from, MinDamage );
//			int max = Scale( from, MaxDamage );

            for (int i = 0; i < toExplode.Count; ++i)
            {
                object o = toExplode[i];

                if (o is Mobile)
                {
                    Mobile m = (Mobile)o;

                    if (from != null)
                    {
                        if (from != null)
                        {
                            from.DoHarmful(m);
                        }

                        int damage = Scale(from, Damage);

                        damage += alchemyBonus;

                        if (/*!Core.AOS &&*/ damage > 40)
                        {
                            damage = 40;
                        }

                        if (/*Core.AOS &&*/ toDamage > 2)
                        {
                            damage /= toDamage - 1;
                        }

                        if (from is PlayerMobile)
                        {
                            damage /= 2;
                        }

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

                    pot.Explode(from, false, pot.GetWorldLocation(), pot.Map);
                }
            }
        }
        public void Explode(Mobile from, Point3D loc, Map map)
        {
            if (Deleted)
            {
                return;
            }

            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, 0x207);
            Effects.SendLocationEffect(loc, map, 0x36BD, 20);

            IPooledEnumerable eable     = map.GetObjectsInRange(loc, ExplosionRange);
            ArrayList         toExplode = new ArrayList();

            foreach (object o in eable)
            {
                if (o is Mobile)
                {
                    toExplode.Add(o);
                    AddPotions(((Mobile)o).Backpack, toExplode);
                }
                else if (o is Item)
                {
                    if (o is BaseExplosionPotion && o != this)
                    {
                        toExplode.Add(o);
                    }
                    else if (((Item)o).Items.Count > 0)
                    {
                        AddPotions((Item)o, toExplode);
                    }
                }
            }

            eable.Free();

            int min = Scale(from, MinDamage);
            int max = Scale(from, MaxDamage);

            for (int j = 0; j < toExplode.Count; j++)
            {
                object o = toExplode[j];

                if (o is Mobile)
                {
                    Mobile m = (Mobile)o;

                    int dist = (int)m.GetDistanceToSqrt(loc);
                    if (dist > ExplosionRange)
                    {
                        continue;
                    }

                    if (from == null || from.CanBeHarmful(m, false))
                    {
                        if (from != null)
                        {
                            from.DoHarmful(m);
                        }
                        m.Damage((int)(Utility.RandomMinMax(min, max) * 3.0 / 4.0));
                    }
                }
                else if (o is BaseExplosionPotion)
                {
                    BaseExplosionPotion pot = (BaseExplosionPotion)o;

                    //pot.Explode( from, false, pot.GetWorldLocation(), pot.Map );
                    if ((pot.m_Timer == null || !pot.m_Timer.Running) && !pot.Deleted)
                    {
                        Point3D pp = pot.GetWorldLocation();
                        int     x, y, z;
                        double  val;
                        x = pp.X - loc.X;
                        y = pp.Y - loc.Y;
                        z = pp.Z - loc.Z;

                        if (x == 0 && y == 0 && z == 0)
                        {
                            val = 0;
                        }
                        else
                        {
                            val = Math.Sqrt(x * x + y * y);
                            val = Math.Sqrt(val * val + z * z);
                        }

                        if ((int)val <= ExplosionRange)
                        {
                            val += Utility.Random(4);
                            if (val < 1)
                            {
                                val = 0;
                            }

                            pot.m_Timer = Timer.DelayCall(TimeSpan.FromSeconds(0.75), TimeSpan.FromSeconds(1.0), ((int)val) + 1, new TimerStateCallback(pot.Detonate_OnTick), new object[] { from, ((int)val) });
                        }
                    }
                }
            }

            Delete();
        }
        public void Explode(Mobile from, bool direct, Point3D loc, Map map)
        {
            if (Deleted)
            {
                return;
            }

            // if the potion is exploded in your backpack, you are flagged as a SuicideBomber
            //	guards will cast InvisibleShield on you to nerf the bombs potential
            if (InTown(from) && (from.Holding == this || this.IsChildOf(from.Backpack)))
            {                   // reset the timer
                from.SuicideBomber = false;
                from.ConvictSuicideBomber(TimeSpan.FromMinutes(2.0));
                SetFlag(PotFlags.InBackpack);
            }

            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;
            }

            Effects.PlaySound(loc, map, 0x207);
            Effects.SendLocationEffect(loc, map, 0x36BD, 20);

            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 IPoint3D)
                {
                    IPoint3D i = o as IPoint3D;
                    if (Math.Abs(i.Z - this.Z) > ExplosionRange * 8)
                    {
                        continue;
                    }
                }

                if (o is Mobile)
                {
                    toExplode.Add(o);
                    ++toDamage;
                }
                else if (o is BaseExplosionPotion && o != this)
                {
                    toExplode.Add(o);
                }
            }

            eable.Free();

            int min = Scale(from, MinDamage);
            int max = Scale(from, MaxDamage);

            //	a guard cast InvisibleShield on you since you're flagged as a SuicideBomber and the potion is in your backpack
            // the damage will be limited to you, others will take min damage
            if (from.InvisibleShield && GetFlag(PotFlags.InBackpack))
            {
                from.SendMessage("The invisible shield muffles the explosion.");
            }
            // guards have the ability to disarm the the potion if your skills are poor
            else if (IsGuardAttacking(from) && GetFlag(PotFlags.InBackpack) && !(ChanceBasedOnAbility(from) >= Utility.RandomDouble()))
            {
                SetFlag(PotFlags.Dud1pt);
                from.SendMessage("The guard reaches into your backpack and partially disables the potion.");
            }

            for (int i = 0; i < toExplode.Count; ++i)
            {
                object o = toExplode[i];

                if (o is Mobile)
                {
                    Mobile m = (Mobile)o;

                    // wea: added parameter to CanBeHarmful() check to allow harm after the
                    // death of the potion thrower
                    bool ignoreOurDeadness = ChanceBasedOnAbility(from) >= Utility.RandomDouble();
                    if (from == null || (SpellHelper.ValidIndirectTarget(from, m) && from.CanBeHarmful(m, false, false, ignoreOurDeadness)))
                    {
                        if (from != null)
                        {
                            from.DoHarmful(m);
                        }

                        int damage = Utility.RandomMinMax(min, max);

                        damage += alchemyBonus;

                        if (!Core.AOS && damage > 40)
                        {
                            damage = 40;
                        }
                        else if (Core.AOS && toDamage > 2)
                        {
                            damage /= toDamage - 1;
                        }

                        //	a guard cast InvisibleShield on you since you're flagged as a SuicideBomber and the potion is in your backpack
                        // the damage will be limited to you, others will take min damage
                        if (m != from && from.InvisibleShield && GetFlag(PotFlags.InBackpack))
                        {
                            damage = 1;
                        }

                        // it's a dud (probably because a guard is on you and batted it away to some random spot.)
                        if (GetFlag(PotFlags.Dud1pt) == true)
                        {
                            damage = 1;
                        }

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

                    pot.Explode(from, false, pot.GetWorldLocation(), pot.Map);
                }
            }
        }
Exemple #9
0
            private void Explode(Mobile from, Point3D loc, Map map)
            {
                if (map == null)
                {
                    return;
                }

                Effects.PlaySound(loc, map, 0x207);
                Effects.SendLocationEffect(loc, map, 0x36BD, 20);
                IPooledEnumerable eable     = map.GetObjectsInRange(loc, 2);
                ArrayList         toExplode = new ArrayList();

                foreach (object o in eable)
                {
                    if (o is Mobile)
                    {
                        toExplode.Add(o);
                    }
                    else if (o is BaseExplosionPotion && o != this)
                    {
                        toExplode.Add(o);
                    }
                }

                eable.Free();
                int d = 0;

                for (int i = 0; i < toExplode.Count; ++i)
                {
                    object o = toExplode[i];

                    if (o is Mobile)
                    {
                        Mobile m = (Mobile)o;
                        if (m.InRange(loc, 0))
                        {
                            d = 1;
                        }
                        else if (m.InRange(loc, 1))
                        {
                            d = 2;
                        }
                        else if (m.InRange(loc, 2))
                        {
                            d = 3;
                        }
                        if (from == null || (SpellHelper.ValidIndirectTarget(from, m) && from.CanBeHarmful(m, false)))
                        {
                            if (from != null)
                            {
                                from.DoHarmful(m);
                            }

                            int damage = Utility.RandomMinMax((60 / d), (80 / d));

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

                        pot.Explode(from, false, pot.GetWorldLocation(), pot.Map);
                    }
                }
            }
        public void Explode(Mobile from, bool direct, Point3D loc, Map map)
        {
            if (Deleted)
            {
                return;
            }

            // 12/8/13 Xiani - Nullifying an explosion when in an ArenaRegion.

            //TEST: CHECK THIS
            if (from.CombatProhibited)
            {
                return;
            }

            //TEST: CHECK THIS
            if (!ArenaFight.AllowFreeConsume(from, typeof(BasePotion)))
            {
                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, 0x207);
            Effects.SendLocationEffect(loc, map, 0x36BD, 20);

            int alchemyBonus = 0;

            IPooledEnumerable eable     = LeveledExplosion ? (IPooledEnumerable)map.GetObjectsInRange(loc, ExplosionRange) : (IPooledEnumerable)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 BaseExplosionPotion && o != this)
                {
                    toExplode.Add(o);
                }

                if (o is BreakableContainer)
                {
                    toExplode.Add(o);
                }

                if (o is BreakableStatic)
                {
                    toExplode.Add(o);
                }
            }

            eable.Free();

            int min = Scale(from, MinDamage);
            int max = Scale(from, MaxDamage);

            int baseDamage = Utility.RandomMinMax(min, max);

            for (int i = 0; i < toExplode.Count; ++i)
            {
                object o       = toExplode[i];
                double divisor = 0;

                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 damage = baseDamage;

                        damage += alchemyBonus;

                        if (m is PlayerMobile)
                        {
                            if (m.InRange(loc, 0))
                            {
                                divisor = 1;
                            }
                            else if (m.InRange(loc, 1))
                            {
                                divisor = 2;
                            }
                            else if (m.InRange(loc, 2))
                            {
                                divisor = 4;
                            }

                            damage = (int)(damage / divisor);

                            if (damage > 40)
                            {
                                damage = 40;
                            }
                        }

                        else
                        {
                            damage = (int)((double)damage * CreatureDamageScalar);
                        }

                        AOS.Damage(m, from, damage, 0, 100, 0, 0, 0);
                    }
                }

                else if (o is BaseExplosionPotion)
                {
                    BaseExplosionPotion pot = (BaseExplosionPotion)o;

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

                else if (o is BreakableContainer)
                {
                    BreakableContainer breakableContainer = (BreakableContainer)o;

                    if (breakableContainer.ObjectBreakingDeviceDamageScalar == 0)
                    {
                        continue;
                    }

                    baseDamage = (int)((double)baseDamage * CreatureDamageScalar * breakableContainer.ObjectBreakingDeviceDamageScalar);

                    breakableContainer.ReceiveDamage(from, baseDamage, BreakableContainer.InteractionType.ObjectBreakingDevice);
                }

                else if (o is BreakableStatic)
                {
                    BreakableStatic breakableStatic = (BreakableStatic)o;

                    if (breakableStatic.ObjectBreakingDeviceDamageScalar == 0)
                    {
                        continue;
                    }

                    baseDamage = (int)((double)baseDamage * CreatureDamageScalar * breakableStatic.ObjectBreakingDeviceDamageScalar);

                    breakableStatic.ReceiveDamage(from, baseDamage, BreakableStatic.InteractionType.ObjectBreakingDevice);
                }
            }
        }
        public void Explode(Mobile from, Point3D loc, Map map)
        {
            if (map == null)
            {
                return;
            }

            Effects.PlaySound(loc, map, 0x207);
            Effects.SendLocationEffect(loc, map, 0x36BD, 20);


            IPooledEnumerable eable     = map.GetObjectsInRange(loc, 2);
            ArrayList         toExplode = new ArrayList();

            int toDamage = 0;

            foreach (object o in eable)
            {
                if (o is Mobile)
                {
                    toExplode.Add(o);
                    ++toDamage;
                }
                else if (o is BaseExplosionPotion && o != this)
                {
                    toExplode.Add(o);
                }
                else if (o is ICannonDamage)
                {
                    toExplode.Add(o);
                }
            }

            eable.Free();
            int d      = 0;        // Damage scalar
            int damage = 0;

            for (int i = 0; i < toExplode.Count; ++i)
            {
                object o;
                o = toExplode[i];

                if (o is Mobile)
                {
                    Mobile m = (Mobile)o;
                    if (m.InRange(loc, 0))
                    {
                        d = 1;
                    }
                    else if (m.InRange(loc, 1))
                    {
                        d = 2;
                    }
                    else if (m.InRange(loc, 2))
                    {
                        d = 3;
                    }
                    if (from != null || (SpellHelper.ValidIndirectTarget(from, m) && from.CanBeHarmful(m, false)))
                    {
                        if (from != null)
                        {
                            from.DoHarmful(m);
                        }
                        damage = Utility.RandomMinMax((MinDamage / d), (MaxDamage / d));
                        if (d == 1)
                        {
                            AOS.Damage(m, from, damage, 50, 50, 0, 0, 0);                               // Same tile 50% physical 50% fire
                        }
                        else
                        {
                            AOS.Damage(m, from, damage, 0, 100, 0, 0, 0);                               // 2 tile radius 100% fire damage
                        }
                    }
                }
                else if (o is BaseExplosionPotion)
                {
                    BaseExplosionPotion pot = (BaseExplosionPotion)o;
                    pot.Explode(from, true, pot.GetWorldLocation(), pot.Map);
                }
                else if (o is ICannonDamage)
                {
                    //((ICannonDamage)o).Hits -=  Utility.RandomMinMax(MinDamage/3,MaxDamage/3);
                    ((ICannonDamage)o).Damage(from, Utility.RandomMinMax(MinDamage / 3, MaxDamage / 3));
                }
            }
        }
        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;
            }

            Effects.PlaySound(loc, map, 0x207);
            Effects.SendLocationEffect(loc, map, 0x36BD, 20);

            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 IPoint3D)
                {
                    IPoint3D i = o as IPoint3D;
                    if (Math.Abs(i.Z - this.Z) > ExplosionRange * 8)
                    {
                        continue;
                    }
                }

                if (o is Mobile)
                {
                    toExplode.Add(o);
                    ++toDamage;
                }
                else if (o is BaseExplosionPotion && o != this)
                {
                    toExplode.Add(o);
                }
            }

            eable.Free();

            int min = Scale(from, MinDamage);
            int max = Scale(from, MaxDamage);

            for (int i = 0; i < toExplode.Count; ++i)
            {
                object o = toExplode[i];

                if (o is Mobile)
                {
                    Mobile m = (Mobile)o;

                    // wea: added parameter to CanBeHarmful() check to allow harm after the
                    // death of the potion thrower

                    if (from == null || (SpellHelper.ValidIndirectTarget(from, m) && from.CanBeHarmful(m, false, false, true)))
                    {
                        if (from != null)
                        {
                            from.DoHarmful(m);
                        }

                        int damage = Utility.RandomMinMax(min, max);

                        damage += alchemyBonus;

                        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 BaseExplosionPotion)
                {
                    BaseExplosionPotion pot = (BaseExplosionPotion)o;

                    pot.Explode(from, false, pot.GetWorldLocation(), pot.Map);
                }
            }
        }
Exemple #13
0
        public void Explode(Mobile from, bool direct, Point3D loc, Map map)
        {
            if (Deleted)
            {
                return;
            }

            if (from != null)
            {
                CustomRegion cR  = from.Region as CustomRegion;
                CustomRegion cR2 = Region.Find(loc, map) as CustomRegion;

                if ((cR != null && !cR.Controller.CanUsePotExplosion) || (cR2 != null && !cR2.Controller.CanUsePotExplosion))
                {
                    return;
                }
            }
            else
            {
                CustomRegion cR = Region.Find(loc, map) as CustomRegion;

                if ((cR != null && !cR.Controller.CanUsePotExplosion))
                {
                    return;
                }
            }

            if (!EventItem || (EventItem && EventItemConsume))
            {
                Consume();
            }
            else
            {
                Mobile m;
                if (m_Users != null && m_Users[0] is Mobile)
                {
                    m = (Mobile)m_Users[0];
                }
                else
                {
                    m = from;
                }

                if (m != null && RootParentEntity != m)
                {
                    m.AddToBackpack(this);
                }

                m_Timer = null;
            }

            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, 0x207);
            Effects.SendLocationEffect(loc, map, 0x36BD, 20);

            int alchemyBonus = 0;

            if (direct && from != null)
            {
                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 BaseExplosionPotion && o != this)
                {
                    toExplode.Add(o);
                }
            }

            eable.Free();

            int min   = Scale(from, MinDamage);
            int max   = Scale(from, MaxDamage);
            int count = 1;

            for (int i = 0; i < toExplode.Count; ++i)
            {
                object o = toExplode[i];

                if (o is Mobile)
                {
                    Mobile        m   = (Mobile)o;
                    GuardedRegion reg = (GuardedRegion)Region.Find(m.Location, m.Map).GetRegion(typeof(GuardedRegion));

                    //Taran: Don't hurt mobiles in guarded
                    if (reg == null || reg.Disabled)
                    {
                        if (from != null && from.CanBeHarmful(m, false))
                        {
                            from.DoHarmful(m);

                            int damage = Utility.RandomMinMax(min, max);

                            damage += alchemyBonus;

                            #region Taran - Damage based on AR
                            if (m is PlayerMobile)
                            {
                                int armorRating = (int)((PlayerMobile)m).BaseArmorRatingSpells;

                                damage = (int)(damage * 1.5) - armorRating;

                                if (damage > 49)
                                {
                                    damage = 49;
                                }

                                if (damage < 15)
                                {
                                    damage = 15;
                                }
                            }
                            #endregion

                            /*
                             *          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 BaseExplosionPotion && direct)
                {
                    if (count > 4) //Only explode 5 pots at most including the used one
                    {
                        break;
                    }

                    BaseExplosionPotion pot = (BaseExplosionPotion)o;
                    Mobile m;

                    if (pot.m_Users != null && pot.m_Users[0] is Mobile)
                    {
                        m = (Mobile)pot.m_Users[0];
                    }
                    else
                    {
                        m = from;
                    }

                    pot.Explode(m, false, pot.GetWorldLocation(), pot.Map);

                    count++;
                }
            }
        }