Example #1
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.Now > 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)
                            {
                                Mobile m = (Mobile)m_Queue.Dequeue();

                                caster.DoHarmful(m);

                                int damage = m_Item.m_Damage;

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

                                    m.SendAsciiMessage("You feel yourself resisting magical energy.");                                       // You feel yourself resisting magical energy.
                                }

                                AOS.Damage(m, caster, damage, 0, 100, 0, 0, 0);
                                m.PlaySound(0x208);
                            }
                        }
                    }
                }
Example #2
0
        public override bool OnFailDisarm(Mobile from)
        {
            bool bExploded = false;

            double rtskill = from.Skills[SkillName.RemoveTrap].Value;

            double chance = (TrapPower - rtskill) / 800;

            //make sure there's some chance to trip
            if (chance <= 0)
            {
                chance = .005;                           //minimum of 1/200 trip
            }
            if (chance >= 1)
            {
                chance = .995;
            }
            chance *= TrapSensitivity;

            //debug message only available to non-Player level
            if (from.AccessLevel > AccessLevel.Player)
            {
                from.SendMessage("Chance to trip trap: " + chance);
            }

            if (Utility.RandomDouble() < chance)
            {             //trap is tripped, effect disarmer
                int damage   = TrapPower / 2 + (Utility.Random(4, 12) * TrapPower / 25) - (int)rtskill / 5;
                int traptype = 0;
                traptype = Utility.Random(0, 3);

                switch (traptype)
                {
                case 0:                                //explosion
                {
                    from.SendLocalizedMessage(502999); // You set off a trap!

                    if (from.InRange(GetWorldLocation(), 2))
                    {
                        AOS.Damage(from, damage, 0, 100, 0, 0, 0);
                        from.SendLocalizedMessage(503000);                                   // Your skin blisters from the heat!
                    }

                    Point3D loc = GetWorldLocation();

                    Effects.PlaySound(loc, Map, 0x307);
                    Effects.SendLocationEffect(new Point3D(loc.X + 1, loc.Y + 1, loc.Z - 11), Map, 0x36BD, 15);

                    break;
                }

                case 1:                                //dart
                {
                    from.SendLocalizedMessage(502999); // You set off a trap!

                    if (from.InRange(GetWorldLocation(), 2))
                    {
                        AOS.Damage(from, damage / 2, 100, 0, 0, 0, 0);
                        from.SendLocalizedMessage(502380);                                   // A dart embeds...
                    }

                    Point3D loc = GetWorldLocation();

                    Effects.PlaySound(loc, Map, 0x223);
                    //What effect?!?
                    //Effects.SendLocationEffect( new Point3D( loc.X + 1, loc.Y + 1, loc.Z - 11 ), Map, 0x36BD, 15 );
                    break;
                }

                case 2:                                //poison
                {
                    from.SendLocalizedMessage(502999); // You set off a trap!

                    if (from.InRange(GetWorldLocation(), 2))
                    {
                        Poison p = Poison.Lesser;
                        if (damage >= 30)
                        {
                            p = Poison.Regular;
                        }
                        if (damage >= 60)
                        {
                            p = Poison.Greater;
                        }
                        if (damage >= 90)
                        {
                            p = Poison.Deadly;
                        }
                        if (damage >= 100)
                        {
                            p = Poison.Lethal;
                        }

                        from.ApplyPoison(from, p);
                        from.SendLocalizedMessage(503004);                                   // You are enveloped...
                    }

                    Point3D loc = GetWorldLocation();

                    Effects.PlaySound(loc, Map, 0x231);
                    Effects.SendLocationEffect(new Point3D(loc.X + 1, loc.Y + 1, loc.Z - 11), Map, 0x11A6, 20);
                    break;
                }
                }
                from.RevealingAction();
                bExploded = true;
            }

            return(bExploded);
        }
Example #3
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);
        }
Example #4
0
        public void Explode(Mobile from, bool direct, Point3D loc, Map map)
        {
            if (Deleted)
            {
                return;
            }

            Consume();

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

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

            if (map == null)
            {
                return;
            }

            Effects.PlaySound(loc, map, 0x207);
            Effects.SendLocationEffect(loc, map, 0x36BD, 20);

            int alchemyBonus = 0;

            if (direct)
            {
                alchemyBonus = 0;                 //(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);

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

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

                    if (from == null || (SpellHelper.ValidIndirectTarget(from, m) && from.CanBeHarmful(m, false)))
                    {
                        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);
                }
            }
        }
Example #5
0
        public void Explode(Mobile from, Point3D loc, Map map)
        {
            if (map == null)
            {
                return;
            }

            Effects.PlaySound(loc, map, 0x207);
            Effects.SendLocationEffect(loc, map, 0x36BD, 20);


            IPooledEnumerable eable     = map.GetObjectsInRange(loc, 2);
            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);
                }
                else if (o is ICannonDamage)
                {
                    toExplode.Add(o);
                }
            }

            eable.Free();
            int d      = 0;        // Damage scalar
            int damage = 0;

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

                if (o is Mobile)
                {
                    Mobile m = (Mobile)o;
                    if (m.InRange(loc, 0))
                    {
                        d = 1;
                    }
                    else if (m.InRange(loc, 1))
                    {
                        d = 2;
                    }
                    else if (m.InRange(loc, 2))
                    {
                        d = 3;
                    }
                    if (from != null || (SpellHelper.ValidIndirectTarget(from, m) && from.CanBeHarmful(m, false)))
                    {
                        if (from != null)
                        {
                            from.DoHarmful(m);
                        }
                        damage = Utility.RandomMinMax((MinDamage / d), (MaxDamage / d));
                        if (d == 1)
                        {
                            AOS.Damage(m, from, damage, 50, 50, 0, 0, 0);                               // Same tile 50% physical 50% fire
                        }
                        else
                        {
                            AOS.Damage(m, from, damage, 0, 100, 0, 0, 0);                               // 2 tile radius 100% fire damage
                        }
                    }
                }
                else if (o is BaseExplosionPotion)
                {
                    BaseExplosionPotion pot = (BaseExplosionPotion)o;
                    pot.Explode(from, true, pot.GetWorldLocation(), pot.Map);
                }
                else if (o is ICannonDamage)
                {
                    //((ICannonDamage)o).Hits -=  Utility.RandomMinMax(MinDamage/3,MaxDamage/3);
                    ((ICannonDamage)o).Damage(from, Utility.RandomMinMax(MinDamage / 3, MaxDamage / 3));
                }
            }
        }
        private void DoCounter(Mobile attacker)
        {
            if (this.Map == null)
            {
                return;
            }

            if (attacker is BaseCreature && ((BaseCreature)attacker).BardProvoked)
            {
                return;
            }

            if (0.20 > 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, 15))
                {
                    target = attacker;
                }

                this.Animate(10, 4, 1, true, false, 0);

                ArrayList targets = new ArrayList();

                foreach (Mobile m in target.GetMobilesInRange(8))
                {
                    if (m == this || !this.CanBeHarmful(m))
                    {
                        continue;
                    }

                    if (m is BaseCreature && (((BaseCreature)m).Controlled || ((BaseCreature)m).Summoned || ((BaseCreature)m).Team != this.Team))
                    {
                        targets.Add(m);
                    }
                    else if (m.Player && m.Alive)
                    {
                        targets.Add(m);
                    }
                }

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

                    this.DoHarmful(m);

                    AOS.Damage(m, this, Utility.RandomMinMax(35, 45), true, 0, 0, 100, 0, 0);

                    m.FixedParticles(0x36E4, 1, 10, 0x1F78, 0x47F, 0, (EffectLayer)255);
                    m.ApplyPoison(this, Poison.Lethal);
                }
            }
        }
