Exemplo n.º 1
0
            public virtual void ExplodingTarPotionEffect_Callback(object state)
            {
                object[] states = (object[])state;
                Point3D  p      = new Point3D((IPoint3D)states[0]);
                Mobile   from   = (Mobile)states[1];
                Map      map    = (Map)states[2];

                var eable = map.GetMobilesInRange(p, ExplosionRange);

                int           toAffect = 0;
                List <Mobile> toSleep  = new List <Mobile>();

                foreach (Mobile m in eable)
                {
                    if (m.Alive && m != from && Notoriety.Compute(from, m) != Notoriety.Innocent)
                    {
                        toSleep.Add(m);
                        ++toAffect;
                    }
                }


                if (toAffect > 0)
                {
                    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 (Mobile m in toSleep)
                    {
                        if (CheckSleep(from, m))
                        {
                            SpellHelper.Turn(from, m);
                            DoSleep(from, m);
                        }
                    }
                }
                else
                {
                    if (from is PlayerMobile)
                    {
                        ((PlayerMobile)from).NextDrinkExplodingTarPotion = TimeSpan.Zero;
                    }
                }

                m_Potion.Consume();
            }
Exemplo n.º 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();
            }