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

@ -6,7 +6,7 @@ using Server.Targeting;
namespace Server.Spells.Spellweaving
{
public class GiftOfLifeSpell : ArcanistSpell, ISpellTargetingMobile
public class GiftOfLifeSpell : ArcanistSpell, ITargetingSpell<Mobile>
{
private static readonly SpellInfo _info = new(
"Gift of Life",
@ -77,7 +77,7 @@ namespace Server.Spells.Spellweaving
public override void OnCast()
{
Caster.Target = new SpellTargetMobile(this, TargetFlags.Beneficial, 10);
Caster.Target = new SpellTarget<Mobile>(this, TargetFlags.Beneficial);
}
public static void HandleDeath(Mobile m)

View file

@ -4,7 +4,7 @@ using Server.Targeting;
namespace Server.Spells.Spellweaving
{
public class GiftOfRenewalSpell : ArcanistSpell, ISpellTargetingMobile
public class GiftOfRenewalSpell : ArcanistSpell, ITargetingSpell<Mobile>
{
private static readonly SpellInfo _info = new(
"Gift of Renewal",
@ -69,7 +69,7 @@ namespace Server.Spells.Spellweaving
public override void OnCast()
{
Caster.Target = new SpellTargetMobile(this, TargetFlags.Beneficial, 10);
Caster.Target = new SpellTarget<Mobile>(this, TargetFlags.Beneficial);
}
public static bool StopEffect(Mobile m)

View file

@ -1,11 +1,10 @@
using System;
using Server.Mobiles;
using Server.Regions;
using Server.Targeting;
namespace Server.Spells.Spellweaving
{
public class NatureFurySpell : ArcanistSpell, ISpellTargetingPoint3D
public class NatureFurySpell : ArcanistSpell, ITargetingSpell<IPoint3D>
{
private static readonly SpellInfo _info = new(
"Nature's Fury",
@ -71,7 +70,7 @@ namespace Server.Spells.Spellweaving
public override void OnCast()
{
Caster.Target = new SpellTargetPoint3D(this, TargetFlags.None, 10);
Caster.Target = new SpellTarget<IPoint3D>(this);
}
private class InternalTimer : Timer

View file

@ -3,7 +3,7 @@ using Server.Targeting;
namespace Server.Spells.Spellweaving
{
public class WordOfDeathSpell : ArcanistSpell, ISpellTargetingMobile
public class WordOfDeathSpell : ArcanistSpell, ITargetingSpell<Mobile>
{
private static readonly SpellInfo _info = new("Word of Death", "Nyraxle", -1);
@ -72,7 +72,7 @@ namespace Server.Spells.Spellweaving
public override void OnCast()
{
Caster.Target = new SpellTargetMobile(this, TargetFlags.Harmful, 10);
Caster.Target = new SpellTarget<Mobile>(this, TargetFlags.Harmful);
}
}
}