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
|
|
@ -7,7 +7,7 @@ using Server.Mobiles;
|
|||
|
||||
namespace Server.Spells.Necromancy;
|
||||
|
||||
public class AnimateDeadSpell : NecromancerSpell, ISpellTargetingItem
|
||||
public class AnimateDeadSpell : NecromancerSpell, ITargetingSpell<Item>
|
||||
{
|
||||
private static readonly SpellInfo _info = new(
|
||||
"Animate Dead",
|
||||
|
|
@ -190,7 +190,7 @@ public class AnimateDeadSpell : NecromancerSpell, ISpellTargetingItem
|
|||
|
||||
public override void OnCast()
|
||||
{
|
||||
Caster.Target = new SpellTargetItem(this, range: Core.ML ? 10 : 12);
|
||||
Caster.Target = new SpellTarget<Item>(this);
|
||||
Caster.SendLocalizedMessage(1061083); // Animate what corpse?
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@ using Server.Targeting;
|
|||
|
||||
namespace Server.Spells.Necromancy;
|
||||
|
||||
public class BloodOathSpell : NecromancerSpell, ISpellTargetingMobile
|
||||
public class BloodOathSpell : NecromancerSpell, ITargetingSpell<Mobile>
|
||||
{
|
||||
private static readonly SpellInfo _info = new(
|
||||
"Blood Oath",
|
||||
|
|
@ -96,7 +96,7 @@ public class BloodOathSpell : NecromancerSpell, ISpellTargetingMobile
|
|||
|
||||
public override void OnCast()
|
||||
{
|
||||
Caster.Target = new SpellTargetMobile(this, TargetFlags.Harmful, Core.ML ? 10 : 12);
|
||||
Caster.Target = new SpellTarget<Mobile>(this, TargetFlags.Harmful);
|
||||
}
|
||||
|
||||
public static bool RemoveCurse(Mobile target)
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@ using Server.Targeting;
|
|||
|
||||
namespace Server.Spells.Necromancy;
|
||||
|
||||
public class CorpseSkinSpell : NecromancerSpell, ISpellTargetingMobile
|
||||
public class CorpseSkinSpell : NecromancerSpell, ITargetingSpell<Mobile>
|
||||
{
|
||||
private static readonly SpellInfo _info = new(
|
||||
"Corpse Skin",
|
||||
|
|
@ -95,7 +95,7 @@ public class CorpseSkinSpell : NecromancerSpell, ISpellTargetingMobile
|
|||
|
||||
public override void OnCast()
|
||||
{
|
||||
Caster.Target = new SpellTargetMobile(this, TargetFlags.Harmful, Core.ML ? 10 : 12);
|
||||
Caster.Target = new SpellTarget<Mobile>(this, TargetFlags.Harmful);
|
||||
}
|
||||
|
||||
public static bool RemoveCurse(Mobile m)
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@ using Server.Targeting;
|
|||
|
||||
namespace Server.Spells.Necromancy;
|
||||
|
||||
public class EvilOmenSpell : NecromancerSpell, ISpellTargetingMobile
|
||||
public class EvilOmenSpell : NecromancerSpell, ITargetingSpell<Mobile>
|
||||
{
|
||||
private static readonly SpellInfo _info = new(
|
||||
"Evil Omen",
|
||||
|
|
@ -70,7 +70,7 @@ public class EvilOmenSpell : NecromancerSpell, ISpellTargetingMobile
|
|||
|
||||
public override void OnCast()
|
||||
{
|
||||
Caster.Target = new SpellTargetMobile(this, TargetFlags.Harmful, Core.ML ? 10 : 12);
|
||||
Caster.Target = new SpellTarget<Mobile>(this, TargetFlags.Harmful);
|
||||
}
|
||||
|
||||
public static bool EndEffect(Mobile m)
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@ using Server.Targeting;
|
|||
|
||||
namespace Server.Spells.Necromancy;
|
||||
|
||||
public class MindRotSpell : NecromancerSpell, ISpellTargetingMobile
|
||||
public class MindRotSpell : NecromancerSpell, ITargetingSpell<Mobile>
|
||||
{
|
||||
private static readonly SpellInfo _info = new(
|
||||
"Mind Rot",
|
||||
|
|
@ -63,7 +63,7 @@ public class MindRotSpell : NecromancerSpell, ISpellTargetingMobile
|
|||
|
||||
public override void OnCast()
|
||||
{
|
||||
Caster.Target = new SpellTargetMobile(this, TargetFlags.Harmful, Core.ML ? 10 : 12);
|
||||
Caster.Target = new SpellTarget<Mobile>(this, TargetFlags.Harmful);
|
||||
}
|
||||
|
||||
public static bool ClearMindRotScalar(Mobile m)
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@ using Server.Targeting;
|
|||
|
||||
namespace Server.Spells.Necromancy;
|
||||
|
||||
public class PainSpikeSpell : NecromancerSpell, ISpellTargetingMobile
|
||||
public class PainSpikeSpell : NecromancerSpell, ITargetingSpell<Mobile>
|
||||
{
|
||||
private static readonly SpellInfo _info = new(
|
||||
"Pain Spike",
|
||||
|
|
@ -85,7 +85,7 @@ public class PainSpikeSpell : NecromancerSpell, ISpellTargetingMobile
|
|||
|
||||
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
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@ using Server.Targeting;
|
|||
|
||||
namespace Server.Spells.Necromancy;
|
||||
|
||||
public class PoisonStrikeSpell : NecromancerSpell, ISpellTargetingMobile
|
||||
public class PoisonStrikeSpell : NecromancerSpell, ITargetingSpell<Mobile>
|
||||
{
|
||||
private static readonly SpellInfo _info = new(
|
||||
"Poison Strike",
|
||||
|
|
@ -146,6 +146,6 @@ public class PoisonStrikeSpell : NecromancerSpell, ISpellTargetingMobile
|
|||
|
||||
public override void OnCast()
|
||||
{
|
||||
Caster.Target = new SpellTargetMobile(this, TargetFlags.Harmful, Core.ML ? 10 : 12);
|
||||
Caster.Target = new SpellTarget<Mobile>(this, TargetFlags.Harmful);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@ using Server.Targeting;
|
|||
|
||||
namespace Server.Spells.Necromancy;
|
||||
|
||||
public class StrangleSpell : NecromancerSpell, ISpellTargetingMobile
|
||||
public class StrangleSpell : NecromancerSpell, ITargetingSpell<Mobile>
|
||||
{
|
||||
private static readonly SpellInfo _info = new(
|
||||
"Strangle",
|
||||
|
|
@ -111,7 +111,7 @@ public class StrangleSpell : NecromancerSpell, ISpellTargetingMobile
|
|||
|
||||
public override void OnCast()
|
||||
{
|
||||
Caster.Target = new SpellTargetMobile(this, TargetFlags.Harmful, Core.ML ? 10 : 12);
|
||||
Caster.Target = new SpellTarget<Mobile>(this, TargetFlags.Harmful);
|
||||
}
|
||||
|
||||
public static bool RemoveCurse(Mobile m)
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@ using Server.Targeting;
|
|||
|
||||
namespace Server.Spells.Necromancy;
|
||||
|
||||
public class VengefulSpiritSpell : NecromancerSpell, ISpellTargetingMobile
|
||||
public class VengefulSpiritSpell : NecromancerSpell, ITargetingSpell<Mobile>
|
||||
{
|
||||
private static readonly SpellInfo _info = new(
|
||||
"Vengeful Spirit",
|
||||
|
|
@ -66,7 +66,7 @@ public class VengefulSpiritSpell : NecromancerSpell, ISpellTargetingMobile
|
|||
|
||||
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 bool CheckCast()
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue