Exemple #1
0
        public virtual void Explode(Mobile from, Point3D loc, Map map)
        {
            double PoisonChance = .1;

            if (Deleted || map == null)
            {
                return;
            }

            Consume();

            // Check if any other players are using this potion
            for (int i = 0; i < m_Users.Count; i++)
            {
                ThrowTarget targ = m_Users[i].Target as ThrowTarget;

                if (targ != null && targ.Potion == this)
                {
                    Target.Cancel(from);
                }
            }

            // Effects
            Effects.PlaySound(loc, map, 0x207);

            Geometry.Circle2D(loc, map, Radius, new DoEffect_Callback(BlastEffect), 270, 90);

            Timer.DelayCall(TimeSpan.FromSeconds(0.3), new TimerStateCallback(CircleEffect2), new object[] { loc, map });

            foreach (Mobile mobile in map.GetMobilesInRange(loc, Radius))
            {
                if (mobile is BaseCreature)
                {
                    BaseCreature mon = (BaseCreature)mobile;

                    if (mon.Controlled || mon.Summoned)
                    {
                        continue;
                    }

                    mon.Pacify(from, DateTime.UtcNow + TimeSpan.FromSeconds(5.0));                         // TODO check
                    if (Poison != null)
                    {
                        PoisonChance  = 10;
                        PoisonChance += ((from.Skills[SkillName.Poisoning].Value + from.Skills[SkillName.Alchemy].Value + from.Skills[SkillName.TasteID].Value) / 333);
                        if (PoisonChance > Utility.RandomDouble())
                        {
                            mon.ApplyPoison(Poisoner, Poison);
                        }
                    }
                }
            }
        }