Cleans up Spell Targeting (#36)
This commit is contained in:
parent
de50bc9e43
commit
472b84f5ff
99 changed files with 653 additions and 2192 deletions
|
|
@ -5,7 +5,7 @@ using Server.Targeting;
|
|||
|
||||
namespace Server.Spells.Necromancy
|
||||
{
|
||||
public class BloodOathSpell : NecromancerSpell
|
||||
public class BloodOathSpell : NecromancerSpell, ISpellTargetingMobile
|
||||
{
|
||||
private static SpellInfo m_Info = new SpellInfo(
|
||||
"Blood Oath", "In Jux Mani Xen",
|
||||
|
|
@ -28,20 +28,18 @@ namespace Server.Spells.Necromancy
|
|||
|
||||
public override void OnCast()
|
||||
{
|
||||
Caster.Target = new InternalTarget(this);
|
||||
Caster.Target = new SpellTargetMobile(this, TargetFlags.Harmful, Core.ML ? 10 : 12);
|
||||
}
|
||||
|
||||
public void Target(Mobile m)
|
||||
{
|
||||
if (Caster == m || !(m is PlayerMobile || m is BaseCreature)
|
||||
) // only PlayerMobile and BaseCreature implement blood oath checking
|
||||
{
|
||||
if (m == null)
|
||||
Caster.SendLocalizedMessage(1060508); // You can't curse that.
|
||||
// only PlayerMobile and BaseCreature implement blood oath checking
|
||||
else if (Caster == m || !(m is PlayerMobile || m is BaseCreature))
|
||||
Caster.SendLocalizedMessage(1060508); // You can't curse that.
|
||||
}
|
||||
else if (m_OathTable.ContainsKey(Caster))
|
||||
{
|
||||
Caster.SendLocalizedMessage(1061607); // You are already bonded in a Blood Oath.
|
||||
}
|
||||
else if (m_OathTable.ContainsKey(m))
|
||||
{
|
||||
if (m.Player)
|
||||
|
|
@ -148,28 +146,5 @@ namespace Server.Spells.Necromancy
|
|||
m_Table.Remove(m_Caster);
|
||||
}
|
||||
}
|
||||
|
||||
private class InternalTarget : Target
|
||||
{
|
||||
private BloodOathSpell m_Owner;
|
||||
|
||||
public InternalTarget(BloodOathSpell owner) : base(Core.ML ? 10 : 12, false, TargetFlags.Harmful)
|
||||
{
|
||||
m_Owner = owner;
|
||||
}
|
||||
|
||||
protected override void OnTarget(Mobile from, object o)
|
||||
{
|
||||
if (o is Mobile mobile)
|
||||
m_Owner.Target(mobile);
|
||||
else
|
||||
from.SendLocalizedMessage(1060508); // You can't curse that.
|
||||
}
|
||||
|
||||
protected override void OnTargetFinish(Mobile from)
|
||||
{
|
||||
m_Owner.FinishSequence();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue