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.Seventh
|
||||
{
|
||||
public class ChainLightningSpell : MagerySpell
|
||||
public class ChainLightningSpell : MagerySpell, ISpellTargetingPoint3D
|
||||
{
|
||||
private static SpellInfo m_Info = new SpellInfo(
|
||||
"Chain Lightning", "Vas Ort Grav",
|
||||
|
|
@ -27,7 +27,7 @@ namespace Server.Spells.Seventh
|
|||
|
||||
public override void OnCast()
|
||||
{
|
||||
Caster.Target = new InternalTarget(this);
|
||||
Caster.Target = new SpellTargetPoint3D(this, TargetFlags.None, Core.ML ? 10 : 12);
|
||||
}
|
||||
|
||||
public void Target(IPoint3D p)
|
||||
|
|
@ -107,26 +107,5 @@ namespace Server.Spells.Seventh
|
|||
|
||||
FinishSequence();
|
||||
}
|
||||
|
||||
private class InternalTarget : Target
|
||||
{
|
||||
private ChainLightningSpell m_Owner;
|
||||
|
||||
public InternalTarget(ChainLightningSpell owner) : base(Core.ML ? 10 : 12, true, TargetFlags.None)
|
||||
{
|
||||
m_Owner = owner;
|
||||
}
|
||||
|
||||
protected override void OnTarget(Mobile from, object o)
|
||||
{
|
||||
if (o is IPoint3D p)
|
||||
m_Owner.Target(p);
|
||||
}
|
||||
|
||||
protected override void OnTargetFinish(Mobile from)
|
||||
{
|
||||
m_Owner.FinishSequence();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@ using Server.Targeting;
|
|||
|
||||
namespace Server.Spells.Seventh
|
||||
{
|
||||
public class EnergyFieldSpell : MagerySpell
|
||||
public class EnergyFieldSpell : MagerySpell, ISpellTargetingPoint3D
|
||||
{
|
||||
private static SpellInfo m_Info = new SpellInfo(
|
||||
"Energy Field", "In Sanct Grav",
|
||||
|
|
@ -27,7 +27,7 @@ namespace Server.Spells.Seventh
|
|||
|
||||
public override void OnCast()
|
||||
{
|
||||
Caster.Target = new InternalTarget(this);
|
||||
Caster.Target = new SpellTargetPoint3D(this, TargetFlags.None, Core.ML ? 10 : 12);
|
||||
}
|
||||
|
||||
public void Target(IPoint3D p)
|
||||
|
|
@ -63,7 +63,7 @@ namespace Server.Spells.Seventh
|
|||
TimeSpan duration;
|
||||
|
||||
if (Core.AOS)
|
||||
duration = TimeSpan.FromSeconds((15 + Caster.Skills.Magery.Fixed / 5) / 7);
|
||||
duration = TimeSpan.FromSeconds((15 + Caster.Skills.Magery.Fixed / 5) / 7.0);
|
||||
else
|
||||
duration = TimeSpan.FromSeconds(Caster.Skills.Magery.Value * 0.28 +
|
||||
2.0); // (28% of magery) + 2.0 seconds
|
||||
|
|
@ -141,16 +141,11 @@ namespace Server.Spells.Seventh
|
|||
|
||||
public override bool OnMoveOver(Mobile m)
|
||||
{
|
||||
int noto;
|
||||
|
||||
if (m is PlayerMobile)
|
||||
{
|
||||
noto = Notoriety.Compute(m_Caster, m);
|
||||
if (noto == Notoriety.Enemy || noto == Notoriety.Ally)
|
||||
return false;
|
||||
}
|
||||
|
||||
return base.OnMoveOver(m);
|
||||
if (!(m is PlayerMobile))
|
||||
return base.OnMoveOver(m);
|
||||
|
||||
int noto = Notoriety.Compute(m_Caster, m);
|
||||
return noto != Notoriety.Enemy && noto != Notoriety.Ally && base.OnMoveOver(m);
|
||||
}
|
||||
|
||||
public override void OnAfterDelete()
|
||||
|
|
@ -176,26 +171,5 @@ namespace Server.Spells.Seventh
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
private class InternalTarget : Target
|
||||
{
|
||||
private EnergyFieldSpell m_Owner;
|
||||
|
||||
public InternalTarget(EnergyFieldSpell owner) : base(Core.ML ? 10 : 12, true, TargetFlags.None)
|
||||
{
|
||||
m_Owner = owner;
|
||||
}
|
||||
|
||||
protected override void OnTarget(Mobile from, object o)
|
||||
{
|
||||
if (o is IPoint3D d)
|
||||
m_Owner.Target(d);
|
||||
}
|
||||
|
||||
protected override void OnTargetFinish(Mobile from)
|
||||
{
|
||||
m_Owner.FinishSequence();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@ using Server.Targeting;
|
|||
|
||||
namespace Server.Spells.Seventh
|
||||
{
|
||||
public class FlameStrikeSpell : MagerySpell
|
||||
public class FlameStrikeSpell : MagerySpell, ISpellTargetingMobile
|
||||
{
|
||||
private static SpellInfo m_Info = new SpellInfo(
|
||||
"Flame Strike", "Kal Vas Flam",
|
||||
|
|
@ -22,15 +22,16 @@ namespace Server.Spells.Seventh
|
|||
|
||||
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 (m == null)
|
||||
return;
|
||||
|
||||
if (!Caster.CanSee(m))
|
||||
{
|
||||
Caster.SendLocalizedMessage(500237); // Target can not be seen.
|
||||
}
|
||||
else if (CheckHSequence(m))
|
||||
{
|
||||
SpellHelper.Turn(Caster, m);
|
||||
|
|
@ -65,26 +66,5 @@ namespace Server.Spells.Seventh
|
|||
|
||||
FinishSequence();
|
||||
}
|
||||
|
||||
private class InternalTarget : Target
|
||||
{
|
||||
private FlameStrikeSpell m_Owner;
|
||||
|
||||
public InternalTarget(FlameStrikeSpell 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);
|
||||
}
|
||||
|
||||
protected override void OnTargetFinish(Mobile from)
|
||||
{
|
||||
m_Owner.FinishSequence();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -4,12 +4,10 @@ using Server.Factions;
|
|||
using Server.Items;
|
||||
using Server.Misc;
|
||||
using Server.Mobiles;
|
||||
using Server.Network;
|
||||
using Server.Targeting;
|
||||
|
||||
namespace Server.Spells.Seventh
|
||||
{
|
||||
public class GateTravelSpell : MagerySpell
|
||||
public class GateTravelSpell : MagerySpell, IRecallSpell
|
||||
{
|
||||
private static SpellInfo m_Info = new SpellInfo(
|
||||
"Gate Travel", "Vas Rel Por",
|
||||
|
|
@ -32,7 +30,7 @@ namespace Server.Spells.Seventh
|
|||
public override void OnCast()
|
||||
{
|
||||
if (m_Entry == null)
|
||||
Caster.Target = new InternalTarget(this);
|
||||
Caster.Target = new RecallSpellTarget(this, false);
|
||||
else
|
||||
Effect(m_Entry.Location, m_Entry.Map, true);
|
||||
}
|
||||
|
|
@ -182,64 +180,5 @@ namespace Server.Spells.Seventh
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
private class InternalTarget : Target
|
||||
{
|
||||
private GateTravelSpell m_Owner;
|
||||
|
||||
public InternalTarget(GateTravelSpell owner) : base(12, false, TargetFlags.None)
|
||||
{
|
||||
m_Owner = owner;
|
||||
|
||||
owner.Caster.LocalOverheadMessage(MessageType.Regular, 0x3B2, 501029); // Select Marked item.
|
||||
}
|
||||
|
||||
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(501803); // 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)o).KeyValue != 0 && ((Key)o).Link is BaseBoat )
|
||||
{
|
||||
BaseBoat boat = ((Key)o).Link as BaseBoat;
|
||||
|
||||
if ( !boat.Deleted && boat.CheckKey( ((Key)o).KeyValue ) )
|
||||
m_Owner.Effect( boat.GetMarkedLocation(), boat.Map, false );
|
||||
else
|
||||
from.Send( new MessageLocalized( from.Serial, from.Body, MessageType.Regular, 0x3B2, 3, 501030, from.Name, "" ) ); // I can not gate travel 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, 501030, from.Name,
|
||||
"")); // I can not gate travel from that object.
|
||||
}
|
||||
}
|
||||
|
||||
protected override void OnNonlocalTarget(Mobile from, object o)
|
||||
{
|
||||
}
|
||||
|
||||
protected override void OnTargetFinish(Mobile from)
|
||||
{
|
||||
m_Owner.FinishSequence();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@ using Server.Targeting;
|
|||
|
||||
namespace Server.Spells.Seventh
|
||||
{
|
||||
public class ManaVampireSpell : MagerySpell
|
||||
public class ManaVampireSpell : MagerySpell, ISpellTargetingMobile
|
||||
{
|
||||
private static SpellInfo m_Info = new SpellInfo(
|
||||
"Mana Vampire", "Ort Sanct",
|
||||
|
|
@ -22,15 +22,16 @@ namespace Server.Spells.Seventh
|
|||
|
||||
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 (m == null)
|
||||
return;
|
||||
|
||||
if (!Caster.CanSee(m))
|
||||
{
|
||||
Caster.SendLocalizedMessage(500237); // Target can not be seen.
|
||||
}
|
||||
else if (CheckHSequence(m))
|
||||
{
|
||||
SpellHelper.Turn(Caster, m);
|
||||
|
|
@ -92,25 +93,5 @@ namespace Server.Spells.Seventh
|
|||
{
|
||||
return 98.0;
|
||||
}
|
||||
|
||||
private class InternalTarget : Target
|
||||
{
|
||||
private ManaVampireSpell m_Owner;
|
||||
|
||||
public InternalTarget(ManaVampireSpell 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);
|
||||
}
|
||||
|
||||
protected override void OnTargetFinish(Mobile from)
|
||||
{
|
||||
m_Owner.FinishSequence();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,12 +1,10 @@
|
|||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using Server.Items;
|
||||
using Server.Mobiles;
|
||||
using Server.Targeting;
|
||||
|
||||
namespace Server.Spells.Seventh
|
||||
{
|
||||
public class MassDispelSpell : MagerySpell
|
||||
public class MassDispelSpell : MagerySpell, ISpellTargetingPoint3D
|
||||
{
|
||||
private static SpellInfo m_Info = new SpellInfo(
|
||||
"Mass Dispel", "Vas An Ort",
|
||||
|
|
@ -26,7 +24,7 @@ namespace Server.Spells.Seventh
|
|||
|
||||
public override void OnCast()
|
||||
{
|
||||
Caster.Target = new InternalTarget(this);
|
||||
Caster.Target = new SpellTargetPoint3D(this, TargetFlags.None, Core.ML ? 10 : 12);
|
||||
}
|
||||
|
||||
public void Target(IPoint3D p)
|
||||
|
|
@ -77,26 +75,5 @@ namespace Server.Spells.Seventh
|
|||
|
||||
FinishSequence();
|
||||
}
|
||||
|
||||
private class InternalTarget : Target
|
||||
{
|
||||
private MassDispelSpell m_Owner;
|
||||
|
||||
public InternalTarget(MassDispelSpell owner) : base(Core.ML ? 10 : 12, true, TargetFlags.None)
|
||||
{
|
||||
m_Owner = owner;
|
||||
}
|
||||
|
||||
protected override void OnTarget(Mobile from, object o)
|
||||
{
|
||||
if (o is IPoint3D p)
|
||||
m_Owner.Target(p);
|
||||
}
|
||||
|
||||
protected override void OnTargetFinish(Mobile from)
|
||||
{
|
||||
m_Owner.FinishSequence();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@ using Server.Targeting;
|
|||
|
||||
namespace Server.Spells.Seventh
|
||||
{
|
||||
public class MeteorSwarmSpell : MagerySpell
|
||||
public class MeteorSwarmSpell : MagerySpell, ISpellTargetingPoint3D
|
||||
{
|
||||
private static SpellInfo m_Info = new SpellInfo(
|
||||
"Meteor Swarm", "Flam Kal Des Ylem",
|
||||
|
|
@ -27,7 +27,7 @@ namespace Server.Spells.Seventh
|
|||
|
||||
public override void OnCast()
|
||||
{
|
||||
Caster.Target = new InternalTarget(this);
|
||||
Caster.Target = new SpellTargetPoint3D(this, TargetFlags.None, Core.ML ? 10 : 12);
|
||||
}
|
||||
|
||||
public void Target(IPoint3D p)
|
||||
|
|
@ -110,26 +110,5 @@ namespace Server.Spells.Seventh
|
|||
|
||||
FinishSequence();
|
||||
}
|
||||
|
||||
private class InternalTarget : Target
|
||||
{
|
||||
private MeteorSwarmSpell m_Owner;
|
||||
|
||||
public InternalTarget(MeteorSwarmSpell owner) : base(Core.ML ? 10 : 12, true, TargetFlags.None)
|
||||
{
|
||||
m_Owner = owner;
|
||||
}
|
||||
|
||||
protected override void OnTarget(Mobile from, object o)
|
||||
{
|
||||
if (o is IPoint3D p)
|
||||
m_Owner.Target(p);
|
||||
}
|
||||
|
||||
protected override void OnTargetFinish(Mobile from)
|
||||
{
|
||||
m_Owner.FinishSequence();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -166,7 +166,7 @@ namespace Server.Spells.Seventh
|
|||
if (!m_Timers.TryGetValue(m, out InternalTimer timer))
|
||||
return;
|
||||
|
||||
timer.Stop();
|
||||
timer?.Stop();
|
||||
m_Timers.Remove(m);
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue