Example #1
0
        private void OnTick()
        {
            if (ItemID == 0x122A && m_StartTime + TimeSpan.FromSeconds(30) < DateTime.UtcNow)
            {
                ItemID++;
            }
            else if (m_StartTime + TimeSpan.FromSeconds(35) < DateTime.UtcNow)
            {
                Delete();
                return;
            }

            if (m_Owner == null)
            {
                return;
            }

            if (!Deleted && Map != Map.Internal && Map != null)
            {
                foreach (var m in SpellHelper.AcquireIndirectTargets(m_Owner, Location, Map, 0).OfType <Mobile>())
                {
                    OnMoveOver(m);
                }
            }
        }
Example #2
0
        public override void OnHit(Mobile attacker, Mobile defender, int damage)
        {
            if (!Validate(attacker))    //Mana check after check that there are targets
            {
                return;
            }

            ClearCurrentAbility(attacker);

            Map map = attacker.Map;

            if (map == null)
            {
                return;
            }

            BaseWeapon weapon = attacker.Weapon as BaseWeapon;

            if (weapon == null)
            {
                return;
            }

            var targets = SpellHelper.AcquireIndirectTargets(attacker, attacker.Location, attacker.Map, 2).OfType <Mobile>().ToList();

            if (targets.Count > 0)
            {
                if (!CheckMana(attacker, true))
                {
                    return;
                }

                attacker.FixedEffect(0x3728, 10, 15);
                attacker.PlaySound(0x2A1);

                if (Registry.ContainsKey(attacker))
                {
                    RemoveFromRegistry(attacker);
                }

                Registry[attacker] = new InternalTimer(attacker, targets);

                foreach (var pm in targets.OfType <PlayerMobile>())
                {
                    BuffInfo.AddBuff(pm, new BuffInfo(BuffIcon.SplinteringEffect, 1153804, 1028852, TimeSpan.FromSeconds(2.0), pm));
                }

                if (defender is PlayerMobile && attacker is PlayerMobile)
                {
                    defender.SendSpeedControl(SpeedControlType.WalkSpeed);
                    BuffInfo.AddBuff(defender, new BuffInfo(BuffIcon.SplinteringEffect, 1153804, 1152144, TimeSpan.FromSeconds(2.0), defender));
                    Timer.DelayCall(TimeSpan.FromSeconds(2), mob => mob.SendSpeedControl(SpeedControlType.Disable), defender);
                }

                if (attacker is BaseCreature)
                {
                    PetTrainingHelper.OnWeaponAbilityUsed((BaseCreature)attacker, SkillName.Ninjitsu);
                }
            }
        }
Example #3
0
        public void HoofStomp()
        {
            if (Map == null)
            {
                return;
            }

            foreach (Mobile m in SpellHelper.AcquireIndirectTargets(this, Location, Map, StrikingRange).OfType <Mobile>())
            {
                if (m.GetStatMod("DreadHornStr") == null)
                {
                    double percent = m.Skills.MagicResist.Value / 100;
                    int    malas   = (int)(-20 + (percent * 5.2));

                    m.AddStatMod(new StatMod(StatType.Str, "DreadHornStr", m.Str < Math.Abs(malas) ? m.Str / 2 : malas, TimeSpan.FromSeconds(60)));
                    m.AddStatMod(new StatMod(StatType.Dex, "DreadHornDex", m.Dex < Math.Abs(malas) ? m.Dex / 2 : malas, TimeSpan.FromSeconds(60)));
                    m.AddStatMod(new StatMod(StatType.Int, "DreadHornInt", m.Int < Math.Abs(malas) ? m.Int / 2 : malas, TimeSpan.FromSeconds(60)));
                }

                m.SendLocalizedMessage(1075081); // *Dreadhorn’s eyes light up, his mouth almost a grin, as he slams one hoof to the ground!*
            }

            // earthquake
            PlaySound(0x2F3);
            m_Stomp = DateTime.UtcNow + TimeSpan.FromSeconds(Utility.RandomMinMax(60, 80));
        }
