Cleans up Spell Targeting (#36)
This commit is contained in:
parent
de50bc9e43
commit
472b84f5ff
99 changed files with 653 additions and 2192 deletions
|
|
@ -4,7 +4,7 @@ using Server.Targeting;
|
|||
|
||||
namespace Server.Spells.Chivalry
|
||||
{
|
||||
public class CleanseByFireSpell : PaladinSpell
|
||||
public class CleanseByFireSpell : PaladinSpell, ISpellTargetingMobile
|
||||
{
|
||||
private static SpellInfo m_Info = new SpellInfo(
|
||||
"Cleanse By Fire", "Expor Flamus",
|
||||
|
|
@ -36,15 +36,16 @@ namespace Server.Spells.Chivalry
|
|||
|
||||
public override void OnCast()
|
||||
{
|
||||
Caster.Target = new InternalTarget(this);
|
||||
Caster.Target = new SpellTargetMobile(this, TargetFlags.Beneficial, Core.ML ? 10 : 12);
|
||||
}
|
||||
|
||||
public void Target(Mobile m)
|
||||
{
|
||||
if (m == null)
|
||||
return;
|
||||
|
||||
if (!m.Poisoned)
|
||||
{
|
||||
Caster.SendLocalizedMessage(1060176); // That creature is not poisoned!
|
||||
}
|
||||
else if (CheckBSequence(m))
|
||||
{
|
||||
SpellHelper.Turn(Caster, m);
|
||||
|
|
@ -101,26 +102,5 @@ namespace Server.Spells.Chivalry
|
|||
|
||||
FinishSequence();
|
||||
}
|
||||
|
||||
private class InternalTarget : Target
|
||||
{
|
||||
private CleanseByFireSpell m_Owner;
|
||||
|
||||
public InternalTarget(CleanseByFireSpell owner) : base(Core.ML ? 10 : 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();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -7,7 +7,7 @@ using Server.Targeting;
|
|||
|
||||
namespace Server.Spells.Chivalry
|
||||
{
|
||||
public class RemoveCurseSpell : PaladinSpell
|
||||
public class RemoveCurseSpell : PaladinSpell, ISpellTargetingMobile
|
||||
{
|
||||
private static SpellInfo m_Info = new SpellInfo(
|
||||
"Remove Curse", "Extermo Vomica",
|
||||
|
|
@ -39,11 +39,14 @@ namespace Server.Spells.Chivalry
|
|||
|
||||
public override void OnCast()
|
||||
{
|
||||
Caster.Target = new InternalTarget(this);
|
||||
Caster.Target = new SpellTargetMobile(this, TargetFlags.Beneficial, Core.ML ? 10 : 12);
|
||||
}
|
||||
|
||||
public void Target(Mobile m)
|
||||
{
|
||||
if (m == null)
|
||||
return;
|
||||
|
||||
if (CheckBSequence(m))
|
||||
{
|
||||
SpellHelper.Turn(Caster, m);
|
||||
|
|
@ -54,7 +57,7 @@ namespace Server.Spells.Chivalry
|
|||
* Chance of removing curse is affected by Caster's Karma.
|
||||
*/
|
||||
|
||||
int chance = 0;
|
||||
int chance;
|
||||
|
||||
if (Caster.Karma < -5000)
|
||||
chance = 0;
|
||||
|
|
@ -116,26 +119,5 @@ namespace Server.Spells.Chivalry
|
|||
|
||||
FinishSequence();
|
||||
}
|
||||
|
||||
private class InternalTarget : Target
|
||||
{
|
||||
private RemoveCurseSpell m_Owner;
|
||||
|
||||
public InternalTarget(RemoveCurseSpell owner) : base(Core.ML ? 10 : 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();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -3,13 +3,10 @@ using Server.Factions;
|
|||
using Server.Items;
|
||||
using Server.Misc;
|
||||
using Server.Mobiles;
|
||||
using Server.Multis;
|
||||
using Server.Network;
|
||||
using Server.Targeting;
|
||||
|
||||
namespace Server.Spells.Chivalry
|
||||
{
|
||||
public class SacredJourneySpell : PaladinSpell
|
||||
public class SacredJourneySpell : PaladinSpell, IRecallSpell
|
||||
{
|
||||
private static SpellInfo m_Info = new SpellInfo(
|
||||
"Sacred Journey", "Sanctum Viatas",
|
||||
|
|
@ -39,7 +36,7 @@ namespace Server.Spells.Chivalry
|
|||
public override void OnCast()
|
||||
{
|
||||
if (m_Entry == null)
|
||||
Caster.Target = new InternalTarget(this);
|
||||
Caster.Target = new RecallSpellTarget(this);
|
||||
else
|
||||
Effect(m_Entry.Location, m_Entry.Map, true);
|
||||
}
|
||||
|
|
@ -141,61 +138,5 @@ namespace Server.Spells.Chivalry
|
|||
|
||||
FinishSequence();
|
||||
}
|
||||
|
||||
private class InternalTarget : Target
|
||||
{
|
||||
private SacredJourneySpell m_Owner;
|
||||
|
||||
public InternalTarget(SacredJourneySpell owner) : base(Core.ML ? 10 : 12, false, TargetFlags.None)
|
||||
{
|
||||
m_Owner = owner;
|
||||
}
|
||||
|
||||
protected override void OnTarget(Mobile from, object o)
|
||||
{
|
||||
if (o is RecallRune rune)
|
||||
{
|
||||
if (rune.Marked)
|
||||
m_Owner.Effect(rune.Target, rune.TargetMap, true);
|
||||
else
|
||||
from.SendLocalizedMessage(501805); // That rune is not yet marked.
|
||||
}
|
||||
else if (o is Runebook runebook)
|
||||
{
|
||||
RunebookEntry e = runebook.Default;
|
||||
|
||||
if (e != null)
|
||||
m_Owner.Effect(e.Location, e.Map, true);
|
||||
else
|
||||
from.SendLocalizedMessage(502354); // Target is not marked.
|
||||
}
|
||||
else if (o is Key key && key.KeyValue != 0 && key.Link is BaseBoat boat)
|
||||
{
|
||||
if (!boat.Deleted && boat.CheckKey(key.KeyValue))
|
||||
m_Owner.Effect(boat.GetMarkedLocation(), boat.Map, false);
|
||||
else
|
||||
from.Send(new MessageLocalized(from.Serial, from.Body, MessageType.Regular, 0x3B2, 3, 502357,
|
||||
from.Name, "")); // I can not recall from that object.
|
||||
}
|
||||
else if (o is HouseRaffleDeed deed && deed.ValidLocation())
|
||||
{
|
||||
m_Owner.Effect(deed.PlotLocation, deed.PlotFacet, true);
|
||||
}
|
||||
else
|
||||
{
|
||||
from.Send(new MessageLocalized(from.Serial, from.Body, MessageType.Regular, 0x3B2, 3, 502357, from.Name,
|
||||
"")); // I can not recall from that object.
|
||||
}
|
||||
}
|
||||
|
||||
protected override void OnNonlocalTarget(Mobile from, object o)
|
||||
{
|
||||
}
|
||||
|
||||
protected override void OnTargetFinish(Mobile from)
|
||||
{
|
||||
m_Owner.FinishSequence();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue