public override void OnAdded( object parent ) { if ( m_Uses > 0 && parent is Mobile ) { Mobile from = (Mobile)parent; string modName = from.Serial.ToString(); switch( m_Effect ) { case MagicEffect.None: { break; } case MagicEffect.Clumsy: { Timer t = new StatTimer( from, TimeSpan.FromSeconds( 30 ), this ); from.AddStatMod( new StatMod( StatType.Dex, modName + "Dex", Utility.Random( -5, -11 ), TimeSpan.Zero ) ); //from.FixedParticles( 0x3779, 10, 15, 5002, EffectLayer.Head ); //from.PlaySound( 0x1DF ); t.Start(); break; } case MagicEffect.Feeblemind: { Timer t = new StatTimer( from, TimeSpan.FromSeconds( 30 ), this ); from.AddStatMod( new StatMod( StatType.Int, modName + "Int", Utility.Random( -5, -11 ), TimeSpan.Zero ) ); //from.FixedParticles( 0x3779, 10, 15, 5004, EffectLayer.Head ); //from.PlaySound( 0x1E4 ); t.Start(); break; } case MagicEffect.Nightsight: { from.LightLevel = 35; new LightCycle.NightSightTimer( from ).Start(); //from.FixedParticles( 0x376A, 9, 32, 5007, EffectLayer.Waist ); //from.PlaySound( 0x1E3 ); break; } case MagicEffect.Weaken: { Timer t = new StatTimer( from, TimeSpan.FromSeconds( 30 ), this ); from.AddStatMod( new StatMod( StatType.Str, modName + "Str", Utility.Random( -5, -11 ), TimeSpan.Zero ) ); //from.FixedParticles( 0x3779, 10, 15, 5009, EffectLayer.Waist ); //from.PlaySound( 0x1E6 ); t.Start(); break; } case MagicEffect.Agility: { Timer t = new StatTimer( from, TimeSpan.FromSeconds( 30 ), this ); from.AddStatMod( new StatMod( StatType.Dex, modName + "Dex", Utility.Random( 5, 11 ), TimeSpan.Zero ) ); //from.FixedParticles( 0x375A, 10, 15, 5010, EffectLayer.Waist ); //from.PlaySound( 0x28E ); t.Start(); break; } case MagicEffect.Cunning: { Timer t = new StatTimer( from, TimeSpan.FromSeconds( 30 ), this ); from.AddStatMod( new StatMod( StatType.Int, modName + "Int", Utility.Random( 5, 11 ), TimeSpan.Zero ) ); //from.FixedParticles( 0x375A, 10, 15, 5011, EffectLayer.Head ); //from.PlaySound( 0x1EB ); t.Start(); break; } case MagicEffect.Protection: { if ( m_Registry.ContainsKey( from ) ) { from.SendAsciiMessage( "This spell is already in effect." ); } else if ( from.BeginAction( typeof( DefensiveSpell ) ) ) { double value = (int)(from.Skills[SkillName.EvalInt].Value + from.Skills[SkillName.Meditation].Value + from.Skills[SkillName.Inscribe].Value); value /= 4; if ( value < 0 ) value = 0; else if ( value > 75 ) value = 75.0; Registry.Add( from, value ); new ProtectionTimer( from, this ).Start(); from.FixedParticles( 0x375A, 9, 20, 5016, EffectLayer.Waist ); from.PlaySound( 0x1ED ); } else { from.SendAsciiMessage( "The spell will not adhere to you at this time." ); } break; } case MagicEffect.Stength: { Timer t = new StatTimer( from, TimeSpan.FromSeconds( 30 ), this ); from.AddStatMod( new StatMod( StatType.Str, modName + "Str", Utility.Random( 5, 11 ), TimeSpan.Zero ) ); //from.FixedParticles( 0x375A, 10, 15, 5017, EffectLayer.Waist ); //from.PlaySound( 0x1EE ); t.Start(); break; } case MagicEffect.Bless: { Timer t = new StatTimer( from, TimeSpan.FromSeconds( 30 ), this ); from.AddStatMod( new StatMod( StatType.Str, modName + "Str", Utility.Random( 5, 11 ), TimeSpan.Zero ) ); from.AddStatMod( new StatMod( StatType.Dex, modName + "Dex", Utility.Random( 5, 11 ), TimeSpan.Zero ) ); from.AddStatMod( new StatMod( StatType.Int, modName + "Int", Utility.Random( 5, 11 ), TimeSpan.Zero ) ); //from.FixedParticles( 0x373A, 10, 15, 5018, EffectLayer.Waist ); //from.PlaySound( 0x1EA ); t.Start(); break; } case MagicEffect.Invisibility: { Timer t = new InvisTimer( from, TimeSpan.FromSeconds( 10 ), this ); from.Hidden = true; //Effects.SendLocationParticles( EffectItem.Create( new Point3D( from.X, from.Y, from.Z + 16 ), from.Map, EffectItem.DefaultDuration ), 0x376A, 10, 15, 5045 ); //from.PlaySound( 0x203 ); t.Start(); break; } case MagicEffect.MagicReflection: { if ( from.BeginAction( typeof( DefensiveSpell ) ) ) { Timer t = new MRTimer( from, TimeSpan.FromSeconds( 60 ), this ); int value = (int)(from.Skills[SkillName.Magery].Value + from.Skills[SkillName.Inscribe].Value); value = (int)(2 + (value/200)*7.0);//absorb from 8 to 15 "circles" from.MagicDamageAbsorb = value; from.FixedParticles( 0x375A, 10, 15, 5037, EffectLayer.Waist ); from.PlaySound( 0x1E9 ); t.Start(); } else { from.SendAsciiMessage( "The spell will not adhere to you at this time." ); } break; } } --m_Uses; } }
public override void OnAdded(object parent) { if (m_Uses > 0 && parent is Mobile) { Mobile from = (Mobile)parent; string modName = from.Serial.ToString(); switch (m_Effect) { case MagicEffect.None: { break; } case MagicEffect.Clumsy: { Timer t = new StatTimer(from, TimeSpan.FromSeconds(30), this); from.AddStatMod(new StatMod(StatType.Dex, modName + "Dex", Utility.Random(-5, -11), TimeSpan.Zero)); //from.FixedParticles( 0x3779, 10, 15, 5002, EffectLayer.Head ); //from.PlaySound( 0x1DF ); t.Start(); break; } case MagicEffect.Feeblemind: { Timer t = new StatTimer(from, TimeSpan.FromSeconds(30), this); from.AddStatMod(new StatMod(StatType.Int, modName + "Int", Utility.Random(-5, -11), TimeSpan.Zero)); //from.FixedParticles( 0x3779, 10, 15, 5004, EffectLayer.Head ); //from.PlaySound( 0x1E4 ); t.Start(); break; } case MagicEffect.Nightsight: { from.LightLevel = 35; new LightCycle.NightSightTimer(from).Start(); //from.FixedParticles( 0x376A, 9, 32, 5007, EffectLayer.Waist ); //from.PlaySound( 0x1E3 ); break; } case MagicEffect.Weaken: { Timer t = new StatTimer(from, TimeSpan.FromSeconds(30), this); from.AddStatMod(new StatMod(StatType.Str, modName + "Str", Utility.Random(-5, -11), TimeSpan.Zero)); //from.FixedParticles( 0x3779, 10, 15, 5009, EffectLayer.Waist ); //from.PlaySound( 0x1E6 ); t.Start(); break; } case MagicEffect.Agility: { Timer t = new StatTimer(from, TimeSpan.FromSeconds(30), this); from.AddStatMod(new StatMod(StatType.Dex, modName + "Dex", Utility.Random(5, 11), TimeSpan.Zero)); //from.FixedParticles( 0x375A, 10, 15, 5010, EffectLayer.Waist ); //from.PlaySound( 0x28E ); t.Start(); break; } case MagicEffect.Cunning: { Timer t = new StatTimer(from, TimeSpan.FromSeconds(30), this); from.AddStatMod(new StatMod(StatType.Int, modName + "Int", Utility.Random(5, 11), TimeSpan.Zero)); //from.FixedParticles( 0x375A, 10, 15, 5011, EffectLayer.Head ); //from.PlaySound( 0x1EB ); t.Start(); break; } case MagicEffect.Protection: { if (m_Registry.ContainsKey(from)) { from.SendAsciiMessage("This spell is already in effect."); } else if (from.BeginAction(typeof(DefensiveSpell))) { double value = (int)(from.Skills[SkillName.EvalInt].Value + from.Skills[SkillName.Meditation].Value + from.Skills[SkillName.Inscribe].Value); value /= 4; if (value < 0) { value = 0; } else if (value > 75) { value = 75.0; } Registry.Add(from, value); new ProtectionTimer(from, this).Start(); from.FixedParticles(0x375A, 9, 20, 5016, EffectLayer.Waist); from.PlaySound(0x1ED); } else { from.SendAsciiMessage("The spell will not adhere to you at this time."); } break; } case MagicEffect.Stength: { Timer t = new StatTimer(from, TimeSpan.FromSeconds(30), this); from.AddStatMod(new StatMod(StatType.Str, modName + "Str", Utility.Random(5, 11), TimeSpan.Zero)); //from.FixedParticles( 0x375A, 10, 15, 5017, EffectLayer.Waist ); //from.PlaySound( 0x1EE ); t.Start(); break; } case MagicEffect.Bless: { Timer t = new StatTimer(from, TimeSpan.FromSeconds(30), this); from.AddStatMod(new StatMod(StatType.Str, modName + "Str", Utility.Random(5, 11), TimeSpan.Zero)); from.AddStatMod(new StatMod(StatType.Dex, modName + "Dex", Utility.Random(5, 11), TimeSpan.Zero)); from.AddStatMod(new StatMod(StatType.Int, modName + "Int", Utility.Random(5, 11), TimeSpan.Zero)); //from.FixedParticles( 0x373A, 10, 15, 5018, EffectLayer.Waist ); //from.PlaySound( 0x1EA ); t.Start(); break; } case MagicEffect.Invisibility: { Timer t = new InvisTimer(from, TimeSpan.FromSeconds(10), this); from.Hidden = true; //Effects.SendLocationParticles( EffectItem.Create( new Point3D( from.X, from.Y, from.Z + 16 ), from.Map, EffectItem.DefaultDuration ), 0x376A, 10, 15, 5045 ); //from.PlaySound( 0x203 ); t.Start(); break; } case MagicEffect.MagicReflection: { if (from.BeginAction(typeof(DefensiveSpell))) { Timer t = new MRTimer(from, TimeSpan.FromSeconds(60), this); int value = (int)(from.Skills[SkillName.Magery].Value + from.Skills[SkillName.Inscribe].Value); value = (int)(2 + (value / 200) * 7.0); //absorb from 8 to 15 "circles" from.MagicDamageAbsorb = value; from.FixedParticles(0x375A, 10, 15, 5037, EffectLayer.Waist); from.PlaySound(0x1E9); t.Start(); } else { from.SendAsciiMessage("The spell will not adhere to you at this time."); } break; } } --m_Uses; } }