public override void OnHit( Mobile attacker, Mobile defender, int damage )
		{
			if( !Validate( attacker ) || !CheckMana( attacker, true ) )
				return;

			ClearCurrentAbility( attacker );

			attacker.SendLocalizedMessage( 1063353 ); // You perform a masterful defense!

			attacker.FixedParticles( 0x375A, 1, 17, 0x7F2, 0x3E8, 0x3, EffectLayer.Waist );

			int modifier = (int)(30.0 * ((Math.Max( attacker.Skills[SkillName.Bushido].Value, attacker.Skills[SkillName.Ninjitsu].Value ) - 50.0) / 70.0));

			DefenseMasteryInfo info = m_Table[attacker] as DefenseMasteryInfo;

			if( info != null )
				EndDefense( (object)info );

			ResistanceMod mod = new ResistanceMod( ResistanceType.Physical, 50 + modifier );
			attacker.AddResistanceMod( mod );

			info = new DefenseMasteryInfo( attacker, 80 - modifier, mod );
			info.m_Timer = Timer.DelayCall( TimeSpan.FromSeconds( 3.0 ), new TimerStateCallback( EndDefense ), info );

			m_Table[attacker] = info;

			attacker.Delta( MobileDelta.WeaponDamage );
		}
Example #2
0
        public override void OnHit( Mobile attacker, Mobile defender, int damage )
        {
            if ( !Validate( attacker ) || !CheckMana( attacker, true ) )
                return;

            ClearCurrentAbility( attacker );

            Timer t = (Timer) m_Table[attacker];

            if ( t != null )
                t.Stop();

            attacker.SendLocalizedMessage( 1063353 ); // You perform a masterful defense!

            m_Table[attacker] = t = Timer.DelayCall( TimeSpan.FromSeconds( 3.0 ), new TimerStateCallback( Expire_Callback ), attacker );

            if ( mods == null )
            {
                mods = new object[1] { new ResistanceMod( ResistanceType.Physical, 70 ) };

                m_Table[attacker] = mods;

                attacker.AddResistanceMod( (ResistanceMod) mods[0] );
            }

            att = attacker;

            attacker.FixedParticles( 0x375A, 1, 17, 0x7F2, 0x3E8, 0x3, EffectLayer.Waist );
        }
		public override void OnHit( Mobile attacker, Mobile defender, double damageBonus )
		{
			base.OnHit( attacker, defender, damageBonus );

			if ( attacker != null && defender != null )
			{
				ResistanceMod[] mods = new ResistanceMod[]{ new ResistanceMod( ResistanceType.Fire, -15 ) };

				for ( int i = 0; i < mods.Length; ++i )
					attacker.AddResistanceMod( mods[i] );

				TimedResistanceMod.AddMod( 
					defender, 
					"BistroFork", 
					mods, 
					TimeSpan.FromSeconds( 10 )
				);
			}
		}
Example #4
0
		public override void OnGaveMeleeAttack( Mobile defender )
		{
			base.OnGaveMeleeAttack( defender );

			if ( Utility.RandomDouble() < 0.1 )
			{
				ExpireTimer timer;

				if ( m_Table.TryGetValue( defender, out timer ) )
					timer.DoExpire();

				defender.FixedParticles( 0x3709, 10, 30, 5052, EffectLayer.LeftFoot );
				defender.PlaySound( 0x208 );
				defender.SendLocalizedMessage( 1070833 ); // The creature fans you with fire, reducing your resistance to fire attacks.

				ResistanceMod mod = new ResistanceMod( ResistanceType.Fire, -10 );
				defender.AddResistanceMod( mod );

				m_Table[defender] = timer = new ExpireTimer( defender, mod );
				timer.Start();
			}
		}
		public static void LowerResistanceAttack( Mobile from, ref ExpireTimer timer, TimeSpan duration, Mobile target, ResistanceMod[] mod, Hashtable hashtbl )
		{
			target.PlaySound( 0x1E9 );
			target.FixedParticles( 0x376A, 9, 32, 5008, EffectLayer.Waist );

			timer = new ExpireTimer( target, mod, duration, hashtbl );
			timer.Start();

			hashtbl[target] = timer;

			for (int i=0;i<mod.Length;i++)
				target.AddResistanceMod( mod[i] );		

			if ( hashtbl == m_RuneBeetleRMT )
				target.SendLocalizedMessage( 1070845 ); // The creature continues to corrupt your armor!

			if ( hashtbl == m_FanDancerRMT )
				target.SendLocalizedMessage( 1070835 ); // The creature surrounds you with fire, reducing your resistance to fire attacks.

			from.DoHarmful( target );

			return;
		}
        public override void OnGaveMeleeAttack( Mobile defender )
        {
            base.OnGaveMeleeAttack( defender );

            if( 0.1 > Utility.RandomDouble() )
            {
                /* Flurry of Twigs
                 * Start cliloc: 1070850
                 * Effect: Physical resistance -15% for 5 seconds
                 * End cliloc: 1070852
                 * Effect: Type: "3" From: "0x57D4F5B" To: "0x0" ItemId: "0x37B9" ItemIdName: "glow" FromLocation: "(1048 779, 6)" ToLocation: "(1048 779, 6)" Speed: "10" Duration: "5" FixedDirection: "True" Explode: "False"
                 */

                ExpireTimer timer = (ExpireTimer)m_FlurryOfTwigsTable[defender];

                if( timer != null )
                {
                    timer.DoExpire();
                    defender.SendLocalizedMessage( 1070851 ); // The creature lands another blow in your weakened state.
                }
                else
                    defender.SendLocalizedMessage( 1070850 ); // The creature's flurry of twigs has made you more susceptible to physical attacks!

                int effect = -(defender.PhysicalResistance * 15 / 100);

                ResistanceMod mod = new ResistanceMod( ResistanceType.Physical, effect );

                defender.FixedEffect( 0x37B9, 10, 5 );
                defender.AddResistanceMod( mod );

                timer = new ExpireTimer( defender, mod, m_FlurryOfTwigsTable, TimeSpan.FromSeconds( 5.0 ) );
                timer.Start();
                m_FlurryOfTwigsTable[defender] = timer;
            }
            else if( 0.05 > Utility.RandomDouble() )
            {
                /* Chlorophyl Blast
                 * Start cliloc: 1070827
                 * Effect: Energy resistance -50% for 10 seconds
                 * End cliloc: 1070829
                 * Effect: Type: "3" From: "0x57D4F5B" To: "0x0" ItemId: "0x37B9" ItemIdName: "glow" FromLocation: "(1048 779, 6)" ToLocation: "(1048 779, 6)" Speed: "10" Duration: "5" FixedDirection: "True" Explode: "False"
                 */

                ExpireTimer timer = (ExpireTimer)m_ChlorophylBlastTable[defender];

                if( timer != null )
                {
                    timer.DoExpire();
                    defender.SendLocalizedMessage( 1070828 ); // The creature continues to hinder your energy resistance!
                }
                else
                    defender.SendLocalizedMessage( 1070827 ); // The creature's attack has made you more susceptible to energy attacks!

                int effect = -(defender.EnergyResistance / 2);

                ResistanceMod mod = new ResistanceMod( ResistanceType.Energy, effect );

                defender.FixedEffect( 0x37B9, 10, 5 );
                defender.AddResistanceMod( mod );

                timer = new ExpireTimer( defender, mod, m_ChlorophylBlastTable, TimeSpan.FromSeconds( 10.0 ) );
                timer.Start();
                m_ChlorophylBlastTable[defender] = timer;
            }
        }
Example #7
0
		public override void OnGaveMeleeAttack( Mobile defender )
		{
			base.OnGaveMeleeAttack( defender );

			if ( !IsFanned( defender ) && 0.05 > Utility.RandomDouble() )
			{
				/* Fanning Fire
				 * Graphic: Type: "3" From: "0x57D4F5B" To: "0x0" ItemId: "0x3709" ItemIdName: "fire column" FromLocation: "(994 325, 16)" ToLocation: "(994 325, 16)" Speed: "10" Duration: "30" FixedDirection: "True" Explode: "False" Hue: "0x0" RenderMode: "0x0" Effect: "0x34" ExplodeEffect: "0x1" ExplodeSound: "0x0" Serial: "0x57D4F5B" Layer: "5" Unknown: "0x0"
				 * Sound: 0x208
				 * Start cliloc: 1070833
				 * Effect: Fire res -10% for 10 seconds
				 * Damage: 35-45, 100% fire
				 * End cliloc: 1070834
				 * Effect does not stack
				 */

				defender.SendLocalizedMessage( 1070833 ); // The creature fans you with fire, reducing your resistance to fire attacks.

				int effect = -(defender.FireResistance / 10);

				ResistanceMod mod = new ResistanceMod( ResistanceType.Fire, effect );

				defender.FixedParticles( 0x37B9, 10, 30, 0x34, EffectLayer.RightFoot );
				defender.PlaySound( 0x208 );

				// This should be done in place of the normal attack damage.
				//AOS.Damage( defender, this, Utility.RandomMinMax( 35, 45 ), 0, 100, 0, 0, 0 );

				defender.AddResistanceMod( mod );
		
				ExpireTimer timer = new ExpireTimer( defender, mod, TimeSpan.FromSeconds( 10.0 ) );
				timer.Start();
				m_Table[defender] = timer;
			}
		}