Example #7
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 ( !CheckHandsFree() )
            //{
            //    m_Caster.SendLocalizedMessage(502626); // Your hands must be free to cast spells or meditate.
            //}
            else if (!CheckHandsFree() && m_Caster.AccessLevel == AccessLevel.Player)
            {
                m_Caster.SendLocalizedMessage(502626); // Your hands must be free to cast spells or meditate.
            }
            else if (CheckFizzle())
            {
                m_Caster.Mana -= mana;

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

                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)
                {
                    Misc.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);
        }
Example #8
0
        private static void DoAttempt()
        {
            int number = 0;

            for (int i = 0; i < 4; i++)
            {
                if (m_Answer[i] == m_Attempt[i])
                {
                    number++;
                }
            }

            if (number == 4)
            {
                List <Mobile> list = new List <Mobile>();

                IPooledEnumerable ip = Map.Malas.GetMobilesInRange(m_PlayerLocations[0], 0);
                foreach (Mobile m in ip)
                {
                    if (m is PlayerMobile)
                    {
                        if (m_LocationsPressed)
                        {
                            if ((Party == null || Party.Get(m) == Party))
                            {
                                list.Add(m);
                            }

                            else
                            {
                                m.SendLocalizedMessage(1050004); // The circle is the key, the key is incomplete and so the gate remains closed.
                            }
                        }

                        else
                        {
                            StatuesTalk(4);
                        }
                    }
                }

                if (list.Count != 0)
                {
                    Timer.DelayCall(TimeSpan.FromSeconds(1.5), new TimerStateCallback(MoveThief_Callback), list);
                    list[0].BoltEffect(0);
                    GenerateAnswer();
                }
            }

            else
            {
                StatuesTalk(number);
                List <Mobile> moblist = new List <Mobile>();

                for (int i = 0; i < 5; ++i)
                {
                    IPooledEnumerable ip = Map.Malas.GetMobilesInRange(m_PlayerLocations[i], 1);
                    foreach (Mobile m in ip)
                    {
                        if (m is PlayerMobile && !moblist.Contains(m))
                        {
                            moblist.Add(m);
                        }
                    }
                }

                for (int i = 0; i < m_PlayerLocations.Length; i++)
                {
                    Effects.SendMovingEffect(new Entity(Serial.Zero, new Point3D(m_PlayerLocations[i].X, m_PlayerLocations[i].Y, m_PlayerLocations[i].Z + 80), Map.Malas), new Entity(Serial.Zero, new Point3D(m_PlayerLocations[i].X, m_PlayerLocations[i].Y, m_PlayerLocations[i].Z + 2), Map.Malas), 0x11B8, 5, 16, false, false);
                }

                Timer.DelayCall(TimeSpan.FromSeconds(0.75), new TimerCallback(Boulder_Callback));

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

                    m.LocalOverheadMessage(0, 0x3B2, 3000066); // OUCH!
                    if (m == moblist[0])
                    {
                        m.SendLocalizedMessage(1050005); // The weight of the boulder pins you to the ground!
                    }
                    else
                    {
                        m.SendLocalizedMessage(1050006); // A flying rock smashes against your head!
                    }
                    AOS.Damage(m, 250 - (ClosestDistance(m) * 30), 100, 0, 0, 0, 0);
                }
            }

            m_Attempt = new int[4];
            foreach (DoomLever lever in m_Levers)
            {
                if (lever != null)
                {
                    lever.Pressed = false;
                }
            }
        }
Example #9
0
        public void Explode(Mobile from, bool direct, Point3D loc, Map map)
        {
            if (Deleted || from == null)
            {
                return;
            }

            bool damageThrower = false;

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

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

            Consume();

            if (map == null)
            {
                return;
            }

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

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

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

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

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

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

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

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

                damage += alchemyBonus;

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

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

            list.Clear();
        }
Example #10
0
        public override void OnActionCombat()
        {
            int         damagemin = this.Hits / 20 + 25;
            int         damagemax = this.Hits / 25 + 50;
            IDamageable from      = this.Combatant;

            if (from != null && this.ControlMaster != null)
            {
                if (m_TrialByFire == true)
                {
                    if (Utility.Random(2500) < 5)
                    {
                        if (this.Stam <= 50)
                        {
                            if (this.ControlMaster != null)
                            {
                                this.ControlMaster.SendMessage("You pet lacks the stamina to preform its power attack.");
                            }
                        }
                        else
                        {
                            this.Stam -= 50;

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

                            Effects.SendMovingParticles(new Entity(Serial.Zero, new Point3D(from.X - 7, from.Y, from.Z), from.Map), from, 0x36E4, 7, 0, false, true, 0, 0, 9502, 1, 0, (EffectLayer)255, 0x100);
                            Effects.SendMovingParticles(new Entity(Serial.Zero, new Point3D(from.X + 7, from.Y, from.Z), from.Map), from, 0x36E4, 7, 0, false, true, 0, 0, 9502, 1, 0, (EffectLayer)255, 0x100);
                            Effects.SendMovingParticles(new Entity(Serial.Zero, new Point3D(from.X, from.Y - 7, from.Z), from.Map), from, 0x36E4, 7, 0, false, true, 0, 0, 9502, 1, 0, (EffectLayer)255, 0x100);
                            Effects.SendMovingParticles(new Entity(Serial.Zero, new Point3D(from.X, from.Y + 7, from.Z), from.Map), from, 0x36E4, 7, 0, false, true, 0, 0, 9502, 1, 0, (EffectLayer)255, 0x100);

                            FixedParticles(0x3709, 10, 15, 5012, EffectLayer.Waist);
                            FixedParticles(0x36B0, 10, 15, 5012, EffectLayer.Waist);
                            PlaySound(776);
                            PlaySound(477);

                            AOS.Damage(from, this, Utility.RandomMinMax(30, 60), 0, 100, 0, 0, 0);
                            AOS.Damage(from, this, Utility.RandomMinMax(10, 30), 0, 100, 0, 0, 0);
                            AOS.Damage(from, this, Utility.RandomMinMax(5, 10), 0, 100, 0, 0, 0);

                            this.Emote("[Power Attack]");
                            this.Emote("[Trail By Fire]");
                        }
                    }
                }

                if (m_IceBlast == true)
                {
                    Mobile cm = this.ControlMaster;
                    if (Utility.Random(2500) < 5)
                    {
                        if (this.Stam <= 50)
                        {
                            if (this.ControlMaster != null)
                            {
                                this.ControlMaster.SendMessage("You pet lacks the stamina to preform its power attack.");
                            }
                        }
                        else
                        {
                            this.Stam -= 50;

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

                            AOS.Damage(from, this, Utility.RandomMinMax(20, 30), 0, 0, 100, 0, 0);

                            IceFragments ice = new IceFragments();
                            ice.Location = from.Location;
                            ice.Map      = from.Map;
                            ice.PetOwner = cm;
                            ice.Pet      = this;
                            World.AddItem(ice);

                            IceSnow ices = new IceSnow();
                            ices.X   = from.X + Utility.RandomMinMax(3, 5);
                            ices.Y   = from.Y + Utility.RandomMinMax(3, 5);
                            ices.Z   = from.Z;
                            ices.Map = from.Map;
                            World.AddItem(ices);

                            IceSnow2 is2 = new IceSnow2();
                            is2.X   = from.X - Utility.RandomMinMax(3, 5);
                            is2.Y   = from.Y - Utility.RandomMinMax(3, 5);
                            is2.Z   = from.Z;
                            is2.Map = from.Map;
                            World.AddItem(is2);

                            IceSnow3 is3 = new IceSnow3();
                            is3.X   = from.X - Utility.RandomMinMax(3, 5);
                            is3.Y   = from.Y + Utility.RandomMinMax(3, 5);
                            is3.Z   = from.Z;
                            is3.Map = from.Map;
                            World.AddItem(is3);

                            IceSnow is4 = new IceSnow();
                            is4.X   = from.X + Utility.RandomMinMax(3, 5);
                            is4.Y   = from.Y - Utility.RandomMinMax(3, 5);
                            is4.Z   = from.Z;
                            is4.Map = from.Map;
                            World.AddItem(is4);

                            PlaySound(22);

                            this.Emote("[Power Attack]");
                            this.Emote("[Ice Blast]");
                        }
                    }
                }
                else if (m_CometAttack == true)
                {
                    if (Utility.Random(2500) < 5)
                    {
                        if (this.Stam <= 50)
                        {
                            if (this.ControlMaster != null)
                            {
                                this.ControlMaster.SendMessage("You pet lacks the stamina to preform its power attack.");
                            }
                        }
                        else
                        {
                            this.Stam -= 50;

                            Effects.SendMovingParticles(new Entity(Serial.Zero, new Point3D(from.X, from.Y, from.Z + 35), from.Map), from, 0x11B6, 7, 0, false, true, 1160, 0, 9502, 1, 0, (EffectLayer)255, 0x100);

                            FixedParticles(0x3709, 10, 15, 5012, EffectLayer.Waist);
                            FixedParticles(0x36B0, 10, 15, 5012, EffectLayer.Waist);
                            PlaySound(551);

                            ArrayList targets = new ArrayList();

                            foreach (Mobile m in this.GetMobilesInRange(15))
                            {
                                if (this != m && this.ControlMaster != m)
                                {
                                    targets.Add(m);
                                }
                            }

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

                                if (m != null)
                                {
                                    if (m is BaseVendor || m is PlayerVendor || m.Blessed != false)
                                    {
                                        m.Say("What was that?");
                                    }
                                    else
                                    {
                                        if (m is PlayerMobile)
                                        {
                                            PlayerMobile pm = (PlayerMobile)m;
                                            if (pm.Combatant == this || pm.Combatant == this.ControlMaster || this.Combatant == pm || this.ControlMaster.Combatant == pm)
                                            {
                                                AOS.Damage(m, this, Utility.RandomMinMax(30, 60), 0, 100, 0, 0, 0);

                                                m.SendMessage("You have been hit by a shock wave.");
                                                this.ControlMaster.DoHarmful(m);
                                            }
                                        }
                                        else if (m is BaseCreature)
                                        {
                                            BaseCreature bc = (BaseCreature)m;
                                            if (bc.Controlled == false && bc.ControlMaster == null)
                                            {
                                                AOS.Damage(m, this, Utility.RandomMinMax(30, 60), 25, 50, 0, 25, 0);
                                                this.ControlMaster.DoHarmful(m);
                                            }
                                            else if (bc.Combatant == this || bc.Combatant == this.ControlMaster || this.Combatant == bc || this.ControlMaster.Combatant == bc)
                                            {
                                                AOS.Damage(m, this, Utility.RandomMinMax(30, 60), 0, 100, 0, 0, 0);

                                                bc.ControlMaster.SendMessage("Your pet has been hit by a shock wave.");
                                                this.ControlMaster.DoHarmful(m);
                                            }
                                        }
                                    }
                                }
                            }
                        }
                        this.Emote("[Power Attack]");
                        this.Emote("[Comet Strike]");
                    }
                }
                else if (m_CallOfNature == true)
                {
                    if (Utility.Random(2500) < 5)
                    {
                        if (this.Stam <= 50)
                        {
                            if (this.ControlMaster != null)
                            {
                                this.ControlMaster.SendMessage("You pet lacks the stamina to preform its power attack.");
                            }
                        }
                        else
                        {
                            this.Stam -= 50;

                            PlaySound(4);

                            ArrayList targets = new ArrayList();

                            foreach (Mobile m in this.GetMobilesInRange(10))
                            {
                                if (m != this)
                                {
                                    targets.Add(m);
                                }
                            }

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

                                if (m != null)
                                {
                                    if (m is BaseVendor || m is PlayerVendor || m.Blessed != false)
                                    {
                                        m.Say("Someone is calling for help!");
                                    }
                                    else if (m is BaseCreature)
                                    {
                                        BaseCreature bc = (BaseCreature)m;
                                        if (bc.Controlled != true)
                                        {
                                            bc.Combatant = from;
                                        }
                                    }
                                    else
                                    {
                                        m.SendMessage("You hear a creature give out a cry for help!");
                                    }
                                }
                            }
                        }
                        this.Emote("[Power Attack]");
                        this.Emote("[Call Of Nature]");
                    }
                }
                else if (m_AcidRain == true)
                {
                    if (Utility.Random(2500) < 5)
                    {
                        if (this.Stam <= 50)
                        {
                            if (this.ControlMaster != null)
                            {
                                this.ControlMaster.SendMessage("You pet lacks the stamina to preform its power attack.");
                            }
                        }
                        else
                        {
                            this.Stam -= 50;

                            ArrayList targets = new ArrayList();

                            foreach (Mobile m in this.GetMobilesInRange(7))
                            {
                                if (this != m && this.ControlMaster != m)
                                {
                                    targets.Add(m);
                                }
                            }

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

                                if (m != null)
                                {
                                    if (m is BaseVendor || m is PlayerVendor || m.Blessed != false)
                                    {
                                        m.Say("*resists the poison*");
                                    }
                                    else
                                    {
                                        if (m is PlayerMobile)
                                        {
                                            PlayerMobile pm = (PlayerMobile)m;
                                            if (pm.Combatant == this || pm.Combatant == this.ControlMaster || this.Combatant == pm || this.ControlMaster.Combatant == pm)
                                            {
                                                AOS.Damage(m, this, Utility.RandomMinMax(5, 25), 0, 0, 0, 100, 0);

                                                m.SendMessage("You have been hit by toxic rain.");

                                                int level;

                                                double total = this.Skills[SkillName.Poisoning].Value;

                                                if (total >= 99.9)
                                                {
                                                    level = 4;
                                                }
                                                else if (total > 75.0)
                                                {
                                                    level = 3;
                                                }
                                                else if (total > 50.0)
                                                {
                                                    level = 2;
                                                }
                                                else if (total > 35.0)
                                                {
                                                    level = 1;
                                                }
                                                else
                                                {
                                                    level = 0;
                                                }

                                                m.ApplyPoison(this, Poison.GetPoison(level));
                                                this.ControlMaster.DoHarmful(m);
                                                Effects.SendMovingParticles(new Entity(Serial.Zero, new Point3D(m.X, m.Y, m.Z + 35), m.Map), m, 0x35D4, 7, 0, false, true, 63, 0, 9502, 1, 0, (EffectLayer)255, 0x100);
                                                m.PlaySound(551);
                                            }
                                        }
                                        else if (m is BaseCreature)
                                        {
                                            BaseCreature bc = (BaseCreature)m;
                                            if (bc.Controlled == false && bc.ControlMaster == null)
                                            {
                                                AOS.Damage(bc, this, Utility.RandomMinMax(5, 25), 0, 0, 0, 0, 100);

                                                int level;

                                                double total = this.Skills[SkillName.Poisoning].Value;

                                                if (total >= 99.9)
                                                {
                                                    level = 4;
                                                }
                                                else if (total > 75.0)
                                                {
                                                    level = 3;
                                                }
                                                else if (total > 50.0)
                                                {
                                                    level = 2;
                                                }
                                                else if (total > 35.0)
                                                {
                                                    level = 1;
                                                }
                                                else
                                                {
                                                    level = 0;
                                                }

                                                bc.ApplyPoison(this, Poison.GetPoison(level));
                                                this.ControlMaster.DoHarmful(m);
                                                Effects.SendMovingParticles(new Entity(Serial.Zero, new Point3D(m.X, m.Y, m.Z + 35), m.Map), m, 0x35D4, 7, 0, false, true, 63, 0, 9502, 1, 0, (EffectLayer)255, 0x100);
                                            }
                                            else if (bc.Combatant == this || bc.Combatant == this.ControlMaster || this.Combatant == bc || this.ControlMaster.Combatant == bc)
                                            {
                                                AOS.Damage(bc, this, Utility.RandomMinMax(5, 25), 0, 0, 0, 0, 100);

                                                bc.ControlMaster.SendMessage("Your pet has been hit by toxic rain.");

                                                int level;

                                                double total = this.Skills[SkillName.Poisoning].Value;

                                                if (total >= 99.9)
                                                {
                                                    level = 4;
                                                }
                                                else if (total > 75.0)
                                                {
                                                    level = 3;
                                                }
                                                else if (total > 50.0)
                                                {
                                                    level = 2;
                                                }
                                                else if (total > 35.0)
                                                {
                                                    level = 1;
                                                }
                                                else
                                                {
                                                    level = 0;
                                                }

                                                bc.ApplyPoison(this, Poison.GetPoison(level));
                                                this.ControlMaster.DoHarmful(m);
                                                Effects.SendMovingParticles(new Entity(Serial.Zero, new Point3D(m.X, m.Y, m.Z + 35), m.Map), m, 0x35D4, 7, 0, false, true, 63, 0, 9502, 1, 0, (EffectLayer)255, 0x100);
                                            }
                                        }
                                    }
                                }
                            }

                            this.Emote("[Power Attack]");
                            this.Emote("[Acid Rain]");
                        }
                    }
                }
            }
        }
Example #11
0
        public override void OnGotMeleeAttack(Mobile attacker)
        {
            base.OnGotMeleeAttack(attacker);

            if (this.ControlMaster != null)
            {
                int damagemin = this.Hits / 20;
                int damagemax = this.Hits / 25;

                if (m_BluntAttack == true)
                {
                    if (Utility.Random(100) < 15)
                    {
                        if (this.Stam <= 10)
                        {
                            if (this.ControlMaster != null)
                            {
                                this.ControlMaster.SendMessage("You pet lacks the stamina to preform its counter attack.");
                            }
                        }
                        else
                        {
                            this.Stam -= 10;

                            this.Emote("[Counter] [Blunt Attack]");
                            AOS.Damage(attacker, this, Utility.RandomMinMax(10, 25), 100, 0, 0, 0, 0);
                            attacker.FixedParticles(0x373A, 10, 15, 5012, EffectLayer.Waist);
                            PlaySound(562);
                        }
                    }
                }
                if (m_Healing == true)
                {
                    if (Utility.Random(100) < 15)
                    {
                        if (this.Stam <= 25)
                        {
                            if (this.ControlMaster != null)
                            {
                                this.ControlMaster.SendMessage("You pet lacks the stamina to preform its counter attack.");
                            }
                        }
                        else
                        {
                            this.Stam -= 25;

                            this.Emote("[Counter] [Healing]");
                            this.FixedParticles(0x373A, 10, 15, 5012, EffectLayer.Waist);
                            PlaySound(498);
                            this.Hits += Utility.RandomMinMax(75, 150);
                        }
                    }
                }

                if (m_PoisonAttack == true)
                {
                    if (Utility.Random(100) < 15)
                    {
                        if (this.Stam <= 10)
                        {
                            if (this.ControlMaster != null)
                            {
                                this.ControlMaster.SendMessage("You pet lacks the stamina to preform its counter attack.");
                            }
                        }
                        else
                        {
                            this.Stam -= 10;

                            this.Emote("[Counter] [Poison Attack]");
                            this.FixedParticles(4518, 10, 15, 5012, EffectLayer.Waist);
                            AOS.Damage(attacker, this, Utility.RandomMinMax(10, 25), 0, 0, 0, 100, 0);
                            PlaySound(560);

                            int level;

                            double total = this.Skills[SkillName.Poisoning].Value;

                            if (total >= 99.9)
                            {
                                level = 4;
                            }
                            else if (total > 75.0)
                            {
                                level = 3;
                            }
                            else if (total > 50.0)
                            {
                                level = 2;
                            }
                            else if (total > 35.0)
                            {
                                level = 1;
                            }
                            else
                            {
                                level = 0;
                            }

                            attacker.ApplyPoison(this, Poison.GetPoison(level));
                        }
                    }
                }
            }
        }
Example #12
0
        public void Damage(Mobile m)
        {
            m.SendLocalizedMessage(1112366); // The flammable goo covering you bursts into flame!

            AOS.Damage(m, Utility.RandomMinMax(m_MinDamage, m_MaxDamage), 0, 100, 0, 0, 0);
        }
Example #13
0
        private void ClearAround()
        {
            Point3D loc   = Location;
            Map     pmmap = Map;

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

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

            if (pmmap != Map.Internal && pmmap != null)
            {
                Server.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));
                    }
                });

                Server.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));
        }
                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)
                        {
                            IPooledEnumerable eable = m_Item.GetMobilesInRange(0);

                            foreach (Mobile m in eable)
                            {
                                if ((m.Z + 16) > m_Item.Z && (m_Item.Z + 12) > m.Z && SpellHelper.ValidIndirectTarget(caster, m) && caster.CanBeHarmful(m, false))
                                {
                                    m_Queue.Enqueue(m);
                                }
                            }

                            eable.Free();

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

                                caster.DoHarmful(m);

                                double damage = (double)m_Item.m_Damage;

                                if (m_ResistCheck && m.CheckSkill(SkillName.MagicResist, 0.0, m_Item.MaxResist, 1.0))
                                {
                                    damage *= .5;
                                }

                                if (m_Item.m_Enhanced && m is BaseCreature)
                                {
                                    damage *= .5;
                                }

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

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

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

                                if (m is BaseCreature)
                                {
                                    ((BaseCreature)m).OnHarmfulSpell(caster);
                                }
                            }
                        }
                    }
                }