Example #4
0
        public override void OnHit(Mobile attacker, Mobile defender, int damage)
        {
            if (!this.Validate(attacker))
            {
                return;
            }

            ClearCurrentAbility(attacker);

            Map map = attacker.Map;

            if (map == null)
            {
                return;
            }

            BaseWeapon weapon = attacker.Weapon as BaseWeapon;

            if (weapon == null)
            {
                return;
            }

            if (!this.CheckMana(attacker, true))
            {
                return;
            }

            attacker.FixedEffect(0x3728, 10, 15);
            attacker.PlaySound(0x2A1);

            var list = SpellHelper.AcquireIndirectTargets(attacker, attacker, attacker.Map, 1)
                       .OfType <Mobile>()
                       .Where(m => attacker.InRange(m, weapon.MaxRange) && m != defender);

            var count = list.Count();

            if (count > 0)
            {
                double bushido     = attacker.Skills.Bushido.Value;
                double damageBonus = 1.0 + Math.Pow((count * bushido) / 60, 2) / 100;

                if (damageBonus > 2.0)
                {
                    damageBonus = 2.0;
                }

                attacker.RevealingAction();

                foreach (var m in list)
                {
                    attacker.SendLocalizedMessage(1060161); // The whirling attack strikes a target!
                    m.SendLocalizedMessage(1060162);        // You are struck by the whirling attack and take damage!

                    weapon.OnHit(attacker, m, damageBonus);
                }
            }

            weapon.ProcessingMultipleHits = false;
        }
Example #5
0
        private void Teleport()
        {
            List <PlayerMobile> toTele = new List <PlayerMobile>();

            foreach (IDamageable target in SpellHelper.AcquireIndirectTargets(this, Location, Map, StrikingRange))
            {
                if (target is PlayerMobile mobile)
                {
                    toTele.Add(mobile);
                }
            }

            if (toTele.Count > 0)
            {
                PlayerMobile from = toTele[Utility.Random(toTele.Count)];

                if (from != null)
                {
                    Combatant = from;

                    from.MoveToWorld(GetSpawnPosition(1), Map);
                    from.FixedParticles(0x376A, 9, 32, 0x13AF, EffectLayer.Waist);
                    from.PlaySound(0x1FE);

                    from.ApplyPoison(this, HitPoison);
                }
            }

            ColUtility.Free(toTele);
            m_Teleport = DateTime.UtcNow + TimeSpan.FromSeconds(Utility.RandomMinMax(40, 60));
        }
Example #6
0
        private void DoAura()
        {
            DoEffects();

            foreach (Mobile m in SpellHelper.AcquireIndirectTargets(this, this, Map, 4).OfType <Mobile>())
            {
                int damage = Utility.RandomMinMax(10, 20);

                AOS.Damage(m, this, damage, 0, 0, 0, 100, 0, DamageType.SpellAOE);

                m.RevealingAction();
            }
        }
Example #7
0
        public virtual void Explode(Mobile from, Point3D loc, Map map)
        {
            if (Deleted || map == null)
            {
                return;
            }

            Consume();

            // Effects
            Effects.PlaySound(loc, map, 0x207);
            Geometry.Circle2D(loc, map, Radius, TarEffect, 270, 90);

            Timer.DelayCall(TimeSpan.FromSeconds(1), new TimerStateCallback(CircleEffect2), new object[] { loc, map });

            foreach (Mobile m in SpellHelper.AcquireIndirectTargets(from, loc, map, Radius).OfType <Mobile>())
            {
                AddEffects(m);
            }
        }
Example #8
0
        private void Teleport()
        {
            var toTele = SpellHelper.AcquireIndirectTargets(this, Location, Map, 12).OfType <PlayerMobile>().ToList();

            if (toTele.Count > 0)
            {
                PlayerMobile from = toTele[Utility.Random(toTele.Count)];

                if (from != null)
                {
                    Combatant = from;

                    from.MoveToWorld(GetSpawnPosition(1), Map);
                    from.FixedParticles(0x376A, 9, 32, 0x13AF, EffectLayer.Waist);
                    from.PlaySound(0x1FE);
                }
            }

            ColUtility.Free(toTele);
        }
