Exemplo n.º 1
0
            protected override void OnTarget(Mobile from, object targeted)
            {
                if (m_Potion != null && !m_Potion.Deleted && m_Potion.Map != Map.Internal)
                {
                    var mob = targeted as Mobile;
                    var p   = targeted as IPoint3D;

                    if (p != null)
                    {
                        Map map = from.Map;

                        if (map != null)
                        {
                            SpellHelper.GetSurfaceTop(ref p);

                            from.RevealingAction();

                            IEntity to = new Entity(Serial.Zero, new Point3D(p), map);

                            if (RelativeLocation && mob != null)
                            {
                                to = mob;
                            }

                            Effects.SendMovingEffect(from, to, m_Potion.ItemID, 7, 0, false, false, m_Potion.Hue, 0);

                            var entity = targeted as IEntity;
                            if (XmlScript.HasTrigger(entity, TriggerName.onTargeted) &&
                                UberScriptTriggers.Trigger(entity, from, TriggerName.onTargeted, m_Potion))
                            {
                                Effects.PlaySound(p, map, 0x307);
                                Effects.SendLocationEffect(p, map, 0x36BD, 9, 10, 0, 0);
                                m_Potion.Consume();
                                return;
                            }

                            if (m_Potion.Amount > 1)
                            {
                                Mobile.LiftItemDupe(m_Potion, 1);
                            }

                            m_Potion.Internalize();
                            Timer.DelayCall(TimeSpan.FromSeconds(1.0), m_Potion.Reposition_OnTick, new[] { from, to });
                        }
                    }
                }
            }