Example #8
0
		public override void OnGaveMeleeAttack( Mobile defender )
		{
			base.OnGaveMeleeAttack( defender );

			if( 0.1 > Utility.RandomDouble() )
			{
				/* Grasping Claw
				 * Start cliloc: 1070836
				 * Effect: Physical resistance -15% for 5 seconds
				 * End cliloc: 1070838
				 * Effect: Type: "3" - From: "0x57D4F5B" (player) - To: "0x0" - ItemId: "0x37B9" - ItemIdName: "glow" - FromLocation: "(1149 808, 32)" - ToLocation: "(1149 808, 32)" - Speed: "10" - Duration: "5" - FixedDirection: "True" - Explode: "False"
				 */

				ExpireTimer timer = (ExpireTimer)m_Table[defender];

				if( timer != null )
				{
					timer.DoExpire();
					defender.SendLocalizedMessage( 1070837 ); // The creature lands another blow in your weakened state.
				}
				else
					defender.SendLocalizedMessage( 1070836 ); // The blow from the creature's claws has made you more susceptible to physical attacks.

				int effect = -(defender.PhysicalResistance * 15 / 100);

				ResistanceMod mod = new ResistanceMod( ResistanceType.Physical, effect );

				defender.FixedEffect( 0x37B9, 10, 5 );
				defender.AddResistanceMod( mod );

				timer = new ExpireTimer( defender, mod, TimeSpan.FromSeconds( 5.0 ) );
				timer.Start();
				m_Table[defender] = timer;
			}
		}
Example #9
0
		public static bool OnCast( Mobile caster, Spell spell )
		{
			ITransformationSpell transformSpell = spell as ITransformationSpell;

			if( transformSpell == null )
				return false;

			if( Factions.Sigil.ExistsOn( caster ) )
			{
				caster.SendLocalizedMessage( 1061632 ); // You can't do that while carrying the sigil.
			}
			else if( !caster.CanBeginAction( typeof( PolymorphSpell ) ) )
			{
				caster.SendLocalizedMessage( 1061628 ); // You can't do that while polymorphed.
			}
			else if( AnimalForm.UnderTransformation( caster ) )
			{
				caster.SendLocalizedMessage( 1061091 ); // You cannot cast that spell in this form.
			}
			else if( !caster.CanBeginAction( typeof( IncognitoSpell ) ) || (caster.IsBodyMod && GetContext( caster ) == null) )
			{
				spell.DoFizzle();
			}
			else if( spell.CheckSequence() )
			{
				TransformContext context = GetContext( caster );
				Type ourType = spell.GetType();

				bool wasTransformed = (context != null);
				bool ourTransform = (wasTransformed && context.Type == ourType);

				if( wasTransformed )
				{
					RemoveContext( caster, context, ourTransform );

					if( ourTransform )
					{
						caster.PlaySound( 0xFA );
						caster.FixedParticles( 0x3728, 1, 13, 5042, EffectLayer.Waist );
					}
				}

				if( !ourTransform )
				{
					List<ResistanceMod> mods = new List<ResistanceMod>();

					if( transformSpell.PhysResistOffset != 0 )
						mods.Add( new ResistanceMod( ResistanceType.Physical, transformSpell.PhysResistOffset ) );

					if( transformSpell.FireResistOffset != 0 )
						mods.Add( new ResistanceMod( ResistanceType.Fire, transformSpell.FireResistOffset ) );

					if( transformSpell.ColdResistOffset != 0 )
						mods.Add( new ResistanceMod( ResistanceType.Cold, transformSpell.ColdResistOffset ) );

					if( transformSpell.PoisResistOffset != 0 )
						mods.Add( new ResistanceMod( ResistanceType.Poison, transformSpell.PoisResistOffset ) );

					if( transformSpell.NrgyResistOffset != 0 )
						mods.Add( new ResistanceMod( ResistanceType.Energy, transformSpell.NrgyResistOffset ) );

					if( !((Body)transformSpell.Body).IsHuman )
					{
						Mobiles.IMount mt = caster.Mount;

						if( mt != null )
							mt.Rider = null;
					}

					caster.BodyMod = transformSpell.Body;
					caster.HueMod = transformSpell.Hue;

					for( int i = 0; i < mods.Count; ++i )
						caster.AddResistanceMod( mods[i] );

					transformSpell.DoEffect( caster );

					Timer timer = new TransformTimer( caster, transformSpell );
					timer.Start();

					AddContext( caster, new TransformContext( timer, mods, ourType, transformSpell ) );
					return true;
				}
			}

			return false;
		}
        public static void FinalEffect( Mobile target, int protection, int duration )
        {
            if( target == null || target.Deleted || !(target is IKhaerosMobile) )
                return;

            if( target.ResistanceMods != null )
                target.ResistanceMods.Clear();

            if( ((IKhaerosMobile)target).AuraOfProtection != null )
                ((IKhaerosMobile)target).AuraOfProtection.Stop();

            target.PlaySound( 0x1E9 );
            target.FixedParticles( 0x375A, 9, 20, 5016, EffectLayer.Waist );

            ResistanceMod blunt = new ResistanceMod( ResistanceType.Blunt, protection );
            ResistanceMod slash = new ResistanceMod( ResistanceType.Slashing, protection );
            ResistanceMod pierce = new ResistanceMod( ResistanceType.Piercing, protection );
            target.AddResistanceMod( blunt );
            target.AddResistanceMod( slash );
            target.AddResistanceMod( pierce );

            ((IKhaerosMobile)target).AuraOfProtection = new AuraOfProtectionTimer( target, duration );
            ((IKhaerosMobile)target).AuraOfProtection.Start();

            if( target is PlayerMobile && ((PlayerMobile)target).HasGump( typeof( CharInfoGump ) ) )
                ((PlayerMobile)target).SendGump( new CharInfoGump( (PlayerMobile)target ) );
        }
 public ResistancePrayerTimer(Mobile target, ResistanceType type, int intensity, int seconds)
     : base(TimeSpan.FromSeconds(seconds))
 {
     m_Target = target;
     m_ResistanceMod = new ResistanceMod(type, intensity);
     target.AddResistanceMod(m_ResistanceMod);
 }
