using Server.Targeting; namespace Server.Spells.Third { public class PoisonSpell : MagerySpell { private static readonly SpellInfo m_Info = new SpellInfo( "Poison", "In Nox", 203, 9051, Reagent.Nightshade); public override SpellCircle Circle => SpellCircle.Third; public PoisonSpell(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(this, Caster, ref m); if (m.Spell != null) m.Spell.OnCasterHurt(); m.Paralyzed = false; if (CheckResisted(m) || Mysticism.StoneFormSpell.CheckImmunity(m)) { m.SendLocalizedMessage(501783); // You feel yourself resisting magical energy. } else { int level; int total = (Caster.Skills.Magery.Fixed + Caster.Skills.Poisoning.Fixed) / 2; if (Caster.InRange(m, 8)) { int range = (int)Caster.GetDistanceToSqrt(m.Location); if (total >= 1000) level = Utility.RandomDouble() <= .1 ? 4 : 3; else if (total > 850) level = 2; else if (total > 650) level = 1; else level = 0; if (!Caster.InRange(m, 2)) level -= range / 2; if (level < 0) level = 0; } else if (Caster.InRange(m, 2)) { if (total >= 1000) level = 3; else if (total > 850) level = 2; else if (total > 650) level = 1; else level = 0; } else { level = 0; } m.ApplyPoison(Caster, Poison.GetPoison(level)); } m.FixedParticles(0x374A, 10, 15, 5021, EffectLayer.Waist); m.PlaySound(0x205); HarmfulSpell(m); } FinishSequence(); } private class InternalTarget : Target { private readonly PoisonSpell m_Owner; public InternalTarget(PoisonSpell owner) : base(10, 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(); } } } }