Example #15
0
            protected override void OnTick()
            {
                if (!m_Target.Alive)
                {
                    m_Table.Remove(m_Target);
                    Stop();
                }

                if (!m_Target.Alive || DateTime.Now < 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.Now + 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);
                }
            }
Example #16
0
        public void OnTick()
        {
            if (HasBegun && !Complete)
            {
                foreach (KeyValuePair <PlayerMobile, PlayerStatsEntry> part in GetParticipants(true))
                {
                    PlayerMobile pm = part.Key;

                    if (!RidingFlyingAllowed && pm.Mounted)
                    {
                        IMount mount = pm.Mount;

                        if (mount != null)
                        {
                            mount.Rider = null;
                            pm.SetMountBlock(BlockMountType.DismountRecovery, TimeSpan.FromSeconds(10), false);
                        }

                        if (InPreFight)
                        {
                            pm.SendLocalizedMessage(1115997); // The rules prohibit riding a mount or flying.
                        }
                        else
                        {
                            pm.SendLocalizedMessage(1115998); // The rules prohibit riding a mount or flying. You have received penalty damage!

                            int damage = 37;

                            if (!Warned.Contains(pm))
                            {
                                Warned.Add(pm);
                            }
                            else
                            {
                                damage = 237;
                            }

                            AOS.Damage(pm, null, damage, 0, 0, 0, 0, 0, 0, 100);
                        }
                    }

                    if (!RangedWeaponsAllowed)
                    {
                        Item item = pm.FindItemOnLayer(Layer.TwoHanded);

                        if (item is BaseRanged)
                        {
                            pm.AddToBackpack(item);
                            pm.SendLocalizedMessage(1115996); // The rules prohibit the use of ranged weapons!
                        }
                    }

                    if (!SummonSpellsAllowed)
                    {
                        foreach (Mobile mob in Arena.Region.GetEnumeratedMobiles())
                        {
                            if (mob is BaseCreature creature && creature.Summoned)
                            {
                                Mobile master = creature.GetMaster();

                                master?.SendLocalizedMessage(1149603); // The rules prohibit the use of summoning spells!

                                creature.Delete();
                            }
                        }
                    }
                }

                if (InPreFight)
                {
                    if (EntryDeadline != DateTime.MinValue && EntryDeadline < DateTime.UtcNow)
                    {
                        BeginDuel();
                    }
                }
                else if (EndTime < DateTime.UtcNow)
                {
                    EndDuel();
                }
            }
        }
Example #17
0
        public override void OnHit(Mobile attacker, Mobile defender, int damage)
        {
            if (!MonkSystem.IsMonk(attacker))
            {
                attacker.SendMessage("Only monks can use this strike.");
                return;
            }

            MonkFists mf     = attacker.FindItemOnLayer(Layer.Gloves) as MonkFists;
            int       amount = 0;

            if (mf != null)
            {
                amount = Utility.Dice(mf.Teir, 3, (3 * mf.Teir));
            }
            else
            {
                amount = Utility.Dice(2, 6, 0);
            }

            switch (m_Element)
            {
            case MonkElement.Air:
            {
                defender.FixedParticles(0x374A, 10, 20, 5013, 1176, 0, EffectLayer.Waist);
                AOS.Damage(defender, attacker, amount, 0, 0, 0, 0, 100);
                PlayPunchSound(attacker);
                break;
            }

            case MonkElement.Earth:
            {
                defender.FixedParticles(0x374A, 10, 20, 5013, 1191, 0, EffectLayer.Waist);
                AOS.Damage(defender, attacker, amount, 100, 0, 0, 0, 0);
                PlayPunchSound(attacker);
                break;
            }

            case MonkElement.Fire:
            {
                defender.FixedParticles(0x374A, 10, 20, 5013, 1160, 0, EffectLayer.Waist);
                AOS.Damage(defender, attacker, amount, 0, 100, 0, 0, 0);
                PlayPunchSound(attacker);
                break;
            }

            case MonkElement.Water:
            {
                defender.FixedParticles(0x374A, 10, 20, 5013, 1364, 0, EffectLayer.Waist);
                AOS.Damage(defender, attacker, amount, 0, 0, 0, 100, 0);
                PlayPunchSound(attacker);
                break;
            }

            case MonkElement.Light:
            {
                defender.FixedParticles(0x374A, 10, 20, 5013, 1149, 0, EffectLayer.Waist);
                AOS.Damage(defender, attacker, amount / 2, false, 0, 0, 0, 0, 0, 0, 100 /*direct*/, false, false, false);
                PlayPunchSound(attacker);
                mf.LightEnergy += 5;
                break;
            }

            case MonkElement.Dark:
            {
                defender.FixedParticles(0x374A, 10, 20, 5013, 1108, 0, EffectLayer.Waist);
                AOS.Damage(defender, attacker, amount, false, 0, 0, 0, 0, 0, 100 /*chaos*/, 0, false, false, false);
                PlayPunchSound(attacker);
                mf.DarkEnergy += 5;
                break;
            }

            case MonkElement.AirCombo: { MonkCombos.AirCombo(attacker, defender); break; }

            case MonkElement.EarthCombo: { MonkCombos.EarthCombo(attacker, defender); break; }

            case MonkElement.FireCombo:
            {
                // Handled in MonkStrikeGump
                break;
            }

            case MonkElement.WaterCombo: { MonkCombos.WaterCombo(attacker, defender); break; }

            case MonkElement.DarkCombo: { MonkCombos.DarkCombo(attacker, defender); break; }

            case MonkElement.DarkAirCombo: { MonkCombos.DarkAirCombo(attacker, defender); break; }

            case MonkElement.DarkEarthCombo: { MonkCombos.DarkEarthCombo(attacker, defender); break; }

            case MonkElement.DarkFireCombo:
            {
                MonkCombos.DarkFireCombo(attacker, defender, ref damage);
                break;
            }

            case MonkElement.DarkWaterCombo: { MonkCombos.DarkWaterCombo(attacker, defender); break; }
            }

            if ((int)m_Element < 11)
            {
                attacker.SendMessage("You hit your opponent with an elemental attack.");
            }

            ClearCurrentMove(attacker);

            MonkSystem.AddHit(attacker, m_Element);

            if (attacker.HasGump(typeof(MonkStrikeGump)))
            {
                attacker.CloseGump(typeof(MonkStrikeGump));
            }

            attacker.SendGump(new MonkStrikeGump(attacker));
        }
Example #18
0
        public virtual bool ExecuteTrap(Mobile from)
        {
            if (m_TrapType != TrapType.None)
            {
                Point3D loc   = this.GetWorldLocation();
                Map     facet = this.Map;

                if (from.AccessLevel >= AccessLevel.GameMaster)
                {
                    SendMessageTo(from, "That is trapped, but you open it with your godly powers.", 0x3B2);
                    return(false);
                }

                switch (m_TrapType)
                {
                case TrapType.ExplosionTrap:
                {
                    SendMessageTo(from, 502999, 0x3B2);                               // You set off a trap!

                    if (from.InRange(loc, 3))
                    {
                        int damage;

                        if (m_TrapLevel > 0)
                        {
                            damage = Utility.RandomMinMax(10, 30) * m_TrapLevel;
                        }
                        else
                        {
                            damage = m_TrapPower;
                        }

                        AOS.Damage(from, damage, 0, 100, 0, 0, 0);

                        // Your skin blisters from the heat!
                        from.LocalOverheadMessage(Network.MessageType.Regular, 0x2A, 503000);
                    }

                    Effects.SendLocationEffect(loc, facet, 0x36BD, 15, 10);
                    Effects.PlaySound(loc, facet, 0x307);

                    break;
                }

                case TrapType.MagicTrap:
                {
                    if (from.InRange(loc, 1))
                    {
                        from.Damage(m_TrapPower);
                    }
                    //AOS.Damage( from, m_TrapPower, 0, 100, 0, 0, 0 );

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

                    Effects.SendLocationEffect(new Point3D(loc.X - 1, loc.Y, loc.Z), Map, 0x36BD, 15);
                    Effects.SendLocationEffect(new Point3D(loc.X + 1, loc.Y, loc.Z), Map, 0x36BD, 15);

                    Effects.SendLocationEffect(new Point3D(loc.X, loc.Y - 1, loc.Z), Map, 0x36BD, 15);
                    Effects.SendLocationEffect(new Point3D(loc.X, loc.Y + 1, loc.Z), Map, 0x36BD, 15);

                    Effects.SendLocationEffect(new Point3D(loc.X + 1, loc.Y + 1, loc.Z + 11), Map, 0x36BD, 15);

                    break;
                }

                case TrapType.DartTrap:
                {
                    SendMessageTo(from, 502999, 0x3B2);                               // You set off a trap!

                    if (from.InRange(loc, 3))
                    {
                        int damage;

                        if (m_TrapLevel > 0)
                        {
                            damage = Utility.RandomMinMax(5, 15) * m_TrapLevel;
                        }
                        else
                        {
                            damage = m_TrapPower;
                        }

                        AOS.Damage(from, damage, 100, 0, 0, 0, 0);

                        // A dart imbeds itself in your flesh!
                        from.LocalOverheadMessage(Network.MessageType.Regular, 0x62, 502998);
                    }

                    Effects.PlaySound(loc, facet, 0x223);

                    break;
                }

                case TrapType.PoisonTrap:
                {
                    SendMessageTo(from, 502999, 0x3B2);                               // You set off a trap!

                    if (from.InRange(loc, 3))
                    {
                        Poison poison;

                        if (m_TrapLevel > 0)
                        {
                            poison = Poison.GetPoison(Math.Max(0, Math.Min(4, m_TrapLevel - 1)));
                        }
                        else
                        {
                            AOS.Damage(from, m_TrapPower, 0, 0, 0, 100, 0);
                            poison = Poison.Greater;
                        }

                        from.ApplyPoison(from, poison);

                        // You are enveloped in a noxious green cloud!
                        from.LocalOverheadMessage(Network.MessageType.Regular, 0x44, 503004);
                    }

                    Effects.SendLocationEffect(loc, facet, 0x113A, 10, 20);
                    Effects.PlaySound(loc, facet, 0x231);

                    break;
                }
                }

                m_TrapType  = TrapType.None;
                m_TrapPower = 0;
                m_TrapLevel = 0;
                return(true);
            }

            return(false);
        }
Example #19
0
        public void Target(Mobile m)
        {
            if (!m.Poisoned)
            {
                Caster.SendLocalizedMessage(1060176); // That creature is not poisoned!
            }
            else if (CheckBSequence(m))
            {
                SpellHelper.Turn(Caster, m);

                /* Cures the target of poisons, but causes the caster to be burned by fire damage for 13-55 hit points.
                 * The amount of fire damage is lessened if the caster has high Karma.
                 */

                Poison p = m.Poison;

                if (p != null)
                {
                    // Cleanse by fire is now difficulty based
                    int chanceToCure = 10000 + (int)(Caster.Skills[SkillName.Chivalry].Value * 75) - ((p.RealLevel + 1) * 2000);
                    chanceToCure /= 100;

                    if (chanceToCure > Utility.Random(100))
                    {
                        if (m.CurePoison(Caster))
                        {
                            if (Caster != m)
                            {
                                Caster.SendLocalizedMessage(1010058); // You have cured the target of all poisons!
                            }
                            m.SendLocalizedMessage(1010059);          // You have been cured of all poisons.
                        }
                    }
                    else
                    {
                        m.SendLocalizedMessage(1010060); // You have failed to cure your target!
                    }
                }

                m.PlaySound(0x1E0);
                m.FixedParticles(0x373A, 1, 15, 5012, 3, 2, EffectLayer.Waist);

                IEntity from = new Entity(Serial.Zero, new Point3D(m.X, m.Y, m.Z - 5), m.Map);
                IEntity to   = new Entity(Serial.Zero, new Point3D(m.X, m.Y, m.Z + 45), m.Map);
                Effects.SendMovingParticles(from, to, 0x374B, 1, 0, false, false, 63, 2, 9501, 1, 0, EffectLayer.Head, 0x100);

                Caster.PlaySound(0x208);
                Caster.FixedParticles(0x3709, 1, 30, 9934, 0, 7, EffectLayer.Waist);

                int damage = 50 - ComputePowerValue(4);

                // TODO: Should caps be applied?
                if (damage < 13)
                {
                    damage = 13;
                }
                else if (damage > 55)
                {
                    damage = 55;
                }

                AOS.Damage(Caster, Caster, damage, 0, 100, 0, 0, 0, true);
            }

            FinishSequence();
        }
Example #20
0
        public void Explode(Mobile from, bool direct, Point3D loc, Map map)
        {
            if (Deleted)
            {
                return;
            }

            // 12/8/13 Xiani - Nullifying an explosion when in an ArenaRegion.
            if (from.CombatProhibited)
            {
                return;
            }

            Consume();

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

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

            if (map == null)
            {
                return;
            }

            Effects.PlaySound(loc, map, 0x207);
            Effects.SendLocationEffect(loc, map, 0x36BD, 20);

            int alchemyBonus = 0;

            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)
                {
                    toExplode.Add(o);
                    ++toDamage;
                }

                else if (o is BaseExplosionPotion && o != this)
                {
                    toExplode.Add(o);
                }

                if (o is BreakableContainer)
                {
                    toExplode.Add(o);
                }

                if (o is BreakableStatic)
                {
                    toExplode.Add(o);
                }
            }

            eable.Free();

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

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

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

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

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

                        int damage = baseDamage;

                        damage += alchemyBonus;

                        if (m is PlayerMobile)
                        {
                            if (m.InRange(loc, 0))
                            {
                                divisor = 1;
                            }
                            else if (m.InRange(loc, 1))
                            {
                                divisor = 2;
                            }
                            else if (m.InRange(loc, 2))
                            {
                                divisor = 4;
                            }

                            damage = (int)(damage / divisor);

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

                        else
                        {
                            damage = (int)((double)damage * CreatureDamageScalar);
                        }

                        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);
                }

                else if (o is BreakableContainer)
                {
                    BreakableContainer breakableContainer = (BreakableContainer)o;

                    if (breakableContainer.ObjectBreakingDeviceDamageScalar == 0)
                    {
                        continue;
                    }

                    baseDamage = (int)((double)baseDamage * CreatureDamageScalar * breakableContainer.ObjectBreakingDeviceDamageScalar);

                    breakableContainer.ReceiveDamage(from, baseDamage, BreakableContainer.InteractionType.ObjectBreakingDevice);
                }

                else if (o is BreakableStatic)
                {
                    BreakableStatic breakableStatic = (BreakableStatic)o;

                    if (breakableStatic.ObjectBreakingDeviceDamageScalar == 0)
                    {
                        continue;
                    }

                    baseDamage = (int)((double)baseDamage * CreatureDamageScalar * breakableStatic.ObjectBreakingDeviceDamageScalar);

                    breakableStatic.ReceiveDamage(from, baseDamage, BreakableStatic.InteractionType.ObjectBreakingDevice);
                }
            }
        }
 protected override void OnTick()
 {
     m_Mobile.PlaySound(0x11D);
     AOS.Damage(m_Mobile, m_From, Utility.RandomMinMax(5, 15), 0, 100, 0, 0, 0);
 }
