Cleans up Spell Targeting (#36)

This commit is contained in:
Kamron Batman 2019-03-15 15:23:03 -07:00 • committed by GitHub
parent de50bc9e43
commit 472b84f5ff
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
99 changed files with 653 additions and 2192 deletions

View file

@ -1,5 +1,4 @@
using System;
using System.Collections;
using System.Collections.Generic;
using Server.Items;
using Server.Misc;
@ -8,7 +7,7 @@ using Server.Targeting;
namespace Server.Spells.Fifth
{
public class PoisonFieldSpell : MagerySpell
public class PoisonFieldSpell : MagerySpell, ISpellTargetingPoint3D
{
private static SpellInfo m_Info = new SpellInfo(
"Poison Field", "In Nox Grav",
@ -28,7 +27,7 @@ namespace Server.Spells.Fifth
public override void OnCast()
{
Caster.Target = new InternalTarget(this);
Caster.Target = new SpellTargetPoint3D(this, TargetFlags.None, Core.ML ? 10 : 12, false);
}
public void Target(IPoint3D p)
@ -270,26 +269,5 @@ namespace Server.Spells.Fifth
}
}
}
private class InternalTarget : Target
{
private PoisonFieldSpell m_Owner;
public InternalTarget(PoisonFieldSpell owner) : base(Core.ML ? 10 : 12, true, TargetFlags.None)
{
m_Owner = owner;
}
protected override void OnTarget(Mobile from, object o)
{
if (o is IPoint3D d)
m_Owner.Target(d);
}
protected override void OnTargetFinish(Mobile from)
{
m_Owner.FinishSequence();
}
}
}
}