Example #9
0
        public virtual void Explode(Mobile from, Point3D loc, Map map)
        {
            if (Deleted || map == null)
            {
                return;
            }

            Consume();

            Effects.PlaySound(loc, map, 0x207);

            var skill = (int)from.Skills[SkillName.Alchemy].Value + AosAttributes.GetValue(from, AosAttribute.EnhancePotions);

            foreach (PlayerMobile m in SpellHelper.AcquireIndirectTargets(from, loc, map, Radius).OfType <PlayerMobile>())
            {
                if (Utility.Random(skill) > m.Skills[SkillName.MagicResist].Value / 2)
                {
                    AddEffects(m);
                }
            }
        }
Example #10
0
        private IEnumerable <Mobile> GetTargets(Point3D newPoint, Map map)
        {
            if (Operator != null)
            {
                foreach (Mobile m in SpellHelper.AcquireIndirectTargets(Operator, newPoint, map, 0).OfType <Mobile>())
                {
                    yield return(m);
                }

                yield break;
            }

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

            foreach (Mobile m in eable)
            {
                if (m is PlayerMobile || (m is BaseCreature && ((BaseCreature)m).GetMaster() is PlayerMobile))
                {
                    yield return(m);
                }
            }
        }
Example #11
0
        public override void OnDrainLife(Mobile victim)
        {
            if (Map == null || Altar == null)
            {
                return;
            }

            var count = Altar == null ? 0 : Altar.Helpers.Count;

            foreach (Mobile m in SpellHelper.AcquireIndirectTargets(this, Location, Map, 20).OfType <Mobile>())
            {
                if (Altar.Helpers.Count < 6)
                {
                    SpawnHelper(new DarkWisp(), Location);
                }

                if (Region.IsPartOf("Underwater World") && (Map == Map.Trammel || Map == Map.Felucca))
                {
                    int teleportchance = Hits / HitsMax;

                    if (teleportchance < Utility.RandomDouble() && m.Alive)
                    {
                        switch (Utility.Random(6))
                        {
                        case 0: m.MoveToWorld(new Point3D(6431, 1664, 0), Map); break;

                        case 1: m.MoveToWorld(new Point3D(6432, 1634, 0), Map); break;

                        case 2: m.MoveToWorld(new Point3D(6401, 1657, 0), Map); break;

                        case 3: m.MoveToWorld(new Point3D(6401, 1637, 0), Map); break;

                        default: m.MoveToWorld(Location, Map); break;
                        }
                    }
                }
            }
        }
Example #12
0
        private void Teleport()
        {
            System.Collections.Generic.List <PlayerMobile> toTele = SpellHelper.AcquireIndirectTargets(this, Location, Map, StrikingRange).OfType <PlayerMobile>().ToList();

            if (toTele.Count > 0)
            {
                PlayerMobile from = toTele[Utility.Random(toTele.Count)];

                if (from != null)
                {
                    Combatant = from;

                    from.MoveToWorld(GetSpawnPosition(1), Map);
                    from.FixedParticles(0x376A, 9, 32, 0x13AF, EffectLayer.Waist);
                    from.PlaySound(0x1FE);

                    from.ApplyPoison(this, HitPoison);
                }
            }

            ColUtility.Free(toTele);
            m_Teleport = DateTime.UtcNow + TimeSpan.FromSeconds(Utility.RandomMinMax(40, 60));
        }
Example #13
0
        public void Explode(Mobile from, bool direct, Point3D loc, Map map)
        {
            if (Deleted)
            {
                return;
            }

            Consume();

            for (int i = 0; m_Users != null && i < m_Users.Count; ++i)
            {
                Mobile      m    = (Mobile)m_Users[i];
                ThrowTarget targ = m.Target as ThrowTarget;

                if (targ != null && targ.Potion == this)
                {
                    Target.Cancel(m);
                }
            }

            if (map == null)
            {
                return;
            }

            Effects.PlaySound(loc, map, 0x307);

            Effects.SendLocationEffect(loc, map, 0x36B0, 9, 10, 0, 0);
            int alchemyBonus = 0;

            if (direct)
            {
                alchemyBonus = (int)(from.Skills.Alchemy.Value / (Core.AOS ? 5 : 10));
            }

            int min = Scale(from, MinDamage);
            int max = Scale(from, MaxDamage);

            var list = SpellHelper.AcquireIndirectTargets(from, loc, map, ExplosionRange, false).OfType <Mobile>().ToList();

            foreach (var m in list)
            {
                if (from != null)
                {
                    from.DoHarmful(m);
                }

                int damage = Utility.RandomMinMax(min, max);

                damage += alchemyBonus;

                if (!Core.AOS && damage > 40)
                {
                    damage = 40;
                }
                else if (Core.AOS && list.Count > 2)
                {
                    damage /= list.Count - 1;
                }

                AOS.Damage(m, from, damage, 0, 100, 0, 0, 0, Server.DamageType.SpellAOE);
            }

            list.Clear();
        }
Example #14
0
        public void Use(Mobile from, IPoint3D loc)
        {
            if (!this.CheckUse(from))
            {
                return;
            }

            from.BeginAction(typeof(FireHorn));
            Timer.DelayCall(Core.AOS ? TimeSpan.FromSeconds(6.0) : TimeSpan.FromSeconds(12.0), new TimerStateCallback(EndAction), from);

            int music = from.Skills[SkillName.Musicianship].Fixed;

            int    sucChance  = 500 + (music - 775) * 2;
            double dSucChance = ((double)sucChance) / 1000.0;

            if (!from.CheckSkill(SkillName.Musicianship, dSucChance))
            {
                from.SendLocalizedMessage(1049618); // The horn emits a pathetic squeak.
                from.PlaySound(0x18A);
                return;
            }

            int sulfAsh = Core.AOS ? 4 : 15;

            from.Backpack.ConsumeUpTo(typeof(SulfurousAsh), sulfAsh);

            from.PlaySound(0x15F);
            Effects.SendPacket(from, from.Map, new HuedEffect(EffectType.Moving, from.Serial, Serial.Zero, 0x36D4, from.Location, loc, 5, 0, false, true, 0, 0));

            var  targets        = SpellHelper.AcquireIndirectTargets(from, loc, from.Map, 2).OfType <Mobile>().ToList();
            var  count          = targets.Count;
            bool playerVsPlayer = targets.Any(t => t.Player);

            if (count > 0)
            {
                int prov  = from.Skills[SkillName.Provocation].Fixed;
                int disc  = from.Skills[SkillName.Discordance].Fixed;
                int peace = from.Skills[SkillName.Peacemaking].Fixed;

                int minDamage, maxDamage;

                if (Core.AOS)
                {
                    int musicScaled = music + Math.Max(0, music - 900) * 2;
                    int provScaled  = prov + Math.Max(0, prov - 900) * 2;
                    int discScaled  = disc + Math.Max(0, disc - 900) * 2;
                    int peaceScaled = peace + Math.Max(0, peace - 900) * 2;

                    int weightAvg = (musicScaled + provScaled * 3 + discScaled * 3 + peaceScaled) / 80;

                    int avgDamage;
                    if (playerVsPlayer)
                    {
                        avgDamage = weightAvg / 3;
                    }
                    else
                    {
                        avgDamage = weightAvg / 2;
                    }

                    minDamage = (avgDamage * 9) / 10;
                    maxDamage = (avgDamage * 10) / 9;
                }
                else
                {
                    int total = prov + disc / 5 + peace / 5;

                    if (playerVsPlayer)
                    {
                        total /= 3;
                    }

                    maxDamage = (total * 2) / 30;
                    minDamage = (maxDamage * 7) / 10;
                }

                double damage = Utility.RandomMinMax(minDamage, maxDamage);

                if (Core.AOS && count > 1)
                {
                    damage = (damage * 2) / count;
                }
                else if (!Core.AOS)
                {
                    damage /= count;
                }

                foreach (var m in targets)
                {
                    double toDeal = damage;

                    if (!Core.AOS && m.CheckSkill(SkillName.MagicResist, 0.0, 120.0))
                    {
                        toDeal *= 0.5;
                        m.SendLocalizedMessage(501783); // You feel yourself resisting magical energy.
                    }

                    from.DoHarmful(m);
                    SpellHelper.Damage(TimeSpan.Zero, m, from, toDeal, 0, 100, 0, 0, 0);

                    Effects.SendTargetEffect(m, 0x3709, 10, 30);
                }
            }

            ColUtility.Free(targets);

            double breakChance = Core.AOS ? 0.01 : 0.16;

            if (Utility.RandomDouble() < breakChance)
            {
                from.SendLocalizedMessage(1049619); // The fire horn crumbles in your hands.
                this.Delete();
            }
        }
Example #15
0
        public void Use(Mobile from, IPoint3D loc)
        {
            if (!CheckUse(from))
            {
                return;
            }

            from.BeginAction(typeof(FireHorn));
            Timer.DelayCall(TimeSpan.FromSeconds(6.0), new TimerStateCallback(EndAction), from);

            int music = from.Skills[SkillName.Musicianship].Fixed;

            int    sucChance  = 500 + (music - 775) * 2;
            double dSucChance = sucChance / 1000.0;

            if (!from.CheckSkill(SkillName.Musicianship, dSucChance))
            {
                from.SendLocalizedMessage(1049618); // The horn emits a pathetic squeak.
                from.PlaySound(0x18A);
                return;
            }

            from.Backpack.ConsumeUpTo(typeof(SulfurousAsh), 4);

            from.PlaySound(0x15F);
            Effects.SendPacket(from, from.Map, new HuedEffect(EffectType.Moving, from.Serial, Serial.Zero, 0x36D4, from.Location, loc, 5, 0, false, true, 0, 0));

            System.Collections.Generic.List <Mobile> targets = SpellHelper.AcquireIndirectTargets(from, loc, from.Map, 2).OfType <Mobile>().ToList();
            int  count          = targets.Count;
            bool playerVsPlayer = targets.Any(t => t.Player);

            if (count > 0)
            {
                int prov  = from.Skills[SkillName.Provocation].Fixed;
                int disc  = from.Skills[SkillName.Discordance].Fixed;
                int peace = from.Skills[SkillName.Peacemaking].Fixed;

                int minDamage, maxDamage;

                int musicScaled = music + Math.Max(0, music - 900) * 2;
                int provScaled  = prov + Math.Max(0, prov - 900) * 2;
                int discScaled  = disc + Math.Max(0, disc - 900) * 2;
                int peaceScaled = peace + Math.Max(0, peace - 900) * 2;

                int weightAvg = (musicScaled + provScaled * 3 + discScaled * 3 + peaceScaled) / 80;

                int avgDamage;
                if (playerVsPlayer)
                {
                    avgDamage = weightAvg / 3;
                }
                else
                {
                    avgDamage = weightAvg / 2;
                }

                minDamage = avgDamage * 9 / 10;
                maxDamage = avgDamage * 10 / 9;

                double damage = Utility.RandomMinMax(minDamage, maxDamage);

                if (count > 1)
                {
                    damage = damage * 2 / count;
                }

                foreach (Mobile m in targets)
                {
                    double toDeal = damage;

                    from.DoHarmful(m);
                    SpellHelper.Damage(TimeSpan.Zero, m, from, toDeal, 0, 100, 0, 0, 0);

                    Effects.SendTargetEffect(m, 0x3709, 10, 30);
                }
            }

            ColUtility.Free(targets);

            if (Utility.RandomDouble() < 0.01)
            {
                from.SendLocalizedMessage(1049619); // The fire horn crumbles in your hands.
                Delete();
            }
        }
