ModernUO/Projects/UOContent/Spells/Targeting/SpellTargetMobile.cs
Kamron Batman bea20f36a0
fix: Fixes targeting checks (#869)
* Adds CanTarget for more granular overrides of specific targeting restrictions
* Updates spell targeting
* Fixes targeting checks
2021-12-01 08:15:16 -08:00

32 lines
947 B
C#

using Server.Targeting;
namespace Server.Spells
{
public interface ISpellTargetingMobile : ISpell
{
void Target(Mobile from);
}
public class SpellTargetMobile : Target, ISpellTarget
{
private readonly ISpellTargetingMobile _spell;
public SpellTargetMobile(ISpellTargetingMobile spell, TargetFlags flags, int range = 12) :
base(range, false, flags) => _spell = spell;
public ISpell Spell => _spell;
protected override bool CanTarget(Mobile from, StaticTarget staticTarget, ref Point3D loc, ref Map map) => false;
protected override bool CanTarget(Mobile from, Item item, ref Point3D loc, ref Map map) => false;
protected override void OnTarget(Mobile from, object o)
{
_spell.Target(o as Mobile);
}
protected override void OnTargetFinish(Mobile from)
{
_spell?.FinishSequence();
}
}
}