Example #12
0
		public static void BeginGuardOff( Mobile m, Mobile caster )
		{
			if ( m_Table.ContainsKey( m.Serial ) )
			{
				Timer timer = m_Table[m.Serial];
				timer.Stop();
				m_Table.Remove( m.Serial );
			}

			List<ResistanceMod> mods = new List<ResistanceMod>();
			mods.Add( new ResistanceMod( ResistanceType.Physical, -(m.PhysicalResistance / 2) ) );
			mods.Add( new ResistanceMod( ResistanceType.Fire, -(m.FireResistance / 2) ) );
			mods.Add( new ResistanceMod( ResistanceType.Cold, -(m.ColdResistance / 2) ) );
			mods.Add( new ResistanceMod( ResistanceType.Poison, -(m.PoisonResistance / 2) ) );
			mods.Add( new ResistanceMod( ResistanceType.Energy, -(m.EnergyResistance / 2) ) );

			Double duration = ( BlueSpell.ScaleBySkill( caster, SkillName.Forensics ) * 3.0 );

			InternalTimer timertostart = new InternalTimer( m, mods, duration );
			timertostart.Start();
			m_Table.Add( m.Serial, timertostart );

			for ( int i = 0; i < mods.Count; ++i )
				m.AddResistanceMod( mods[i] );

			m.SendMessage( "Your guard has been lowered" );
		}
Example #13
0
        public override void OnGaveMeleeAttack( Mobile defender )
        {
            base.OnGaveMeleeAttack( defender );

            if ( 0.1 > Utility.RandomDouble() )
            {
                ExpireTimer timer = (ExpireTimer) m_Table[defender];

                if ( timer != null )
                {
                    timer.DoExpire();
                    defender.SendLocalizedMessage( 1070837 ); // The creature lands another blow in your weakened state.
                }
                else
                    defender.SendLocalizedMessage( 1070836 ); // The blow from the creature's claws has made you more susceptible to physical attacks.

                int effect = -( defender.PhysicalResistance * 15 / 100 );

                ResistanceMod mod = new ResistanceMod( ResistanceType.Physical, effect );

                defender.FixedEffect( 0x37B9, 10, 5 );
                defender.AddResistanceMod( mod );

                timer = new ExpireTimer( defender, mod, TimeSpan.FromSeconds( 5.0 ) );
                timer.Start();
                m_Table[defender] = timer;
            }
        }
Example #14
0
        private static void ApplyMods( Mobile from, ArrayList mods )
        {
            for ( int i = 0; i < mods.Count; ++i )
            {
                object mod = mods[i];

                if ( mod is ResistanceMod )
                    from.AddResistanceMod( (ResistanceMod) mod );
                else if ( mod is StatMod )
                    from.AddStatMod( (StatMod) mod );
                else if ( mod is SkillMod )
                    from.AddSkillMod( (SkillMod) mod );
            }
        }