Example #16
0
        public override void OnHit(Mobile attacker, Mobile defender, int damage)
        {
            bool any = false;

            if (Contexts != null)
            {
                for (var index = 0; index < Contexts.Count; index++)
                {
                    var c = Contexts[index];

                    if (Contexts != null && c.Attacker == attacker)
                    {
                        any = true;
                        break;
                    }
                }
            }

            if (!Validate(attacker) || Contexts != null && any)
            {
                return;
            }

            ClearCurrentAbility(attacker);

            Map map = attacker.Map;

            if (map == null)
            {
                return;
            }

            BaseWeapon weapon = attacker.Weapon as BaseWeapon;

            if (weapon == null)
            {
                return;
            }

            if (!CheckMana(attacker, true))
            {
                return;
            }

            attacker.FixedEffect(0x3728, 10, 15);
            attacker.PlaySound(0x2A1);

            List <Mobile> list = new List <Mobile>();

            foreach (IDamageable target in SpellHelper.AcquireIndirectTargets(attacker, attacker, attacker.Map, 1))
            {
                if (target is Mobile m && (attacker.InRange(m, weapon.MaxRange) && m != defender))
                {
                    list.Add(m);
                }
            }

            int count = list.Count;

            if (count > 0)
            {
                double bushido = attacker.Skills.Bushido.Value;

                int bonus = 0;

                if (bushido > 0)
                {
                    bonus = (int)Math.Min(100, ((list.Count * bushido) * (list.Count * bushido)) / 3600);
                }

                var context = new WhirlwindAttackContext(attacker, list, bonus);
                AddContext(context);

                attacker.RevealingAction();

                for (var index = 0; index < list.Count; index++)
                {
                    Mobile m = list[index];

                    attacker.SendLocalizedMessage(1060161); // The whirling attack strikes a target!
                    m.SendLocalizedMessage(1060162);        // You are struck by the whirling attack and take damage!

                    weapon.OnHit(attacker, m);
                }

                RemoveContext(context);
            }

            ColUtility.Free(list);

            weapon.ProcessingMultipleHits = false;
        }
Example #17
0
        public override void OnHit(Mobile attacker, Mobile defender, int damage)
        {
            if (!Validate(attacker) || (Contexts != null && Contexts.Any(c => c.Attacker == attacker)))
            {
                return;
            }

            ClearCurrentAbility(attacker);

            Map map = attacker.Map;

            if (map == null)
            {
                return;
            }


            if (!(attacker.Weapon is BaseWeapon weapon))
            {
                return;
            }

            if (!CheckMana(attacker, true))
            {
                return;
            }

            attacker.FixedEffect(0x3728, 10, 15);
            attacker.PlaySound(0x2A1);

            var list = SpellHelper.AcquireIndirectTargets(attacker, attacker, attacker.Map, 1)
                       .OfType <Mobile>()
                       .Where(m => attacker.InRange(m, weapon.MaxRange) && m != defender).ToList();

            int count = list.Count;

            if (count > 0)
            {
                double bushido = attacker.Skills.Bushido.Value;

                //   double damageBonus = 1.0 + Math.Pow((count * bushido) / 60, 2) / 100;

                int damagebonus = 0;

                if (bushido > 0)
                {
                    damagebonus = (int)Math.Min(100, ((list.Count * bushido) * (list.Count * bushido)) / 3600);
                }

                if (damagebonus > 2)
                {
                    damagebonus = 2;
                }

                var context = new WhirlwindAttackContext(attacker, list, damagebonus);
                AddContext(context);

                attacker.RevealingAction();

                foreach (var m in list)
                {
                    attacker.SendLocalizedMessage(1060161); // The whirling attack strikes a target!
                    m.SendLocalizedMessage(1060162);        // You are struck by the whirling attack and take damage!

                    weapon.OnHit(attacker, m);              // , damageBonus
                }

                RemoveContext(context);
            }

            ColUtility.Free(list);

            weapon.ProcessingMultipleHits = false;
        }
