Example #1
0
            protected override void OnTarget(Mobile from, object targeted)
            {
                if (m_Potion.Deleted || m_Potion.Map == Map.Internal)
                {
                    return;
                }

                IPoint3D p = targeted as IPoint3D;
                Point3D  d = new Point3D(p);

                if (p == null || from.Map == null)
                {
                    return;
                }

                SpellHelper.GetSurfaceTop(ref p);

                int nThrown = 1;

                if (from.GetDistanceToSqrt(d) > 8)
                {
                    nThrown = 0;
                    from.SendMessage("That is too far away.");
                }
                else if (!from.CanSee(d))
                {
                    nThrown = 0;
                    from.SendLocalizedMessage(500237);                       // Target can not be seen.
                }
                else if ((from.Paralyzed || from.Blessed || from.Frozen || (from.Spell != null && from.Spell.IsCasting)))
                {
                    nThrown = 0;
                    from.SendMessage("You cannot do that yet.");
                }
                else
                {
                    string jar = m_Potion.Name;
                    if (jar.Contains("flask of "))
                    {
                        jar = jar.Replace("flask of ", "");
                    }
                    int glow = 0; if (m_Potion.Weight == 2.0)
                    {
                        glow = 1;
                    }
                    MonsterSplatter.AddSplatter(p.X, p.Y, p.Z, from.Map, d, from, jar, m_Potion.Hue, glow);
                }

                if (nThrown > 0)
                {
                    from.RevealingAction();
                    m_Potion.Name   = "crystalline flask";
                    m_Potion.Hue    = 0;
                    m_Potion.Weight = 1.0;
                }
            }
            protected override void OnTarget(Mobile from, object targeted)
            {
                if (m_Potion.Deleted || m_Potion.Map == Map.Internal)
                {
                    return;
                }

                IPoint3D p = targeted as IPoint3D;
                Point3D  d = new Point3D(p);

                if (p == null || from.Map == null)
                {
                    return;
                }

                SpellHelper.GetSurfaceTop(ref p);

                int nThrown = 1;

                if (from.GetDistanceToSqrt(d) > 8)
                {
                    nThrown = 0;
                    from.SendMessage("That is too far away.");
                }
                else if (!from.CanSee(d))
                {
                    nThrown = 0;
                    from.SendLocalizedMessage(500237);                       // Target can not be seen.
                }
                else if ((from.Paralyzed || from.Blessed || from.Frozen || (from.Spell != null && from.Spell.IsCasting)))
                {
                    nThrown = 0;
                    from.SendMessage("You cannot do that yet.");
                }
                else
                {
                    MonsterSplatter.AddSplatter(p.X, p.Y, p.Z, from.Map, d, from, m_Potion.Name, 0x4F8, 0);
                }

                if (nThrown > 0)
                {
                    from.RevealingAction();
                    m_Potion.Consume();
                    from.AddToBackpack(new Bottle());
                    Misc.Titles.AwardKarma(from, -40, true);
                }
            }