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
|
|
@ -487,7 +487,7 @@ namespace Server.Factions
|
|||
{
|
||||
targ.Invoke(m_Guard, toHarm);
|
||||
}
|
||||
else if ((targ as ISpellTarget)?.Spell is DispelSpell)
|
||||
else if ((targ as ISpellTarget<Mobile>)?.Spell is DispelSpell)
|
||||
{
|
||||
targ.Cancel(m_Guard, TargetCancelType.Canceled);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -31,7 +31,7 @@ public class HealerAI : BaseAI
|
|||
|
||||
if (targ != null)
|
||||
{
|
||||
var spellTarg = targ as ISpellTarget;
|
||||
var spellTarg = targ as ISpellTarget<Mobile>;
|
||||
|
||||
if (spellTarg?.Spell is CureSpell)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -777,7 +777,7 @@ public class MageAI : BaseAI
|
|||
m_Mobile.DebugSay("I used my abilities!");
|
||||
}
|
||||
}
|
||||
else if (m_Mobile.Spell == null && Core.TickCount - m_NextCastTime >= 0 && m_Mobile.InRange(c, Core.ML ? 10 : 12))
|
||||
else if (m_Mobile.Spell == null && Core.TickCount - m_NextCastTime >= 0)
|
||||
{
|
||||
// We are ready to cast a spell
|
||||
Spell spell;
|
||||
|
|
@ -816,24 +816,30 @@ public class MageAI : BaseAI
|
|||
};
|
||||
|
||||
// Now we have a spell picked
|
||||
// Move first before casting
|
||||
var range = (spell as IRangedSpell)?.TargetRange ?? m_Mobile.RangePerception;
|
||||
|
||||
// Move first before casting
|
||||
if (!SmartAI || toDispel == null)
|
||||
{
|
||||
RunTo(c);
|
||||
}
|
||||
else if (m_Mobile.InRange(toDispel, 10))
|
||||
else if (m_Mobile.InRange(toDispel, Math.Min(10, range)))
|
||||
{
|
||||
RunFrom(toDispel);
|
||||
}
|
||||
else if (!m_Mobile.InRange(toDispel, Core.ML ? 10 : 12))
|
||||
else if (!m_Mobile.InRange(toDispel, range))
|
||||
{
|
||||
RunTo(toDispel);
|
||||
}
|
||||
|
||||
spell?.Cast();
|
||||
// After running, make sure we are still in range
|
||||
if (spell == null || m_Mobile.InRange(c, range))
|
||||
{
|
||||
spell?.Cast();
|
||||
|
||||
m_NextCastTime = Core.TickCount + (int)GetDelay(spell).TotalMilliseconds;
|
||||
// Even if we don't have a spell, delay the next potential cast
|
||||
m_NextCastTime = Core.TickCount + (int)GetDelay(spell).TotalMilliseconds;
|
||||
}
|
||||
}
|
||||
else if (m_Mobile.Spell?.IsCasting != true)
|
||||
{
|
||||
|
|
@ -857,7 +863,7 @@ public class MageAI : BaseAI
|
|||
{
|
||||
var map = m_Mobile.Map;
|
||||
|
||||
if (map == null || !m_Mobile.InRange(m_LastTargetLoc, Core.ML ? 10 : 12))
|
||||
if (map == null || !m_Mobile.InRange(m_LastTargetLoc, m_Mobile.RangePerception))
|
||||
{
|
||||
m_LastTarget = null;
|
||||
}
|
||||
|
|
@ -967,7 +973,7 @@ public class MageAI : BaseAI
|
|||
var comb = m_Mobile.Combatant;
|
||||
|
||||
if (comb?.Deleted == false && comb.Alive && !comb.IsDeadBondedPet &&
|
||||
m_Mobile.InRange(comb, Core.ML ? 10 : 12) && CanDispel(comb))
|
||||
m_Mobile.InRange(comb, m_Mobile.RangePerception) && CanDispel(comb))
|
||||
{
|
||||
active = comb;
|
||||
activePrio = m_Mobile.GetDistanceToSqrt(comb);
|
||||
|
|
@ -983,7 +989,7 @@ public class MageAI : BaseAI
|
|||
var info = aggressed[i];
|
||||
var m = info.Defender;
|
||||
|
||||
if (m != comb && m.Combatant == m_Mobile && m_Mobile.InRange(m, Core.ML ? 10 : 12) && CanDispel(m))
|
||||
if (m != comb && m.Combatant == m_Mobile && m_Mobile.InRange(m, m_Mobile.RangePerception) && CanDispel(m))
|
||||
{
|
||||
var prio = m_Mobile.GetDistanceToSqrt(m);
|
||||
|
||||
|
|
@ -1005,7 +1011,7 @@ public class MageAI : BaseAI
|
|||
var info = aggressors[i];
|
||||
var m = info.Attacker;
|
||||
|
||||
if (m != comb && m.Combatant == m_Mobile && m_Mobile.InRange(m, Core.ML ? 10 : 12) && CanDispel(m))
|
||||
if (m != comb && m.Combatant == m_Mobile && m_Mobile.InRange(m, m_Mobile.RangePerception) && CanDispel(m))
|
||||
{
|
||||
var prio = m_Mobile.GetDistanceToSqrt(m);
|
||||
|
||||
|
|
@ -1040,7 +1046,7 @@ public class MageAI : BaseAI
|
|||
actPrio = inactPrio = m_Mobile.GetDistanceToSqrt(comb);
|
||||
}
|
||||
|
||||
foreach (var m in m_Mobile.GetMobilesInRange(Core.ML ? 10 : 12))
|
||||
foreach (var m in m_Mobile.GetMobilesInRange(m_Mobile.RangePerception))
|
||||
{
|
||||
if (m != m_Mobile && CanDispel(m))
|
||||
{
|
||||
|
|
@ -1079,7 +1085,7 @@ public class MageAI : BaseAI
|
|||
return false;
|
||||
}
|
||||
|
||||
var spellTarg = targ as ISpellTarget;
|
||||
var spellTarg = targ as ISpellTarget<Mobile>;
|
||||
|
||||
var isReveal = spellTarg?.Spell is RevealSpell;
|
||||
var isDispel = spellTarg?.Spell is DispelSpell;
|
||||
|
|
|
|||
|
|
@ -181,7 +181,6 @@ namespace Server.Mobiles
|
|||
public const int MaxOwners = 5;
|
||||
|
||||
public const int DefaultRangePerception = 16;
|
||||
public const int OldRangePerception = 10;
|
||||
|
||||
private const double ChanceToRummage = 0.5; // 50%
|
||||
|
||||
|
|
@ -350,15 +349,10 @@ namespace Server.Mobiles
|
|||
public BaseCreature(
|
||||
AIType ai,
|
||||
FightMode mode = FightMode.Closest,
|
||||
int iRangePerception = 10,
|
||||
int iRangePerception = DefaultRangePerception,
|
||||
int iRangeFight = 1
|
||||
)
|
||||
{
|
||||
if (iRangePerception == OldRangePerception)
|
||||
{
|
||||
iRangePerception = DefaultRangePerception;
|
||||
}
|
||||
|
||||
m_Loyalty = MaxLoyalty; // Wonderfully Happy
|
||||
|
||||
m_CurrentAI = ai;
|
||||
|
|
@ -1980,11 +1974,6 @@ namespace Server.Mobiles
|
|||
_passiveSpeed = reader.ReadDouble();
|
||||
_currentSpeed = reader.ReadDouble();
|
||||
|
||||
if (RangePerception == OldRangePerception)
|
||||
{
|
||||
RangePerception = DefaultRangePerception;
|
||||
}
|
||||
|
||||
m_Home.X = reader.ReadInt();
|
||||
m_Home.Y = reader.ReadInt();
|
||||
m_Home.Z = reader.ReadInt();
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@ using Server.Targeting;
|
|||
|
||||
namespace Server.Spells.Chivalry
|
||||
{
|
||||
public class CleanseByFireSpell : PaladinSpell, ISpellTargetingMobile
|
||||
public class CleanseByFireSpell : PaladinSpell, ITargetingSpell<Mobile>
|
||||
{
|
||||
private static readonly SpellInfo _info = new(
|
||||
"Cleanse By Fire",
|
||||
|
|
@ -113,7 +113,7 @@ namespace Server.Spells.Chivalry
|
|||
|
||||
public override void OnCast()
|
||||
{
|
||||
Caster.Target = new SpellTargetMobile(this, TargetFlags.Beneficial, Core.ML ? 10 : 12);
|
||||
Caster.Target = new SpellTarget<Mobile>(this, TargetFlags.Beneficial);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@ using Server.Targeting;
|
|||
|
||||
namespace Server.Spells.Chivalry
|
||||
{
|
||||
public class CloseWoundsSpell : PaladinSpell, ISpellTargetingMobile
|
||||
public class CloseWoundsSpell : PaladinSpell, ITargetingSpell<Mobile>
|
||||
{
|
||||
private static readonly SpellInfo _info = new(
|
||||
"Close Wounds",
|
||||
|
|
@ -93,7 +93,7 @@ namespace Server.Spells.Chivalry
|
|||
|
||||
public override void OnCast()
|
||||
{
|
||||
Caster.Target = new SpellTargetMobile(this, TargetFlags.Beneficial);
|
||||
Caster.Target = new SpellTarget<Mobile>(this, TargetFlags.Beneficial);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -8,7 +8,7 @@ using Server.Targeting;
|
|||
|
||||
namespace Server.Spells.Chivalry
|
||||
{
|
||||
public class RemoveCurseSpell : PaladinSpell, ISpellTargetingMobile
|
||||
public class RemoveCurseSpell : PaladinSpell, ITargetingSpell<Mobile>
|
||||
{
|
||||
private static readonly SpellInfo _info = new(
|
||||
"Remove Curse",
|
||||
|
|
@ -139,7 +139,7 @@ namespace Server.Spells.Chivalry
|
|||
|
||||
public override void OnCast()
|
||||
{
|
||||
Caster.Target = new SpellTargetMobile(this, TargetFlags.Beneficial, Core.ML ? 10 : 12);
|
||||
Caster.Target = new SpellTarget<Mobile>(this, TargetFlags.Beneficial);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@ using Server.Mobiles;
|
|||
|
||||
namespace Server.Spells.Eighth
|
||||
{
|
||||
public class EnergyVortexSpell : MagerySpell, ISpellTargetingPoint3D
|
||||
public class EnergyVortexSpell : MagerySpell, ITargetingSpell<IPoint3D>
|
||||
{
|
||||
private static readonly SpellInfo _info = new(
|
||||
"Energy Vortex",
|
||||
|
|
@ -60,7 +60,7 @@ namespace Server.Spells.Eighth
|
|||
|
||||
public override void OnCast()
|
||||
{
|
||||
Caster.Target = new SpellTargetPoint3D(this, retryOnLOS: true);
|
||||
Caster.Target = new SpellTarget<IPoint3D>(this, retryOnLos: true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@ using Server.Targeting;
|
|||
|
||||
namespace Server.Spells.Eighth
|
||||
{
|
||||
public class ResurrectionSpell : MagerySpell, ISpellTargetingMobile
|
||||
public class ResurrectionSpell : MagerySpell, ITargetingSpell<Mobile>
|
||||
{
|
||||
private static readonly SpellInfo _info = new(
|
||||
"Resurrection",
|
||||
|
|
@ -22,6 +22,8 @@ namespace Server.Spells.Eighth
|
|||
|
||||
public override SpellCircle Circle => SpellCircle.Eighth;
|
||||
|
||||
public int TargetRange => 1;
|
||||
|
||||
public void Target(Mobile m)
|
||||
{
|
||||
if (m == Caster)
|
||||
|
|
@ -79,7 +81,7 @@ namespace Server.Spells.Eighth
|
|||
|
||||
public override void OnCast()
|
||||
{
|
||||
Caster.Target = new SpellTargetMobile(this, TargetFlags.Beneficial, 1);
|
||||
Caster.Target = new SpellTarget<Mobile>(this, TargetFlags.Beneficial);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@ using Server.Mobiles;
|
|||
|
||||
namespace Server.Spells.Fifth
|
||||
{
|
||||
public class BladeSpiritsSpell : MagerySpell, ISpellTargetingPoint3D
|
||||
public class BladeSpiritsSpell : MagerySpell, ITargetingSpell<IPoint3D>
|
||||
{
|
||||
private static readonly SpellInfo _info = new(
|
||||
"Blade Spirits",
|
||||
|
|
@ -78,7 +78,7 @@ namespace Server.Spells.Fifth
|
|||
|
||||
public override void OnCast()
|
||||
{
|
||||
Caster.Target = new SpellTargetPoint3D(this, retryOnLOS: true);
|
||||
Caster.Target = new SpellTarget<IPoint3D>(this, retryOnLos: true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@ using Server.Misc;
|
|||
|
||||
namespace Server.Spells.Fifth
|
||||
{
|
||||
public class DispelFieldSpell : MagerySpell, ISpellTargetingItem
|
||||
public class DispelFieldSpell : MagerySpell, ITargetingSpell<Item>
|
||||
{
|
||||
private static readonly SpellInfo _info = new(
|
||||
"Dispel Field",
|
||||
|
|
@ -51,7 +51,7 @@ namespace Server.Spells.Fifth
|
|||
|
||||
public override void OnCast()
|
||||
{
|
||||
Caster.Target = new SpellTargetItem(this, range: Core.ML ? 10 : 12);
|
||||
Caster.Target = new SpellTarget<Item>(this);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@ using Server.Targeting;
|
|||
|
||||
namespace Server.Spells.Fifth
|
||||
{
|
||||
public class MindBlastSpell : MagerySpell, ISpellTargetingMobile
|
||||
public class MindBlastSpell : MagerySpell, ITargetingSpell<Mobile>
|
||||
{
|
||||
private static readonly SpellInfo _info = new(
|
||||
"Mind Blast",
|
||||
|
|
@ -110,7 +110,7 @@ namespace Server.Spells.Fifth
|
|||
|
||||
public override void OnCast()
|
||||
{
|
||||
Caster.Target = new SpellTargetMobile(this, TargetFlags.Harmful, Core.ML ? 10 : 12);
|
||||
Caster.Target = new SpellTarget<Mobile>(this, TargetFlags.Harmful);
|
||||
}
|
||||
|
||||
private void AosDelay_Callback(Mobile caster, Mobile target, Mobile defender, int damage)
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@ using Server.Targeting;
|
|||
|
||||
namespace Server.Spells.Fifth
|
||||
{
|
||||
public class ParalyzeSpell : MagerySpell, ISpellTargetingMobile
|
||||
public class ParalyzeSpell : MagerySpell, ITargetingSpell<Mobile>
|
||||
{
|
||||
private static readonly SpellInfo _info = new(
|
||||
"Paralyze",
|
||||
|
|
@ -82,7 +82,7 @@ namespace Server.Spells.Fifth
|
|||
|
||||
public override void OnCast()
|
||||
{
|
||||
Caster.Target = new SpellTargetMobile(this, TargetFlags.Harmful, Core.ML ? 10 : 12);
|
||||
Caster.Target = new SpellTarget<Mobile>(this, TargetFlags.Harmful);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -7,7 +7,7 @@ using Server.Mobiles;
|
|||
|
||||
namespace Server.Spells.Fifth;
|
||||
|
||||
public class PoisonFieldSpell : MagerySpell, ISpellTargetingPoint3D
|
||||
public class PoisonFieldSpell : MagerySpell, ITargetingSpell<IPoint3D>
|
||||
{
|
||||
private static readonly SpellInfo _info = new(
|
||||
"Poison Field",
|
||||
|
|
@ -57,7 +57,7 @@ public class PoisonFieldSpell : 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.Targeting;
|
|||
|
||||
namespace Server.Spells.First
|
||||
{
|
||||
public class ClumsySpell : MagerySpell, ISpellTargetingMobile
|
||||
public class ClumsySpell : MagerySpell, ITargetingSpell<Mobile>
|
||||
{
|
||||
private static readonly SpellInfo _info = new(
|
||||
"Clumsy",
|
||||
|
|
@ -47,7 +47,7 @@ namespace Server.Spells.First
|
|||
|
||||
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.First
|
||||
{
|
||||
public class FeeblemindSpell : MagerySpell, ISpellTargetingMobile
|
||||
public class FeeblemindSpell : MagerySpell, ITargetingSpell<Mobile>
|
||||
{
|
||||
private static readonly SpellInfo _info = new(
|
||||
"Feeblemind",
|
||||
|
|
@ -49,7 +49,7 @@ namespace Server.Spells.First
|
|||
|
||||
public override void OnCast()
|
||||
{
|
||||
Caster.Target = new SpellTargetMobile(this, TargetFlags.Harmful, Core.ML ? 10 : 12);
|
||||
Caster.Target = new SpellTarget<Mobile>(this, TargetFlags.Harmful);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@ using Server.Targeting;
|
|||
|
||||
namespace Server.Spells.First
|
||||
{
|
||||
public class HealSpell : MagerySpell, ISpellTargetingMobile
|
||||
public class HealSpell : MagerySpell, ITargetingSpell<Mobile>
|
||||
{
|
||||
private static readonly SpellInfo _info = new(
|
||||
"Heal",
|
||||
|
|
@ -84,7 +84,7 @@ namespace Server.Spells.First
|
|||
|
||||
public override void OnCast()
|
||||
{
|
||||
Caster.Target = new SpellTargetMobile(this, TargetFlags.Beneficial, Core.ML ? 10 : 12);
|
||||
Caster.Target = new SpellTarget<Mobile>(this, TargetFlags.Beneficial);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@ using Server.Targeting;
|
|||
|
||||
namespace Server.Spells.First
|
||||
{
|
||||
public class MagicArrowSpell : MagerySpell, ISpellTargetingMobile
|
||||
public class MagicArrowSpell : MagerySpell, ITargetingSpell<Mobile>
|
||||
{
|
||||
private static readonly SpellInfo _info = new(
|
||||
"Magic Arrow",
|
||||
|
|
@ -68,7 +68,7 @@ namespace Server.Spells.First
|
|||
|
||||
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.First;
|
||||
|
||||
public class NightSightSpell : MagerySpell, ISpellTargetingMobile
|
||||
public class NightSightSpell : MagerySpell, ITargetingSpell<Mobile>
|
||||
{
|
||||
private static readonly SpellInfo _info = new(
|
||||
"Night Sight",
|
||||
|
|
@ -14,6 +14,8 @@ public class NightSightSpell : MagerySpell, ISpellTargetingMobile
|
|||
Reagent.SpidersSilk
|
||||
);
|
||||
|
||||
public int TargetRange => 12;
|
||||
|
||||
public NightSightSpell(Mobile caster, Item scroll = null) : base(caster, scroll, _info)
|
||||
{
|
||||
}
|
||||
|
|
@ -22,7 +24,7 @@ public class NightSightSpell : MagerySpell, ISpellTargetingMobile
|
|||
|
||||
public override void OnCast()
|
||||
{
|
||||
Caster.Target = new SpellTargetMobile(this, TargetFlags.Beneficial, 12);
|
||||
Caster.Target = new SpellTarget<Mobile>(this, TargetFlags.Beneficial);
|
||||
}
|
||||
|
||||
public void Target(Mobile m)
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@ using Server.Targeting;
|
|||
|
||||
namespace Server.Spells.First
|
||||
{
|
||||
public class WeakenSpell : MagerySpell, ISpellTargetingMobile
|
||||
public class WeakenSpell : MagerySpell, ITargetingSpell<Mobile>
|
||||
{
|
||||
private static readonly SpellInfo _info = new(
|
||||
"Weaken",
|
||||
|
|
@ -47,7 +47,7 @@ namespace Server.Spells.First
|
|||
|
||||
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.Mobiles;
|
|||
|
||||
namespace Server.Spells.Fourth
|
||||
{
|
||||
public class ArchCureSpell : MagerySpell, ISpellTargetingPoint3D
|
||||
public class ArchCureSpell : MagerySpell, ITargetingSpell<IPoint3D>
|
||||
{
|
||||
private static readonly SpellInfo _info = new(
|
||||
"Arch Cure",
|
||||
|
|
@ -95,7 +95,7 @@ namespace Server.Spells.Fourth
|
|||
|
||||
public override void OnCast()
|
||||
{
|
||||
Caster.Target = new SpellTargetPoint3D(this, range: Core.ML ? 10 : 12);
|
||||
Caster.Target = new SpellTarget<IPoint3D>(this);
|
||||
}
|
||||
|
||||
private bool AreaCanTarget(Mobile target, bool feluccaRules)
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@ using Server.Spells.Second;
|
|||
|
||||
namespace Server.Spells.Fourth
|
||||
{
|
||||
public class ArchProtectionSpell : MagerySpell, ISpellTargetingPoint3D
|
||||
public class ArchProtectionSpell : MagerySpell, ITargetingSpell<IPoint3D>
|
||||
{
|
||||
private static readonly SpellInfo _info = new(
|
||||
"Arch Protection",
|
||||
|
|
@ -94,7 +94,7 @@ namespace Server.Spells.Fourth
|
|||
|
||||
public override void OnCast()
|
||||
{
|
||||
Caster.Target = new SpellTargetPoint3D(this, range: Core.ML ? 10 : 12);
|
||||
Caster.Target = new SpellTarget<IPoint3D>(this);
|
||||
}
|
||||
|
||||
private static void AddEntry(Mobile m, int v)
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@ using Server.Targeting;
|
|||
|
||||
namespace Server.Spells.Fourth
|
||||
{
|
||||
public class CurseSpell : MagerySpell, ISpellTargetingMobile
|
||||
public class CurseSpell : MagerySpell, ITargetingSpell<Mobile>
|
||||
{
|
||||
private static readonly SpellInfo _info = new(
|
||||
"Curse",
|
||||
|
|
@ -105,7 +105,7 @@ namespace Server.Spells.Fourth
|
|||
|
||||
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 RemoveEffect(Mobile m)
|
||||
|
|
|
|||
|
|
@ -7,7 +7,7 @@ using Server.Mobiles;
|
|||
|
||||
namespace Server.Spells.Fourth;
|
||||
|
||||
public class FireFieldSpell : MagerySpell, ISpellTargetingPoint3D
|
||||
public class FireFieldSpell : MagerySpell, ITargetingSpell<IPoint3D>
|
||||
{
|
||||
private static readonly SpellInfo _info = new(
|
||||
"Fire Field",
|
||||
|
|
@ -60,7 +60,7 @@ public class FireFieldSpell : MagerySpell, ISpellTargetingPoint3D
|
|||
|
||||
public override void OnCast()
|
||||
{
|
||||
Caster.Target = new SpellTargetPoint3D(this, range: Core.ML ? 10 : 12);
|
||||
Caster.Target = new SpellTarget<IPoint3D>(this);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@ using Server.Targeting;
|
|||
|
||||
namespace Server.Spells.Fourth
|
||||
{
|
||||
public class GreaterHealSpell : MagerySpell, ISpellTargetingMobile
|
||||
public class GreaterHealSpell : MagerySpell, ITargetingSpell<Mobile>
|
||||
{
|
||||
private static readonly SpellInfo _info = new(
|
||||
"Greater Heal",
|
||||
|
|
@ -72,7 +72,7 @@ namespace Server.Spells.Fourth
|
|||
|
||||
public override void OnCast()
|
||||
{
|
||||
Caster.Target = new SpellTargetMobile(this, TargetFlags.Beneficial, Core.ML ? 10 : 12);
|
||||
Caster.Target = new SpellTarget<Mobile>(this, TargetFlags.Beneficial);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@ using Server.Targeting;
|
|||
|
||||
namespace Server.Spells.Fourth
|
||||
{
|
||||
public class LightningSpell : MagerySpell, ISpellTargetingMobile
|
||||
public class LightningSpell : MagerySpell, ITargetingSpell<Mobile>
|
||||
{
|
||||
private static readonly SpellInfo _info = new(
|
||||
"Lightning",
|
||||
|
|
@ -57,7 +57,7 @@ namespace Server.Spells.Fourth
|
|||
|
||||
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.Fourth
|
||||
{
|
||||
public class ManaDrainSpell : MagerySpell, ISpellTargetingMobile
|
||||
public class ManaDrainSpell : MagerySpell, ITargetingSpell<Mobile>
|
||||
{
|
||||
private static readonly SpellInfo _info = new(
|
||||
"Mana Drain",
|
||||
|
|
@ -77,7 +77,7 @@ namespace Server.Spells.Fourth
|
|||
|
||||
public override void OnCast()
|
||||
{
|
||||
Caster.Target = new SpellTargetMobile(this, TargetFlags.Harmful, Core.ML ? 10 : 12);
|
||||
Caster.Target = new SpellTarget<Mobile>(this, TargetFlags.Harmful);
|
||||
}
|
||||
|
||||
private static void AosDelay_Callback(Mobile m, int mana)
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@ using Server.Mobiles;
|
|||
|
||||
namespace Server.Spells.Mysticism;
|
||||
|
||||
public class AnimatedWeaponSpell : MysticSpell, ISpellTargetingPoint3D
|
||||
public class AnimatedWeaponSpell : MysticSpell, ITargetingSpell<IPoint3D>
|
||||
{
|
||||
private static readonly SpellInfo _info = new(
|
||||
"Animated Weapon",
|
||||
|
|
@ -55,6 +55,6 @@ public class AnimatedWeaponSpell : MysticSpell, ISpellTargetingPoint3D
|
|||
|
||||
public override void OnCast()
|
||||
{
|
||||
Caster.Target = new SpellTargetPoint3D(this);
|
||||
Caster.Target = new SpellTarget<IPoint3D>(this);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@ using System;
|
|||
|
||||
namespace Server.Spells.Mysticism;
|
||||
|
||||
public class BombardSpell : MysticSpell, ISpellTargetingMobile
|
||||
public class BombardSpell : MysticSpell, ITargetingSpell<Mobile>
|
||||
{
|
||||
private static readonly SpellInfo _info = new(
|
||||
"Bombard", "Corp Por Ylem",
|
||||
|
|
@ -26,7 +26,7 @@ public class BombardSpell : MysticSpell, ISpellTargetingMobile
|
|||
|
||||
public override void OnCast()
|
||||
{
|
||||
Caster.Target = new SpellTargetMobile(this, TargetFlags.Harmful);
|
||||
Caster.Target = new SpellTarget<Mobile>(this, TargetFlags.Harmful);
|
||||
}
|
||||
|
||||
public void Target(Mobile m)
|
||||
|
|
|
|||
|
|
@ -7,7 +7,7 @@ using Server.Collections;
|
|||
|
||||
namespace Server.Spells.Mysticism;
|
||||
|
||||
public class CleansingWindsSpell : MysticSpell, ISpellTargetingMobile
|
||||
public class CleansingWindsSpell : MysticSpell, ITargetingSpell<Mobile>
|
||||
{
|
||||
public override SpellCircle Circle => SpellCircle.Sixth;
|
||||
|
||||
|
|
@ -27,7 +27,7 @@ public class CleansingWindsSpell : MysticSpell, ISpellTargetingMobile
|
|||
|
||||
public override void OnCast()
|
||||
{
|
||||
Caster.Target = new SpellTargetMobile(this, TargetFlags.Beneficial);
|
||||
Caster.Target = new SpellTarget<Mobile>(this, TargetFlags.Beneficial);
|
||||
}
|
||||
|
||||
public void Target(Mobile m)
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@ using Server.Targeting;
|
|||
|
||||
namespace Server.Spells.Mysticism;
|
||||
|
||||
public class EagleStrikeSpell : MysticSpell, ISpellTargetingMobile
|
||||
public class EagleStrikeSpell : MysticSpell, ITargetingSpell<Mobile>
|
||||
{
|
||||
private static readonly SpellInfo _info = new(
|
||||
"Eagle Strike",
|
||||
|
|
@ -55,7 +55,7 @@ public class EagleStrikeSpell : MysticSpell, ISpellTargetingMobile
|
|||
|
||||
public override void OnCast()
|
||||
{
|
||||
Caster.Target = new SpellTargetMobile(this, TargetFlags.Harmful);
|
||||
Caster.Target = new SpellTarget<Mobile>(this, TargetFlags.Harmful);
|
||||
}
|
||||
|
||||
private void Damage(Mobile to)
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
namespace Server.Spells.Mysticism;
|
||||
|
||||
public class HailStormSpell : MysticSpell, ISpellTargetingPoint3D
|
||||
public class HailStormSpell : MysticSpell, ITargetingSpell<IPoint3D>
|
||||
{
|
||||
private static readonly SpellInfo _info = new(
|
||||
"Hail Storm",
|
||||
|
|
@ -73,7 +73,7 @@ public class HailStormSpell : MysticSpell, ISpellTargetingPoint3D
|
|||
|
||||
public override void OnCast()
|
||||
{
|
||||
Caster.Target = new SpellTargetPoint3D(this);
|
||||
Caster.Target = new SpellTarget<IPoint3D>(this);
|
||||
}
|
||||
|
||||
private static void PlayEffect(Point3D p, Map map)
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
namespace Server.Spells.Mysticism;
|
||||
|
||||
public class NetherCycloneSpell : MysticSpell, ISpellTargetingPoint3D
|
||||
public class NetherCycloneSpell : MysticSpell, ITargetingSpell<IPoint3D>
|
||||
{
|
||||
private static readonly SpellInfo _info = new(
|
||||
"Nether Cyclone",
|
||||
|
|
@ -89,7 +89,7 @@ public class NetherCycloneSpell : MysticSpell, ISpellTargetingPoint3D
|
|||
|
||||
public override void OnCast()
|
||||
{
|
||||
Caster.Target = new SpellTargetPoint3D(this);
|
||||
Caster.Target = new SpellTarget<IPoint3D>(this);
|
||||
}
|
||||
|
||||
private static void PlayEffect(Point3D p, Map map)
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@ using Server.Targeting;
|
|||
|
||||
namespace Server.Spells.Mysticism;
|
||||
|
||||
public class SpellPlagueSpell : MysticSpell, ISpellTargetingMobile
|
||||
public class SpellPlagueSpell : MysticSpell, ITargetingSpell<Mobile>
|
||||
{
|
||||
private static readonly SpellInfo _info = new(
|
||||
"Spell Plague",
|
||||
|
|
@ -32,7 +32,7 @@ public class SpellPlagueSpell : MysticSpell, ISpellTargetingMobile
|
|||
|
||||
public override void OnCast()
|
||||
{
|
||||
Caster.Target = new SpellTargetMobile(this, TargetFlags.Harmful);
|
||||
Caster.Target = new SpellTarget<Mobile>(this, TargetFlags.Harmful);
|
||||
}
|
||||
|
||||
public void Target(Mobile m)
|
||||
|
|
|
|||
|
|
@ -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()
|
||||
|
|
|
|||
|
|
@ -5,11 +5,10 @@ using Server.Misc;
|
|||
using Server.Mobiles;
|
||||
using Server.Regions;
|
||||
using Server.SkillHandlers;
|
||||
using Server.Targeting;
|
||||
|
||||
namespace Server.Spells.Ninjitsu;
|
||||
|
||||
public class Shadowjump : NinjaSpell, ISpellTargetingPoint3D
|
||||
public class Shadowjump : NinjaSpell, ITargetingSpell<IPoint3D>
|
||||
{
|
||||
private static readonly SpellInfo _info = new(
|
||||
"Shadowjump",
|
||||
|
|
@ -29,6 +28,8 @@ public class Shadowjump : NinjaSpell, ISpellTargetingPoint3D
|
|||
|
||||
public override bool BlockedByAnimalForm => false;
|
||||
|
||||
public int TargetRange => 11;
|
||||
|
||||
public void Target(IPoint3D p)
|
||||
{
|
||||
var orig = p;
|
||||
|
|
@ -111,6 +112,6 @@ public class Shadowjump : NinjaSpell, ISpellTargetingPoint3D
|
|||
public override void OnCast()
|
||||
{
|
||||
Caster.SendLocalizedMessage(1063088); // You prepare to perform a Shadowjump.
|
||||
Caster.Target = new SpellTargetPoint3D(this, TargetFlags.None, 11);
|
||||
Caster.Target = new SpellTarget<IPoint3D>(this);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@ using Server.Targeting;
|
|||
|
||||
namespace Server.Spells.Second
|
||||
{
|
||||
public class AgilitySpell : MagerySpell, ISpellTargetingMobile
|
||||
public class AgilitySpell : MagerySpell, ITargetingSpell<Mobile>
|
||||
{
|
||||
private static readonly SpellInfo _info = new(
|
||||
"Agility",
|
||||
|
|
@ -51,7 +51,7 @@ namespace Server.Spells.Second
|
|||
|
||||
public override void OnCast()
|
||||
{
|
||||
Caster.Target = new SpellTargetMobile(this, TargetFlags.Beneficial, Core.ML ? 10 : 12);
|
||||
Caster.Target = new SpellTarget<Mobile>(this, TargetFlags.Beneficial);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@ using Server.Targeting;
|
|||
|
||||
namespace Server.Spells.Second
|
||||
{
|
||||
public class CunningSpell : MagerySpell, ISpellTargetingMobile
|
||||
public class CunningSpell : MagerySpell, ITargetingSpell<Mobile>
|
||||
{
|
||||
private static readonly SpellInfo _info = new(
|
||||
"Cunning",
|
||||
|
|
@ -51,7 +51,7 @@ namespace Server.Spells.Second
|
|||
|
||||
public override void OnCast()
|
||||
{
|
||||
Caster.Target = new SpellTargetMobile(this, TargetFlags.Beneficial, Core.ML ? 10 : 12);
|
||||
Caster.Target = new SpellTarget<Mobile>(this, TargetFlags.Beneficial);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@ using Server.Targeting;
|
|||
|
||||
namespace Server.Spells.Second
|
||||
{
|
||||
public class CureSpell : MagerySpell, ISpellTargetingMobile
|
||||
public class CureSpell : MagerySpell, ITargetingSpell<Mobile>
|
||||
{
|
||||
private static readonly SpellInfo _info = new(
|
||||
"Cure",
|
||||
|
|
@ -70,7 +70,7 @@ namespace Server.Spells.Second
|
|||
|
||||
public override void OnCast()
|
||||
{
|
||||
Caster.Target = new SpellTargetMobile(this, TargetFlags.Beneficial, Core.ML ? 10 : 12);
|
||||
Caster.Target = new SpellTarget<Mobile>(this, TargetFlags.Beneficial);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@ using Server.Targeting;
|
|||
|
||||
namespace Server.Spells.Second
|
||||
{
|
||||
public class HarmSpell : MagerySpell, ISpellTargetingMobile
|
||||
public class HarmSpell : MagerySpell, ITargetingSpell<Mobile>
|
||||
{
|
||||
private static readonly SpellInfo _info = new(
|
||||
"Harm",
|
||||
|
|
@ -75,7 +75,7 @@ namespace Server.Spells.Second
|
|||
|
||||
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 GetSlayerDamageScalar(Mobile target) => 1.0;
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@ using Server.Items;
|
|||
|
||||
namespace Server.Spells.Second
|
||||
{
|
||||
public class MagicTrapSpell : MagerySpell, ISpellTargetingItem
|
||||
public class MagicTrapSpell : MagerySpell, ITargetingSpell<Item>
|
||||
{
|
||||
private static readonly SpellInfo _info = new(
|
||||
"Magic Trap",
|
||||
|
|
@ -82,7 +82,7 @@ namespace Server.Spells.Second
|
|||
|
||||
public override void OnCast()
|
||||
{
|
||||
Caster.Target = new SpellTargetItem(this, range: Core.ML ? 10 : 12);
|
||||
Caster.Target = new SpellTarget<Item>(this);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@ using Server.Items;
|
|||
|
||||
namespace Server.Spells.Second
|
||||
{
|
||||
public class RemoveTrapSpell : MagerySpell, ISpellTargetingItem
|
||||
public class RemoveTrapSpell : MagerySpell, ITargetingSpell<Item>
|
||||
{
|
||||
private static readonly SpellInfo _info = new(
|
||||
"Remove Trap",
|
||||
|
|
@ -52,7 +52,7 @@ namespace Server.Spells.Second
|
|||
|
||||
public override void OnCast()
|
||||
{
|
||||
Caster.Target = new SpellTargetItem(this, range: Core.ML ? 10 : 12);
|
||||
Caster.Target = new SpellTarget<Item>(this);
|
||||
Caster.SendLocalizedMessage(502368);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@ using Server.Targeting;
|
|||
|
||||
namespace Server.Spells.Second
|
||||
{
|
||||
public class StrengthSpell : MagerySpell, ISpellTargetingMobile
|
||||
public class StrengthSpell : MagerySpell, ITargetingSpell<Mobile>
|
||||
{
|
||||
private static readonly SpellInfo _info = new(
|
||||
"Strength",
|
||||
|
|
@ -51,7 +51,7 @@ namespace Server.Spells.Second
|
|||
|
||||
public override void OnCast()
|
||||
{
|
||||
Caster.Target = new SpellTargetMobile(this, TargetFlags.Beneficial, Core.ML ? 10 : 12);
|
||||
Caster.Target = new SpellTarget<Mobile>(this, TargetFlags.Beneficial);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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)
|
||||
|
|
|
|||
|
|
@ -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)
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,9 +1,6 @@
|
|||
namespace Server.Spells
|
||||
namespace Server.Spells;
|
||||
|
||||
public interface IRecallSpell : IRangedSpell
|
||||
{
|
||||
public interface IRecallSpell
|
||||
{
|
||||
Mobile Caster { get; }
|
||||
void Effect(Point3D loc, Map map, bool checkMulti);
|
||||
void FinishSequence();
|
||||
}
|
||||
void Effect(Point3D loc, Map map, bool checkMulti);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,7 +1,6 @@
|
|||
namespace Server.Spells
|
||||
namespace Server.Spells;
|
||||
|
||||
public interface ISpellTarget<in T> where T : IPoint3D
|
||||
{
|
||||
public interface ISpellTarget
|
||||
{
|
||||
ISpell Spell { get; }
|
||||
}
|
||||
ITargetingSpell<T> Spell { get; }
|
||||
}
|
||||
|
|
|
|||
14
Projects/UOContent/Spells/Targeting/ITargetingSpell.cs
Normal file
14
Projects/UOContent/Spells/Targeting/ITargetingSpell.cs
Normal file
|
|
@ -0,0 +1,14 @@
|
|||
namespace Server.Spells;
|
||||
|
||||
public interface IRangedSpell
|
||||
{
|
||||
Mobile Caster { get; }
|
||||
|
||||
int TargetRange => Core.ML ? 10 : 12;
|
||||
void FinishSequence();
|
||||
}
|
||||
|
||||
public interface ITargetingSpell<in T> : IRangedSpell where T : IPoint3D
|
||||
{
|
||||
void Target(T target);
|
||||
}
|
||||
|
|
@ -10,7 +10,7 @@ public class RecallSpellTarget : Target
|
|||
private readonly IRecallSpell _spell;
|
||||
private readonly bool _toBoat;
|
||||
|
||||
public RecallSpellTarget(IRecallSpell spell, bool toBoat = true) : base(Core.ML ? 10 : 12, false, TargetFlags.None)
|
||||
public RecallSpellTarget(IRecallSpell spell, bool toBoat = true) : base(spell.TargetRange, false, TargetFlags.None)
|
||||
{
|
||||
_spell = spell;
|
||||
_toBoat = toBoat;
|
||||
|
|
@ -68,8 +68,5 @@ public class RecallSpellTarget : Target
|
|||
{
|
||||
}
|
||||
|
||||
protected override void OnTargetFinish(Mobile from)
|
||||
{
|
||||
_spell?.FinishSequence();
|
||||
}
|
||||
protected override void OnTargetFinish(Mobile from) => _spell?.FinishSequence();
|
||||
}
|
||||
|
|
|
|||
58
Projects/UOContent/Spells/Targeting/SpellTarget.cs
Normal file
58
Projects/UOContent/Spells/Targeting/SpellTarget.cs
Normal file
|
|
@ -0,0 +1,58 @@
|
|||
using Server.Targeting;
|
||||
|
||||
namespace Server.Spells;
|
||||
|
||||
public class SpellTarget<T> : Target, ISpellTarget<T> where T : class, IPoint3D
|
||||
{
|
||||
private static readonly bool _canTargetStatic = typeof(T).IsAssignableFrom(typeof(StaticTarget));
|
||||
private static readonly bool _canTargetMobile = typeof(T).IsAssignableFrom(typeof(Mobile));
|
||||
private static readonly bool _canTargetItem = typeof(T).IsAssignableFrom(typeof(Item));
|
||||
|
||||
private readonly bool _retryOnLos;
|
||||
protected readonly ITargetingSpell<T> _spell;
|
||||
|
||||
public SpellTarget(
|
||||
ITargetingSpell<T> spell,
|
||||
TargetFlags flags = TargetFlags.None,
|
||||
bool retryOnLos = false
|
||||
) : this(spell, false, flags, retryOnLos)
|
||||
{
|
||||
}
|
||||
|
||||
public SpellTarget(ITargetingSpell<T> spell, bool allowGround, TargetFlags flags = TargetFlags.None, bool retryOnLos = false)
|
||||
: base(spell.TargetRange, allowGround, flags)
|
||||
{
|
||||
_spell = spell;
|
||||
_retryOnLos = retryOnLos;
|
||||
}
|
||||
|
||||
public ITargetingSpell<T> Spell => _spell;
|
||||
|
||||
protected override bool CanTarget(Mobile from, StaticTarget staticTarget, ref Point3D loc, ref Map map)
|
||||
=> _canTargetStatic;
|
||||
|
||||
protected override bool CanTarget(Mobile from, Mobile mobile, ref Point3D loc, ref Map map) => _canTargetMobile;
|
||||
|
||||
protected override bool CanTarget(Mobile from, Item item, ref Point3D loc, ref Map map) => _canTargetItem;
|
||||
|
||||
protected override void OnCantSeeTarget(Mobile from, object o)
|
||||
{
|
||||
from.SendLocalizedMessage(500237); // Target can not be seen.
|
||||
}
|
||||
|
||||
protected override void OnTarget(Mobile from, object o) => _spell.Target(o as T);
|
||||
|
||||
protected override void OnTargetOutOfLOS(Mobile from, object o)
|
||||
{
|
||||
if (!_retryOnLos)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
from.SendLocalizedMessage(501943); // Target cannot be seen. Try again.
|
||||
from.Target = new SpellTarget<T>(_spell, AllowGround, Flags, true);
|
||||
from.Target.BeginTimeout(from, TimeoutTime - Core.TickCount);
|
||||
}
|
||||
|
||||
protected override void OnTargetFinish(Mobile from) => _spell?.FinishSequence();
|
||||
}
|
||||
|
|
@ -1,37 +0,0 @@
|
|||
using Server.Targeting;
|
||||
|
||||
namespace Server.Spells
|
||||
{
|
||||
public interface ISpellTargetingItem : ISpell
|
||||
{
|
||||
void Target(Item item);
|
||||
}
|
||||
|
||||
public class SpellTargetItem : Target, ISpellTarget
|
||||
{
|
||||
private readonly ISpellTargetingItem _spell;
|
||||
|
||||
public SpellTargetItem(ISpellTargetingItem spell, TargetFlags flags = TargetFlags.None, int range = 12)
|
||||
: base(range, false, flags) => _spell = spell;
|
||||
|
||||
public ISpell Spell => _spell;
|
||||
|
||||
protected override bool CanTarget(Mobile from, StaticTarget staticTarget, ref Point3D loc, ref Map map) => false;
|
||||
protected override bool CanTarget(Mobile from, Mobile mobile, ref Point3D loc, ref Map map) => false;
|
||||
|
||||
protected override void OnCantSeeTarget(Mobile from, object o)
|
||||
{
|
||||
from.SendLocalizedMessage(500237); // Target can not be seen.
|
||||
}
|
||||
|
||||
protected override void OnTarget(Mobile from, object o)
|
||||
{
|
||||
_spell.Target(o as Item);
|
||||
}
|
||||
|
||||
protected override void OnTargetFinish(Mobile from)
|
||||
{
|
||||
_spell?.FinishSequence();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1,32 +0,0 @@
|
|||
using Server.Targeting;
|
||||
|
||||
namespace Server.Spells
|
||||
{
|
||||
public interface ISpellTargetingMobile : ISpell
|
||||
{
|
||||
void Target(Mobile m);
|
||||
}
|
||||
|
||||
public class SpellTargetMobile : Target, ISpellTarget
|
||||
{
|
||||
private readonly ISpellTargetingMobile _spell;
|
||||
|
||||
public SpellTargetMobile(ISpellTargetingMobile spell, TargetFlags flags, int range = 12) :
|
||||
base(range, false, flags) => _spell = spell;
|
||||
|
||||
public ISpell Spell => _spell;
|
||||
|
||||
protected override bool CanTarget(Mobile from, StaticTarget staticTarget, ref Point3D loc, ref Map map) => false;
|
||||
protected override bool CanTarget(Mobile from, Item item, ref Point3D loc, ref Map map) => false;
|
||||
|
||||
protected override void OnTarget(Mobile from, object o)
|
||||
{
|
||||
_spell.Target(o as Mobile);
|
||||
}
|
||||
|
||||
protected override void OnTargetFinish(Mobile from)
|
||||
{
|
||||
_spell?.FinishSequence();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1,53 +0,0 @@
|
|||
using Server.Targeting;
|
||||
|
||||
namespace Server.Spells
|
||||
{
|
||||
public interface ISpellTargetingPoint3D : ISpell
|
||||
{
|
||||
void Target(IPoint3D p);
|
||||
}
|
||||
|
||||
public class SpellTargetPoint3D : Target, ISpellTarget
|
||||
{
|
||||
private readonly bool _retryOnLos;
|
||||
private ISpellTargetingPoint3D _spell;
|
||||
|
||||
public SpellTargetPoint3D(
|
||||
ISpellTargetingPoint3D spell, TargetFlags flags = TargetFlags.None, int range = 12, bool retryOnLOS = false
|
||||
) : base(range, true, flags)
|
||||
{
|
||||
_spell = spell;
|
||||
_retryOnLos = retryOnLOS;
|
||||
}
|
||||
|
||||
public ISpell Spell => _spell;
|
||||
|
||||
protected override void OnTarget(Mobile from, object o)
|
||||
{
|
||||
_spell.Target(o as IPoint3D);
|
||||
}
|
||||
|
||||
protected override void OnCantSeeTarget(Mobile from, object o)
|
||||
{
|
||||
from.SendLocalizedMessage(500237); // Target can not be seen.
|
||||
}
|
||||
|
||||
protected override void OnTargetOutOfLOS(Mobile from, object o)
|
||||
{
|
||||
if (!_retryOnLos)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
from.SendLocalizedMessage(501943); // Target cannot be seen. Try again.
|
||||
from.Target = new SpellTargetPoint3D(_spell);
|
||||
from.Target.BeginTimeout(from, TimeoutTime - Core.TickCount);
|
||||
_spell = null; // Needed?
|
||||
}
|
||||
|
||||
protected override void OnTargetFinish(Mobile from)
|
||||
{
|
||||
_spell?.FinishSequence();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -3,7 +3,7 @@ using Server.Targeting;
|
|||
|
||||
namespace Server.Spells.Third
|
||||
{
|
||||
public class BlessSpell : MagerySpell, ISpellTargetingMobile
|
||||
public class BlessSpell : MagerySpell, ITargetingSpell<Mobile>
|
||||
{
|
||||
private static readonly SpellInfo _info = new(
|
||||
"Bless",
|
||||
|
|
@ -55,7 +55,7 @@ namespace Server.Spells.Third
|
|||
|
||||
public override void OnCast()
|
||||
{
|
||||
Caster.Target = new SpellTargetMobile(this, TargetFlags.Beneficial, Core.ML ? 10 : 12);
|
||||
Caster.Target = new SpellTarget<Mobile>(this, TargetFlags.Beneficial);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@ using Server.Targeting;
|
|||
|
||||
namespace Server.Spells.Third
|
||||
{
|
||||
public class FireballSpell : MagerySpell, ISpellTargetingMobile
|
||||
public class FireballSpell : MagerySpell, ITargetingSpell<Mobile>
|
||||
{
|
||||
private static readonly SpellInfo _info = new(
|
||||
"Fireball",
|
||||
|
|
@ -59,7 +59,7 @@ namespace Server.Spells.Third
|
|||
|
||||
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.Multis;
|
|||
|
||||
namespace Server.Spells.Third
|
||||
{
|
||||
public class MagicLockSpell : MagerySpell, ISpellTargetingItem
|
||||
public class MagicLockSpell : MagerySpell, ITargetingSpell<Item>
|
||||
{
|
||||
private static readonly SpellInfo _info = new(
|
||||
"Magic Lock",
|
||||
|
|
@ -62,7 +62,7 @@ namespace Server.Spells.Third
|
|||
|
||||
public override void OnCast()
|
||||
{
|
||||
Caster.Target = new SpellTargetItem(this, range: Core.ML ? 10 : 12);
|
||||
Caster.Target = new SpellTarget<Item>(this);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@ using Server.Targeting;
|
|||
|
||||
namespace Server.Spells.Third
|
||||
{
|
||||
public class PoisonSpell : MagerySpell, ISpellTargetingMobile
|
||||
public class PoisonSpell : MagerySpell, ITargetingSpell<Mobile>
|
||||
{
|
||||
private static readonly SpellInfo _info = new(
|
||||
"Poison",
|
||||
|
|
@ -99,7 +99,7 @@ namespace Server.Spells.Third
|
|||
|
||||
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.Items;
|
|||
|
||||
namespace Server.Spells.Third
|
||||
{
|
||||
public class TelekinesisSpell : MagerySpell, ISpellTargetingItem
|
||||
public class TelekinesisSpell : MagerySpell, ITargetingSpell<Item>
|
||||
{
|
||||
private static readonly SpellInfo _info = new(
|
||||
"Telekinesis",
|
||||
|
|
@ -72,7 +72,7 @@ namespace Server.Spells.Third
|
|||
|
||||
public override void OnCast()
|
||||
{
|
||||
Caster.Target = new SpellTargetItem(this, range: Core.ML ? 10 : 12);
|
||||
Caster.Target = new SpellTarget<Item>(this);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -9,7 +9,7 @@ using Server.Spells.Sixth;
|
|||
|
||||
namespace Server.Spells.Third
|
||||
{
|
||||
public class TeleportSpell : MagerySpell, ISpellTargetingPoint3D
|
||||
public class TeleportSpell : MagerySpell, ITargetingSpell<IPoint3D>
|
||||
{
|
||||
private static readonly SpellInfo _info = new(
|
||||
"Teleport",
|
||||
|
|
@ -139,7 +139,7 @@ namespace Server.Spells.Third
|
|||
|
||||
public override void OnCast()
|
||||
{
|
||||
Caster.Target = new SpellTargetPoint3D(this, range: Core.ML ? 10 : 12);
|
||||
Caster.Target = new SpellTarget<IPoint3D>(this);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@ using Server.Multis;
|
|||
|
||||
namespace Server.Spells.Third
|
||||
{
|
||||
public class UnlockSpell : MagerySpell, ISpellTargetingPoint3D
|
||||
public class UnlockSpell : MagerySpell, ITargetingSpell<IPoint3D>
|
||||
{
|
||||
private static readonly SpellInfo _info = new(
|
||||
"Unlock Spell",
|
||||
|
|
@ -84,7 +84,7 @@ namespace Server.Spells.Third
|
|||
|
||||
public override void OnCast()
|
||||
{
|
||||
Caster.Target = new SpellTargetPoint3D(this, range: Core.ML ? 10 : 12);
|
||||
Caster.Target = new SpellTarget<IPoint3D>(this);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@ using Server.Mobiles;
|
|||
|
||||
namespace Server.Spells.Third;
|
||||
|
||||
public class WallOfStoneSpell : MagerySpell, ISpellTargetingPoint3D
|
||||
public class WallOfStoneSpell : MagerySpell, ITargetingSpell<IPoint3D>
|
||||
{
|
||||
private static readonly SpellInfo _info = new(
|
||||
"Wall of Stone",
|
||||
|
|
@ -56,7 +56,7 @@ public class WallOfStoneSpell : MagerySpell, ISpellTargetingPoint3D
|
|||
|
||||
public override void OnCast()
|
||||
{
|
||||
Caster.Target = new SpellTargetPoint3D(this, range: Core.ML ? 10 : 12);
|
||||
Caster.Target = new SpellTarget<IPoint3D>(this);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue