Exemplo n.º 1
0
            public InternalTimer(LavaField LavaField, Mobile owner, double intervalDuration, int maxIntervals, int minDamage, int maxDamage, bool hitOwner, bool hitMonsters, bool hitPlayers, int hitSound)
                : base(TimeSpan.FromSeconds(0), TimeSpan.FromSeconds(intervalDuration))
            {
                Priority = TimerPriority.TwoFiftyMS;

                m_LavaField = LavaField;

                m_Owner = owner;

                m_IntervalDuration = intervalDuration;
                m_MaxIntervals     = maxIntervals;
                m_MinDamage        = minDamage;
                m_MaxDamage        = maxDamage;

                m_HitOwner    = hitOwner;
                m_HitMonsters = hitMonsters;
                m_HitPlayers  = hitPlayers;

                if (hitSound != -1)
                {
                    m_HitSound = hitSound;
                }
            }
Exemplo n.º 2
0
        public void Detonate()
        {
            Point3D location = Location;
            Map     map      = Map;

            if (!SpecialAbilities.Exists(m_Owner))
            {
                return;
            }

            Mobile owner = m_Owner;

            Effects.PlaySound(Location, Map, 0x306);

            int radius   = m_Radius;
            int minRange = radius * -1;
            int maxRange = radius;

            int minDamage = m_MinDamage;
            int maxDamage = m_MaxDamage;

            for (int a = minRange; a < maxRange + 1; a++)
            {
                for (int b = minRange; b < maxRange + 1; b++)
                {
                    Point3D newPoint = new Point3D(location.X + a, location.Y + b, location.Z);
                    newPoint.Z = map.GetSurfaceZ(newPoint, 30);

                    int distance = Utility.GetDistance(location, newPoint);

                    double effectChance = .95 - ((double)distance * .05);

                    if (Utility.RandomDouble() > effectChance)
                    {
                        continue;
                    }

                    Timer.DelayCall(TimeSpan.FromSeconds(distance * .10), delegate
                    {
                        int impactItemId = 0x3709;
                        int impactHue    = 2074;

                        if (Utility.RandomDouble() <= .75)
                        {
                            LavaField lavaField = new LavaField(null, 0, 1, m_LavaDuration, m_LavaMinDamage, m_LavaMaxDamage, false, false, true, -1, true);
                            lavaField.MoveToWorld(newPoint, map);
                        }

                        else
                        {
                            Effects.PlaySound(newPoint, map, 0x5CF);
                            Effects.SendLocationParticles(EffectItem.Create(newPoint, map, EffectItem.DefaultDuration), impactItemId, 20, 20, impactHue, 0, 0, 0);

                            IPooledEnumerable mobilesOnTile = map.GetMobilesInRange(newPoint, 0);

                            if (!SpecialAbilities.Exists(owner))
                            {
                                return;
                            }

                            Queue m_Queue = new Queue();

                            foreach (Mobile mobile in mobilesOnTile)
                            {
                                if (m_Owner == mobile)
                                {
                                    continue;
                                }
                                if (!SpecialAbilities.MonsterCanDamage(m_Owner, mobile))
                                {
                                    continue;
                                }

                                m_Queue.Enqueue(mobile);
                            }

                            mobilesOnTile.Free();

                            while (m_Queue.Count > 0)
                            {
                                double damage = Utility.RandomMinMax(minDamage, maxDamage);

                                Mobile mobile = (Mobile)m_Queue.Dequeue();

                                if (mobile is BaseCreature)
                                {
                                    damage *= 2;
                                }

                                int finalDamage = (int)(Math.Round((double)damage));

                                new Blood().MoveToWorld(mobile.Location, mobile.Map);
                                AOS.Damage(mobile, m_Owner, finalDamage, 100, 0, 0, 0, 0);
                            }
                        }
                    });
                }
            }

            Delete();
        }