Reorganizes Project (#41)

This commit is contained in:
Kamron Batman 2019-08-02 18:13:40 -07:00 committed by GitHub
parent 08bf44af9a
commit 3614a66aee
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3499 changed files with 79 additions and 55 deletions

View file

@ -0,0 +1,46 @@
using System;
using Server.Targeting;
namespace Server.Spells
{
public interface ISpellTargetingPoint3D : ISpell
{
void Target(IPoint3D p);
}
public class SpellTargetPoint3D : Target
{
private ISpellTargetingPoint3D m_Spell;
public ISpell Spell => m_Spell;
private bool m_CheckLOS;
public SpellTargetPoint3D(ISpellTargetingPoint3D spell, TargetFlags flags = TargetFlags.None, int range = 12, bool checkLOS = true) : base(range, true, flags)
{
m_Spell = spell;
m_CheckLOS = checkLOS;
}
protected override void OnTarget(Mobile from, object o)
{
if (o is IPoint3D p)
m_Spell.Target(p);
}
protected override void OnTargetOutOfLOS(Mobile from, object o)
{
if (!m_CheckLOS)
return;
from.SendLocalizedMessage(501943); // Target cannot be seen. Try again.
from.Target = new SpellTargetPoint3D(m_Spell);
from.Target.BeginTimeout(from, TimeoutTime - DateTime.UtcNow);
m_Spell = null; // Needed?
}
protected override void OnTargetFinish(Mobile from)
{
m_Spell?.FinishSequence();
}
}
}