Example #18
0
        public override void OnThink()
        {
            base.OnThink();

            if (Blessed)
            {
                if (InitialSpawn != null)
                {
                    if (InitialSpawn.All(s => s.Deleted))
                    {
                        ColUtility.Free(InitialSpawn);
                        InitialSpawn = null;

                        Blessed = false;
                    }
                }
                else
                {
                    Blessed = false;
                }
            }

            if (Combatant == null)
            {
                if (SpawnLocation != Point3D.Zero &&
                    _LastActivity > DateTime.MinValue &&
                    _LastActivity + TimeSpan.FromHours(2) < DateTime.UtcNow)
                {
                    Delete();
                }

                return;
            }

            _LastActivity = DateTime.UtcNow;

            if (_NextSpecial < DateTime.UtcNow && 0.25 > Utility.RandomDouble())
            {
                if (Utility.RandomBool())
                {
                    Mobile target = GetTeleportTarget();

                    if (target != null)
                    {
                        Summon(target);
                    }
                }
                else
                {
                    int  baseDamage = 100;
                    bool switched   = false;

                    PlaySound(0x20D);

                    foreach (Mobile m in SpellHelper.AcquireIndirectTargets(this, Location, Map, 10).OfType <Mobile>())
                    {
                        int range = (int)GetDistanceToSqrt(m);

                        if (range < 1)
                        {
                            range = 1;
                        }
                        if (range > 4)
                        {
                            range = 4;
                        }

                        m.PlaySound(0x20D);
                        AOS.Damage(this, m, baseDamage / range, 0, 0, 0, 0, 0, 100, 0);

                        if (!switched && 0.2 > Utility.RandomDouble())
                        {
                            Combatant = m;
                            switched  = true;
                        }
                    }
                }

                _NextSpecial = DateTime.UtcNow + TimeSpan.FromSeconds(Utility.RandomMinMax(30, 60));
            }

            if (Map != null && SpawnLocation != Point3D.Zero && !Utility.InRange(Location, SpawnLocation, 25))
            {
                MoveToWorld(SpawnLocation, Map);
            }
        }
Example #19
0
        public void Explode(Mobile from, bool direct, Point3D loc, Map map)
        {
            if (Deleted || from == null)
            {
                return;
            }

            bool damageThrower = false;

            if (from.Target is ThrowTarget && ((ThrowTarget)from.Target).Potion == this)
            {
                Target.Cancel(from);
            }

            if (IsChildOf(from.Backpack) || Parent == from)
            {
                damageThrower = true;
            }

            Consume();

            if (map == null)
            {
                return;
            }

            Effects.PlaySound(loc, map, 0x307);

            Effects.SendLocationEffect(loc, map, 0x36B0, 9, 10, 0, 0);
            int alchemyBonus = 0;

            if (direct)
            {
                alchemyBonus = (int)(from.Skills.Alchemy.Value / 5);
            }

            int min = Scale(from, MinDamage);
            int max = Scale(from, MaxDamage);

            System.Collections.Generic.List <Mobile> list = SpellHelper.AcquireIndirectTargets(from, loc, map, ExplosionRange, false).OfType <Mobile>().ToList();

            if (damageThrower && !list.Contains(from))
            {
                list.Add(from);
            }

            foreach (Mobile m in list)
            {
                from.DoHarmful(m);

                int damage = Utility.RandomMinMax(min, max);

                damage += alchemyBonus;

                if (list.Count > 2)
                {
                    damage /= list.Count - 1;
                }

                AOS.Damage(m, from, damage, 0, 100, 0, 0, 0, Server.DamageType.SpellAOE);
            }

            list.Clear();
        }