Example #22
0
        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;
            }
            }
        }
Example #23
0
            protected override void OnTick()
            {
                m_Mobile.PlaySound(0x4CF);

                AOS.Damage(m_Mobile, m_From, Utility.RandomMinMax(10, 20), 90, 10, 0, 0, 0);
            }
Example #24
0
            protected override void OnTick()
            {
                if (!this.m_Target.Alive)
                {
                    m_Table.Remove(this.m_Target);
                    this.Stop();
                }

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

                --this.m_Count;

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

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

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

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

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

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

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

                    AOS.Damage(this.m_Target, this.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
                    {
                        this.m_Target.RevealingAction();
                    }
                }
            }
Example #25
0
        private static void ProcessDeathStrike(object state)
        {
            Mobile defender = (Mobile)state;

            DeathStrikeInfo info = m_Table[defender] as DeathStrikeInfo;

            if (info == null)   //sanity
            {
                return;
            }

            int maxDamage, damage = 0;

            double ninjitsu      = info.m_Attacker.Skills[SkillName.Ninjitsu].Value;
            double stalkingBonus = Tracking.GetStalkingBonus(info.m_Attacker, info.m_Target);

            if (Core.ML)
            {
                double scalar = (info.m_Attacker.Skills[SkillName.Hiding].Value + info.m_Attacker.Skills[SkillName.Stealth].Value) / 220;

                if (scalar > 1)
                {
                    scalar = 1;
                }

                // New formula doesn't apply DamageBonus anymore, caps must be, directly, 60/30.
                if (info.m_Steps >= 5)
                {
                    damage = (int)Math.Floor(Math.Min(60, (ninjitsu / 3) * (0.3 + 0.7 * scalar) + stalkingBonus));
                }
                else
                {
                    damage = (int)Math.Floor(Math.Min(30, (ninjitsu / 9) * (0.3 + 0.7 * scalar) + stalkingBonus));
                }

                if (info.m_isRanged)
                {
                    damage /= 2;
                }
            }
            else
            {
                int    divisor    = (info.m_Steps >= 5) ? 30 : 80;
                double baseDamage = ninjitsu / divisor * 10;

                maxDamage = (info.m_Steps >= 5) ? 62 : 22; // DamageBonus is 8 at most. That brings the cap up to 70/30.
                damage    = Math.Max(0, Math.Min(maxDamage, (int)(baseDamage + stalkingBonus))) + info.m_DamageBonus;
            }

            if (Core.ML)
            {
                info.m_Target.Damage(damage, info.m_Attacker); // Damage is direct.
            }
            else
            {
                AOS.Damage(info.m_Target, info.m_Attacker, damage, true, 100, 0, 0, 0, 0, 0, 0, false, false, true); // Damage is physical.
            }
            if (info.m_Timer != null)
            {
                info.m_Timer.Stop();
            }

            m_Table.Remove(info.m_Target);
        }
Example #26
0
        public static void DoBreathAttack(BreathAttackType breathType, BaseCreature creature, Mobile target)
        {
            if (!SpecialAbilities.Exists(creature))
            {
                return;
            }
            if (!SpecialAbilities.Exists(target))
            {
                return;
            }
            if (!creature.CanBeHarmful(target))
            {
                return;
            }

            creature.DoHarmful(target);
            creature.Direction = creature.GetDirectionTo(target);

            if (creature.IsHighSeasBodyType)
            {
                creature.Animate(Utility.RandomList(27), 5, 1, true, false, 0);
            }
            else
            {
                creature.Animate(12, 5, 1, true, false, 0);
            }

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

            Timer.DelayCall(TimeSpan.FromSeconds(1.3), delegate
            {
                if (!SpecialAbilities.Exists(creature))
                {
                    return;
                }

                switch (breathType)
                {
                case BreathAttackType.Fire:
                    Effects.PlaySound(creature.Location, creature.Map, 0x227);
                    Effects.SendMovingEffect(creature, target, 0x36D4, 5, 0, false, false, 0, 0);
                    break;

                case BreathAttackType.Ice:
                    Effects.PlaySound(creature.Location, creature.Map, 0x64F);
                    Effects.SendMovingEffect(creature, target, 0x36D4, 5, 0, false, false, 1153, 0);
                    break;

                case BreathAttackType.Poison:
                    Effects.PlaySound(creature.Location, creature.Map, 0x22F);
                    Effects.SendMovingEffect(creature, target, 0x372A, 10, 0, false, false, 2208, 0);
                    break;
                }

                Timer.DelayCall(TimeSpan.FromSeconds(1.0), delegate
                {
                    if (creature == null)
                    {
                        return;
                    }

                    if (creature.CanBeHarmful(target))
                    {
                        double baseDamage = (double)creature.DamageMax;

                        if (creature.Controlled && creature.ControlMaster is PlayerMobile)
                        {
                            if (target is PlayerMobile)
                            {
                                baseDamage *= BaseCreature.BreathDamageToPlayerScalar * creature.PvPAbilityDamageScalar;
                            }

                            if (target is BaseCreature)
                            {
                                baseDamage *= BaseCreature.BreathDamageToCreatureScalar;
                            }
                        }

                        DungeonArmor.PlayerDungeonArmorProfile defenderDungeonArmor = new DungeonArmor.PlayerDungeonArmorProfile(target, null);

                        if (defenderDungeonArmor.MatchingSet && !defenderDungeonArmor.InPlayerCombat)
                        {
                            baseDamage *= defenderDungeonArmor.DungeonArmorDetail.BreathDamageReceivedScalar;
                        }

                        switch (breathType)
                        {
                        case BreathAttackType.Fire:
                            Effects.PlaySound(target.Location, target.Map, 0x208);
                            Effects.SendLocationParticles(EffectItem.Create(target.Location, target.Map, TimeSpan.FromSeconds(0.5)), 0x3996, 10, 20, 5029);
                            break;

                        case BreathAttackType.Ice:
                            baseDamage = (double)creature.DamageMax * .75;

                            if (target is PlayerMobile)
                            {
                                SpecialAbilities.CrippleSpecialAbility(1.0, creature, target, .05, 10, -1, true, "", "The blast of ice has slowed your actions!", "-1");
                            }
                            else
                            {
                                SpecialAbilities.CrippleSpecialAbility(1.0, creature, target, .10, 10, -1, true, "", "The blast of ice has slowed your actions!", "-1");
                            }

                            Effects.PlaySound(target.Location, target.Map, 0x208);
                            Effects.SendLocationParticles(EffectItem.Create(target.Location, target.Map, TimeSpan.FromSeconds(0.25)), 0x3779, 10, 20, 1153, 0, 5029, 0);
                            break;

                        case BreathAttackType.Poison:
                            baseDamage = (double)creature.DamageMax * .5;

                            int poisonLevel = 0;

                            if (creature.HitPoison != null)
                            {
                                poisonLevel = creature.HitPoison.Level;
                            }

                            double poisonChance = 1.0;

                            if (creature.IsControlledCreature())
                            {
                                if (target is PlayerMobile)
                                {
                                    poisonChance = .5;
                                    poisonLevel--;
                                }

                                if (target is BaseCreature)
                                {
                                    BaseCreature bc_Target = target as BaseCreature;

                                    if (bc_Target.IsControlledCreature())
                                    {
                                        poisonChance = .5;
                                        poisonLevel--;
                                    }
                                }
                            }

                            if (poisonLevel < 0)
                            {
                                poisonLevel = 0;
                            }

                            int poisonHue = 2208;

                            poisonHue += poisonLevel;

                            if (Utility.RandomDouble() <= poisonChance)
                            {
                                Poison poison = Poison.GetPoison(poisonLevel);
                                target.ApplyPoison(target, poison);
                            }

                            Effects.PlaySound(target.Location, target.Map, 0x22F);
                            Effects.SendLocationParticles(EffectItem.Create(target.Location, target.Map, TimeSpan.FromSeconds(0.25)), 0x372A, 10, 20, poisonHue, 0, 5029, 0);
                            break;
                        }

                        int finalDamage = (int)baseDamage;

                        if (target != null)
                        {
                            AOS.Damage(target, creature, finalDamage, 100, 0, 0, 0, 0);
                        }
                    }
                });
            });
        }
