Cleans up Spell Targeting (#36)

This commit is contained in:
Kamron Batman 2019-03-15 15:23:03 -07:00 • committed by GitHub
parent de50bc9e43
commit 472b84f5ff
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
99 changed files with 653 additions and 2192 deletions

View file

@ -1,10 +1,9 @@
using System;
using Server.Mobiles;
using Server.Targeting;
namespace Server.Spells.Mysticism
{
public class AnimatedWeaponSpell : MysticSpell
public class AnimatedWeaponSpell : MysticSpell, ISpellTargetingPoint3D
{
private static SpellInfo m_Info = new SpellInfo(
"Animated Weapon", "In Jux Por Ylem",
@ -28,7 +27,7 @@ namespace Server.Spells.Mysticism
public override void OnCast()
{
Caster.Target = new InternalTarget(this);
Caster.Target = new SpellTargetPoint3D(this);
}
public void Target(IPoint3D p)
@ -63,27 +62,5 @@ namespace Server.Spells.Mysticism
FinishSequence();
}
public class InternalTarget : Target
{
private AnimatedWeaponSpell m_Owner;
public InternalTarget(AnimatedWeaponSpell owner)
: base(12, true, TargetFlags.None)
{
m_Owner = owner;
}
protected override void OnTarget(Mobile from, object o)
{
if (o is IPoint3D d)
m_Owner.Target(d);
}
protected override void OnTargetFinish(Mobile from)
{
m_Owner.FinishSequence();
}
}
}
}

View file

@ -3,7 +3,7 @@ using Server.Targeting;
namespace Server.Spells.Mysticism
{
public class EagleStrikeSpell : MysticSpell
public class EagleStrikeSpell : MysticSpell, ISpellTargetingMobile
{
private static SpellInfo m_Info = new SpellInfo(
"Eagle Strike", "Kal Por Xen",
@ -27,11 +27,14 @@ namespace Server.Spells.Mysticism
public override void OnCast()
{
Caster.Target = new InternalTarget(this);
Caster.Target = new SpellTargetMobile(this, TargetFlags.Harmful);
}
public void Target(Mobile m)
{
if (m == null)
return;
if (CheckHSequence(m))
{
/* Conjures a magical eagle that assaults the Target with
@ -62,27 +65,5 @@ namespace Server.Spells.Mysticism
to.PlaySound(0x64D);
}
private class InternalTarget : Target
{
private EagleStrikeSpell m_Owner;
public InternalTarget(EagleStrikeSpell owner)
: base(12, false, TargetFlags.Harmful)
{
m_Owner = owner;
}
protected override void OnTarget(Mobile from, object o)
{
if (o is Mobile mobile)
m_Owner.Target(mobile);
}
protected override void OnTargetFinish(Mobile from)
{
m_Owner.FinishSequence();
}
}
}
}

View file

@ -1,11 +1,10 @@
using System;
using System.Collections.Generic;
using Server.Network;
using Server.Targeting;
namespace Server.Spells.Mysticism
{
public class HailStormSpell : MysticSpell
public class HailStormSpell : MysticSpell, ISpellTargetingPoint3D
{
private static SpellInfo m_Info = new SpellInfo(
"Hail Storm", "Kal Des Ylem",
@ -29,7 +28,7 @@ namespace Server.Spells.Mysticism
public override void OnCast()
{
Caster.Target = new InternalTarget(this);
Caster.Target = new SpellTargetPoint3D(this);
}
public void Target(IPoint3D p)
@ -118,27 +117,5 @@ namespace Server.Spells.Mysticism
new HuedEffect(EffectType.Moving, Serial.Zero, Serial.Zero, 0x36D4, orig, dest, 0, 0, false, false, 0x63,
0x4));
}
private class InternalTarget : Target
{
private HailStormSpell m_Owner;
public InternalTarget(HailStormSpell owner)
: base(12, true, TargetFlags.None)
{
m_Owner = owner;
}
protected override void OnTarget(Mobile from, object o)
{
if (o is IPoint3D p)
m_Owner.Target(p);
}
protected override void OnTargetFinish(Mobile from)
{
m_Owner.FinishSequence();
}
}
}
}

View file

@ -1,11 +1,10 @@
using System;
using System.Collections.Generic;
using Server.Network;
using Server.Targeting;
namespace Server.Spells.Mysticism
{
public class NetherCycloneSpell : MysticSpell
public class NetherCycloneSpell : MysticSpell, ISpellTargetingPoint3D
{
private static SpellInfo m_Info = new SpellInfo(
"Nether Cyclone", "Grav Hur",
@ -29,7 +28,7 @@ namespace Server.Spells.Mysticism
public override void OnCast()
{
Caster.Target = new InternalTarget(this);
Caster.Target = new SpellTargetPoint3D(this);
}
public void Target(IPoint3D p)
@ -127,27 +126,5 @@ namespace Server.Spells.Mysticism
new HuedEffect(EffectType.Moving, Serial.Zero, Serial.Zero, 0x375A, orig, dest, 0, 0, false, false, 0x49A,
0x4));
}
private class InternalTarget : Target
{
private NetherCycloneSpell m_Owner;
public InternalTarget(NetherCycloneSpell owner)
: base(12, true, TargetFlags.None)
{
m_Owner = owner;
}
protected override void OnTarget(Mobile from, object o)
{
if (o is IPoint3D p)
m_Owner.Target(p);
}
protected override void OnTargetFinish(Mobile from)
{
m_Owner.FinishSequence();
}
}
}
}