コード例 #1
0
        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.Grenade == this)
                {
                    Target.Cancel(m);
                }
            }

            if (map == null)
            {
                return;
            }

            Effects.PlaySound(loc, map, 0x307);

            Effects.SendLocationEffect(loc, map, 0x36B0, 9, 10, 0, 0);

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

            eable.Free();

            int min = 60;
            int max = 90;

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

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

                    pot.Explode(from, false, pot.GetWorldLocation(), pot.Map);
                }
            }
        }
コード例 #2
0
 public ThrowTarget(PlasmaGrenade grenade) : base(12, true, TargetFlags.None)
 {
     m_Grenade = grenade;
 }