using System; using System.Collections.Generic; using Server.Network; using Server.Targeting; namespace Server.Spells.Fourth { public class ManaDrainSpell : MagerySpell { private static SpellInfo m_Info = new SpellInfo( "Mana Drain", "Ort Rel", 215, 9031, Reagent.BlackPearl, Reagent.MandrakeRoot, Reagent.SpidersSilk ); public override SpellCircle Circle { get { return SpellCircle.Fourth; } } public ManaDrainSpell( Mobile caster, Item scroll ) : base( caster, scroll, m_Info ) { } public override void OnCast() { Caster.Target = new InternalTarget( this ); } public void Target( Mobile m ) { if ( !Caster.CanSee( m ) ) { Caster.SendLocalizedMessage( 500237 ); // Target can not be seen. } else if ( CheckHSequence( m ) ) { SpellHelper.Turn( Caster, m ); SpellHelper.CheckReflect( (int)this.Circle, Caster, ref m ); if ( m.Spell != null ) m.Spell.OnCasterHurt(); m.Paralyzed = false; if ( CheckResisted( m ) ) m.SendLocalizedMessage( 501783 ); // You feel yourself resisting magical energy. else if ( m.Mana >= 100 ) m.Mana -= Utility.Random( 1, 100 ); else m.Mana -= Utility.Random( 1, m.Mana ); m.FixedParticles( 0x374A, 10, 15, 5032, EffectLayer.Head ); m.PlaySound( 0x1F8 ); HarmfulSpell( m ); } FinishSequence(); } public override double GetResistPercent( Mobile target ) { return 99.0; } private class InternalTarget : Target { private ManaDrainSpell m_Owner; public InternalTarget( ManaDrainSpell owner ) : base( 12, false, TargetFlags.Harmful ) { m_Owner = owner; } protected override void OnTarget( Mobile from, object o ) { if ( o is Mobile ) m_Owner.Target( (Mobile)o ); } protected override void OnTargetFinish( Mobile from ) { m_Owner.FinishSequence(); } } } }