public override void OnCast()
		{
			Mobile caster = this.Caster;

			/*if ( caster.Mounted )
			{
				caster.SendLocalizedMessage( 1042561 ); // Please dismount first.
			}
			else */
			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 ( Spells.Ninjitsu.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) )
			{
				DoFizzle();
			}
			else if ( CheckSequence() )
			{
				TransformContext context = GetContext( caster );
				Type ourType = this.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 ( PhysResistOffset != 0 )
						mods.Add( new ResistanceMod( ResistanceType.Physical, PhysResistOffset ) );

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

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

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

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

					if ( !((Body)this.Body).IsHuman )
					{
						Mobiles.IMount mt = Caster.Mount;

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

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

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

					PlayEffect( caster );

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

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

			FinishSequence();
		}
        public override void OnCast()
        {
            Mobile caster = this.Caster;

            /*if ( caster.Mounted )
             * {
             * }
             * else */
            if (Factions.Sigil.ExistsOn(Caster))
            {
            }
            else if (!caster.CanBeginAction(typeof(PolymorphSpell)))
            {
            }
            else if (!caster.CanBeginAction(typeof(IncognitoSpell)) || !caster.CanBeginAction(typeof(PolymorphSpell)) || (caster.IsBodyMod && GetContext(caster) == null))
            {
                DoFizzle();
            }
            else if (CheckSequence())
            {
                TransformContext context = GetContext(caster);
                Type             ourType = this.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)
                {
                    ArrayList mods = new ArrayList();

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

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

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

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

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

                    if (!((Body)this.Body).IsHuman)
                    {
                        Mobiles.IMount mt = Caster.Mount;

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

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

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

                    PlayEffect(caster);

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

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

            FinishSequence();
        }
Esempio n. 3
0
        public override void OnCast()
        {
            Mobile caster = this.Caster;

            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 (Spells.Ninjitsu.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))
            {
                DoFizzle();
            }
            else if (CheckSequence())
            {
                TransformContext context = GetContext(caster);
                Type             ourType = this.GetType();

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

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

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

                if (!ourTransform)
                {
                    ArrayList mods = new ArrayList();

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

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

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

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

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

                    if (!((Body)this.Body).IsHuman)
                    {
                        Mobiles.IMount mt = Caster.Mount;

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

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

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

                    PlayEffect(caster);

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

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

            FinishSequence();
        }
        public override void OnCast()
        {
            Mobile caster = this.Caster;

            /*if ( caster.Mounted )
            {
            }
            else */
            if ( Factions.Sigil.ExistsOn( Caster ) )
            {
            }
            else if ( !caster.CanBeginAction( typeof( PolymorphSpell ) ) )
            {
            }
            else if ( !caster.CanBeginAction( typeof( IncognitoSpell ) ) || !caster.CanBeginAction( typeof( PolymorphSpell ) ) || (caster.IsBodyMod && GetContext( caster ) == null) )
            {
                DoFizzle();
            }
            else if ( CheckSequence() )
            {
                TransformContext context = GetContext( caster );
                Type ourType = this.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 )
                {
                    ArrayList mods = new ArrayList();

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

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

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

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

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

                    if ( !((Body)this.Body).IsHuman )
                    {
                        Mobiles.IMount mt = Caster.Mount;

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

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

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

                    PlayEffect( caster );

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

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

            FinishSequence();
        }