ModernUO/Projects/UOContent/Spells/Targeting/SpellTargetMobile.cs
Kamron Batman b8ad5c671d
fix: Fixes double calls with Target cancel and spell sequences (#1840)
### Summary
- Cleans up target cancellation being called incorrectly.
- An invalid target type (which should never happen), now calls `OnTargetUntargetable` instead of `OnTargetCanceled`
- Removes double calls to `FinishSequence` in Spells.
2024-06-17 15:19:06 -07:00

32 lines
944 B
C#

using Server.Targeting;
namespace Server.Spells
{
public interface ISpellTargetingMobile : ISpell
{
void Target(Mobile m);
}
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();
}
}
}