public override void Damage(Mobile m)
        {
            base.Damage(m);

            if (m.Alive)
            {
                // Wind
                if (Utility.RandomDouble() < 0.25)
                {
                    m.PlaySound(Utility.RandomList(0x014, 0x15, 0x016, 0x5C7));
                    AOS.Damage(m, 0, 0, 0, 0, 0, 0);
                }

                // Wind
                if (Utility.RandomDouble() < 0.15)
                {
                    m.PlaySound(Utility.RandomList(0x014, 0x15, 0x016, 0x5C7));
                    AOS.Damage(m, 0, 0, 0, 0, 0, 0);
                }

                // Wind
                if (Utility.RandomDouble() < 0.08)
                {
                    m.PlaySound(Utility.RandomList(0x014, 0x15, 0x016, 0x5C7));
                    AOS.Damage(m, 0, 0, 0, 0, 0, 0);
                }

                // Wind
                if (Utility.RandomDouble() < 0.05)
                {
                    m.PlaySound(Utility.RandomList(0x014, 0x15, 0x016, 0x5C7));
                    AOS.Damage(m, 0, 0, 0, 0, 0, 0);
                }

                // Jungle noises
                if (Utility.RandomDouble() < 0.08)
                {
                    m.PlaySound(Utility.RandomList(0x003, 0x004, 0x005));
                    AOS.Damage(m, 0, 0, 0, 0, 0, 0);
                }

                // sfx noises
                if (Utility.RandomDouble() < 0.02)
                {
                    m.PlaySound(Utility.RandomList(0x0F5, 0x0F7, 0x0F8, 0x0FB));
                    AOS.Damage(m, 0, 0, 0, 0, 0, 0);
                }

                // water drips
                if (Utility.RandomDouble() < 0.03)
                {
                    m.PlaySound(Utility.RandomList(0x022, 0x023, 0x024));
                    AOS.Damage(m, 0, 0, 0, 0, 0, 0);
                }

                // Cricket noises
                if (Utility.RandomDouble() < 0.03)
                {
                    m.PlaySound(Utility.RandomList(0x00A, 0x00B));
                    AOS.Damage(m, 0, 0, 0, 0, 0, 0);
                }
            }
        }
Exemple #2
0
                protected override void OnTick()
                {
                    if (m_Item.Deleted)
                    {
                        return;
                    }

                    if (!m_Item.Visible)
                    {
                        if (m_InLOS && m_CanFit)
                        {
                            m_Item.Visible = true;
                        }
                        else
                        {
                            m_Item.Delete();
                        }

                        if (!m_Item.Deleted)
                        {
                            m_Item.ProcessDelta();
                            Effects.SendLocationParticles(EffectItem.Create(m_Item.Location, m_Item.Map, EffectItem.DefaultDuration), 0x376A, 9, 10, 5029);
                        }
                    }
                    else if (DateTime.UtcNow > m_Item.m_End)
                    {
                        m_Item.Delete();
                        Stop();
                    }
                    else
                    {
                        Map    map    = m_Item.Map;
                        Mobile caster = m_Item.m_Caster;

                        if (map != null && caster != null)
                        {
                            foreach (Mobile m in m_Item.GetMobilesInRange(0))
                            {
                                if ((m.Z + 16) > m_Item.Z && (m_Item.Z + 12) > m.Z && (!Core.AOS || m != caster) && SpellHelper.ValidIndirectTarget(caster, m) && caster.CanBeHarmful(m, false))
                                {
                                    m_Queue.Enqueue(m);
                                }
                            }

                            while (m_Queue.Count > 0)
                            {
                                int damage = m_Item.m_Damage;
                                if (damage > 0)
                                {
                                    Mobile m = (Mobile)m_Queue.Dequeue();

                                    if (SpellHelper.CanRevealCaster(m))
                                    {
                                        caster.RevealingAction();
                                    }

                                    caster.DoHarmful(m);


                                    if (!Core.AOS && m.CheckSkill(SkillName.MagicResist, 0.0, 30.0))
                                    {
                                        damage = 1;

                                        m.SendLocalizedMessage(501783); // You feel yourself resisting magical energy.
                                    }

                                    AOS.Damage(m, caster, damage, 0, 100, 0, 0, 0);
                                    m.PlaySound(0x208);

                                    if (m is BaseCreature)
                                    {
                                        ((BaseCreature)m).OnHarmfulSpell(caster);
                                    }
                                }
                            }
                        }
                    }
                }
        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    = 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));
            }

            IPooledEnumerable eable     = LeveledExplosion ? (IPooledEnumerable)map.GetObjectsInRange(loc, ExplosionRange) : (IPooledEnumerable)map.GetMobilesInRange(loc, ExplosionRange);
            ArrayList         toExplode = new ArrayList();

            int toDamage = 0;

            foreach (object o in eable)
            {
                if (o is Mobile && (from == null || (SpellHelper.ValidIndirectTarget(from, (Mobile)o) && from.CanBeHarmful((Mobile)o, false))))
                {
                    toExplode.Add(o);
                    ++toDamage;
                }
                else if (o is BaseExplosionPotion && o != this)
                {
                    toExplode.Add(o);
                }
            }

            eable.Free();

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

            for (int i = 0; i < toExplode.Count; ++i)
            {
                object o = toExplode[i];

                if (o is Mobile)
                {
                    Mobile m = (Mobile)o;

                    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 && toDamage > 2)
                    {
                        damage /= toDamage - 1;
                    }

                    AOS.Damage(m, from, damage, 0, 100, 0, 0, 0);
                }
                else if (o is BaseExplosionPotion)
                {
                    BaseExplosionPotion pot = (BaseExplosionPotion)o;

                    pot.Explode(from, false, pot.GetWorldLocation(), pot.Map);
                }
            }
        }
Exemple #4
0
        public virtual int GetNewAosDamage(int bonus, int dice, int sides, bool playerVsPlayer, double scalar, IDamageable damageable)
        {
            Mobile target = damageable as Mobile;

            int damage      = Utility.Dice(dice, sides, bonus) * 100;
            int damageBonus = 0;

            int inscribeSkill = GetInscribeFixed(m_Caster);
            int inscribeBonus = (inscribeSkill + (1000 * (inscribeSkill / 1000))) / 200;

            damageBonus += inscribeBonus;

            int intBonus = Caster.Int / 10;

            damageBonus += intBonus;

            int sdiBonus = AosAttributes.GetValue(m_Caster, AosAttribute.SpellDamage);

            #region Mondain's Legacy
            sdiBonus += ArcaneEmpowermentSpell.GetSpellBonus(m_Caster, playerVsPlayer);
            #endregion

            if (target != null && RunedSashOfWarding.IsUnderEffects(target, WardingEffect.SpellDamage))
            {
                sdiBonus -= 10;
            }

            sdiBonus -= Block.GetSpellReduction(target);

            // PvP spell damage increase cap of 15% from an item’s magic property, 30% if spell school focused.
            if (playerVsPlayer)
            {
                if (SpellHelper.HasSpellFocus(m_Caster, CastSkill) && sdiBonus > 30)
                {
                    sdiBonus = 30;
                }

                if (!SpellHelper.HasSpellFocus(m_Caster, CastSkill) && sdiBonus > 15)
                {
                    sdiBonus = 15;
                }
            }

            damageBonus += sdiBonus;

            damage = AOS.Scale(damage, 100 + damageBonus);

            if (target != null && Feint.Registry.ContainsKey(target) && Feint.Registry[target].Enemy == Caster)
            {
                damage -= (int)((double)damage * ((double)Feint.Registry[target].DamageReduction / 100));
            }

            int evalSkill = GetDamageFixed(m_Caster);
            int evalScale = 30 + ((9 * evalSkill) / 100);

            damage = AOS.Scale(damage, evalScale);

            damage = AOS.Scale(damage, (int)(scalar * 100));

            #region Skill Mastery
            SkillMasterySpell spell = SkillMasterySpell.GetHarmfulSpell(Caster, typeof(TribulationSpell));

            if (spell != null)
            {
                spell.AbsorbDamage(ref damage);
            }
            #endregion

            return(damage / 100);
        }
Exemple #5
0
        public void RaiseRocks()
        {
            if (this.Map == null)
            {
                return;
            }

            IPooledEnumerable eable  = this.Map.GetMobilesInRange(this.Location, 12);
            List <Mobile>     random = new List <Mobile>();

            foreach (Mobile m in eable)
            {
                if (m.Alive && m is PlayerMobile && SpellHelper.ValidIndirectTarget(this, m) && this.CanBeHarmful(m, false))
                {
                    random.Add(m);
                }
            }

            eable.Free();
            Mobile target = null;

            if (random.Count > 0)
            {
                target = random[Utility.Random(random.Count)];
            }

            if (target != null)
            {
                Direction   d = Utility.GetDirection(this, target);
                Rectangle2D r = new Rectangle2D(target.X - 8, target.Y - 2, 17, 5);

                switch (d)
                {
                case Direction.West:
                    r = new Rectangle2D(this.X - 24, this.Y - 2, 20, 5); break;

                case Direction.North:
                    r = new Rectangle2D(this.X - 2, this.Y - 24, 5, 20); break;

                case Direction.East:
                    r = new Rectangle2D(this.X + 4, this.Y - 2, 20, 5); break;

                case Direction.South:
                    r = new Rectangle2D(this.X - 4, this.Y + 4, 20, 5); break;
                }

                for (int x = r.X; x <= r.X + r.Width; x++)
                {
                    for (int y = r.Y; y <= r.Y + r.Height; y++)
                    {
                        if (x > this.X - 4 && x < this.X + 4 && y > this.Y - 4 && y < this.Y + 4)
                        {
                            continue;
                        }

                        if (0.75 > Utility.RandomDouble())
                        {
                            int id = Utility.RandomList <int>(2282, 2273, 2277, 40106, 40107, 40108, 40106, 40107, 40108, 40106, 40107, 40108);
                            Effects.SendLocationEffect(new Point3D(x, y, this.Map.GetAverageZ(x, y)), this.Map, id, 60);
                        }
                    }
                }

                IPooledEnumerable eable2 = this.Map.GetMobilesInBounds(r);

                foreach (Mobile m in eable2)
                {
                    if (m.Alive && m is PlayerMobile && SpellHelper.ValidIndirectTarget(this, m) && this.CanBeHarmful(m, false))
                    {
                        if (m.X > this.X - 4 && m.X < this.X + 4 && m.Y > this.Y - 4 && m.Y < this.Y + 4)
                        {
                            continue;
                        }

                        m.Freeze(TimeSpan.FromSeconds(2));
                        BleedAttack.BeginBleed(m, this, false);

                        AOS.Damage(target, this, Utility.RandomMinMax(100, 110), 100, 0, 0, 0, 0);
                        m.PrivateOverheadMessage(MessageType.Regular, 0x21, 1156849, m.NetState); // *Rising columns of rock rip through your flesh and concuss you!*
                    }
                }

                eable2.Free();
            }
        }
Exemple #6
0
            protected override void OnTarget(Mobile from, object targeted)
            {
                if (m_Dagger.Deleted)
                {
                    return;
                }

                if (!from.Items.Contains(m_Dagger))
                {
                    from.SendMessage("You must be holding that weapon to use it.");
                }
                else if (targeted is Mobile m)
                {
                    if (m != from && from.HarmfulCheck(m))
                    {
                        Direction to = from.GetDirectionTo(m);

                        from.Direction = to;

                        from.Animate(from.Mounted ? 26 : 9, 7, 1, true, false, 0);

                        if (Utility.RandomDouble() >= Math.Sqrt(m.Dex / 100.0) * 0.8)
                        {
                            from.MovingEffect(m, 0x1BFE, 7, 1, false, false, 0x481, 0);

                            AOS.Damage(m, from, Utility.Random(5, from.Str / 10), 100, 0, 0, 0, 0);

                            m_Dagger.MoveToWorld(m.Location, m.Map);
                        }
                        else
                        {
                            int x = 0, y = 0;

                            switch (to & Direction.Mask)
                            {
                            case Direction.North:
                                --y;
                                break;

                            case Direction.South:
                                ++y;
                                break;

                            case Direction.West:
                                --x;
                                break;

                            case Direction.East:
                                ++x;
                                break;

                            case Direction.Up:
                                --x;
                                --y;
                                break;

                            case Direction.Down:
                                ++x;
                                ++y;
                                break;

                            case Direction.Left:
                                --x;
                                ++y;
                                break;

                            case Direction.Right:
                                ++x;
                                --y;
                                break;
                            }

                            x += Utility.Random(-1, 3);
                            y += Utility.Random(-1, 3);

                            x += m.X;
                            y += m.Y;

                            m_Dagger.MoveToWorld(new Point3D(x, y, m.Z), m.Map);

                            from.MovingEffect(m_Dagger, 0x1BFE, 7, 1, false, false, 0x481, 0);

                            from.SendMessage("You miss.");
                        }
                    }
                }
            }
Exemple #7
0
        public override bool OnMoveOver(Mobile m)
        {
            bool hurts = true;

            if (m.Blessed)
            {
                hurts = false;
            }

            if (!m.Alive)
            {
                hurts = false;
            }

            if (owner is BaseCreature && m is BaseCreature)
            {
                BaseCreature bc = (BaseCreature)m;

                if (!bc.Controlled)
                {
                    hurts = false;
                }
            }

            if (hurts)
            {
                SlayerEntry SilverSlayer   = SlayerGroup.GetEntryByName(SlayerName.Silver);
                SlayerEntry ExorcismSlayer = SlayerGroup.GetEntryByName(SlayerName.Exorcism);

                if (this.Name == "hot magma" && !(m is MagmaElemental))
                {
                    owner.DoHarmful(m);
                    Effects.SendLocationParticles(EffectItem.Create(m.Location, m.Map, EffectItem.DefaultDuration), 0x3709, 10, 30, 5052);
                    Effects.PlaySound(m.Location, m.Map, 0x225);
                    AOS.Damage(m, owner, Hurt(owner, 24, 48), 0, 100, 0, 0, 0);
                    //												Ph,		Fr,		Cd,		Ps,		Eg
                }
                else if (this.Name == "quick silver")
                {
                    owner.DoHarmful(m);
                    Effects.PlaySound(m.Location, m.Map, 0x4D1);
                    AOS.Damage(m, owner, Hurt(owner, 24, 48), 50, 0, 0, 0, 50);
                    //												Ph,		Fr,		Cd,		Ps,		Eg
                }
                else if (this.Name == "holy water" && (SilverSlayer.Slays(m) || ExorcismSlayer.Slays(m)))
                {
                    owner.DoHarmful(m);
                    Effects.SendLocationParticles(EffectItem.Create(m.Location, m.Map, EffectItem.DefaultDuration), 0x3709, 10, 30, 5052);
                    Effects.PlaySound(m.Location, m.Map, 0x225);
                    AOS.Damage(m, owner, Hurt(owner, 40, 60), 20, 20, 20, 20, 20);
                    //												Ph,		Fr,		Cd,		Ps,		Eg
                }
                else if (this.Name == "toxic goo" && !(m is RadiationDemon))
                {
                    owner.DoHarmful(m);
                    Effects.SendLocationParticles(EffectItem.Create(m.Location, m.Map, EffectItem.DefaultDuration), 0x36B0, 1, 14, 63, 7, 9915, 0);
                    int eSound = 0x229;
                    if (m.Body == 0x190 && m is PlayerMobile)
                    {
                        eSound = 0x43F;
                    }
                    else if (m.Body == 0x191 && m is PlayerMobile)
                    {
                        eSound = 0x32D;
                    }
                    Effects.PlaySound(m.Location, m.Map, eSound);
                    AOS.Damage(m, owner, Hurt(owner, 24, 48), 0, 0, 0, 50, 50);
                    //												Ph,		Fr,		Cd,		Ps,		Eg
                }
                else if (this.Name == "glowing goo" && !(m is GlowBeetle))
                {
                    owner.DoHarmful(m);
                    Effects.SendLocationParticles(EffectItem.Create(m.Location, m.Map, EffectItem.DefaultDuration), 0x36B0, 1, 14, 63, 7, 9915, 0);
                    int eSound = 0x229;
                    if (m.Body == 0x190 && m is PlayerMobile)
                    {
                        eSound = 0x43F;
                    }
                    else if (m.Body == 0x191 && m is PlayerMobile)
                    {
                        eSound = 0x32D;
                    }
                    Effects.PlaySound(m.Location, m.Map, eSound);
                    AOS.Damage(m, owner, Hurt(owner, 24, 48), 0, 0, 0, 50, 50);
                    //												Ph,		Fr,		Cd,		Ps,		Eg
                }
                else if (this.Name == "scorching ooze" && !(m is Lavapede))
                {
                    owner.DoHarmful(m);
                    Effects.SendLocationParticles(EffectItem.Create(m.Location, m.Map, EffectItem.DefaultDuration), 0x36B0, 1, 14, 63, 7, 9915, 0);
                    int eSound = 0x229;
                    if (m.Body == 0x190 && m is PlayerMobile)
                    {
                        eSound = 0x43F;
                    }
                    else if (m.Body == 0x191 && m is PlayerMobile)
                    {
                        eSound = 0x32D;
                    }
                    Effects.PlaySound(m.Location, m.Map, eSound);
                    AOS.Damage(m, owner, Hurt(owner, 24, 48), 0, 100, 0, 0, 0);
                    //												Ph,		Fr,		Cd,		Ps,		Eg
                }
                else if (this.Name == "blue slime" && !(m is SlimeDevil))
                {
                    owner.DoHarmful(m);
                    Effects.PlaySound(m.Location, m.Map, 0x4D1);
                    AOS.Damage(m, owner, Hurt(owner, 24, 48), 0, 0, 100, 0, 0);
                    //												Ph,		Fr,		Cd,		Ps,		Eg
                }
                else if (this.Name == "swamp muck" && !(m is SwampThing))
                {
                    owner.DoHarmful(m);
                    Effects.PlaySound(m.Location, m.Map, 0x4D1);
                    AOS.Damage(m, owner, Hurt(owner, 24, 48), 50, 0, 0, 50, 0);
                    //												Ph,		Fr,		Cd,		Ps,		Eg
                }
                else if (this.Name == "poisonous slime" && !(m is AbyssCrawler))
                {
                    owner.DoHarmful(m);
                    Effects.PlaySound(m.Location, m.Map, 0x4D1);
                    AOS.Damage(m, owner, Hurt(owner, 24, 48), 0, 0, 0, 100, 0);
                    //												Ph,		Fr,		Cd,		Ps,		Eg
                }
                else if (this.Name == "poison spit" && !(m is Neptar) && !(m is NeptarWizard))
                {
                    owner.DoHarmful(m);
                    Effects.PlaySound(m.Location, m.Map, 0x4D1);
                    AOS.Damage(m, owner, Hurt(owner, 24, 48), 0, 0, 0, 100, 0);
                    //												Ph,		Fr,		Cd,		Ps,		Eg
                }
                else if (this.Name == "poison spittle" && !(m is Lurker))
                {
                    owner.DoHarmful(m);
                    Effects.PlaySound(m.Location, m.Map, 0x4D1);
                    AOS.Damage(m, owner, Hurt(owner, 24, 48), 0, 0, 0, 100, 0);
                    //												Ph,		Fr,		Cd,		Ps,		Eg
                }
                else if (this.Name == "fungal slime" && !(m is Fungal) && !(m is FungalMage))
                {
                    owner.DoHarmful(m);
                    Effects.PlaySound(m.Location, m.Map, 0x4D1);
                    AOS.Damage(m, owner, Hurt(owner, 24, 48), 50, 0, 0, 50, 0);
                    //												Ph,		Fr,		Cd,		Ps,		Eg
                }
                else if (this.Name == "spider ooze" && !(m is ZombieSpider))
                {
                    owner.DoHarmful(m);
                    Effects.PlaySound(m.Location, m.Map, 0x4D1);
                    AOS.Damage(m, owner, Hurt(owner, 24, 48), 50, 0, 0, 50, 0);
                    //												Ph,		Fr,		Cd,		Ps,		Eg
                }
                else if (this.Name == "acidic slime" && !(m is ToxicElemental))
                {
                    owner.DoHarmful(m);
                    Effects.PlaySound(m.Location, m.Map, 0x231);
                    AOS.Damage(m, owner, Hurt(owner, 24, 48), 50, 0, 0, 50, 0);
                    //												Ph,		Fr,		Cd,		Ps,		Eg
                }
                else if (this.Name == "acidic ichor" && !(m is AntaurKing) && !(m is AntaurProgenitor) && !(m is AntaurSoldier) && !(m is AntaurWorker))
                {
                    owner.DoHarmful(m);
                    Effects.PlaySound(m.Location, m.Map, 0x231);
                    AOS.Damage(m, owner, Hurt(owner, 24, 48), 50, 0, 0, 50, 0);
                    //												Ph,		Fr,		Cd,		Ps,		Eg
                }
                else if (this.Name == "thick blood" && !(m is BloodElemental) && !(m is BloodDemon))
                {
                    owner.DoHarmful(m);
                    Effects.SendLocationParticles(EffectItem.Create(m.Location, m.Map, EffectItem.DefaultDuration), 0x36B0, 1, 14, 0x25, 7, 9915, 0);
                    int eSound = 0x229;
                    if (m.Body == 0x190 && m is PlayerMobile)
                    {
                        eSound = 0x43F;
                    }
                    else if (m.Body == 0x191 && m is PlayerMobile)
                    {
                        eSound = 0x32D;
                    }
                    Effects.PlaySound(m.Location, m.Map, eSound);
                    AOS.Damage(m, owner, Hurt(owner, 24, 48), 0, 0, 0, 100, 0);
                    //												Ph,		Fr,		Cd,		Ps,		Eg
                }
                else if (this.Name == "infected blood" && !(m is Infected))
                {
                    owner.DoHarmful(m);
                    Effects.SendLocationParticles(EffectItem.Create(m.Location, m.Map, EffectItem.DefaultDuration), 0x36B0, 1, 14, 0x25, 7, 9915, 0);
                    int eSound = 0x229;
                    if (m.Body == 0x190 && m is PlayerMobile)
                    {
                        eSound = 0x43F;
                    }
                    else if (m.Body == 0x191 && m is PlayerMobile)
                    {
                        eSound = 0x32D;
                    }
                    Effects.PlaySound(m.Location, m.Map, eSound);
                    AOS.Damage(m, owner, Hurt(owner, 24, 48), 0, 0, 0, 100, 0);
                    //												Ph,		Fr,		Cd,		Ps,		Eg
                }
                else if (this.Name == "alien blood" && !(m is Xenomorph) && !(m is Xenomutant))
                {
                    owner.DoHarmful(m);
                    Effects.SendLocationParticles(EffectItem.Create(m.Location, m.Map, EffectItem.DefaultDuration), 0x36B0, 1, 14, 0x25, 7, 9915, 0);
                    int eSound = 0x229;
                    if (m.Body == 0x190 && m is PlayerMobile)
                    {
                        eSound = 0x43F;
                    }
                    else if (m.Body == 0x191 && m is PlayerMobile)
                    {
                        eSound = 0x32D;
                    }
                    Effects.PlaySound(m.Location, m.Map, eSound);
                    AOS.Damage(m, owner, Hurt(owner, 24, 48), 20, 20, 20, 20, 20);
                    //												Ph,		Fr,		Cd,		Ps,		Eg
                }
                else if (this.Name == "green blood" && !(m is ZombieGiant))
                {
                    owner.DoHarmful(m);
                    Effects.SendLocationParticles(EffectItem.Create(m.Location, m.Map, EffectItem.DefaultDuration), 0x36B0, 1, 14, 0x25, 7, 9915, 0);
                    int eSound = 0x229;
                    if (m.Body == 0x190 && m is PlayerMobile)
                    {
                        eSound = 0x43F;
                    }
                    else if (m.Body == 0x191 && m is PlayerMobile)
                    {
                        eSound = 0x32D;
                    }
                    Effects.PlaySound(m.Location, m.Map, eSound);
                    AOS.Damage(m, owner, Hurt(owner, 24, 48), 20, 0, 0, 80, 0);
                    //												Ph,		Fr,		Cd,		Ps,		Eg
                }
                else if (this.Name == "toxic blood" && !(m is Mutant))
                {
                    owner.DoHarmful(m);
                    Effects.SendLocationParticles(EffectItem.Create(m.Location, m.Map, EffectItem.DefaultDuration), 0x36B0, 1, 14, 0x25, 7, 9915, 0);
                    int eSound = 0x229;
                    if (m.Body == 0x190 && m is PlayerMobile)
                    {
                        eSound = 0x43F;
                    }
                    else if (m.Body == 0x191 && m is PlayerMobile)
                    {
                        eSound = 0x32D;
                    }
                    Effects.PlaySound(m.Location, m.Map, eSound);
                    AOS.Damage(m, owner, Hurt(owner, 24, 48), 0, 0, 0, 100, 0);
                    //												Ph,		Fr,		Cd,		Ps,		Eg
                }
                else if (this.Name == "freezing water" && !(m is WaterElemental) && !(m is WaterWeird) && !(m is DeepWaterElemental) && !(m is Dagon))
                {
                    owner.DoHarmful(m);
                    Effects.PlaySound(m.Location, m.Map, 0x4D1);
                    AOS.Damage(m, owner, Hurt(owner, 20, 40), 0, 0, 100, 0, 0);
                    //												Ph,		Fr,		Cd,		Ps,		Eg
                }
                else if (this.Name == "deep water" && !(m is WaterElemental) && !(m is WaterWeird) && !(m is DeepWaterElemental) && !(m is Dagon))
                {
                    owner.DoHarmful(m);
                    Effects.PlaySound(m.Location, m.Map, 0x4D1);
                    AOS.Damage(m, owner, Hurt(owner, 40, 60), 0, 0, 100, 0, 0);
                    //												Ph,		Fr,		Cd,		Ps,		Eg
                }
                else if (this.Name == "lesser poison potion" || this.Name == "poison potion" || this.Name == "greater poison potion" | this.Name == "deadly poison potion" || this.Name == "lethal poison potion")
                {
                    int pSkill = (int)(owner.Skills[SkillName.Poisoning].Value / 50);
                    int tSkill = (int)(owner.Skills[SkillName.TasteID].Value / 33);
                    int aSkill = (int)(owner.Skills[SkillName.Alchemy].Value / 33);

                    int    pMin   = pSkill + tSkill + aSkill;
                    int    pMax   = pMin * 2;
                    int    pLevel = 5;
                    Poison pois   = Poison.Lesser;

                    if (this.Name == "poison potion")
                    {
                        pMin = pMin + 2;  pMax = pMax + 2;  pLevel = 4;     pois = Poison.Regular;
                    }
                    else if (this.Name == "greater poison potion")
                    {
                        pMin = pMin + 3;  pMax = pMax + 3;  pLevel = 3;     pois = Poison.Greater;
                    }
                    else if (this.Name == "deadly poison potion")
                    {
                        pMin = pMin + 4;  pMax = pMax + 4;  pLevel = 2;     pois = Poison.Deadly;
                    }
                    else if (this.Name == "lethal poison potion")
                    {
                        pMin = pMin + 5;  pMax = pMax + 5;  pLevel = 1;     pois = Poison.Lethal;
                    }

                    if (pMin >= Utility.RandomMinMax(1, 16))
                    {
                        m.ApplyPoison(owner, pois);
                    }

                    owner.DoHarmful(m);
                    Effects.PlaySound(m.Location, m.Map, 0x4D1);
                    AOS.Damage(m, owner, Hurt(owner, pMin, pMax), 0, 0, 0, 100, 0);
                    //													Ph,		Fr,		Cd,		Ps,		Eg
                }
                else if (this.Name == "liquid fire")
                {
                    int liqMin = Server.Items.BaseLiquid.GetLiquidBonus(owner);
                    int liqMax = liqMin * 2;
                    owner.DoHarmful(m);
                    Effects.SendLocationEffect(m.Location, m.Map, 0x3709, 30, 10);
                    m.PlaySound(0x208);
                    AOS.Damage(m, owner, Hurt(owner, liqMin, liqMax), 20, 80, 0, 0, 0);
                    //														Ph,		Fr,		Cd,		Ps,		Eg
                }
                else if (this.Name == "liquid goo")
                {
                    int liqMin = Server.Items.BaseLiquid.GetLiquidBonus(owner);
                    int liqMax = liqMin * 2;
                    owner.DoHarmful(m);
                    Effects.SendLocationEffect(m.Location, m.Map, Utility.RandomList(0x3967, 0x3979), 30, 10);
                    m.PlaySound(0x5C3);
                    AOS.Damage(m, owner, Hurt(owner, liqMin, liqMax), 20, 0, 0, 0, 80);
                    //														Ph,		Fr,		Cd,		Ps,		Eg
                }
                else if (this.Name == "liquid ice")
                {
                    int liqMin = Server.Items.BaseLiquid.GetLiquidBonus(owner);
                    int liqMax = liqMin * 2;
                    owner.DoHarmful(m);
                    Effects.SendLocationEffect(m.Location, m.Map, 0x1A84, 30, 10, 0x9C1, 0);
                    m.PlaySound(0x10B);
                    AOS.Damage(m, owner, Hurt(owner, liqMin, liqMax), 20, 0, 80, 0, 0);
                    //														Ph,		Fr,		Cd,		Ps,		Eg
                }
                else if (this.Name == "liquid rot")
                {
                    int liqMin = Server.Items.BaseLiquid.GetLiquidBonus(owner);
                    int liqMax = liqMin * 2;
                    owner.DoHarmful(m);
                    Effects.SendLocationEffect(m.Location, m.Map, 0x3400, 60);
                    Effects.PlaySound(m.Location, m.Map, 0x108);
                    AOS.Damage(m, owner, Hurt(owner, liqMin, liqMax), 20, 0, 0, 80, 0);
                    //														Ph,		Fr,		Cd,		Ps,		Eg
                }
                else if (this.Name == "liquid pain")
                {
                    int liqMin = Server.Items.BaseLiquid.GetLiquidBonus(owner);
                    int liqMax = liqMin * 2;
                    owner.DoHarmful(m);
                    m.FixedParticles(0x37C4, 1, 8, 9916, 39, 3, EffectLayer.Head);
                    m.FixedParticles(0x37C4, 1, 8, 9502, 39, 4, EffectLayer.Head);
                    m.PlaySound(0x210);
                    AOS.Damage(m, owner, Hurt(owner, liqMin, liqMax), 80, 5, 5, 5, 5);
                    //														Ph,		Fr,		Cd,		Ps,		Eg
                }
            }
            return(true);
        }
Exemple #8
0
            protected override void OnTick()
            {
                if (!m_Target.Alive)
                {
                    m_Table.Remove(m_Target);
                    Stop();
                }

                if (!m_Target.Alive || DateTime.UtcNow < m_NextHit)
                {
                    return;
                }

                --m_Count;

                if (m_HitDelay > 1)
                {
                    if (m_MaxCount < 5)
                    {
                        --m_HitDelay;
                    }
                    else
                    {
                        int delay = (int)(Math.Ceiling((1.0 + (5 * m_Count)) / m_MaxCount));

                        if (delay <= 5)
                        {
                            m_HitDelay = delay;
                        }
                        else
                        {
                            m_HitDelay = 5;
                        }
                    }
                }

                if (m_Count == 0)
                {
                    m_Target.SendLocalizedMessage(1061687);                     // You can breath normally again.
                    m_Table.Remove(m_Target);
                    Stop();
                }
                else
                {
                    m_NextHit = DateTime.UtcNow + TimeSpan.FromSeconds(m_HitDelay);

                    double damage = m_MinBaseDamage + (Utility.RandomDouble() * (m_MaxBaseDamage - m_MinBaseDamage));

                    damage *= (3 - (((double)m_Target.Stam / m_Target.StamMax) * 2));

                    if (damage < 1)
                    {
                        damage = 1;
                    }

                    if (!m_Target.Player)
                    {
                        damage *= 1.75;
                    }

                    AOS.Damage(m_Target, m_From, (int)damage, 0, 0, 0, 100, 0);

                    if (0.60 <= Utility.RandomDouble())                     // OSI: randomly revealed between first and third damage tick, guessing 60% chance
                    {
                        m_Target.RevealingAction();
                    }
                }
            }
        private void OnFirebombTimerTick()
        {
            if (Deleted)
            {
                m_Timer.Stop();
                return;
            }

            if (Map == Map.Internal && HeldBy == null)
            {
                return;
            }

            switch (m_Ticks)
            {
            case 0:
            case 1:
            case 2:
            {
                ++m_Ticks;

                if (HeldBy != null)
                {
                    HeldBy.PublicOverheadMessage(MessageType.Regular, 957, false, m_Ticks.ToString());
                }
                else if (RootParent == null)
                {
                    PublicOverheadMessage(MessageType.Regular, 957, false, m_Ticks.ToString());
                }
                else if (RootParent is Mobile)
                {
                    ((Mobile)RootParent).PublicOverheadMessage(MessageType.Regular, 957, false, m_Ticks.ToString());
                }

                break;
            }

            default:
            {
                if (HeldBy != null)
                {
                    HeldBy.DropHolding();
                }

                if (m_Users != null)
                {
                    foreach (Mobile m in m_Users)
                    {
                        ThrowTarget targ = m.Target as ThrowTarget;

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

                    m_Users.Clear();
                    m_Users = null;
                }

                if (RootParent is Mobile)
                {
                    Mobile parent = (Mobile)RootParent;
                    parent.SendLocalizedMessage(1060583);         // The firebomb explodes in your hand!
                    AOS.Damage(parent, Utility.Random(3) + 4, 0, 100, 0, 0, 0);
                }
                else if (RootParent == null)
                {
                    List <Mobile>     toDamage = new List <Mobile>();
                    IPooledEnumerable eable    = Map.GetMobilesInRange(Location, 1);

                    foreach (Mobile m in eable)
                    {
                        toDamage.Add(m);
                    }
                    eable.Free();

                    Mobile victim;
                    for (int i = 0; i < toDamage.Count; ++i)
                    {
                        victim = toDamage[i];

                        if (m_LitBy == null || (SpellHelper.ValidIndirectTarget(m_LitBy, victim) && m_LitBy.CanBeHarmful(victim, false)))
                        {
                            if (m_LitBy != null)
                            {
                                m_LitBy.DoHarmful(victim);
                            }

                            AOS.Damage(victim, m_LitBy, Utility.Random(3) + 4, 0, 100, 0, 0, 0);
                        }
                    }
                    (new FirebombField(m_LitBy, toDamage)).MoveToWorld(Location, Map);
                }

                m_Timer.Stop();
                Delete();
                break;
            }
            }
        }
Exemple #10
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;
            }

            List <Mobile>     targets = new List <Mobile>();
            IPooledEnumerable eable   = defender.GetMobilesInRange(5);

            foreach (Mobile m in eable)
            {
                if (m != defender && m != attacker && SpellHelper.ValidIndirectTarget(attacker, m))
                {
                    if (m == null || m.Deleted || m.Map != attacker.Map || !m.Alive || !attacker.CanSee(m) || !attacker.CanBeHarmful(m))
                    {
                        continue;
                    }

                    if (!attacker.InRange(m, weapon.MaxRange) || !attacker.InLOS(m))
                    {
                        continue;
                    }

                    targets.Add(m);
                }
            }

            eable.Free();
            defender.BoltEffect(0);

            if (targets.Count > 0)
            {
                while (targets.Count > 2)
                {
                    targets.Remove(targets[Utility.Random(targets.Count)]);
                }

                for (int i = 0; i < targets.Count; ++i)
                {
                    Mobile m = targets[i];

                    m.BoltEffect(0);

                    AOS.Damage(m, attacker, Utility.RandomMinMax(29, 40), 0, 0, 0, 0, 100);
                }
            }

            targets.Clear();
        }
Exemple #11
0
        public override void OnHit(Mobile attacker, Mobile defender, int damage)
        {
            if (!Validate(attacker))
            {
                return;
            }

            if (defender is ChaosDragoon || defender is ChaosDragoonElite)
            {
                return;
            }

            if (attacker.Mounted && (!(attacker.Weapon is Lance) || !(defender.Weapon is Lance)))                 // TODO: Should there be a message here?
            {
                return;
            }

            ClearCurrentAbility(attacker);

            IMount mount = defender.Mount;

            if (mount == null && !Server.Spells.Ninjitsu.AnimalForm.UnderTransformation(defender))
            {
                attacker.SendLocalizedMessage(1060848);                   // This attack only works on mounted targets
                return;
            }

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

            if (Core.ML && attacker is LesserHiryu && 0.8 >= Utility.RandomDouble())
            {
                return;                 //Lesser Hiryu have an 80% chance of missing this attack
            }

            attacker.SendLocalizedMessage(1060082);               // The force of your attack has dislodged them from their mount!

            if (attacker.Mounted)
            {
                defender.SendLocalizedMessage(1062315);                   // You fall off your mount!
            }
            else
            {
                defender.SendLocalizedMessage(1060083);                   // You fall off of your mount and take damage!
            }
            defender.PlaySound(0x140);
            defender.FixedParticles(0x3728, 10, 15, 9955, EffectLayer.Waist);

            if (defender is PlayerMobile)
            {
                if (Server.Spells.Ninjitsu.AnimalForm.UnderTransformation(defender))
                {
                    defender.SendLocalizedMessage(1114066, attacker.Name);                     // ~1_NAME~ knocked you out of animal form!
                }
                else if (defender.Mounted)
                {
                    defender.SendLocalizedMessage(1040023);                     // You have been knocked off of your mount!
                }

                (defender as PlayerMobile).SetMountBlock(BlockMountType.Dazed, TimeSpan.FromSeconds(10), true);
            }
            else
            {
                defender.Mount.Rider = null;
            }

            if (attacker is PlayerMobile)
            {
                (attacker as PlayerMobile).SetMountBlock(BlockMountType.DismountRecovery, RemountDelay, true);
            }
            else if (Core.ML && attacker is BaseCreature)
            {
                BaseCreature bc = attacker as BaseCreature;

                if (bc.ControlMaster is PlayerMobile)
                {
                    PlayerMobile pm = bc.ControlMaster as PlayerMobile;

                    pm.SetMountBlock(BlockMountType.DismountRecovery, RemountDelay, false);
                }
            }

            if (!attacker.Mounted)
            {
                AOS.Damage(defender, attacker, Utility.RandomMinMax(15, 25), 100, 0, 0, 0, 0);
            }
        }
Exemple #12
0
            protected override void OnTarget(Mobile from, object target)
            {
                PlayerMobile player = from as PlayerMobile;

                if (!UOACZSystem.IsUOACZValidMobile(player))
                {
                    return;
                }
                if (!player.IsUOACZHuman)
                {
                    return;
                }

                if (m_Torch == null)
                {
                    return;
                }
                if (m_Torch.Deleted)
                {
                    return;
                }

                IPoint3D location = target as IPoint3D;

                if (location == null)
                {
                    return;
                }

                Map map = player.Map;

                if (map == null)
                {
                    return;
                }

                SpellHelper.GetSurfaceTop(ref location);

                Mobile mobileTarget = null;

                targetLocation = new Entity(Serial.Zero, new Point3D(location), map);

                if (new Point3D(location) == from.Location)
                {
                    return;
                }

                if (!player.CanBeginAction(typeof(UOACZTorch)))
                {
                    player.SendMessage("You must wait a few moments before throwing another torch.");
                    return;
                }

                if (Utility.GetDistance(player.Location, targetLocation.Location) > ThrowRange)
                {
                    player.SendMessage("That location is too far away.");
                    return;
                }

                player.RevealingAction();

                SpecialAbilities.HinderSpecialAbility(1.0, null, player, 1.0, 1, true, 0, false, "", "", "-1");

                m_Torch.Delete();

                player.Animate(31, 7, 1, true, false, 0);

                int throwSound = 0x5D3;
                int hitSound   = 0x5CF;
                int itemID     = 2578;
                int itemHue    = 0;

                Timer.DelayCall(TimeSpan.FromSeconds(.5), delegate
                {
                    if (!UOACZSystem.IsUOACZValidMobile(player))
                    {
                        return;
                    }
                    if (!player.IsUOACZHuman)
                    {
                        return;
                    }

                    player.BeginAction(typeof(UOACZTorch));

                    Timer.DelayCall(TimeSpan.FromSeconds(UOACZTorch.CooldownSeconds), delegate
                    {
                        if (player != null)
                        {
                            player.EndAction(typeof(UOACZTorch));
                        }
                    });

                    Effects.PlaySound(player.Location, player.Map, throwSound);

                    IEntity startLocation = new Entity(Serial.Zero, new Point3D(player.Location.X, player.Location.Y, player.Location.Z + 5), player.Map);
                    IEntity endLocation   = new Entity(Serial.Zero, new Point3D(targetLocation.Location.X, targetLocation.Location.Y, targetLocation.Location.Z + 5), targetLocation.Map);

                    Effects.SendMovingEffect(startLocation, endLocation, itemID, 15, 0, false, false, itemHue, 0);

                    double distance         = player.GetDistanceToSqrt(endLocation.Location);
                    double destinationDelay = (double)distance * .04;

                    Timer.DelayCall(TimeSpan.FromSeconds(destinationDelay), delegate
                    {
                        Effects.PlaySound(endLocation.Location, endLocation.Map, hitSound);
                        Effects.SendLocationParticles(EffectItem.Create(endLocation.Location, endLocation.Map, TimeSpan.FromSeconds(1.0)), 0x3709, 10, 30, 0, 0, 5052, 0);

                        //Mobiles
                        Queue m_Queue = new Queue();

                        IPooledEnumerable nearbyMobiles = endLocation.Map.GetMobilesInRange(endLocation.Location, 0);

                        int mobilesHit = 0;

                        foreach (Mobile mobile in nearbyMobiles)
                        {
                            if (!UOACZSystem.IsUOACZValidMobile(mobile))
                            {
                                continue;
                            }

                            m_Queue.Enqueue(mobile);
                            mobilesHit++;
                        }

                        nearbyMobiles.Free();

                        while (m_Queue.Count > 0)
                        {
                            Mobile mobile = (Mobile)m_Queue.Dequeue();

                            BaseCreature bc_Target = mobile as BaseCreature;
                            PlayerMobile pm_Target = mobile as PlayerMobile;

                            int minDamage = 20;
                            int maxDamage = 40;

                            double damageScalar = 2;

                            if (pm_Target != null)
                            {
                                if (pm_Target.IsUOACZHuman)
                                {
                                    damageScalar = 0;
                                }

                                if (pm_Target.IsUOACZUndead)
                                {
                                    damageScalar = .66;
                                }
                            }

                            int damage = (int)(Math.Round(((double)Utility.RandomMinMax(minDamage, maxDamage)) * damageScalar));

                            bool humanSource = false;

                            if (player != null)
                            {
                                if (player.IsUOACZHuman)
                                {
                                    humanSource = true;
                                }
                            }

                            if (damage > 0)
                            {
                                if (humanSource)
                                {
                                    player.DoHarmful(mobile);

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

                                else
                                {
                                    new Blood().MoveToWorld(mobile.Location, mobile.Map);
                                    AOS.Damage(mobile, damage, 100, 0, 0, 0, 0);
                                }
                            }
                        }

                        if (mobilesHit > 0)
                        {
                            Effects.PlaySound(endLocation.Location, endLocation.Map, 0x054);
                            Effects.SendLocationParticles(EffectItem.Create(endLocation.Location, endLocation.Map, TimeSpan.FromSeconds(1.0)), 0x3709, 10, 30, 0, 0, 5052, 0);
                        }

                        bool oilLocationHit = false;

                        //Items
                        IPooledEnumerable nearbyItems = endLocation.Map.GetItemsInRange(endLocation.Location, 1);

                        foreach (Item item in nearbyItems)
                        {
                            if (item is UOACZOilLocation)
                            {
                                m_Queue.Enqueue(item);
                            }
                        }

                        nearbyItems.Free();

                        while (m_Queue.Count > 0)
                        {
                            UOACZOilLocation oilLocation = (UOACZOilLocation)m_Queue.Dequeue();

                            if (oilLocation == null)
                            {
                                continue;
                            }
                            if (oilLocation.Deleted)
                            {
                                continue;
                            }
                            if (oilLocation.Burning)
                            {
                                continue;
                            }

                            oilLocation.Ignite(player);
                            oilLocationHit = true;
                        }

                        if (!oilLocationHit)
                        {
                            Effects.PlaySound(endLocation.Location, endLocation.Map, 0x3BE);
                            Effects.SendLocationParticles(EffectItem.Create(endLocation.Location, endLocation.Map, TimeSpan.FromSeconds(1.0)), 0x3735, 10, 30, 0, 0, 5052, 0);
                        }
                    });
                });
            }
Exemple #13
0
        public void Explode(Mobile from, bool direct, Point3D loc, Map map)
        {
            if (Deleted)
            {
                return;
            }

            if (from != null)
            {
                CustomRegion cR  = from.Region as CustomRegion;
                CustomRegion cR2 = Region.Find(loc, map) as CustomRegion;

                if ((cR != null && !cR.Controller.CanUsePotExplosion) || (cR2 != null && !cR2.Controller.CanUsePotExplosion))
                {
                    return;
                }
            }
            else
            {
                CustomRegion cR = Region.Find(loc, map) as CustomRegion;

                if ((cR != null && !cR.Controller.CanUsePotExplosion))
                {
                    return;
                }
            }

            if (!EventItem || (EventItem && EventItemConsume))
            {
                Consume();
            }
            else
            {
                Mobile m;
                if (m_Users != null && m_Users[0] is Mobile)
                {
                    m = (Mobile)m_Users[0];
                }
                else
                {
                    m = from;
                }

                if (m != null && RootParentEntity != m)
                {
                    m.AddToBackpack(this);
                }

                m_Timer = null;
            }

            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, 0x207);
            Effects.SendLocationEffect(loc, map, 0x36BD, 20);

            int alchemyBonus = 0;

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

            IPooledEnumerable eable     = LeveledExplosion ? map.GetObjectsInRange(loc, ExplosionRange) : map.GetMobilesInRange(loc, ExplosionRange);
            ArrayList         toExplode = new ArrayList();

            int toDamage = 0;

            foreach (object o in eable)
            {
                if (o is Mobile)
                {
                    toExplode.Add(o);
                    ++toDamage;
                }
                else if (o is BaseExplosionPotion && o != this)
                {
                    toExplode.Add(o);
                }
            }

            eable.Free();

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

            for (int i = 0; i < toExplode.Count; ++i)
            {
                object o = toExplode[i];

                if (o is Mobile)
                {
                    Mobile        m   = (Mobile)o;
                    GuardedRegion reg = (GuardedRegion)Region.Find(m.Location, m.Map).GetRegion(typeof(GuardedRegion));

                    //Taran: Don't hurt mobiles in guarded
                    if (reg == null || reg.Disabled)
                    {
                        if (from != null && from.CanBeHarmful(m, false))
                        {
                            from.DoHarmful(m);

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

                            damage += alchemyBonus;

                            #region Taran - Damage based on AR
                            if (m is PlayerMobile)
                            {
                                int armorRating = (int)((PlayerMobile)m).BaseArmorRatingSpells;

                                damage = (int)(damage * 1.5) - armorRating;

                                if (damage > 49)
                                {
                                    damage = 49;
                                }

                                if (damage < 15)
                                {
                                    damage = 15;
                                }
                            }
                            #endregion

                            /*
                             *          if (!Core.AOS && damage > 40)
                             *              damage = 40;
                             *          else if (Core.AOS && toDamage > 2)
                             *              damage /= toDamage - 1;
                             */

                            AOS.Damage(m, from, damage, 0, 100, 0, 0, 0);
                        }
                    }
                }
                else if (o is BaseExplosionPotion && direct)
                {
                    if (count > 4) //Only explode 5 pots at most including the used one
                    {
                        break;
                    }

                    BaseExplosionPotion pot = (BaseExplosionPotion)o;
                    Mobile m;

                    if (pot.m_Users != null && pot.m_Users[0] is Mobile)
                    {
                        m = (Mobile)pot.m_Users[0];
                    }
                    else
                    {
                        m = from;
                    }

                    pot.Explode(m, false, pot.GetWorldLocation(), pot.Map);

                    count++;
                }
            }
        }
Exemple #14
0
        private void DoCounter(Mobile attacker)
        {
            if (0.2 > Utility.RandomDouble())
            {
                Mobile target = null;

                if (attacker is BaseCreature)
                {
                    Mobile m = ((BaseCreature)attacker).GetMaster();

                    if (m != null)
                    {
                        target = m;
                    }
                }

                if (target == null || !target.InRange(this, 25))
                {
                    target = attacker;
                }

                int roll = Utility.Random(100);

                if (roll < 10)
                {
                    Mobile spawn = new ExodusOverseer();
                    spawn.MoveToWorld(target.Location, target.Map);

                    spawn.Combatant = target;
                    spawn.Z++;

                    if (target is PlayerMobile)
                    {
                        target.SendMessage("Fail Safe summons a minion!");
                    }
                }
                else if (roll < 30)
                {
                    int dmg = target.Hits / 2;

                    this.MovingParticles(target, 0x36D4, 7, 0, false, true, 9502, 4019, 0x160);
                    this.PlaySound(Core.AOS ? 0x15E : 0x44B);

                    DoHarmful(target);
                    AOS.Damage(target, this, dmg, true, 50, 0, 0, 0, 50);

                    if (target is PlayerMobile)
                    {
                        target.SendMessage("Fail Safe uses a fusion attack.");
                    }
                }
                else
                {
                    target.Location = this.Location;
                    target.Map      = this.Map;

                    this.FixedParticles(0x376A, 9, 32, 0x13AF, EffectLayer.Waist);
                    this.PlaySound(0x1FE);

                    if (target is PlayerMobile)
                    {
                        target.SendMessage("Fail Safe uses gravity well on you!");
                    }
                }
            }
        }
 public override void AlterDamageScalarFrom(Mobile caster, ref double scalar)
 {
     base.AlterDamageScalarFrom(caster, ref scalar);
     caster.BoltEffect(0);
     AOS.Damage(this, caster, 20, 0, 0, 0, 0, 100);
 }
Exemple #16
0
 public override void OnTick()
 {
     AOS.Damage(Victim, Attacker, Utility.RandomMinMax(20, 40), 0, 0, 0, 0, 100);
 }
Exemple #17
0
        public override void OnThink()
        {
            base.OnThink();

            if (Combatant == null)
            {
                return;
            }

            if (_NextSpecial < DateTime.UtcNow)
            {
                _NextSpecial = DateTime.UtcNow + TimeSpan.FromSeconds(Utility.RandomMinMax(45, 60));

                switch (Utility.Random(Teleports ? 3 : 2))
                {
                case 0:
                    IPooledEnumerable eable = Map.GetMobilesInRange(Location, 10);

                    foreach (Mobile m in eable)
                    {
                        if (m.Alive && m.AccessLevel == AccessLevel.Player && m is PlayerMobile && .75 > Utility.RandomDouble())
                        {
                            DoDismount(m);
                        }
                    }

                    eable.Free();
                    break;

                case 1:
                    IPooledEnumerable eable2  = Map.GetMobilesInRange(Location, 10);
                    List <Mobile>     mobiles = new List <Mobile>();

                    foreach (Mobile m in eable2)
                    {
                        if (m.Alive && m.AccessLevel == AccessLevel.Player && m is PlayerMobile)
                        {
                            mobiles.Add(m);
                        }
                    }

                    eable2.Free();

                    if (mobiles.Count > 0)
                    {
                        Mobile  m    = mobiles[Utility.Random(mobiles.Count)];
                        Point3D old2 = m.Location;
                        Point3D p2   = _PlayerTeleList[Utility.Random(_PlayerTeleList.Length)];

                        m.MoveToWorld(p2, Map);
                        m.ProcessDelta();

                        Effects.SendLocationParticles(EffectItem.Create(old2, Map, EffectItem.DefaultDuration), 0x3728, 10, 10, 2023);
                        Effects.SendLocationParticles(EffectItem.Create(p2, Map, EffectItem.DefaultDuration), 0x3728, 10, 10, 5023);
                    }

                    ColUtility.Free(mobiles);
                    break;

                case 2:
                    int ran = -1;

                    while (ran < 0 || ran > _TeleList.Length || ran == _LastTeleport)
                    {
                        ran = Utility.Random(_TeleList.Length);
                    }

                    _LastTeleport = ran;
                    Point3D p   = _TeleList[ran];
                    Point3D old = Location;

                    MoveToWorld(p, Map);
                    ProcessDelta();

                    Effects.SendLocationParticles(EffectItem.Create(old, Map, EffectItem.DefaultDuration), 0x3728, 10, 10, 2023);
                    Effects.SendLocationParticles(EffectItem.Create(p, Map, EffectItem.DefaultDuration), 0x3728, 10, 10, 5023);
                    break;
                }
            }
            else if (_NextBarrelThrow < DateTime.UtcNow && .25 > Utility.RandomDouble())
            {
                _NextBarrelThrow = DateTime.UtcNow + TimeSpan.FromSeconds(Utility.RandomMinMax(5, 10));
                int barrel = CheckBarrel();

                if (barrel >= 0)
                {
                    IPooledEnumerable eable   = Map.GetMobilesInRange(Location, 10);
                    List <Mobile>     mobiles = new List <Mobile>();

                    foreach (Mobile m in eable)
                    {
                        if (m.Alive && m.AccessLevel == AccessLevel.Player && m is PlayerMobile)
                        {
                            mobiles.Add(m);
                        }
                    }

                    eable.Free();

                    if (mobiles.Count > 0)
                    {
                        Mobile m = mobiles[Utility.Random(mobiles.Count)];
                        DoHarmful(m);

                        MovingParticles(m, barrel, 10, 0, false, true, 0, 0, 9502, 6014, 0x11D, EffectLayer.Waist, 0);

                        Timer.DelayCall(TimeSpan.FromSeconds(1), () =>
                        {
                            m.PlaySound(0x11D);
                            AOS.Damage(m, this, Utility.RandomMinMax(70, 120), 100, 0, 0, 0, 0);
                        });
                    }

                    ColUtility.Free(mobiles);
                }
            }
        }
Exemple #18
0
        public virtual int GetNewAosDamage(int bonus, int dice, int sides, bool playerVsPlayer, double scalar, Mobile target)
        {
            int damage      = Utility.Dice(dice, sides, bonus) * 100;
            int damageBonus = 0;

            int inscribeSkill = GetInscribeFixed(m_Caster);
            int inscribeBonus = (inscribeSkill + (1000 * (inscribeSkill / 1000))) / 200;

            damageBonus += inscribeBonus;

            int intBonus = Caster.Int / 10;

            damageBonus += intBonus;

            int sdiBonus = AosAttributes.GetValue(m_Caster, AosAttribute.SpellDamage);

            #region Mondain's Legacy
            sdiBonus += ArcaneEmpowermentSpell.GetSpellBonus(m_Caster, playerVsPlayer);
            #endregion

            if (target != null && RunedSashOfWarding.IsUnderEffects(target, WardingEffect.SpellDamage))
            {
                sdiBonus -= 10;
            }

            if (m_Caster is PlayerMobile && m_Caster.Race == Race.Gargoyle)
            {
                double perc = ((double)m_Caster.Hits / (double)m_Caster.HitsMax) * 100;

                perc  = 100 - perc;
                perc /= 20;

                if (perc > 4)
                {
                    sdiBonus += 12;
                }
                else if (perc >= 3)
                {
                    sdiBonus += 9;
                }
                else if (perc >= 2)
                {
                    sdiBonus += 6;
                }
                else if (perc >= 1)
                {
                    sdiBonus += 3;
                }
            }

            // PvP spell damage increase cap of 15% from an item’s magic property, 30% if spell school focused.
            if (playerVsPlayer)
            {
                if (SpellHelper.HasSpellMastery(m_Caster) && sdiBonus > 30)
                {
                    sdiBonus = 30;
                }

                if (!SpellHelper.HasSpellMastery(m_Caster) && sdiBonus > 15)
                {
                    sdiBonus = 15;
                }
            }

            damageBonus += sdiBonus;

            damage = AOS.Scale(damage, 100 + damageBonus);

            if (target != null && Feint.Registry.ContainsKey(target) && Feint.Registry[target].Enemy == Caster)
            {
                damage -= (int)((double)damage * ((double)Feint.Registry[target].DamageReduction / 100));
            }

            int evalSkill = GetDamageFixed(m_Caster);
            int evalScale = 30 + ((9 * evalSkill) / 100);

            damage = AOS.Scale(damage, evalScale);

            damage = AOS.Scale(damage, (int)(scalar * 100));

            return(damage / 100);
        }
Exemple #19
0
        public void Earthquake()
        {
            Map map = Map;

            if (map == null)
            {
                return;
            }
            ArrayList         targets = new ArrayList();
            IPooledEnumerable eable   = GetMobilesInRange(8);

            foreach (Mobile m in eable)
            {
                if (m == this || !CanBeHarmful(m))
                {
                    continue;
                }
                if (m is BaseCreature && (((BaseCreature)m).Controlled || ((BaseCreature)m).Summoned || ((BaseCreature)m).Team != Team))
                {
                    targets.Add(m);
                }
                else if (m.Player)
                {
                    targets.Add(m);
                }
            }
            eable.Free();
            PlaySound(0x2F3);
            for (int i = 0; i < targets.Count; ++i)
            {
                Mobile m = (Mobile)targets[i];

                if (m == null || m.Deleted)
                {
                    continue;
                }

                if (m is PlayerMobile pm && pm.Mounted)
                {
                    pm.SetMountBlock(BlockMountType.DismountRecovery, TimeSpan.FromSeconds(10), true);
                }

                double damage = m.Hits * 0.6;//was .6

                if (damage < 10.0)
                {
                    damage = 10.0;
                }
                else if (damage > 75.0)
                {
                    damage = 75.0;
                }

                DoHarmful(m);

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

                if (m.Alive && m.Body.IsHuman && !m.Mounted)
                {
                    m.Animate(20, 7, 1, true, false, 0); // take hit
                }
            }
        }
Exemple #20
0
 public static int Scale(Mobile m, int v)
 {
     return(AOS.Scale(v, 100 + EnhancePotions(m)));
 }
        public override void OnResponse(NetState state, RelayInfo info)
        {
            Mobile from = state.Mobile;

            from.CloseGump(typeof(ResurrectGump));

            if (info.ButtonID == 1 || info.ButtonID == 2)
            {
                if (from.Map == null || !from.Map.CanFit(from.Location, 16, false, false))
                {
                    from.SendLocalizedMessage(502391);                       // Thou can not be resurrected there!
                    return;
                }

                if (m_Price > 0)
                {
                    if (info.IsSwitched(1))
                    {
                        if (Banker.Withdraw(from, m_Price))
                        {
                            from.SendLocalizedMessage(1060398, m_Price.ToString());                               // ~1_AMOUNT~ gold has been withdrawn from your bank box.
                            from.SendLocalizedMessage(1060022, Banker.GetBalance(from).ToString());               // You have ~1_AMOUNT~ gold in cash remaining in your bank box.
                        }
                        else
                        {
                            from.SendLocalizedMessage(1060020);                               // Unfortunately, you do not have enough cash in your bank to cover the cost of the healing.
                            return;
                        }
                    }
                    else
                    {
                        from.SendLocalizedMessage(1060019);                           // You decide against paying the healer, and thus remain dead.
                        return;
                    }
                }

                from.PlaySound(0x214);

                from.Resurrect();

                Effects.SendLocationParticles(EffectItem.Create(from.Location, from.Map, EffectItem.DefaultDuration), 0, 0, 0, 0, 0, 5060, 0);

                Effects.SendMovingParticles(new Entity(0, new Point3D(from.X - 6, from.Y - 6, from.Z + 15), from.Map), from, 0x36D4, 7, 0, false, true, 0x497, 0, 9502, 1, 0, (EffectLayer)255, 0x100);
                Effects.SendMovingParticles(new Entity(0, new Point3D(from.X - 4, from.Y - 6, from.Z + 15), from.Map), from, 0x36D4, 7, 0, false, true, 0x497, 0, 9502, 1, 0, (EffectLayer)255, 0x100);
                Effects.SendMovingParticles(new Entity(0, new Point3D(from.X - 6, from.Y - 4, from.Z + 15), from.Map), from, 0x36D4, 7, 0, false, true, 0x497, 0, 9502, 1, 0, (EffectLayer)255, 0x100);

                Effects.SendTargetParticles(from, 0x375A, 35, 90, 0x00, 0x00, 9502, (EffectLayer)255, 0x100);

                if (m_Healer != null && from != m_Healer)
                {
                    VirtueLevel level = VirtueHelper.GetLevel(m_Healer, VirtueName.Compassion);

                    switch (level)
                    {
                    case VirtueLevel.Seeker:
                        from.Hits = AOS.Scale(from.HitsMax, 20);
                        break;

                    case VirtueLevel.Follower:
                        from.Hits = AOS.Scale(from.HitsMax, 40);
                        break;

                    case VirtueLevel.Knight:
                        from.Hits = AOS.Scale(from.HitsMax, 80);
                        break;
                    }
                }

                Mobile m = from;

                Misc.Titles.AwardFame(from, -100, true);                   // TODO: Proper fame loss

                if (!Core.AOS && from.ShortTermMurders >= 5)
                {
                    double loss = (100.0 - (4.0 + (from.ShortTermMurders / 5.0))) / 100.0;                 //5 to 15% loss
                    if (loss < 0.85)
                    {
                        loss = 0.85;
                    }
                    else if (loss > 0.95)
                    {
                        loss = 0.95;
                    }

                    if (from.RawStr * loss > 10)
                    {
                        from.RawStr = (int)(from.RawStr * loss);
                    }
                    if (from.RawInt * loss > 10)
                    {
                        from.RawInt = (int)(from.RawInt * loss);
                    }
                    if (from.RawDex * loss > 10)
                    {
                        from.RawDex = (int)(from.RawDex * loss);
                    }

                    for (int s = 0; s < from.Skills.Length; s++)
                    {
                        if (from.Skills[s].Base * loss > 35)
                        {
                            from.Skills[s].Base *= loss;
                        }
                    }
                }
            }
        }
Exemple #22
0
        public override void OnResponse(NetState state, RelayInfo info)
        {
            Mobile from = state.Mobile;

            from.CloseGump <ResurrectGump>();

            if (info.ButtonID == 2)
            {
                if (from.Map == null || !from.Map.CanFit(from.Location, 16, false, false))
                {
                    from.SendLocalizedMessage(502391);                       // Thou can not be resurrected there!
                    return;
                }

                if (m_Price > 0)
                {
                    if (info.IsSwitched(1))
                    {
                        if (Banker.Withdraw(from, m_Price))
                        {
                            from.SendLocalizedMessage(1060398, m_Price.ToString());                               // ~1_AMOUNT~ gold has been withdrawn from your bank box.
                            from.SendLocalizedMessage(1060022, Banker.GetBalance(from).ToString());               // You have ~1_AMOUNT~ gold in cash remaining in your bank box.
                        }
                        else
                        {
                            from.SendLocalizedMessage(1060020);                               // Unfortunately, you do not have enough cash in your bank to cover the cost of the healing.
                            return;
                        }
                    }
                    else
                    {
                        from.SendLocalizedMessage(1060019);                           // You decide against paying the healer, and thus remain dead.
                        return;
                    }
                }

                from.PlaySound(0x214);

                from.Resurrect(m_Healer);

                if (from is PlayerMobile)
                {
                    ((PlayerMobile)from).CheckKRStartingQuestStep(26);
                }

                if (m_Healer != null && from != m_Healer)
                {
                    VirtueLevel level = VirtueHelper.GetLevel(m_Healer, VirtueName.Compassion);

                    switch (level)
                    {
                    case VirtueLevel.Seeker:
                        from.Hits = AOS.Scale(from.HitsMax, 20);
                        break;

                    case VirtueLevel.Follower:
                        from.Hits = AOS.Scale(from.HitsMax, 40);
                        break;

                    case VirtueLevel.Knight:
                        from.Hits = AOS.Scale(from.HitsMax, 80);
                        break;
                    }
                }

                if (m_FromSacrifice && from is PlayerMobile)
                {
                    ((PlayerMobile)from).AvailableResurrects -= 1;

                    Container pack   = from.Backpack;
                    Container corpse = from.Corpse;

                    if (pack != null && corpse != null)
                    {
                        ArrayList items = new ArrayList(corpse.Items);

                        for (int i = 0; i < items.Count; ++i)
                        {
                            Item item = (Item)items[i];

                            if (item.Movable && item.LootType != LootType.Cursed)
                            {
                                pack.DropItem(item);
                            }
                        }
                    }
                }

                if (from.Fame > 0)
                {
                    int amount = from.Fame / 10;

                    Misc.Titles.AwardFame(from, -amount, true);
                }
            }
        }
Exemple #23
0
        public virtual bool CheckSequence()
        {
            int mana = ScaleMana(GetMana());

            if (m_Caster.Deleted || !m_Caster.Alive || m_Caster.Spell != this || m_State != SpellState.Sequencing)
            {
                DoFizzle();
            }
            else if (m_Scroll != null && !(m_Scroll is Runebook) &&
                     (m_Scroll.Amount <= 0 || m_Scroll.Deleted || m_Scroll.RootParent != m_Caster ||
                      (m_Scroll is BaseWand && (((BaseWand)m_Scroll).Charges <= 0 || m_Scroll.Parent != m_Caster))))
            {
                DoFizzle();
            }
            else if (!ConsumeReagents())
            {
                m_Caster.LocalOverheadMessage(MessageType.Regular, 0x22, 502630);                 // More reagents are needed for this spell.
            }
            else if (m_Caster.Mana < mana)
            {
                m_Caster.LocalOverheadMessage(MessageType.Regular, 0x22, 502625);                 // Insufficient mana for this spell.
            }
            else if (Core.AOS && (m_Caster.Frozen || m_Caster.Paralyzed))
            {
                m_Caster.SendLocalizedMessage(502646);                 // You cannot cast a spell while frozen.
                DoFizzle();
            }
            else if (m_Caster is PlayerMobile && ((PlayerMobile)m_Caster).PeacedUntil > DateTime.UtcNow)
            {
                m_Caster.SendLocalizedMessage(1072060);                 // You cannot cast a spell while calmed.
                DoFizzle();
            }
            else if (CheckFizzle())
            {
                m_Caster.Mana -= mana;

                if (m_Scroll is SpellScroll)
                {
                    m_Scroll.Consume();
                }
                #region SA
                else if (m_Scroll is SpellStone)
                {
                    // The SpellScroll check above isn't removing the SpellStones for some reason.
                    m_Scroll.Delete();
                }
                #endregion

                else if (m_Scroll is BaseWand)
                {
                    ((BaseWand)m_Scroll).ConsumeCharge(m_Caster);
                    m_Caster.RevealingAction();
                }

                if (m_Scroll is BaseWand)
                {
                    bool m = m_Scroll.Movable;

                    m_Scroll.Movable = false;

                    if (ClearHandsOnCast)
                    {
                        m_Caster.ClearHands();
                    }

                    m_Scroll.Movable = m;
                }
                else
                {
                    if (ClearHandsOnCast)
                    {
                        m_Caster.ClearHands();
                    }
                }

                int karma = ComputeKarmaAward();

                if (karma != 0)
                {
                    Titles.AwardKarma(Caster, karma, true);
                }

                if (TransformationSpellHelper.UnderTransformation(m_Caster, typeof(VampiricEmbraceSpell)))
                {
                    bool garlic = false;

                    for (int i = 0; !garlic && i < m_Info.Reagents.Length; ++i)
                    {
                        garlic = (m_Info.Reagents[i] == Reagent.Garlic);
                    }

                    if (garlic)
                    {
                        m_Caster.SendLocalizedMessage(1061651);                         // The garlic burns you!
                        AOS.Damage(m_Caster, Utility.RandomMinMax(17, 23), 100, 0, 0, 0, 0);
                    }
                }

                return(true);
            }
            else
            {
                DoFizzle();
            }

            return(false);
        }