Example #27
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);
                }
            }
        }
Example #28
0
        private void DoCounter(Mobile attacker)
        {
            if (Map == null || (attacker is BaseCreature && ((BaseCreature)attacker).BardProvoked))
            {
                return;
            }

            if (0.2 > Utility.RandomDouble())
            {
                /* Counterattack with Hit Poison Area
                 * 20-25 damage, unresistable
                 * Lethal poison, 100% of the time
                 * Particle effect: Type: "2" From: "0x4061A107" To: "0x0" ItemId: "0x36BD" ItemIdName: "explosion" FromLocation: "(296 615, 17)" ToLocation: "(296 615, 17)" Speed: "1" Duration: "10" FixedDirection: "True" Explode: "False" Hue: "0xA6" RenderMode: "0x0" Effect: "0x1F78" ExplodeEffect: "0x1" ExplodeSound: "0x0" Serial: "0x4061A107" Layer: "255" Unknown: "0x0"
                 * Doesn't work on provoked monsters
                 */

                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;
                }

                Animate(10, 4, 1, true, false, 0);

                ArrayList targets = new ArrayList();

                foreach (Mobile m in target.GetMobilesInRange(8))
                {
                    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);
                    }
                }

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

                    DoHarmful(m);

                    AOS.Damage(m, this, Utility.RandomMinMax(20, 25), true, 0, 0, 0, 100, 0);

                    m.FixedParticles(0x36BD, 1, 10, 0x1F78, 0xA6, 0, (EffectLayer)255);
                    m.ApplyPoison(this, Poison.Lethal);
                }
            }
        }
Example #29
0
        private void Stone_OnTick(object state)
        {
            object[] states = (object[])state;
            Mobile   from   = (Mobile)states[0];
            Point3D  loc    = (Point3D)states[1];
            Map      map    = (Map)states[2];

            if (from == null || from.Deleted)
            {
                return;
            }

            Item stoneCenter = new StoneItem(Utility.RandomList(4963, 4967, 4970, 4973));

            stoneCenter.MoveToWorld(loc, map);

            Effects.SendLocationEffect(loc, map, 0x3728, 20);

            int stoneCount = 0;

            for (int i = -3; i <= 3; ++i)
            {
                for (int j = -3; j <= 3; ++j)
                {
                    if (i == 0 && j == 0)
                    {
                        continue;
                    }
                    if (Utility.Random(49) < 4 && stoneCount < 5)
                    {
                        Point3D loc1 = new Point3D(loc.X + i, loc.Y + j, loc.Z);

                        bool canFit = SpellHelper.AdjustField(ref loc1, map, 12, false);

                        if (canFit)
                        {
                            new StoneItem(Utility.RandomList(4964, 4965, 4966, 4968, 4969, 4971, 4972)).MoveToWorld(loc1, map);
                            stoneCount++;
                        }
                    }
                }
            }

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

            foreach (Mobile m in stoneCenter.GetMobilesInRange(15))
            {
                if (m == from || !from.CanBeHarmful(m))
                {
                    continue;
                }
                if (m.AccessLevel > AccessLevel.Player)
                {
                    continue;
                }
                if (m is BaseCreature && (((BaseCreature)m).Controlled || ((BaseCreature)m).Summoned || ((BaseCreature)m).Team != this.Team))
                {
                    list.Add(m);
                }
                if (m.Player)
                {
                    list.Add(m);
                }
            }

            foreach (Mobile m in list)
            {
                m.SendMessage("The cyclops hurls a boulder, stunning you!");
                m.PlaySound(0x2F3); // sound effect from earthquake spell
                from.DoHarmful(m);
                AOS.Damage(m, from, 50, 100, 0, 0, 0, 0);
                m.Animate(21, 6, 1, true, false, 0);
                Timer.DelayCall(TimeSpan.FromSeconds(0.7), new TimerStateCallback(OnGround_CallBack), m);

                if (m.Alive)
                {
                    m.Frozen    = true;
                    m.Combatant = null;
                    Timer.DelayCall(TimeSpan.FromSeconds(5.0), new TimerStateCallback(Recover_Callback), m);
                }
            }
        }
Example #30
0
        public override void OnHit(Mobile attacker, Mobile defender, int damage)
        {
            if (!Validate(attacker))
            {
                return;
            }

            if (attacker is Player)
            {
                Dragoon drg = Perk.GetByType <Dragoon>((Player)attacker);

                if (drg != null)
                {
                    if (!drg.MountedRival())
                    {
                        if (attacker.Mounted) // TODO: Should there be a message here?
                        {
                            return;
                        }
                    }
                }
            }

            //else if (attacker.Mounted)
            //return;

            ClearCurrentAbility(attacker);

            IMount mount = defender.Mount;

            if (mount == null)
            {
                attacker.SendLocalizedMessage(1060848);                   // This attack only works on mounted targets
                return;
            }

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

            if (defender is Player)
            {
                Dragoon drg = Perk.GetByType <Dragoon>((Player)defender);

                if (drg != null)
                {
                    if (drg.SaddleBound() && Utility.RandomDouble() < 0.80) // 80% chance for the dragoon to resist dismount.
                    {
                        attacker.SendMessage("The rider resist your attempt to dismount.");
                        defender.SendMessage("You resist your attackers attempt to dismount.");
                        return;
                    }
                }
            }

            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);

            mount.Rider = null;

            BaseMount.SetMountPrevention(defender, BlockMountType.Dazed, DefenderRemountDelay);
            BaseMount.SetMountPrevention(attacker, BlockMountType.DismountRecovery, AttackerRemountDelay);

            if (!attacker.Mounted)
            {
                AOS.Damage(defender, attacker, Utility.RandomMinMax(15, 25), 100, 0, 0, 0, 0);
            }
        }