Example #1
0
 private static void ApplyMods(Mobile m, List <AttributeMod> mods)
 {
     for (int i = 0; i < mods.Count; i++)
     {
         m.AddAttributeMod(mods[i]);
     }
 }
Example #2
0
        public static void DoSleep(Mobile from, Mobile m)
        {
            /* Puts the Target into a temporary Sleep state. In this state,
             * a Slept Target will be unable to attack or cast spells, and
             * will move at a much slower speed. A Slept Target will awaken
             * if harmed or after a set amount of time. The Sleep duration
             * is determined by a comparison between the Caster's Evaluating
             * Intelligence and Mysticism skills and the Target's Resisting
             * Spells skill.
             *
             * Buff message:
             * - Movement slowed.
             * - Cannot attack or cast spells.
             * - Defensive capabilities greatly reduced.
             */

            from.PlaySound(0x653);

            int seconds = (int)(GetBaseSkill(from) + GetBoostSkill(from)) / 20;

            seconds -= (int)m.Skills[SkillName.MagicResist].Value / 10;

            if (seconds > 0 && !UnderCooldown(m))
            {
                BuffInfo.AddBuff(m, new BuffInfo(BuffIcon.Sleep, 1080139, TimeSpan.FromSeconds(seconds), m, seconds.ToString()));

                Timer t = new InternalTimer(m, DateTime.Now + TimeSpan.FromSeconds(seconds));
                t.Start();

                List <AttributeMod> mods = new List <AttributeMod>();
                mods.Add(new AttributeMod(MagicalAttribute.AttackChance, -45));
                mods.Add(new AttributeMod(MagicalAttribute.DefendChance, -45));
                mods.Add(new AttributeMod(MagicalAttribute.WeaponSpeed, -40));
                mods.Add(new AttributeMod(MagicalAttribute.CastSpeed, -2));
                mods.Add(new AttributeMod(MagicalAttribute.CastRecovery, -4));
                foreach (AttributeMod mod in mods)
                {
                    m.AddAttributeMod(mod);
                }

                m_SleptTable[m] = new SleepContext(t, mods);

                m.ForcedWalk = true;

                int cooldownSeconds = seconds + (int)m.Skills.MagicResist.Value / 10;

                m_CooldownTable.Add(m);
                Timer.DelayCall(TimeSpan.FromSeconds(cooldownSeconds), new TimerCallback(
                                    delegate
                {
                    m_CooldownTable.Remove(m);
                }));
            }
            else
            {
                from.SendLocalizedMessage(1080136);                // Your target resists sleep.
                m.SendLocalizedMessage(1080137);                   // You resist sleep.
            }
        }
Example #3
0
        protected override void OnTargetAdded(Mobile m)
        {
            base.OnTargetAdded(m);

            foreach (AttributeMod mod in m_Mods)
            {
                m.AddAttributeMod(mod);
            }
        }
Example #4
0
        protected override void OnTargetAdded(Mobile m)
        {
            BuffInfo.AddBuff(m, this.BuffInfo);

            foreach (AttributeMod mod in m_Mods)
            {
                m.AddAttributeMod(mod);
            }

            foreach (StatMod mod in m_StatMods)
            {
                m.AddStatMod(mod);
            }
        }
Example #5
0
        private static void ApplyMods(Mobile m, List <object> mods)
        {
            for (int i = 0; i < mods.Count; i++)
            {
                object mod = mods[i];

                if (mod is AttributeMod)
                {
                    m.AddAttributeMod((AttributeMod)mod);
                }
                else if (mod is ResistanceMod)
                {
                    m.AddResistanceMod((ResistanceMod)mod);
                }
            }
        }
Example #6
0
 private static void ApplyMods( Mobile m, List<AttributeMod> mods )
 {
     for ( int i = 0; i < mods.Count; i++ )
         m.AddAttributeMod( mods[i] );
 }
Example #7
0
        public static void DoSleep( Mobile from, Mobile m )
        {
            /* Puts the Target into a temporary Sleep state. In this state,
             * a Slept Target will be unable to attack or cast spells, and
             * will move at a much slower speed. A Slept Target will awaken
             * if harmed or after a set amount of time. The Sleep duration
             * is determined by a comparison between the Caster's Evaluating
             * Intelligence and Mysticism skills and the Target's Resisting
             * Spells skill.
             *
             * Buff message:
             * - Movement slowed.
             * - Cannot attack or cast spells.
             * - Defensive capabilities greatly reduced.
             */

            from.PlaySound( 0x653 );

            int seconds = (int) ( GetBaseSkill( from ) + GetBoostSkill( from ) ) / 20;
            seconds -= (int) m.Skills[SkillName.MagicResist].Value / 10;

            if ( seconds > 0 && !UnderCooldown( m ) )
            {
                BuffInfo.AddBuff( m, new BuffInfo( BuffIcon.Sleep, 1080139, TimeSpan.FromSeconds( seconds ), m, seconds.ToString() ) );

                Timer t = new InternalTimer( m, DateTime.Now + TimeSpan.FromSeconds( seconds ) );
                t.Start();

                List<AttributeMod> mods = new List<AttributeMod>();
                mods.Add( new AttributeMod( MagicalAttribute.AttackChance, -45 ) );
                mods.Add( new AttributeMod( MagicalAttribute.DefendChance, -45 ) );
                mods.Add( new AttributeMod( MagicalAttribute.WeaponSpeed, -40 ) );
                mods.Add( new AttributeMod( MagicalAttribute.CastSpeed, -2 ) );
                mods.Add( new AttributeMod( MagicalAttribute.CastRecovery, -4 ) );
                foreach ( AttributeMod mod in mods )
                {
                    m.AddAttributeMod( mod );
                }

                m_SleptTable[m] = new SleepContext( t, mods );

                m.ForcedWalk = true;

                int cooldownSeconds = seconds + (int) m.Skills.MagicResist.Value / 10;

                m_CooldownTable.Add( m );
                Timer.DelayCall( TimeSpan.FromSeconds( cooldownSeconds ), new TimerCallback(
                    delegate
                    {
                        m_CooldownTable.Remove( m );
                    } ) );
            }
            else
            {
                from.SendLocalizedMessage( 1080136 ); // Your target resists sleep.
                m.SendLocalizedMessage( 1080137 ); // You resist sleep.
            }
        }
Example #8
0
        private static void ApplyMods( Mobile m, List<object> mods )
        {
            for ( int i = 0; i < mods.Count; i++ )
            {
                object mod = mods[i];

                if ( mod is AttributeMod )
                    m.AddAttributeMod( (AttributeMod) mod );
                else if ( mod is ResistanceMod )
                    m.AddResistanceMod( (ResistanceMod) mod );
            }
        }