fix: Magic NPCs now use spell range (#1870)
### Summary - Drastically streamlines the spell targeting by collapsing the target classes into a single `SpellTarget<T>` class. - Moves TargetRange to the spell itself so it can be used by MageAI. - Changes range check in MageAI to use TargetRange. This should fix target acquisition bugs
This commit is contained in:
parent
91e37fb8d4
commit
9b7fea2c20
85 changed files with 255 additions and 313 deletions
|
|
@ -4,7 +4,7 @@ using Server.Targeting;
|
|||
|
||||
namespace Server.Spells.Sixth
|
||||
{
|
||||
public class DispelSpell : MagerySpell, ISpellTargetingMobile
|
||||
public class DispelSpell : MagerySpell, ITargetingSpell<Mobile>
|
||||
{
|
||||
private static readonly SpellInfo _info = new(
|
||||
"Dispel",
|
||||
|
|
@ -58,7 +58,7 @@ namespace Server.Spells.Sixth
|
|||
|
||||
public override void OnCast()
|
||||
{
|
||||
Caster.Target = new SpellTargetMobile(this, TargetFlags.Harmful, Core.ML ? 10 : 12);
|
||||
Caster.Target = new SpellTarget<Mobile>(this, TargetFlags.Harmful);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@ using Server.Targeting;
|
|||
|
||||
namespace Server.Spells.Sixth
|
||||
{
|
||||
public class EnergyBoltSpell : MagerySpell, ISpellTargetingMobile
|
||||
public class EnergyBoltSpell : MagerySpell, ITargetingSpell<Mobile>
|
||||
{
|
||||
private static readonly SpellInfo _info = new(
|
||||
"Energy Bolt",
|
||||
|
|
@ -63,7 +63,7 @@ namespace Server.Spells.Sixth
|
|||
|
||||
public override void OnCast()
|
||||
{
|
||||
Caster.Target = new SpellTargetMobile(this, TargetFlags.Harmful, Core.ML ? 10 : 12);
|
||||
Caster.Target = new SpellTarget<Mobile>(this, TargetFlags.Harmful);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@ using Server.Targeting;
|
|||
|
||||
namespace Server.Spells.Sixth
|
||||
{
|
||||
public class ExplosionSpell : MagerySpell, ISpellTargetingMobile
|
||||
public class ExplosionSpell : MagerySpell, ITargetingSpell<Mobile>
|
||||
{
|
||||
private static readonly SpellInfo _info = new(
|
||||
"Explosion",
|
||||
|
|
@ -45,7 +45,7 @@ namespace Server.Spells.Sixth
|
|||
|
||||
public override void OnCast()
|
||||
{
|
||||
Caster.Target = new SpellTargetMobile(this, TargetFlags.Harmful, Core.ML ? 10 : 12);
|
||||
Caster.Target = new SpellTarget<Mobile>(this, TargetFlags.Harmful);
|
||||
}
|
||||
|
||||
private class InternalTimer : Timer
|
||||
|
|
|
|||
|
|
@ -7,7 +7,7 @@ using Server.Targeting;
|
|||
|
||||
namespace Server.Spells.Sixth
|
||||
{
|
||||
public class InvisibilitySpell : MagerySpell, ISpellTargetingMobile
|
||||
public class InvisibilitySpell : MagerySpell, ITargetingSpell<Mobile>
|
||||
{
|
||||
private static readonly SpellInfo _info = new(
|
||||
"Invisibility",
|
||||
|
|
@ -82,7 +82,7 @@ namespace Server.Spells.Sixth
|
|||
|
||||
public override void OnCast()
|
||||
{
|
||||
Caster.Target = new SpellTargetMobile(this, TargetFlags.Beneficial, Core.ML ? 10 : 12);
|
||||
Caster.Target = new SpellTarget<Mobile>(this, TargetFlags.Beneficial);
|
||||
}
|
||||
|
||||
public static bool HasTimer(Mobile m) => _table.ContainsKey(m);
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@ using Server.Network;
|
|||
|
||||
namespace Server.Spells.Sixth
|
||||
{
|
||||
public class MarkSpell : MagerySpell, ISpellTargetingItem
|
||||
public class MarkSpell : MagerySpell, ITargetingSpell<Item>
|
||||
{
|
||||
private static readonly SpellInfo _info = new(
|
||||
"Mark",
|
||||
|
|
@ -59,7 +59,7 @@ namespace Server.Spells.Sixth
|
|||
|
||||
public override void OnCast()
|
||||
{
|
||||
Caster.Target = new SpellTargetItem(this, range: Core.ML ? 10 : 12);
|
||||
Caster.Target = new SpellTarget<Item>(this);
|
||||
}
|
||||
|
||||
public override bool CheckCast()
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
namespace Server.Spells.Sixth
|
||||
{
|
||||
public class MassCurseSpell : MagerySpell, ISpellTargetingPoint3D
|
||||
public class MassCurseSpell : MagerySpell, ITargetingSpell<IPoint3D>
|
||||
{
|
||||
private static readonly SpellInfo _info = new(
|
||||
"Mass Curse",
|
||||
|
|
@ -58,7 +58,7 @@ namespace Server.Spells.Sixth
|
|||
|
||||
public override void OnCast()
|
||||
{
|
||||
Caster.Target = new SpellTargetPoint3D(this, range: Core.ML ? 10 : 12);
|
||||
Caster.Target = new SpellTarget<IPoint3D>(this);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@ using Server.Mobiles;
|
|||
|
||||
namespace Server.Spells.Sixth;
|
||||
|
||||
public class ParalyzeFieldSpell : MagerySpell, ISpellTargetingPoint3D
|
||||
public class ParalyzeFieldSpell : MagerySpell, ITargetingSpell<IPoint3D>
|
||||
{
|
||||
private static readonly SpellInfo _info = new(
|
||||
"Paralyze Field",
|
||||
|
|
@ -71,7 +71,7 @@ public class ParalyzeFieldSpell : MagerySpell, ISpellTargetingPoint3D
|
|||
|
||||
public override void OnCast()
|
||||
{
|
||||
Caster.Target = new SpellTargetPoint3D(this, range: Core.ML ? 10 : 12);
|
||||
Caster.Target = new SpellTarget<IPoint3D>(this);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@ using Server.Mobiles;
|
|||
|
||||
namespace Server.Spells.Sixth
|
||||
{
|
||||
public class RevealSpell : MagerySpell, ISpellTargetingPoint3D
|
||||
public class RevealSpell : MagerySpell, ITargetingSpell<IPoint3D>
|
||||
{
|
||||
private static readonly SpellInfo _info = new(
|
||||
"Reveal",
|
||||
|
|
@ -55,7 +55,7 @@ namespace Server.Spells.Sixth
|
|||
|
||||
public override void OnCast()
|
||||
{
|
||||
Caster.Target = new SpellTargetPoint3D(this, range: Core.ML ? 10 : 12);
|
||||
Caster.Target = new SpellTarget<IPoint3D>(this);
|
||||
}
|
||||
|
||||
// Reveal uses magery and detect hidden vs. hide and stealth
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue