Cleans up Spell Targeting (#36)
This commit is contained in:
parent
de50bc9e43
commit
472b84f5ff
99 changed files with 653 additions and 2192 deletions
|
|
@ -7,7 +7,7 @@ using Server.Targeting;
|
|||
|
||||
namespace Server.Spells.Chivalry
|
||||
{
|
||||
public class CloseWoundsSpell : PaladinSpell
|
||||
public class CloseWoundsSpell : PaladinSpell, ISpellTargetingMobile
|
||||
{
|
||||
private static SpellInfo m_Info = new SpellInfo(
|
||||
"Close Wounds", "Obsu Vulni",
|
||||
|
|
@ -39,31 +39,24 @@ namespace Server.Spells.Chivalry
|
|||
|
||||
public override void OnCast()
|
||||
{
|
||||
Caster.Target = new InternalTarget(this);
|
||||
Caster.Target = new SpellTargetMobile(this, TargetFlags.Beneficial);
|
||||
}
|
||||
|
||||
public void Target(Mobile m)
|
||||
{
|
||||
if (m == null)
|
||||
return;
|
||||
|
||||
if (!Caster.InRange(m, 2))
|
||||
{
|
||||
Caster.SendLocalizedMessage(1060178); // You are too far away to perform that action!
|
||||
}
|
||||
else if (m is BaseCreature creature && creature.IsAnimatedDead)
|
||||
{
|
||||
Caster.SendLocalizedMessage(1061654); // You cannot heal that which is not alive.
|
||||
}
|
||||
else if (m.IsDeadBondedPet)
|
||||
{
|
||||
Caster.SendLocalizedMessage(1060177); // You cannot heal a creature that is already dead!
|
||||
}
|
||||
else if (m.Hits >= m.HitsMax)
|
||||
{
|
||||
Caster.SendLocalizedMessage(500955); // That being is not damaged!
|
||||
}
|
||||
else if (m.Poisoned || MortalStrike.IsWounded(m))
|
||||
{
|
||||
Caster.LocalOverheadMessage(MessageType.Regular, 0x3B2, Caster == m ? 1005000 : 1010398);
|
||||
}
|
||||
else if (CheckBSequence(m))
|
||||
{
|
||||
SpellHelper.Turn(Caster, m);
|
||||
|
|
@ -90,26 +83,5 @@ namespace Server.Spells.Chivalry
|
|||
|
||||
FinishSequence();
|
||||
}
|
||||
|
||||
private class InternalTarget : Target
|
||||
{
|
||||
private CloseWoundsSpell m_Owner;
|
||||
|
||||
public InternalTarget(CloseWoundsSpell owner) : base(12, false, TargetFlags.Beneficial)
|
||||
{
|
||||
m_Owner = owner;
|
||||
}
|
||||
|
||||
protected override void OnTarget(Mobile from, object o)
|
||||
{
|
||||
if (o is Mobile mobile)
|
||||
m_Owner.Target(mobile);
|
||||
}
|
||||
|
||||
protected override void OnTargetFinish(Mobile from)
|
||||
{
|
||||
m_Owner.FinishSequence();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue