示例#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;

                if (p == null)
                {
                    return;
                }

                Map map = from.Map;

                if (map == null)
                {
                    return;
                }

                SpellHelper.GetSurfaceTop(ref p);

                from.RevealingAction();

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

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

                Timer.DelayCall(TimeSpan.FromSeconds(1.0), new TimerStateCallback(ExplodingTarPotionEffect_Callback), new object[] { p, from, map });

                m_Potion.SetNextDrinkTime(from);
            }
示例#2
0
            private async void DoEffect(Mobile from, IPoint3D p, Map map)
            {
                SpellHelper.GetSurfaceTop(ref p);

                from.RevealingAction();

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

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

                m_Potion.SetNextDrinkTime(from);

                await TimeSpan.FromSeconds(1.0);

                var toSleep = map.GetMobilesInRange(p, ExplosionRange)
                              .Where(m => m.Alive && m != from && Notoriety.Compute(from, m) != Notoriety.Innocent);

                if (toSleep.Any())
                {
                    Effects.PlaySound(p, map, 0x207);
                    Effects.SendLocationParticles(EffectItem.Create(new Point3D(p.X, p.Y, p.Z), from.Map, EffectItem.DefaultDuration), 0x36B0, 1, 14, 0x455, 0x7, 0x26BB, 0);

                    foreach (var m in toSleep.ToArray())
                    {
                        if (CheckSleep(from, m))
                        {
                            SpellHelper.Turn(from, m);
                            DoSleep(from, m);
                        }
                    }
                }
                else
                {
                    if (from is PlayerMobile)
                    {
                        ((PlayerMobile)from).NextDrinkExplodingTarPotion = TimeSpan.Zero;
                    }
                }

                m_Potion.Consume();
            }