Exemple #24
0
        public override void OnResponse(NetState state, RelayInfo info)
        {
            Mobile from = state.Mobile;

            from.CloseGump(typeof(ResurrectGump));

            if (info.ButtonID == 1 || info.ButtonID == 2)
            {
                if (from.Map == null || !from.Map.CanFit(from.Location, 16, false, false))
                {
                    from.SendLocalizedMessage(502391);                       // Thou can not be resurrected there!
                    return;
                }

                if (m_Price > 0)
                {
                    if (info.IsSwitched(1))
                    {
                        if (Banker.Withdraw(from, m_Price))
                        {
                            from.SendLocalizedMessage(1060398, m_Price.ToString());                               // ~1_AMOUNT~ gold has been withdrawn from your bank box.
                            from.SendLocalizedMessage(1060022, Banker.GetBalance(from).ToString());               // You have ~1_AMOUNT~ gold in cash remaining in your bank box.
                        }
                        else
                        {
                            from.SendLocalizedMessage(1060020);                               // Unfortunately, you do not have enough cash in your bank to cover the cost of the healing.
                            return;
                        }
                    }
                    else
                    {
                        from.SendLocalizedMessage(1060019);                           // You decide against paying the healer, and thus remain dead.
                        return;
                    }
                }

                from.PlaySound(0x214);
                from.FixedEffect(0x376A, 10, 16);

                from.Resurrect();

                if (m_Healer != null && from != m_Healer)
                {
                    VirtueLevel level = VirtueHelper.GetLevel(m_Healer, VirtueName.Compassion);

                    switch (level)
                    {
                    case VirtueLevel.Seeker: from.Hits = AOS.Scale(from.HitsMax, 20); break;

                    case VirtueLevel.Follower: from.Hits = AOS.Scale(from.HitsMax, 40); break;

                    case VirtueLevel.Knight: from.Hits = AOS.Scale(from.HitsMax, 80); break;
                    }
                }

                if (m_FromSacrifice && from is PlayerMobile)
                {
                    ((PlayerMobile)from).AvailableResurrects -= 1;

                    Container pack   = from.Backpack;
                    Container corpse = from.Corpse;

                    if (pack != null && corpse != null)
                    {
                        List <Item> items = new List <Item>(corpse.Items);

                        for (int i = 0; i < items.Count; ++i)
                        {
                            Item item = items[i];

                            if (item.Layer != Layer.Hair && item.Layer != Layer.FacialHair && item.Movable)
                            {
                                pack.DropItem(item);
                            }
                        }
                    }
                }

                if (from.Fame > 0)
                {
                    int amount = from.Fame / 10;

                    Misc.Titles.AwardFame(from, -amount, true);
                }

                if (Core.AOS && from.ShortTermMurders >= 5)
                {
                    double loss = (100.0 - (4.0 + (from.ShortTermMurders / 5.0))) / 100.0;                     // 5 to 15% loss

                    if (loss < 0.85)
                    {
                        loss = 0.85;
                    }
                    else if (loss > 0.95)
                    {
                        loss = 0.95;
                    }

                    if (from.RawStr * loss > 10)
                    {
                        from.RawStr = (int)(from.RawStr * loss);
                    }
                    if (from.RawInt * loss > 10)
                    {
                        from.RawInt = (int)(from.RawInt * loss);
                    }
                    if (from.RawDex * loss > 10)
                    {
                        from.RawDex = (int)(from.RawDex * loss);
                    }

                    for (int s = 0; s < from.Skills.Length; s++)
                    {
                        if (from.Skills[s].Base * loss > 35)
                        {
                            from.Skills[s].Base *= loss;
                        }
                    }
                }

                if (from.Alive && m_HitsScalar > 0)
                {
                    from.Hits = (int)(from.HitsMax * m_HitsScalar);
                }
            }
        }
Exemple #25
0
        public void DoSpecial()
        {
            Map map = this.Map;

            if (map == null || map == Map.Internal)
            {
                return;
            }

            int     counter = 0;
            int     dist    = 4;
            Point3D p       = Point3D.Zero;

            IPooledEnumerable eable = this.Map.GetMobilesInRange(this.Location, dist);

            foreach (Mobile m in eable)
            {
                if (m is PlayerMobile)
                {
                    m.Mana = 0;
                    m.PrivateOverheadMessage(MessageType.Regular, 0x21, 1156856, m.NetState); // *Your mana is converted to pure energy!*
                }
            }
            eable.Free();

            for (int i = 0; i < _Offsets.Length; i += 2)
            {
                int tarx = this.X + (int)(_Offsets[i] * dist);
                int tary = this.Y + (int)(_Offsets[i + 1] * dist);
                int tarz = this.Map.GetAverageZ(tarx, tary);

                if (tarx == p.X && tary == p.Y)
                {
                    continue;
                }

                p = new Point3D(tarx, tary, tarz);

                Timer.DelayCall <Point3D>(TimeSpan.FromMilliseconds(350 * counter), (point) =>
                {
                    //Point3D point = new Point3D(tarx, tary, tarz);

                    Entity e = new Entity(Serial.Zero, point, map);
                    this.MovingParticles(e, 0x3818, 10, 0, false, false, 1150, 0, 9502, 6014, 0x11D, EffectLayer.Waist, 0);

                    Timer.DelayCall <Point3D>(TimeSpan.FromMilliseconds(250), (pnt) =>
                    {
                        Effects.SendLocationEffect(pnt, this.Map, 14089, 30, 1150, 4);     // TODO: Check
                    }, point);
                }, p);

                counter++;
            }

            Timer.DelayCall(TimeSpan.FromMilliseconds(Utility.RandomMinMax(300, 350) * (_Offsets.Length / 2)), () =>
            {
                eable = this.Map.GetMobilesInRange(this.Location, dist);

                foreach (Mobile m in eable)
                {
                    if (m != this && m is PlayerMobile || (m is BaseCreature && ((BaseCreature)m).GetMaster() is PlayerMobile) && CanBeHarmful(m))
                    {
                        Direction d = Utility.GetDirection(this, m);

                        int range = 0;
                        int x     = m.X;
                        int y     = m.Y;
                        int orx   = x;
                        int ory   = y;

                        while (range < 15)
                        {
                            range++;
                            int lastx = x;
                            int lasty = y;

                            Movement.Movement.Offset(d, ref x, ref y);
                            int z = map.GetAverageZ(x, y);

                            if (!this.Map.CanFit(new Point3D(x, y, z), 16, false, false))
                            {
                                m.MoveToWorld(new Point3D(lastx, lasty, this.Map.GetAverageZ(lastx, lasty)), this.Map);
                                AOS.Damage(m, this, Utility.RandomMinMax(100, 150), 0, 0, 0, 0, 100);
                                break;
                            }

                            if (range >= 15 && (orx != x || ory != y))
                            {
                                m.MoveToWorld(new Point3D(x, y, z), this.Map);
                                AOS.Damage(m, this, Utility.RandomMinMax(100, 150), 0, 0, 0, 0, 100);
                            }
                        }
                    }
                }
                eable.Free();
            });
        }
Exemple #26
0
        public override void Damage(Mobile m)
        {
            base.Damage(m);

            if (m.Alive)
            {
                BaseEquipableLight lightsource = m.FindItemOnLayer(Layer.TwoHanded) as BaseEquipableLight;

                if (lightsource != null && lightsource.Burning)
                {
                    // Wind
                    if (Utility.RandomDouble() < 0.09)
                    {
                        m.PlaySound(Utility.RandomList(0x014, 0x15, 0x016, 0x5C7));
                        AOS.Damage(m, 0, 0, 0, 0, 0, 0);
                    }
                }
                else
                {
                    // Wind
                    if (Utility.RandomDouble() < 0.09)
                    {
                        m.PlaySound(Utility.RandomList(0x014, 0x15, 0x016, 0x5C7));
                        AOS.Damage(m, 0, 0, 0, 0, 0, 0);
                    }

                    // Anchimayen Ambush 1
                    if (Utility.RandomDouble() < 0.00002)
                    {
                        if (m.Map == Map.Malas)
                        {
                            int x1 = m.X + 10;
                            int y1 = m.Y + 10;
                            int z1 = Map.Malas.GetAverageZ(x1, y1);

                            if (Map.Malas.CanSpawnMobile(x1, y1, z1))
                            {
                                BaseCreature ghoul = new Anchimayen();
                                ghoul.MoveToWorld(new Point3D(x1, y1, z1), Map.Malas);
                                ghoul.PlaySound(1534);

                                AOS.Damage(m, 0, 0, 0, 0, 0, 0);
                                Timer.DelayCall(TimeSpan.FromMinutes(3.0), new TimerStateCallback(DeleteGhoul), ghoul);
                            }
                        }
                    }

                    // Anchimayen Ambush 2
                    if (Utility.RandomDouble() < 0.00002)
                    {
                        if (m.Map == Map.Malas)
                        {
                            int x2 = m.X - 10;
                            int y2 = m.Y - 10;
                            int z2 = Map.Malas.GetAverageZ(x2, y2);

                            if (Map.Malas.CanSpawnMobile(x2, y2, z2))
                            {
                                BaseCreature ghoul = new Anchimayen();
                                ghoul.MoveToWorld(new Point3D(x2, y2, z2), Map.Malas);
                                ghoul.PlaySound(1534);

                                AOS.Damage(m, 0, 0, 0, 0, 0, 0);
                                Timer.DelayCall(TimeSpan.FromMinutes(3.0), new TimerStateCallback(DeleteGhoul), ghoul);
                            }
                        }
                    }

                    // Gualichu Ambush 1
                    if (Utility.RandomDouble() < 0.00002)
                    {
                        if (m.Map == Map.Malas)
                        {
                            int x1 = m.X + 8;
                            int y1 = m.Y + 8;
                            int z1 = Map.Malas.GetAverageZ(x1, y1);

                            if (Map.Malas.CanSpawnMobile(x1, y1, z1))
                            {
                                BaseCreature skeleton = new Gualichu();
                                skeleton.MoveToWorld(new Point3D(x1, y1, z1), Map.Malas);
                                skeleton.PlaySound(0x48D);

                                AOS.Damage(m, 0, 0, 0, 0, 0, 0);
                                Timer.DelayCall(TimeSpan.FromMinutes(3.0), new TimerStateCallback(DeleteSkeleton), skeleton);
                            }
                        }
                    }

                    // Gualichu Ambush 2
                    if (Utility.RandomDouble() < 0.00002)
                    {
                        if (m.Map == Map.Malas)
                        {
                            int x2 = m.X - 8;
                            int y2 = m.Y - 8;
                            int z2 = Map.Malas.GetAverageZ(x2, y2);

                            if (Map.Malas.CanSpawnMobile(x2, y2, z2))
                            {
                                BaseCreature skeleton = new Gualichu();
                                skeleton.MoveToWorld(new Point3D(x2, y2, z2), Map.Malas);
                                skeleton.PlaySound(0x48D);

                                AOS.Damage(m, 0, 0, 0, 0, 0, 0);
                                Timer.DelayCall(TimeSpan.FromMinutes(3.0), new TimerStateCallback(DeleteSkeleton), skeleton);
                            }
                        }
                    }

                    // Wekufe Ambush 1
                    if (Utility.RandomDouble() < 0.00002)
                    {
                        if (m.Map == Map.Malas)
                        {
                            int x1 = m.X + 20;
                            int y1 = m.Y + 20;
                            int z1 = Map.Malas.GetAverageZ(x1, y1);

                            if (Map.Malas.CanSpawnMobile(x1, y1, z1))
                            {
                                BaseCreature wraith = new Wekufe();
                                wraith.MoveToWorld(new Point3D(x1, y1, z1), Map.Malas);
                                wraith.PlaySound(748);

                                AOS.Damage(m, 0, 0, 0, 0, 0, 0);
                                Timer.DelayCall(TimeSpan.FromMinutes(3.0), new TimerStateCallback(DeleteWraith), wraith);
                            }
                        }
                    }

                    // Wekufe Ambush 2
                    if (Utility.RandomDouble() < 0.00002)
                    {
                        if (m.Map == Map.Malas)
                        {
                            int x2 = m.X - 20;
                            int y2 = m.Y - 20;
                            int z2 = Map.Malas.GetAverageZ(x2, y2);

                            if (Map.Malas.CanSpawnMobile(x2, y2, z2))
                            {
                                BaseCreature wraith = new Wekufe();
                                wraith.MoveToWorld(new Point3D(x2, y2, z2), Map.Malas);
                                wraith.PlaySound(748);

                                AOS.Damage(m, 0, 0, 0, 0, 0, 0);
                                Timer.DelayCall(TimeSpan.FromMinutes(3.0), new TimerStateCallback(DeleteWraith), wraith);
                            }
                        }
                    }

                    // Umkhovu Ambush 1
                    if (Utility.RandomDouble() < 0.00002)
                    {
                        if (m.Map == Map.Malas)
                        {
                            int x1 = m.X + 12;
                            int y1 = m.Y + 12;
                            int z1 = Map.Malas.GetAverageZ(x1, y1);

                            if (Map.Malas.CanSpawnMobile(x1, y1, z1))
                            {
                                BaseCreature zombie = new Umkhovu();
                                zombie.MoveToWorld(new Point3D(x1, y1, z1), Map.Malas);
                                zombie.PlaySound(471);

                                AOS.Damage(m, 0, 0, 0, 0, 0, 0);
                                Timer.DelayCall(TimeSpan.FromMinutes(3.0), new TimerStateCallback(DeleteZombie), zombie);
                            }
                        }
                    }

                    // Umkhovu Ambush 2
                    if (Utility.RandomDouble() < 0.00002)
                    {
                        if (m.Map == Map.Malas)
                        {
                            int x2 = m.X - 12;
                            int y2 = m.Y - 12;
                            int z2 = Map.Malas.GetAverageZ(x2, y2);

                            if (Map.Malas.CanSpawnMobile(x2, y2, z2))
                            {
                                BaseCreature zombie = new Umkhovu();
                                zombie.MoveToWorld(new Point3D(x2, y2, z2), Map.Malas);
                                zombie.PlaySound(471);

                                AOS.Damage(m, 0, 0, 0, 0, 0, 0);
                                Timer.DelayCall(TimeSpan.FromMinutes(3.0), new TimerStateCallback(DeleteZombie), zombie);
                            }
                        }
                    }
                }
            }
        }
Exemple #27
0
        private void ClearAround()
        {
            Point3D loc   = Location;
            Map     pmmap = Map;

            List <Point3D> points = new List <Point3D>();

            Misc.Geometry.Circle2D(loc, pmmap, 7, (pnt, map) =>
            {
                if (map.CanFit(pnt, 0) && InLOS(pnt))
                {
                    points.Add(pnt);
                }
            });

            if (pmmap != Map.Internal && pmmap != null)
            {
                Misc.Geometry.Circle2D(loc, pmmap, 6, (pnt, map) =>
                {
                    if (map.CanFit(pnt, 0) && InLOS(pnt) && Utility.RandomBool())
                    {
                        Effects.SendPacket(pnt, map, new ParticleEffect(EffectType.FixedXYZ, Serial, Serial.Zero, 0x3789, pnt, pnt, 1, 30, false, false, 0, 3, 0, 9502, 1, Serial, 153, 0));
                        Effects.SendPacket(pnt, map, new ParticleEffect(EffectType.FixedXYZ, Serial, Serial.Zero, 0x9DAC, pnt, pnt, 1, 30, false, false, 0, 0, 0, 9502, 1, Serial, 153, 0));
                    }
                });

                Misc.Geometry.Circle2D(loc, pmmap, 7, (pnt, map) =>
                {
                    if (map.CanFit(pnt, 0) && InLOS(pnt) && Utility.RandomBool())
                    {
                        Effects.SendPacket(pnt, map, new ParticleEffect(EffectType.FixedXYZ, Serial, Serial.Zero, 0x3789, pnt, pnt, 1, 30, false, false, 0, 3, 0, 9502, 1, Serial, 153, 0));
                        Effects.SendPacket(pnt, map, new ParticleEffect(EffectType.FixedXYZ, Serial, Serial.Zero, 0x9DAC, pnt, pnt, 1, 30, false, false, 0, 0, 0, 9502, 1, Serial, 153, 0));
                    }
                });
            }

            Timer.DelayCall(TimeSpan.FromMilliseconds(500), () =>
            {
                IPooledEnumerable eable = GetMobilesInRange(6);

                foreach (Mobile from in eable)
                {
                    if (!from.Alive || from == this || from.AccessLevel > AccessLevel.Player)
                    {
                        continue;
                    }

                    if /*(points.Count > 0 && */ (from is PlayerMobile || (from is BaseCreature && (((BaseCreature)from).Controlled) || ((BaseCreature)from).Summoned))
                    {
                        Point3D point = points[Utility.Random(points.Count)];
                        from.MoveToWorld(point, pmmap);
                        from.Frozen = true;

                        Timer.DelayCall(TimeSpan.FromSeconds(3), () =>
                        {
                            from.Frozen = false;
                            from.SendLocalizedMessage(1005603); // You can move again!
                        });

                        if (CanBeHarmful(from))
                        {
                            double damage = from.Hits * 0.6;

                            if (damage < 10.0)
                            {
                                damage = 10.0;
                            }
                            else if (damage > 75.0)
                            {
                                damage = 75.0;
                            }

                            DoHarmful(from);

                            AOS.Damage(from, this, (int)damage, 100, 0, 0, 0, 0);
                        }
                    }
                }

                eable.Free();
            });

            Hue = 0;

            m_NextAbilityTime = DateTime.UtcNow + TimeSpan.FromSeconds(Utility.RandomMinMax(200, 300));
        }
Exemple #28
0
        public override void OnThink()
        {
            if (DateTime.Now >= m_NextAbilityTime)
            {
                JukaLord toBuff = null;

                foreach (Mobile m in this.GetMobilesInRange(8))
                {
                    if (m is JukaLord && IsFriend(m) && m.Combatant != null && CanBeBeneficial(m) && m.CanBeginAction(typeof(JukaMage)) && InLOS(m))
                    {
                        toBuff = (JukaLord)m;
                        break;
                    }
                }

                if (toBuff != null)
                {
                    if (CanBeBeneficial(toBuff) && toBuff.BeginAction(typeof(JukaMage)))
                    {
                        m_NextAbilityTime = DateTime.Now + TimeSpan.FromSeconds(Utility.RandomMinMax(30, 60));

                        toBuff.Say(true, "Give me the power to destroy my enemies!");
                        this.Say(true, "Fight well my lord!");

                        DoBeneficial(toBuff);

                        object[] state = new object[] { toBuff, toBuff.HitsMaxSeed, toBuff.RawStr, toBuff.RawDex };

                        SpellHelper.Turn(this, toBuff);

                        int toScale = toBuff.HitsMaxSeed;

                        if (toScale > 0)
                        {
                            toBuff.HitsMaxSeed += AOS.Scale(toScale, 75);
                            toBuff.Hits        += AOS.Scale(toScale, 75);
                        }

                        toScale = toBuff.RawStr;

                        if (toScale > 0)
                        {
                            toBuff.RawStr += AOS.Scale(toScale, 50);
                        }

                        toScale = toBuff.RawDex;

                        if (toScale > 0)
                        {
                            toBuff.RawDex += AOS.Scale(toScale, 50);
                            toBuff.Stam   += AOS.Scale(toScale, 50);
                        }

                        toBuff.Hits = toBuff.Hits;
                        toBuff.Stam = toBuff.Stam;

                        toBuff.FixedParticles(0x375A, 10, 15, 5017, EffectLayer.Waist);
                        toBuff.PlaySound(0x1EE);

                        Timer.DelayCall(TimeSpan.FromSeconds(20.0), new TimerStateCallback(Unbuff), state);
                    }
                }
                else
                {
                    m_NextAbilityTime = DateTime.Now + TimeSpan.FromSeconds(Utility.RandomMinMax(2, 5));
                }
            }

            base.OnThink();
        }
Exemple #29
0
 protected override void OnTick()
 {
     m_Mobile.PlaySound(0x11D);
     AOS.Damage(m_Mobile, m_From, Utility.RandomMinMax(10, 20), 0, 100, 0, 0, 0);
 }
Exemple #30
0
        public override void OnResponse(NetState state, RelayInfo info)
        {
            Mobile from = state.Mobile;

            from.CloseGump(typeof(ResurrectGump));

            if (ResurrectMessage.SilverSapling == m_Msg && 1 == info.ButtonID)
            {
                PlayerMobile pm = from as PlayerMobile;
                if (null != pm && pm.Region.IsPartOf("Abyss"))
                {
                    pm.Location = pm.SSSeedLocation;
                    pm.Map      = pm.SSSeedMap;
                    if (null != pm.Corpse)
                    {
                        pm.Corpse.Location = pm.Location;
                        pm.Corpse.Map      = pm.Map;
                    }
                    pm.Resurrect();
                }
                return;
            }

            if (info.ButtonID == 1 || info.ButtonID == 2)
            {
                if (from.Map == null || !from.Map.CanFit(from.Location, 16, false, false))
                {
                    from.SendLocalizedMessage(502391); // Thou can not be resurrected there!
                    return;
                }

                if (m_Price > 0)
                {
                    if (info.IsSwitched(1))
                    {
                        if (Banker.Withdraw(from, m_Price))
                        {
                            from.SendLocalizedMessage(1060398, m_Price.ToString());                 // ~1_AMOUNT~ gold has been withdrawn from your bank box.
                            from.SendLocalizedMessage(1060022, Banker.GetBalance(from).ToString()); // You have ~1_AMOUNT~ gold in cash remaining in your bank box.
                        }
                        else
                        {
                            from.SendLocalizedMessage(1060020); // Unfortunately, you do not have enough cash in your bank to cover the cost of the healing.
                            return;
                        }
                    }
                    else
                    {
                        from.SendLocalizedMessage(1060019); // You decide against paying the healer, and thus remain dead.
                        return;
                    }
                }

                from.PlaySound(0x214);
                from.FixedEffect(0x376A, 10, 16);

                from.Resurrect();

                if (m_Healer != null && from != m_Healer)
                {
                    VirtueLevel level = VirtueHelper.GetLevel(m_Healer, VirtueName.Compassion);

                    switch (level)
                    {
                    case VirtueLevel.Seeker:
                        from.Hits = AOS.Scale(from.HitsMax, 20);
                        break;

                    case VirtueLevel.Follower:
                        from.Hits = AOS.Scale(from.HitsMax, 40);
                        break;

                    case VirtueLevel.Knight:
                        from.Hits = AOS.Scale(from.HitsMax, 80);
                        break;
                    }
                }

                if (m_FromSacrifice && from is PlayerMobile)
                {
                    ((PlayerMobile)from).AvailableResurrects -= 1;

                    Container pack   = from.Backpack;
                    Container corpse = from.Corpse;

                    if (pack != null && corpse != null)
                    {
                        List <Item> items = new List <Item>(corpse.Items);

                        for (int i = 0; i < items.Count; ++i)
                        {
                            Item item = items[i];

                            if (item.Layer != Layer.Hair && item.Layer != Layer.FacialHair && item.Movable)
                            {
                                pack.DropItem(item);
                            }
                        }
                    }
                }

                if (m_Healer != from && m_Healer is PlayerMobile && from is PlayerMobile)
                {
                    SpiritualityVirtue.OnHeal(m_Healer, 50);
                }

                if (from.Fame > 0)
                {
                    int amount = from.Fame / 10;

                    Misc.Titles.AwardFame(from, -amount, true);
                }

                if (from.Alive && m_HitsScalar > 0)
                {
                    from.Hits = (int)(from.HitsMax * m_HitsScalar);
                }

                if (m_Callback != null)
                {
                    m_Callback(from);
                }
            }
        }