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:
Kamron Batman 2024-08-08 07:05:27 -07:00 • committed by GitHub
parent 91e37fb8d4
commit 9b7fea2c20
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
85 changed files with 255 additions and 313 deletions

View file

@ -2,7 +2,7 @@ using Server.Collections;
namespace Server.Spells.Seventh
{
public class ChainLightningSpell : MagerySpell, ISpellTargetingPoint3D
public class ChainLightningSpell : MagerySpell, ITargetingSpell<IPoint3D>
{
private static readonly SpellInfo _info = new(
"Chain Lightning",
@ -99,7 +99,7 @@ namespace Server.Spells.Seventh
public override void OnCast()
{
Caster.Target = new SpellTargetPoint3D(this, range: Core.ML ? 10 : 12);
Caster.Target = new SpellTarget<IPoint3D>(this);
}
}
}

View file

@ -6,7 +6,7 @@ using Server.Mobiles;
namespace Server.Spells.Seventh;
public class EnergyFieldSpell : MagerySpell, ISpellTargetingPoint3D
public class EnergyFieldSpell : MagerySpell, ITargetingSpell<IPoint3D>
{
private static readonly SpellInfo _info = new(
"Energy Field",
@ -71,7 +71,7 @@ public class EnergyFieldSpell : MagerySpell, ISpellTargetingPoint3D
public override void OnCast()
{
Caster.Target = new SpellTargetPoint3D(this, range: Core.ML ? 10 : 12);
Caster.Target = new SpellTarget<IPoint3D>(this);
}
}

View file

@ -2,7 +2,7 @@ using Server.Targeting;
namespace Server.Spells.Seventh
{
public class FlameStrikeSpell : MagerySpell, ISpellTargetingMobile
public class FlameStrikeSpell : MagerySpell, ITargetingSpell<Mobile>
{
private static readonly SpellInfo _info = new(
"Flame Strike",
@ -58,7 +58,7 @@ namespace Server.Spells.Seventh
public override void OnCast()
{
Caster.Target = new SpellTargetMobile(this, TargetFlags.Harmful, Core.ML ? 10 : 12);
Caster.Target = new SpellTarget<Mobile>(this, TargetFlags.Harmful);
}
}
}

View file

@ -3,7 +3,7 @@ using Server.Targeting;
namespace Server.Spells.Seventh
{
public class ManaVampireSpell : MagerySpell, ISpellTargetingMobile
public class ManaVampireSpell : MagerySpell, ITargetingSpell<Mobile>
{
private static readonly SpellInfo _info = new(
"Mana Vampire",
@ -79,7 +79,7 @@ namespace Server.Spells.Seventh
public override void OnCast()
{
Caster.Target = new SpellTargetMobile(this, TargetFlags.Harmful, Core.ML ? 10 : 12);
Caster.Target = new SpellTarget<Mobile>(this, TargetFlags.Harmful);
}
public override double GetResistPercent(Mobile target) => 98.0;

View file

@ -4,7 +4,7 @@ using Server.Mobiles;
namespace Server.Spells.Seventh
{
public class MassDispelSpell : MagerySpell, ISpellTargetingPoint3D
public class MassDispelSpell : MagerySpell, ITargetingSpell<IPoint3D>
{
private static readonly SpellInfo _info = new(
"Mass Dispel",
@ -76,7 +76,7 @@ namespace Server.Spells.Seventh
public override void OnCast()
{
Caster.Target = new SpellTargetPoint3D(this, range: Core.ML ? 10 : 12);
Caster.Target = new SpellTarget<IPoint3D>(this);
}
}
}

View file

@ -2,7 +2,7 @@ using Server.Collections;
namespace Server.Spells.Seventh
{
public class MeteorSwarmSpell : MagerySpell, ISpellTargetingPoint3D
public class MeteorSwarmSpell : MagerySpell, ITargetingSpell<IPoint3D>
{
private static readonly SpellInfo _info = new(
"Meteor Swarm",
@ -104,7 +104,7 @@ namespace Server.Spells.Seventh
public override void OnCast()
{
Caster.Target = new SpellTargetPoint3D(this, range: Core.ML ? 10 : 12);
Caster.Target = new SpellTarget<IPoint3D>(this);
}
}
}