Exemple #1
0
            private static void ConvertTileBox_Callback(Mobile from, Map map, Point3D start, Point3D end, object state)
            {
                Rectangle2D rect     = new Rectangle2D(start.X, start.Y, end.X - start.X + 1, end.Y - start.Y + 1);
                ArrayList   toDelete = new ArrayList();

                int staticTotal   = 0;
                int nostaticTotal = 0;

                foreach (object item in map.GetObjectsInBounds(rect))
                {
                    if (item is Static && !(item is BreakableTile))
                    {
                        Static oldtile = ( Static )item;

                        BreakableTile tile = new BreakableTile(oldtile.ItemID);
                        tile.Hue  = oldtile.Hue;
                        tile.Name = oldtile.Name;

                        tile.MoveToWorld(oldtile.Location, oldtile.Map);
                        toDelete.Add(oldtile);

                        staticTotal++;
                    }
                    else if (item is Item)
                    {
                        nostaticTotal++;
                    }
                }

                for (int i = 0; i < toDelete.Count; i++)
                {
                    (( Item )toDelete[i]).Delete();
                }

                from.SendMessage("There were {0} total items found. {0} items were converted.", nostaticTotal + staticTotal, staticTotal);
            }
Exemple #2
0
        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);
            AbilityCollection.AreaEffect(TimeSpan.FromSeconds(0.1), TimeSpan.FromSeconds(0.2), .05, map, loc, 0x36BD, 10, 0, 0);

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

            int toDamage = 0;

            foreach (object o in eable)
            {
                if (o is Mobile)
                {
                    toExplode.Add(o);
                    ++toDamage;
                }
                else if (o is BreakableTile)
                {
                    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);
                        }
                        double distance = m.GetDistanceToSqrt(loc);
                        double falloff  = (100 - (10 * distance)) * .01;
                        int    damage   = (int)(200 * falloff);
                        AOS.Scale(damage, (100 - (int)(10 * distance)));

                        AOS.Damage(m, from, damage, 0, 100, 0, 0, 0);
                    }
                }
                else if (o is BreakableTile)
                {
                    // *** Modified by Valik for Breakable Wall/Floor tiles
                    BreakableTile bt = (BreakableTile)o;
                    bt.Damage(PotionEffect.ExplosionGreater);
                }
            }
        }
Exemple #3
0
 public InternalTimer(TimeSpan delay, BreakableTile tile)
     : base(delay)
 {
     Priority = TimerPriority.OneSecond;
     m_Tile   = tile;
 }
        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);
            from.EndAction(typeof(ExplosionPotion));
            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 BaseExplosionPotion && o != this)
                {
                    toExplode.Add(o);
                }
                else if (o is BreakableTile)
                {
                    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 || (SpellHelper.ValidIndirectTarget(from, m) && from.CanBeHarmful(m, false)))
                    {
                        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;
                        //m.Damage(damage, from);
                        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 BreakableTile)
                {
                    // *** Modified by Valik for Breakable Wall/Floor tiles
                    BreakableTile bt = ( BreakableTile )o;
                    bt.Damage(PotionEffect);
                }
            }
        }