Fixes code according to modern code style. Fixes a few expression bugs.
This commit is contained in:
parent
89eea25e5f
commit
970fd563b2
3324 changed files with 441118 additions and 433755 deletions
|
|
@ -3,138 +3,139 @@ using Server.Targeting;
|
|||
|
||||
namespace Server.Spells.Seventh
|
||||
{
|
||||
public class ChainLightningSpell : MagerySpell
|
||||
{
|
||||
private static SpellInfo m_Info = new SpellInfo(
|
||||
"Chain Lightning", "Vas Ort Grav",
|
||||
209,
|
||||
9022,
|
||||
false,
|
||||
Reagent.BlackPearl,
|
||||
Reagent.Bloodmoss,
|
||||
Reagent.MandrakeRoot,
|
||||
Reagent.SulfurousAsh
|
||||
);
|
||||
public class ChainLightningSpell : MagerySpell
|
||||
{
|
||||
private static SpellInfo m_Info = new SpellInfo(
|
||||
"Chain Lightning", "Vas Ort Grav",
|
||||
209,
|
||||
9022,
|
||||
false,
|
||||
Reagent.BlackPearl,
|
||||
Reagent.Bloodmoss,
|
||||
Reagent.MandrakeRoot,
|
||||
Reagent.SulfurousAsh
|
||||
);
|
||||
|
||||
public override SpellCircle Circle => SpellCircle.Seventh;
|
||||
public ChainLightningSpell(Mobile caster, Item scroll) : base(caster, scroll, m_Info)
|
||||
{
|
||||
}
|
||||
|
||||
public ChainLightningSpell( Mobile caster, Item scroll ) : base( caster, scroll, m_Info )
|
||||
{
|
||||
}
|
||||
public override SpellCircle Circle => SpellCircle.Seventh;
|
||||
|
||||
public override void OnCast()
|
||||
{
|
||||
Caster.Target = new InternalTarget( this );
|
||||
}
|
||||
public override bool DelayedDamage => true;
|
||||
|
||||
public override bool DelayedDamage => true;
|
||||
public override void OnCast()
|
||||
{
|
||||
Caster.Target = new InternalTarget(this);
|
||||
}
|
||||
|
||||
public void Target( IPoint3D p )
|
||||
{
|
||||
if ( !Caster.CanSee( p ) )
|
||||
{
|
||||
Caster.SendLocalizedMessage( 500237 ); // Target can not be seen.
|
||||
}
|
||||
else if ( SpellHelper.CheckTown( p, Caster ) && CheckSequence() )
|
||||
{
|
||||
SpellHelper.Turn( Caster, p );
|
||||
public void Target(IPoint3D p)
|
||||
{
|
||||
if (!Caster.CanSee(p))
|
||||
{
|
||||
Caster.SendLocalizedMessage(500237); // Target can not be seen.
|
||||
}
|
||||
else if (SpellHelper.CheckTown(p, Caster) && CheckSequence())
|
||||
{
|
||||
SpellHelper.Turn(Caster, p);
|
||||
|
||||
if ( p is Item )
|
||||
p = ((Item)p).GetWorldLocation();
|
||||
if (p is Item)
|
||||
p = ((Item)p).GetWorldLocation();
|
||||
|
||||
List<Mobile> targets = new List<Mobile>();
|
||||
List<Mobile> targets = new List<Mobile>();
|
||||
|
||||
Map map = Caster.Map;
|
||||
Map map = Caster.Map;
|
||||
|
||||
bool playerVsPlayer = false;
|
||||
bool playerVsPlayer = false;
|
||||
|
||||
if ( map != null )
|
||||
{
|
||||
IPooledEnumerable<Mobile> eable = map.GetMobilesInRange( new Point3D( p ), 2 );
|
||||
if (map != null)
|
||||
{
|
||||
IPooledEnumerable<Mobile> eable = map.GetMobilesInRange(new Point3D(p), 2);
|
||||
|
||||
foreach ( Mobile m in eable )
|
||||
{
|
||||
if ( Core.AOS && m == Caster )
|
||||
continue;
|
||||
foreach (Mobile m in eable)
|
||||
{
|
||||
if (Core.AOS && m == Caster)
|
||||
continue;
|
||||
|
||||
if ( SpellHelper.ValidIndirectTarget( Caster, m ) && Caster.CanBeHarmful( m, false ) )
|
||||
{
|
||||
if ( Core.AOS && !Caster.InLOS( m ) )
|
||||
continue;
|
||||
if (SpellHelper.ValidIndirectTarget(Caster, m) && Caster.CanBeHarmful(m, false))
|
||||
{
|
||||
if (Core.AOS && !Caster.InLOS(m))
|
||||
continue;
|
||||
|
||||
targets.Add( m );
|
||||
targets.Add(m);
|
||||
|
||||
if ( m.Player )
|
||||
playerVsPlayer = true;
|
||||
}
|
||||
}
|
||||
if (m.Player)
|
||||
playerVsPlayer = true;
|
||||
}
|
||||
}
|
||||
|
||||
eable.Free();
|
||||
}
|
||||
eable.Free();
|
||||
}
|
||||
|
||||
double damage;
|
||||
double damage;
|
||||
|
||||
if ( Core.AOS )
|
||||
damage = GetNewAosDamage( 51, 1, 5, playerVsPlayer );
|
||||
else
|
||||
damage = Utility.Random( 27, 22 );
|
||||
if (Core.AOS)
|
||||
damage = GetNewAosDamage(51, 1, 5, playerVsPlayer);
|
||||
else
|
||||
damage = Utility.Random(27, 22);
|
||||
|
||||
if ( targets.Count > 0 )
|
||||
{
|
||||
if ( Core.AOS && targets.Count > 2 )
|
||||
damage = (damage * 2) / targets.Count;
|
||||
else if ( !Core.AOS )
|
||||
damage /= targets.Count;
|
||||
if (targets.Count > 0)
|
||||
{
|
||||
if (Core.AOS && targets.Count > 2)
|
||||
damage = damage * 2 / targets.Count;
|
||||
else if (!Core.AOS)
|
||||
damage /= targets.Count;
|
||||
|
||||
double toDeal;
|
||||
for ( int i = 0; i < targets.Count; ++i )
|
||||
{
|
||||
toDeal = damage;
|
||||
Mobile m = targets[i];
|
||||
double toDeal;
|
||||
for (int i = 0; i < targets.Count; ++i)
|
||||
{
|
||||
toDeal = damage;
|
||||
Mobile m = targets[i];
|
||||
|
||||
if ( !Core.AOS && CheckResisted( m ) )
|
||||
{
|
||||
toDeal *= 0.5;
|
||||
if (!Core.AOS && CheckResisted(m))
|
||||
{
|
||||
toDeal *= 0.5;
|
||||
|
||||
m.SendLocalizedMessage( 501783 ); // You feel yourself resisting magical energy.
|
||||
}
|
||||
toDeal *= GetDamageScalar( m );
|
||||
Caster.DoHarmful( m );
|
||||
SpellHelper.Damage( this, m, toDeal, 0, 0, 0, 0, 100 );
|
||||
m.SendLocalizedMessage(501783); // You feel yourself resisting magical energy.
|
||||
}
|
||||
|
||||
m.BoltEffect( 0 );
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
Caster.PlaySound ( 0x29 );
|
||||
}
|
||||
}
|
||||
toDeal *= GetDamageScalar(m);
|
||||
Caster.DoHarmful(m);
|
||||
SpellHelper.Damage(this, m, toDeal, 0, 0, 0, 0, 100);
|
||||
|
||||
FinishSequence();
|
||||
}
|
||||
m.BoltEffect(0);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
Caster.PlaySound(0x29);
|
||||
}
|
||||
}
|
||||
|
||||
private class InternalTarget : Target
|
||||
{
|
||||
private ChainLightningSpell m_Owner;
|
||||
FinishSequence();
|
||||
}
|
||||
|
||||
public InternalTarget( ChainLightningSpell owner ) : base( Core.ML ? 10 : 12, true, TargetFlags.None )
|
||||
{
|
||||
m_Owner = owner;
|
||||
}
|
||||
private class InternalTarget : Target
|
||||
{
|
||||
private ChainLightningSpell m_Owner;
|
||||
|
||||
protected override void OnTarget( Mobile from, object o )
|
||||
{
|
||||
IPoint3D p = o as IPoint3D;
|
||||
public InternalTarget(ChainLightningSpell owner) : base(Core.ML ? 10 : 12, true, TargetFlags.None)
|
||||
{
|
||||
m_Owner = owner;
|
||||
}
|
||||
|
||||
if ( p != null )
|
||||
m_Owner.Target( p );
|
||||
}
|
||||
protected override void OnTarget(Mobile from, object o)
|
||||
{
|
||||
IPoint3D p = o as IPoint3D;
|
||||
|
||||
protected override void OnTargetFinish( Mobile from )
|
||||
{
|
||||
m_Owner.FinishSequence();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if (p != null)
|
||||
m_Owner.Target(p);
|
||||
}
|
||||
|
||||
protected override void OnTargetFinish(Mobile from)
|
||||
{
|
||||
m_Owner.FinishSequence();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1,206 +1,201 @@
|
|||
using System;
|
||||
using Server.Targeting;
|
||||
using Server.Misc;
|
||||
using Server.Items;
|
||||
using Server.Misc;
|
||||
using Server.Mobiles;
|
||||
using Server.Targeting;
|
||||
|
||||
namespace Server.Spells.Seventh
|
||||
{
|
||||
public class EnergyFieldSpell : MagerySpell
|
||||
{
|
||||
private static SpellInfo m_Info = new SpellInfo(
|
||||
"Energy Field", "In Sanct Grav",
|
||||
221,
|
||||
9022,
|
||||
false,
|
||||
Reagent.BlackPearl,
|
||||
Reagent.MandrakeRoot,
|
||||
Reagent.SpidersSilk,
|
||||
Reagent.SulfurousAsh
|
||||
);
|
||||
public class EnergyFieldSpell : MagerySpell
|
||||
{
|
||||
private static SpellInfo m_Info = new SpellInfo(
|
||||
"Energy Field", "In Sanct Grav",
|
||||
221,
|
||||
9022,
|
||||
false,
|
||||
Reagent.BlackPearl,
|
||||
Reagent.MandrakeRoot,
|
||||
Reagent.SpidersSilk,
|
||||
Reagent.SulfurousAsh
|
||||
);
|
||||
|
||||
public override SpellCircle Circle => SpellCircle.Seventh;
|
||||
public EnergyFieldSpell(Mobile caster, Item scroll) : base(caster, scroll, m_Info)
|
||||
{
|
||||
}
|
||||
|
||||
public EnergyFieldSpell( Mobile caster, Item scroll ) : base( caster, scroll, m_Info )
|
||||
{
|
||||
}
|
||||
public override SpellCircle Circle => SpellCircle.Seventh;
|
||||
|
||||
public override void OnCast()
|
||||
{
|
||||
Caster.Target = new InternalTarget( this );
|
||||
}
|
||||
public override void OnCast()
|
||||
{
|
||||
Caster.Target = new InternalTarget(this);
|
||||
}
|
||||
|
||||
public void Target( IPoint3D p )
|
||||
{
|
||||
if ( !Caster.CanSee( p ) )
|
||||
{
|
||||
Caster.SendLocalizedMessage( 500237 ); // Target can not be seen.
|
||||
}
|
||||
else if ( SpellHelper.CheckTown( p, Caster ) && CheckSequence() )
|
||||
{
|
||||
SpellHelper.Turn( Caster, p );
|
||||
public void Target(IPoint3D p)
|
||||
{
|
||||
if (!Caster.CanSee(p))
|
||||
{
|
||||
Caster.SendLocalizedMessage(500237); // Target can not be seen.
|
||||
}
|
||||
else if (SpellHelper.CheckTown(p, Caster) && CheckSequence())
|
||||
{
|
||||
SpellHelper.Turn(Caster, p);
|
||||
|
||||
SpellHelper.GetSurfaceTop( ref p );
|
||||
SpellHelper.GetSurfaceTop(ref p);
|
||||
|
||||
int dx = Caster.Location.X - p.X;
|
||||
int dy = Caster.Location.Y - p.Y;
|
||||
int rx = (dx - dy) * 44;
|
||||
int ry = (dx + dy) * 44;
|
||||
int dx = Caster.Location.X - p.X;
|
||||
int dy = Caster.Location.Y - p.Y;
|
||||
int rx = (dx - dy) * 44;
|
||||
int ry = (dx + dy) * 44;
|
||||
|
||||
bool eastToWest;
|
||||
bool eastToWest;
|
||||
|
||||
if ( rx >= 0 && ry >= 0 )
|
||||
{
|
||||
eastToWest = false;
|
||||
}
|
||||
else if ( rx >= 0 )
|
||||
{
|
||||
eastToWest = true;
|
||||
}
|
||||
else if ( ry >= 0 )
|
||||
{
|
||||
eastToWest = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
eastToWest = false;
|
||||
}
|
||||
if (rx >= 0 && ry >= 0)
|
||||
eastToWest = false;
|
||||
else if (rx >= 0)
|
||||
eastToWest = true;
|
||||
else if (ry >= 0)
|
||||
eastToWest = true;
|
||||
else
|
||||
eastToWest = false;
|
||||
|
||||
Effects.PlaySound( p, Caster.Map, 0x20B );
|
||||
Effects.PlaySound(p, Caster.Map, 0x20B);
|
||||
|
||||
TimeSpan duration;
|
||||
TimeSpan duration;
|
||||
|
||||
if ( Core.AOS )
|
||||
duration = TimeSpan.FromSeconds( (15 + (Caster.Skills.Magery.Fixed / 5)) / 7 );
|
||||
else
|
||||
duration = TimeSpan.FromSeconds( Caster.Skills[SkillName.Magery].Value * 0.28 + 2.0 ); // (28% of magery) + 2.0 seconds
|
||||
if (Core.AOS)
|
||||
duration = TimeSpan.FromSeconds((15 + Caster.Skills.Magery.Fixed / 5) / 7);
|
||||
else
|
||||
duration = TimeSpan.FromSeconds(Caster.Skills[SkillName.Magery].Value * 0.28 +
|
||||
2.0); // (28% of magery) + 2.0 seconds
|
||||
|
||||
int itemID = eastToWest ? 0x3946 : 0x3956;
|
||||
int itemID = eastToWest ? 0x3946 : 0x3956;
|
||||
|
||||
for ( int i = -2; i <= 2; ++i )
|
||||
{
|
||||
Point3D loc = new Point3D( eastToWest ? p.X + i : p.X, eastToWest ? p.Y : p.Y + i, p.Z );
|
||||
bool canFit = SpellHelper.AdjustField( ref loc, Caster.Map, 12, false );
|
||||
for (int i = -2; i <= 2; ++i)
|
||||
{
|
||||
Point3D loc = new Point3D(eastToWest ? p.X + i : p.X, eastToWest ? p.Y : p.Y + i, p.Z);
|
||||
bool canFit = SpellHelper.AdjustField(ref loc, Caster.Map, 12, false);
|
||||
|
||||
if ( !canFit )
|
||||
continue;
|
||||
if (!canFit)
|
||||
continue;
|
||||
|
||||
Item item = new InternalItem( loc, Caster.Map, duration, itemID, Caster );
|
||||
item.ProcessDelta();
|
||||
Item item = new InternalItem(loc, Caster.Map, duration, itemID, Caster);
|
||||
item.ProcessDelta();
|
||||
|
||||
Effects.SendLocationParticles( EffectItem.Create( loc, Caster.Map, EffectItem.DefaultDuration ), 0x376A, 9, 10, 5051 );
|
||||
}
|
||||
}
|
||||
Effects.SendLocationParticles(EffectItem.Create(loc, Caster.Map, EffectItem.DefaultDuration), 0x376A, 9,
|
||||
10, 5051);
|
||||
}
|
||||
}
|
||||
|
||||
FinishSequence();
|
||||
}
|
||||
FinishSequence();
|
||||
}
|
||||
|
||||
[DispellableField]
|
||||
private class InternalItem : Item
|
||||
{
|
||||
private Timer m_Timer;
|
||||
private Mobile m_Caster;
|
||||
[DispellableField]
|
||||
private class InternalItem : Item
|
||||
{
|
||||
private Mobile m_Caster;
|
||||
private Timer m_Timer;
|
||||
|
||||
public override bool BlocksFit => true;
|
||||
public InternalItem(Point3D loc, Map map, TimeSpan duration, int itemID, Mobile caster) : base(itemID)
|
||||
{
|
||||
Visible = false;
|
||||
Movable = false;
|
||||
Light = LightType.Circle300;
|
||||
|
||||
public InternalItem( Point3D loc, Map map, TimeSpan duration, int itemID, Mobile caster ) : base( itemID )
|
||||
{
|
||||
Visible = false;
|
||||
Movable = false;
|
||||
Light = LightType.Circle300;
|
||||
MoveToWorld(loc, map);
|
||||
|
||||
MoveToWorld( loc, map );
|
||||
m_Caster = caster;
|
||||
|
||||
m_Caster = caster;
|
||||
if (caster.InLOS(this))
|
||||
Visible = true;
|
||||
else
|
||||
Delete();
|
||||
|
||||
if ( caster.InLOS( this ) )
|
||||
Visible = true;
|
||||
else
|
||||
Delete();
|
||||
if (Deleted)
|
||||
return;
|
||||
|
||||
if ( Deleted )
|
||||
return;
|
||||
m_Timer = new InternalTimer(this, duration);
|
||||
m_Timer.Start();
|
||||
}
|
||||
|
||||
m_Timer = new InternalTimer( this, duration );
|
||||
m_Timer.Start();
|
||||
}
|
||||
public InternalItem(Serial serial) : base(serial)
|
||||
{
|
||||
m_Timer = new InternalTimer(this, TimeSpan.FromSeconds(5.0));
|
||||
m_Timer.Start();
|
||||
}
|
||||
|
||||
public InternalItem( Serial serial ) : base( serial )
|
||||
{
|
||||
m_Timer = new InternalTimer( this, TimeSpan.FromSeconds( 5.0 ) );
|
||||
m_Timer.Start();
|
||||
}
|
||||
public override bool BlocksFit => true;
|
||||
|
||||
public override void Serialize( GenericWriter writer )
|
||||
{
|
||||
base.Serialize( writer );
|
||||
public override void Serialize(GenericWriter writer)
|
||||
{
|
||||
base.Serialize(writer);
|
||||
|
||||
writer.Write( (int) 0 ); // version
|
||||
}
|
||||
writer.Write(0); // version
|
||||
}
|
||||
|
||||
public override void Deserialize( GenericReader reader )
|
||||
{
|
||||
base.Deserialize( reader );
|
||||
public override void Deserialize(GenericReader reader)
|
||||
{
|
||||
base.Deserialize(reader);
|
||||
|
||||
int version = reader.ReadInt();
|
||||
}
|
||||
int version = reader.ReadInt();
|
||||
}
|
||||
|
||||
public override bool OnMoveOver( Mobile m )
|
||||
{
|
||||
int noto;
|
||||
public override bool OnMoveOver(Mobile m)
|
||||
{
|
||||
int noto;
|
||||
|
||||
if ( m is PlayerMobile )
|
||||
{
|
||||
noto = Notoriety.Compute( m_Caster, m );
|
||||
if ( noto == Notoriety.Enemy || noto == Notoriety.Ally )
|
||||
return false;
|
||||
}
|
||||
return base.OnMoveOver( m );
|
||||
}
|
||||
if (m is PlayerMobile)
|
||||
{
|
||||
noto = Notoriety.Compute(m_Caster, m);
|
||||
if (noto == Notoriety.Enemy || noto == Notoriety.Ally)
|
||||
return false;
|
||||
}
|
||||
|
||||
public override void OnAfterDelete()
|
||||
{
|
||||
base.OnAfterDelete();
|
||||
return base.OnMoveOver(m);
|
||||
}
|
||||
|
||||
m_Timer?.Stop();
|
||||
}
|
||||
public override void OnAfterDelete()
|
||||
{
|
||||
base.OnAfterDelete();
|
||||
|
||||
private class InternalTimer : Timer
|
||||
{
|
||||
private InternalItem m_Item;
|
||||
m_Timer?.Stop();
|
||||
}
|
||||
|
||||
public InternalTimer( InternalItem item, TimeSpan duration ) : base( duration )
|
||||
{
|
||||
Priority = TimerPriority.OneSecond;
|
||||
m_Item = item;
|
||||
}
|
||||
private class InternalTimer : Timer
|
||||
{
|
||||
private InternalItem m_Item;
|
||||
|
||||
protected override void OnTick()
|
||||
{
|
||||
m_Item.Delete();
|
||||
}
|
||||
}
|
||||
}
|
||||
public InternalTimer(InternalItem item, TimeSpan duration) : base(duration)
|
||||
{
|
||||
Priority = TimerPriority.OneSecond;
|
||||
m_Item = item;
|
||||
}
|
||||
|
||||
private class InternalTarget : Target
|
||||
{
|
||||
private EnergyFieldSpell m_Owner;
|
||||
protected override void OnTick()
|
||||
{
|
||||
m_Item.Delete();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public InternalTarget( EnergyFieldSpell owner ) : base( Core.ML ? 10 : 12, true, TargetFlags.None )
|
||||
{
|
||||
m_Owner = owner;
|
||||
}
|
||||
private class InternalTarget : Target
|
||||
{
|
||||
private EnergyFieldSpell m_Owner;
|
||||
|
||||
protected override void OnTarget( Mobile from, object o )
|
||||
{
|
||||
if ( o is IPoint3D )
|
||||
m_Owner.Target( (IPoint3D)o );
|
||||
}
|
||||
public InternalTarget(EnergyFieldSpell owner) : base(Core.ML ? 10 : 12, true, TargetFlags.None)
|
||||
{
|
||||
m_Owner = owner;
|
||||
}
|
||||
|
||||
protected override void OnTargetFinish( Mobile from )
|
||||
{
|
||||
m_Owner.FinishSequence();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
protected override void OnTarget(Mobile from, object o)
|
||||
{
|
||||
if (o is IPoint3D)
|
||||
m_Owner.Target((IPoint3D)o);
|
||||
}
|
||||
|
||||
protected override void OnTargetFinish(Mobile from)
|
||||
{
|
||||
m_Owner.FinishSequence();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -2,91 +2,88 @@ using Server.Targeting;
|
|||
|
||||
namespace Server.Spells.Seventh
|
||||
{
|
||||
public class FlameStrikeSpell : MagerySpell
|
||||
{
|
||||
private static SpellInfo m_Info = new SpellInfo(
|
||||
"Flame Strike", "Kal Vas Flam",
|
||||
245,
|
||||
9042,
|
||||
Reagent.SpidersSilk,
|
||||
Reagent.SulfurousAsh
|
||||
);
|
||||
public class FlameStrikeSpell : MagerySpell
|
||||
{
|
||||
private static SpellInfo m_Info = new SpellInfo(
|
||||
"Flame Strike", "Kal Vas Flam",
|
||||
245,
|
||||
9042,
|
||||
Reagent.SpidersSilk,
|
||||
Reagent.SulfurousAsh
|
||||
);
|
||||
|
||||
public override SpellCircle Circle => SpellCircle.Seventh;
|
||||
public FlameStrikeSpell(Mobile caster, Item scroll) : base(caster, scroll, m_Info)
|
||||
{
|
||||
}
|
||||
|
||||
public FlameStrikeSpell( Mobile caster, Item scroll ) : base( caster, scroll, m_Info )
|
||||
{
|
||||
}
|
||||
public override SpellCircle Circle => SpellCircle.Seventh;
|
||||
|
||||
public override void OnCast()
|
||||
{
|
||||
Caster.Target = new InternalTarget( this );
|
||||
}
|
||||
public override bool DelayedDamage => true;
|
||||
|
||||
public override bool DelayedDamage => true;
|
||||
public override void OnCast()
|
||||
{
|
||||
Caster.Target = new InternalTarget(this);
|
||||
}
|
||||
|
||||
public void Target( Mobile m )
|
||||
{
|
||||
if ( !Caster.CanSee( m ) )
|
||||
{
|
||||
Caster.SendLocalizedMessage( 500237 ); // Target can not be seen.
|
||||
}
|
||||
else if ( CheckHSequence( m ) )
|
||||
{
|
||||
SpellHelper.Turn( Caster, m );
|
||||
public void Target(Mobile m)
|
||||
{
|
||||
if (!Caster.CanSee(m))
|
||||
{
|
||||
Caster.SendLocalizedMessage(500237); // Target can not be seen.
|
||||
}
|
||||
else if (CheckHSequence(m))
|
||||
{
|
||||
SpellHelper.Turn(Caster, m);
|
||||
|
||||
SpellHelper.CheckReflect( (int)Circle, Caster, ref m );
|
||||
SpellHelper.CheckReflect((int)Circle, Caster, ref m);
|
||||
|
||||
double damage;
|
||||
double damage;
|
||||
|
||||
if ( Core.AOS )
|
||||
{
|
||||
damage = GetNewAosDamage( 48, 1, 5, m );
|
||||
}
|
||||
else
|
||||
{
|
||||
damage = Utility.Random( 27, 22 );
|
||||
if (Core.AOS)
|
||||
{
|
||||
damage = GetNewAosDamage(48, 1, 5, m);
|
||||
}
|
||||
else
|
||||
{
|
||||
damage = Utility.Random(27, 22);
|
||||
|
||||
if ( CheckResisted( m ) )
|
||||
{
|
||||
damage *= 0.6;
|
||||
if (CheckResisted(m))
|
||||
{
|
||||
damage *= 0.6;
|
||||
|
||||
m.SendLocalizedMessage( 501783 ); // You feel yourself resisting magical energy.
|
||||
}
|
||||
m.SendLocalizedMessage(501783); // You feel yourself resisting magical energy.
|
||||
}
|
||||
|
||||
damage *= GetDamageScalar( m );
|
||||
}
|
||||
damage *= GetDamageScalar(m);
|
||||
}
|
||||
|
||||
m.FixedParticles( 0x3709, 10, 30, 5052, EffectLayer.LeftFoot );
|
||||
m.PlaySound( 0x208 );
|
||||
m.FixedParticles(0x3709, 10, 30, 5052, EffectLayer.LeftFoot);
|
||||
m.PlaySound(0x208);
|
||||
|
||||
SpellHelper.Damage( this, m, damage, 0, 100, 0, 0, 0 );
|
||||
}
|
||||
SpellHelper.Damage(this, m, damage, 0, 100, 0, 0, 0);
|
||||
}
|
||||
|
||||
FinishSequence();
|
||||
}
|
||||
FinishSequence();
|
||||
}
|
||||
|
||||
private class InternalTarget : Target
|
||||
{
|
||||
private FlameStrikeSpell m_Owner;
|
||||
private class InternalTarget : Target
|
||||
{
|
||||
private FlameStrikeSpell m_Owner;
|
||||
|
||||
public InternalTarget( FlameStrikeSpell owner ) : base( Core.ML ? 10 : 12, false, TargetFlags.Harmful )
|
||||
{
|
||||
m_Owner = owner;
|
||||
}
|
||||
public InternalTarget(FlameStrikeSpell owner) : base(Core.ML ? 10 : 12, false, TargetFlags.Harmful)
|
||||
{
|
||||
m_Owner = owner;
|
||||
}
|
||||
|
||||
protected override void OnTarget( Mobile from, object o )
|
||||
{
|
||||
if ( o is Mobile )
|
||||
{
|
||||
m_Owner.Target( (Mobile)o );
|
||||
}
|
||||
}
|
||||
protected override void OnTarget(Mobile from, object o)
|
||||
{
|
||||
if (o is Mobile) m_Owner.Target((Mobile)o);
|
||||
}
|
||||
|
||||
protected override void OnTargetFinish( Mobile from )
|
||||
{
|
||||
m_Owner.FinishSequence();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
protected override void OnTargetFinish(Mobile from)
|
||||
{
|
||||
m_Owner.FinishSequence();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1,257 +1,260 @@
|
|||
using System;
|
||||
using Server.Network;
|
||||
using Server.Factions;
|
||||
using Server.Items;
|
||||
using Server.Targeting;
|
||||
using Server.Misc;
|
||||
using Server.Mobiles;
|
||||
using Server.Network;
|
||||
using Server.Targeting;
|
||||
|
||||
namespace Server.Spells.Seventh
|
||||
{
|
||||
public class GateTravelSpell : MagerySpell
|
||||
{
|
||||
private static SpellInfo m_Info = new SpellInfo(
|
||||
"Gate Travel", "Vas Rel Por",
|
||||
263,
|
||||
9032,
|
||||
Reagent.BlackPearl,
|
||||
Reagent.MandrakeRoot,
|
||||
Reagent.SulfurousAsh
|
||||
);
|
||||
public class GateTravelSpell : MagerySpell
|
||||
{
|
||||
private static SpellInfo m_Info = new SpellInfo(
|
||||
"Gate Travel", "Vas Rel Por",
|
||||
263,
|
||||
9032,
|
||||
Reagent.BlackPearl,
|
||||
Reagent.MandrakeRoot,
|
||||
Reagent.SulfurousAsh
|
||||
);
|
||||
|
||||
public override SpellCircle Circle => SpellCircle.Seventh;
|
||||
private RunebookEntry m_Entry;
|
||||
|
||||
private RunebookEntry m_Entry;
|
||||
public GateTravelSpell(Mobile caster, Item scroll) : this(caster, scroll, null)
|
||||
{
|
||||
}
|
||||
|
||||
public GateTravelSpell( Mobile caster, Item scroll ) : this( caster, scroll, null )
|
||||
{
|
||||
}
|
||||
public GateTravelSpell(Mobile caster, Item scroll, RunebookEntry entry) : base(caster, scroll, m_Info)
|
||||
{
|
||||
m_Entry = entry;
|
||||
}
|
||||
|
||||
public GateTravelSpell( Mobile caster, Item scroll, RunebookEntry entry ) : base( caster, scroll, m_Info )
|
||||
{
|
||||
m_Entry = entry;
|
||||
}
|
||||
public override SpellCircle Circle => SpellCircle.Seventh;
|
||||
|
||||
public override void OnCast()
|
||||
{
|
||||
if ( m_Entry == null )
|
||||
Caster.Target = new InternalTarget( this );
|
||||
else
|
||||
Effect( m_Entry.Location, m_Entry.Map, true );
|
||||
}
|
||||
public override void OnCast()
|
||||
{
|
||||
if (m_Entry == null)
|
||||
Caster.Target = new InternalTarget(this);
|
||||
else
|
||||
Effect(m_Entry.Location, m_Entry.Map, true);
|
||||
}
|
||||
|
||||
public override bool CheckCast()
|
||||
{
|
||||
if ( Factions.Sigil.ExistsOn( Caster ) )
|
||||
{
|
||||
Caster.SendLocalizedMessage( 1061632 ); // You can't do that while carrying the sigil.
|
||||
return false;
|
||||
}
|
||||
public override bool CheckCast()
|
||||
{
|
||||
if (Sigil.ExistsOn(Caster))
|
||||
{
|
||||
Caster.SendLocalizedMessage(1061632); // You can't do that while carrying the sigil.
|
||||
return false;
|
||||
}
|
||||
|
||||
if ( Caster.Criminal )
|
||||
{
|
||||
Caster.SendLocalizedMessage( 1005561, "", 0x22 ); // Thou'rt a criminal and cannot escape so easily.
|
||||
return false;
|
||||
}
|
||||
if ( SpellHelper.CheckCombat( Caster ) )
|
||||
{
|
||||
Caster.SendLocalizedMessage( 1005564, "", 0x22 ); // Wouldst thou flee during the heat of battle??
|
||||
return false;
|
||||
}
|
||||
if (Caster.Criminal)
|
||||
{
|
||||
Caster.SendLocalizedMessage(1005561, "", 0x22); // Thou'rt a criminal and cannot escape so easily.
|
||||
return false;
|
||||
}
|
||||
|
||||
return SpellHelper.CheckTravel( Caster, TravelCheckType.GateFrom );
|
||||
}
|
||||
if (SpellHelper.CheckCombat(Caster))
|
||||
{
|
||||
Caster.SendLocalizedMessage(1005564, "", 0x22); // Wouldst thou flee during the heat of battle??
|
||||
return false;
|
||||
}
|
||||
|
||||
private bool GateExistsAt(Map map, Point3D loc )
|
||||
{
|
||||
bool _gateFound = false;
|
||||
return SpellHelper.CheckTravel(Caster, TravelCheckType.GateFrom);
|
||||
}
|
||||
|
||||
IPooledEnumerable<Item> eable = map.GetItemsInRange( loc, 0 );
|
||||
foreach ( Item item in eable )
|
||||
{
|
||||
if ( item is Moongate || item is PublicMoongate )
|
||||
{
|
||||
_gateFound = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
eable.Free();
|
||||
private bool GateExistsAt(Map map, Point3D loc)
|
||||
{
|
||||
bool _gateFound = false;
|
||||
|
||||
return _gateFound;
|
||||
}
|
||||
IPooledEnumerable<Item> eable = map.GetItemsInRange(loc, 0);
|
||||
foreach (Item item in eable)
|
||||
if (item is Moongate || item is PublicMoongate)
|
||||
{
|
||||
_gateFound = true;
|
||||
break;
|
||||
}
|
||||
|
||||
public void Effect( Point3D loc, Map map, bool checkMulti )
|
||||
{
|
||||
if ( Factions.Sigil.ExistsOn( Caster ) )
|
||||
{
|
||||
Caster.SendLocalizedMessage( 1061632 ); // You can't do that while carrying the sigil.
|
||||
}
|
||||
else if ( map == null || (!Core.AOS && Caster.Map != map) )
|
||||
{
|
||||
Caster.SendLocalizedMessage( 1005570 ); // You can not gate to another facet.
|
||||
}
|
||||
else if ( !SpellHelper.CheckTravel( Caster, TravelCheckType.GateFrom ) )
|
||||
{
|
||||
}
|
||||
else if ( !SpellHelper.CheckTravel( Caster, map, loc, TravelCheckType.GateTo ) )
|
||||
{
|
||||
}
|
||||
else if ( map == Map.Felucca && Caster is PlayerMobile && ((PlayerMobile)Caster).Young )
|
||||
{
|
||||
Caster.SendLocalizedMessage( 1049543 ); // You decide against traveling to Felucca while you are still young.
|
||||
}
|
||||
else if ( Caster.Kills >= 5 && map != Map.Felucca )
|
||||
{
|
||||
Caster.SendLocalizedMessage( 1019004 ); // You are not allowed to travel there.
|
||||
}
|
||||
else if ( Caster.Criminal )
|
||||
{
|
||||
Caster.SendLocalizedMessage( 1005561, "", 0x22 ); // Thou'rt a criminal and cannot escape so easily.
|
||||
}
|
||||
else if ( SpellHelper.CheckCombat( Caster ) )
|
||||
{
|
||||
Caster.SendLocalizedMessage( 1005564, "", 0x22 ); // Wouldst thou flee during the heat of battle??
|
||||
}
|
||||
else if ( !map.CanSpawnMobile( loc.X, loc.Y, loc.Z ) )
|
||||
{
|
||||
Caster.SendLocalizedMessage( 501942 ); // That location is blocked.
|
||||
}
|
||||
else if ( (checkMulti && SpellHelper.CheckMulti( loc, map )) )
|
||||
{
|
||||
Caster.SendLocalizedMessage( 501942 ); // That location is blocked.
|
||||
}
|
||||
else if ( Core.SE && ( GateExistsAt( map, loc ) || GateExistsAt( Caster.Map, Caster.Location ) ) ) // SE restricted stacking gates
|
||||
{
|
||||
Caster.SendLocalizedMessage( 1071242 ); // There is already a gate there.
|
||||
}
|
||||
else if ( CheckSequence() )
|
||||
{
|
||||
Caster.SendLocalizedMessage( 501024 ); // You open a magical gate to another location
|
||||
eable.Free();
|
||||
|
||||
Effects.PlaySound( Caster.Location, Caster.Map, 0x20E );
|
||||
return _gateFound;
|
||||
}
|
||||
|
||||
InternalItem firstGate = new InternalItem( loc, map );
|
||||
firstGate.MoveToWorld( Caster.Location, Caster.Map );
|
||||
public void Effect(Point3D loc, Map map, bool checkMulti)
|
||||
{
|
||||
if (Sigil.ExistsOn(Caster))
|
||||
{
|
||||
Caster.SendLocalizedMessage(1061632); // You can't do that while carrying the sigil.
|
||||
}
|
||||
else if (map == null || !Core.AOS && Caster.Map != map)
|
||||
{
|
||||
Caster.SendLocalizedMessage(1005570); // You can not gate to another facet.
|
||||
}
|
||||
else if (!SpellHelper.CheckTravel(Caster, TravelCheckType.GateFrom))
|
||||
{
|
||||
}
|
||||
else if (!SpellHelper.CheckTravel(Caster, map, loc, TravelCheckType.GateTo))
|
||||
{
|
||||
}
|
||||
else if (map == Map.Felucca && Caster is PlayerMobile && ((PlayerMobile)Caster).Young)
|
||||
{
|
||||
Caster.SendLocalizedMessage(1049543); // You decide against traveling to Felucca while you are still young.
|
||||
}
|
||||
else if (Caster.Kills >= 5 && map != Map.Felucca)
|
||||
{
|
||||
Caster.SendLocalizedMessage(1019004); // You are not allowed to travel there.
|
||||
}
|
||||
else if (Caster.Criminal)
|
||||
{
|
||||
Caster.SendLocalizedMessage(1005561, "", 0x22); // Thou'rt a criminal and cannot escape so easily.
|
||||
}
|
||||
else if (SpellHelper.CheckCombat(Caster))
|
||||
{
|
||||
Caster.SendLocalizedMessage(1005564, "", 0x22); // Wouldst thou flee during the heat of battle??
|
||||
}
|
||||
else if (!map.CanSpawnMobile(loc.X, loc.Y, loc.Z))
|
||||
{
|
||||
Caster.SendLocalizedMessage(501942); // That location is blocked.
|
||||
}
|
||||
else if (checkMulti && SpellHelper.CheckMulti(loc, map))
|
||||
{
|
||||
Caster.SendLocalizedMessage(501942); // That location is blocked.
|
||||
}
|
||||
else if (Core.SE && (GateExistsAt(map, loc) || GateExistsAt(Caster.Map, Caster.Location))
|
||||
) // SE restricted stacking gates
|
||||
{
|
||||
Caster.SendLocalizedMessage(1071242); // There is already a gate there.
|
||||
}
|
||||
else if (CheckSequence())
|
||||
{
|
||||
Caster.SendLocalizedMessage(501024); // You open a magical gate to another location
|
||||
|
||||
Effects.PlaySound( loc, map, 0x20E );
|
||||
Effects.PlaySound(Caster.Location, Caster.Map, 0x20E);
|
||||
|
||||
InternalItem secondGate = new InternalItem( Caster.Location, Caster.Map );
|
||||
secondGate.MoveToWorld( loc, map );
|
||||
}
|
||||
InternalItem firstGate = new InternalItem(loc, map);
|
||||
firstGate.MoveToWorld(Caster.Location, Caster.Map);
|
||||
|
||||
FinishSequence();
|
||||
}
|
||||
Effects.PlaySound(loc, map, 0x20E);
|
||||
|
||||
[DispellableField]
|
||||
private class InternalItem : Moongate
|
||||
{
|
||||
public override bool ShowFeluccaWarning => Core.AOS;
|
||||
InternalItem secondGate = new InternalItem(Caster.Location, Caster.Map);
|
||||
secondGate.MoveToWorld(loc, map);
|
||||
}
|
||||
|
||||
public InternalItem( Point3D target, Map map ) : base( target, map )
|
||||
{
|
||||
Map = map;
|
||||
FinishSequence();
|
||||
}
|
||||
|
||||
if ( ShowFeluccaWarning && map == Map.Felucca )
|
||||
ItemID = 0xDDA;
|
||||
[DispellableField]
|
||||
private class InternalItem : Moongate
|
||||
{
|
||||
public InternalItem(Point3D target, Map map) : base(target, map)
|
||||
{
|
||||
Map = map;
|
||||
|
||||
Dispellable = true;
|
||||
if (ShowFeluccaWarning && map == Map.Felucca)
|
||||
ItemID = 0xDDA;
|
||||
|
||||
InternalTimer t = new InternalTimer( this );
|
||||
t.Start();
|
||||
}
|
||||
Dispellable = true;
|
||||
|
||||
public InternalItem( Serial serial ) : base( serial )
|
||||
{
|
||||
}
|
||||
InternalTimer t = new InternalTimer(this);
|
||||
t.Start();
|
||||
}
|
||||
|
||||
public override void Serialize( GenericWriter writer )
|
||||
{
|
||||
base.Serialize( writer );
|
||||
}
|
||||
public InternalItem(Serial serial) : base(serial)
|
||||
{
|
||||
}
|
||||
|
||||
public override void Deserialize( GenericReader reader )
|
||||
{
|
||||
base.Deserialize( reader );
|
||||
public override bool ShowFeluccaWarning => Core.AOS;
|
||||
|
||||
Delete();
|
||||
}
|
||||
public override void Serialize(GenericWriter writer)
|
||||
{
|
||||
base.Serialize(writer);
|
||||
}
|
||||
|
||||
private class InternalTimer : Timer
|
||||
{
|
||||
private Item m_Item;
|
||||
public override void Deserialize(GenericReader reader)
|
||||
{
|
||||
base.Deserialize(reader);
|
||||
|
||||
public InternalTimer( Item item ) : base( TimeSpan.FromSeconds( 30.0 ) )
|
||||
{
|
||||
Priority = TimerPriority.OneSecond;
|
||||
m_Item = item;
|
||||
}
|
||||
Delete();
|
||||
}
|
||||
|
||||
protected override void OnTick()
|
||||
{
|
||||
m_Item.Delete();
|
||||
}
|
||||
}
|
||||
}
|
||||
private class InternalTimer : Timer
|
||||
{
|
||||
private Item m_Item;
|
||||
|
||||
private class InternalTarget : Target
|
||||
{
|
||||
private GateTravelSpell m_Owner;
|
||||
public InternalTimer(Item item) : base(TimeSpan.FromSeconds(30.0))
|
||||
{
|
||||
Priority = TimerPriority.OneSecond;
|
||||
m_Item = item;
|
||||
}
|
||||
|
||||
public InternalTarget( GateTravelSpell owner ) : base( 12, false, TargetFlags.None )
|
||||
{
|
||||
m_Owner = owner;
|
||||
protected override void OnTick()
|
||||
{
|
||||
m_Item.Delete();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
owner.Caster.LocalOverheadMessage( MessageType.Regular, 0x3B2, 501029 ); // Select Marked item.
|
||||
}
|
||||
private class InternalTarget : Target
|
||||
{
|
||||
private GateTravelSpell m_Owner;
|
||||
|
||||
protected override void OnTarget( Mobile from, object o )
|
||||
{
|
||||
if ( o is RecallRune )
|
||||
{
|
||||
RecallRune rune = (RecallRune)o;
|
||||
public InternalTarget(GateTravelSpell owner) : base(12, false, TargetFlags.None)
|
||||
{
|
||||
m_Owner = owner;
|
||||
|
||||
if ( rune.Marked )
|
||||
m_Owner.Effect( rune.Target, rune.TargetMap, true );
|
||||
else
|
||||
from.SendLocalizedMessage( 501803 ); // That rune is not yet marked.
|
||||
}
|
||||
else if ( o is Runebook )
|
||||
{
|
||||
RunebookEntry e = ((Runebook)o).Default;
|
||||
owner.Caster.LocalOverheadMessage(MessageType.Regular, 0x3B2, 501029); // Select Marked item.
|
||||
}
|
||||
|
||||
if ( e != null )
|
||||
m_Owner.Effect( e.Location, e.Map, true );
|
||||
else
|
||||
from.SendLocalizedMessage( 502354 ); // Target is not marked.
|
||||
}
|
||||
/*else if ( o is Key && ((Key)o).KeyValue != 0 && ((Key)o).Link is BaseBoat )
|
||||
{
|
||||
BaseBoat boat = ((Key)o).Link as BaseBoat;
|
||||
protected override void OnTarget(Mobile from, object o)
|
||||
{
|
||||
if (o is RecallRune)
|
||||
{
|
||||
RecallRune rune = (RecallRune)o;
|
||||
|
||||
if ( !boat.Deleted && boat.CheckKey( ((Key)o).KeyValue ) )
|
||||
m_Owner.Effect( boat.GetMarkedLocation(), boat.Map, false );
|
||||
else
|
||||
from.Send( new MessageLocalized( from.Serial, from.Body, MessageType.Regular, 0x3B2, 3, 501030, from.Name, "" ) ); // I can not gate travel from that object.
|
||||
}*/
|
||||
else if ( o is HouseRaffleDeed && ((HouseRaffleDeed)o).ValidLocation() )
|
||||
{
|
||||
HouseRaffleDeed deed = (HouseRaffleDeed)o;
|
||||
if (rune.Marked)
|
||||
m_Owner.Effect(rune.Target, rune.TargetMap, true);
|
||||
else
|
||||
from.SendLocalizedMessage(501803); // That rune is not yet marked.
|
||||
}
|
||||
else if (o is Runebook)
|
||||
{
|
||||
RunebookEntry e = ((Runebook)o).Default;
|
||||
|
||||
m_Owner.Effect( deed.PlotLocation, deed.PlotFacet, true );
|
||||
}
|
||||
else
|
||||
{
|
||||
from.Send( new MessageLocalized( from.Serial, from.Body, MessageType.Regular, 0x3B2, 3, 501030, from.Name, "" ) ); // I can not gate travel from that object.
|
||||
}
|
||||
}
|
||||
if (e != null)
|
||||
m_Owner.Effect(e.Location, e.Map, true);
|
||||
else
|
||||
from.SendLocalizedMessage(502354); // Target is not marked.
|
||||
}
|
||||
/*else if ( o is Key && ((Key)o).KeyValue != 0 && ((Key)o).Link is BaseBoat )
|
||||
{
|
||||
BaseBoat boat = ((Key)o).Link as BaseBoat;
|
||||
|
||||
protected override void OnNonlocalTarget( Mobile from, object o )
|
||||
{
|
||||
}
|
||||
if ( !boat.Deleted && boat.CheckKey( ((Key)o).KeyValue ) )
|
||||
m_Owner.Effect( boat.GetMarkedLocation(), boat.Map, false );
|
||||
else
|
||||
from.Send( new MessageLocalized( from.Serial, from.Body, MessageType.Regular, 0x3B2, 3, 501030, from.Name, "" ) ); // I can not gate travel from that object.
|
||||
}*/
|
||||
else if (o is HouseRaffleDeed && ((HouseRaffleDeed)o).ValidLocation())
|
||||
{
|
||||
HouseRaffleDeed deed = (HouseRaffleDeed)o;
|
||||
|
||||
protected override void OnTargetFinish( Mobile from )
|
||||
{
|
||||
m_Owner.FinishSequence();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
m_Owner.Effect(deed.PlotLocation, deed.PlotFacet, true);
|
||||
}
|
||||
else
|
||||
{
|
||||
from.Send(new MessageLocalized(from.Serial, from.Body, MessageType.Regular, 0x3B2, 3, 501030, from.Name,
|
||||
"")); // I can not gate travel from that object.
|
||||
}
|
||||
}
|
||||
|
||||
protected override void OnNonlocalTarget(Mobile from, object o)
|
||||
{
|
||||
}
|
||||
|
||||
protected override void OnTargetFinish(Mobile from)
|
||||
{
|
||||
m_Owner.FinishSequence();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -2,118 +2,115 @@ using Server.Targeting;
|
|||
|
||||
namespace Server.Spells.Seventh
|
||||
{
|
||||
public class ManaVampireSpell : MagerySpell
|
||||
{
|
||||
private static SpellInfo m_Info = new SpellInfo(
|
||||
"Mana Vampire", "Ort Sanct",
|
||||
221,
|
||||
9032,
|
||||
Reagent.BlackPearl,
|
||||
Reagent.Bloodmoss,
|
||||
Reagent.MandrakeRoot,
|
||||
Reagent.SpidersSilk
|
||||
);
|
||||
public class ManaVampireSpell : MagerySpell
|
||||
{
|
||||
private static SpellInfo m_Info = new SpellInfo(
|
||||
"Mana Vampire", "Ort Sanct",
|
||||
221,
|
||||
9032,
|
||||
Reagent.BlackPearl,
|
||||
Reagent.Bloodmoss,
|
||||
Reagent.MandrakeRoot,
|
||||
Reagent.SpidersSilk
|
||||
);
|
||||
|
||||
public override SpellCircle Circle => SpellCircle.Seventh;
|
||||
public ManaVampireSpell(Mobile caster, Item scroll) : base(caster, scroll, m_Info)
|
||||
{
|
||||
}
|
||||
|
||||
public ManaVampireSpell( Mobile caster, Item scroll ) : base( caster, scroll, m_Info )
|
||||
{
|
||||
}
|
||||
public override SpellCircle Circle => SpellCircle.Seventh;
|
||||
|
||||
public override void OnCast()
|
||||
{
|
||||
Caster.Target = new InternalTarget( this );
|
||||
}
|
||||
public override void OnCast()
|
||||
{
|
||||
Caster.Target = new InternalTarget(this);
|
||||
}
|
||||
|
||||
public void Target( Mobile m )
|
||||
{
|
||||
if ( !Caster.CanSee( m ) )
|
||||
{
|
||||
Caster.SendLocalizedMessage( 500237 ); // Target can not be seen.
|
||||
}
|
||||
else if ( CheckHSequence( m ) )
|
||||
{
|
||||
SpellHelper.Turn( Caster, m );
|
||||
public void Target(Mobile m)
|
||||
{
|
||||
if (!Caster.CanSee(m))
|
||||
{
|
||||
Caster.SendLocalizedMessage(500237); // Target can not be seen.
|
||||
}
|
||||
else if (CheckHSequence(m))
|
||||
{
|
||||
SpellHelper.Turn(Caster, m);
|
||||
|
||||
SpellHelper.CheckReflect( (int)Circle, Caster, ref m );
|
||||
SpellHelper.CheckReflect((int)Circle, Caster, ref m);
|
||||
|
||||
m.Spell?.OnCasterHurt();
|
||||
m.Spell?.OnCasterHurt();
|
||||
|
||||
m.Paralyzed = false;
|
||||
m.Paralyzed = false;
|
||||
|
||||
int toDrain = 0;
|
||||
int toDrain = 0;
|
||||
|
||||
if ( Core.AOS )
|
||||
{
|
||||
toDrain = (int)(GetDamageSkill( Caster ) - GetResistSkill( m ));
|
||||
if (Core.AOS)
|
||||
{
|
||||
toDrain = (int)(GetDamageSkill(Caster) - GetResistSkill(m));
|
||||
|
||||
if ( !m.Player )
|
||||
toDrain /= 2;
|
||||
if (!m.Player)
|
||||
toDrain /= 2;
|
||||
|
||||
if ( toDrain < 0 )
|
||||
toDrain = 0;
|
||||
else if ( toDrain > m.Mana )
|
||||
toDrain = m.Mana;
|
||||
}
|
||||
else
|
||||
{
|
||||
if ( CheckResisted( m ) )
|
||||
m.SendLocalizedMessage( 501783 ); // You feel yourself resisting magical energy.
|
||||
else
|
||||
toDrain = m.Mana;
|
||||
}
|
||||
if (toDrain < 0)
|
||||
toDrain = 0;
|
||||
else if (toDrain > m.Mana)
|
||||
toDrain = m.Mana;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (CheckResisted(m))
|
||||
m.SendLocalizedMessage(501783); // You feel yourself resisting magical energy.
|
||||
else
|
||||
toDrain = m.Mana;
|
||||
}
|
||||
|
||||
if ( toDrain > (Caster.ManaMax - Caster.Mana) )
|
||||
toDrain = Caster.ManaMax - Caster.Mana;
|
||||
if (toDrain > Caster.ManaMax - Caster.Mana)
|
||||
toDrain = Caster.ManaMax - Caster.Mana;
|
||||
|
||||
m.Mana -= toDrain;
|
||||
Caster.Mana += toDrain;
|
||||
m.Mana -= toDrain;
|
||||
Caster.Mana += toDrain;
|
||||
|
||||
if ( Core.AOS )
|
||||
{
|
||||
m.FixedParticles( 0x374A, 1, 15, 5054, 23, 7, EffectLayer.Head );
|
||||
m.PlaySound( 0x1F9 );
|
||||
if (Core.AOS)
|
||||
{
|
||||
m.FixedParticles(0x374A, 1, 15, 5054, 23, 7, EffectLayer.Head);
|
||||
m.PlaySound(0x1F9);
|
||||
|
||||
Caster.FixedParticles( 0x0000, 10, 5, 2054, EffectLayer.Head );
|
||||
}
|
||||
else
|
||||
{
|
||||
m.FixedParticles( 0x374A, 10, 15, 5054, EffectLayer.Head );
|
||||
m.PlaySound( 0x1F9 );
|
||||
}
|
||||
Caster.FixedParticles(0x0000, 10, 5, 2054, EffectLayer.Head);
|
||||
}
|
||||
else
|
||||
{
|
||||
m.FixedParticles(0x374A, 10, 15, 5054, EffectLayer.Head);
|
||||
m.PlaySound(0x1F9);
|
||||
}
|
||||
|
||||
HarmfulSpell( m );
|
||||
}
|
||||
HarmfulSpell(m);
|
||||
}
|
||||
|
||||
FinishSequence();
|
||||
}
|
||||
FinishSequence();
|
||||
}
|
||||
|
||||
public override double GetResistPercent( Mobile target )
|
||||
{
|
||||
return 98.0;
|
||||
}
|
||||
public override double GetResistPercent(Mobile target)
|
||||
{
|
||||
return 98.0;
|
||||
}
|
||||
|
||||
private class InternalTarget : Target
|
||||
{
|
||||
private ManaVampireSpell m_Owner;
|
||||
private class InternalTarget : Target
|
||||
{
|
||||
private ManaVampireSpell m_Owner;
|
||||
|
||||
public InternalTarget( ManaVampireSpell owner ) : base( Core.ML ? 10 : 12, false, TargetFlags.Harmful )
|
||||
{
|
||||
m_Owner = owner;
|
||||
}
|
||||
public InternalTarget(ManaVampireSpell owner) : base(Core.ML ? 10 : 12, false, TargetFlags.Harmful)
|
||||
{
|
||||
m_Owner = owner;
|
||||
}
|
||||
|
||||
protected override void OnTarget( Mobile from, object o )
|
||||
{
|
||||
if ( o is Mobile )
|
||||
{
|
||||
m_Owner.Target( (Mobile)o );
|
||||
}
|
||||
}
|
||||
protected override void OnTarget(Mobile from, object o)
|
||||
{
|
||||
if (o is Mobile) m_Owner.Target((Mobile)o);
|
||||
}
|
||||
|
||||
protected override void OnTargetFinish( Mobile from )
|
||||
{
|
||||
m_Owner.FinishSequence();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
protected override void OnTargetFinish(Mobile from)
|
||||
{
|
||||
m_Owner.FinishSequence();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1,111 +1,113 @@
|
|||
using System.Collections.Generic;
|
||||
using Server.Items;
|
||||
using Server.Targeting;
|
||||
using Server.Mobiles;
|
||||
using Server.Targeting;
|
||||
|
||||
namespace Server.Spells.Seventh
|
||||
{
|
||||
public class MassDispelSpell : MagerySpell
|
||||
{
|
||||
private static SpellInfo m_Info = new SpellInfo(
|
||||
"Mass Dispel", "Vas An Ort",
|
||||
263,
|
||||
9002,
|
||||
Reagent.Garlic,
|
||||
Reagent.MandrakeRoot,
|
||||
Reagent.BlackPearl,
|
||||
Reagent.SulfurousAsh
|
||||
);
|
||||
public class MassDispelSpell : MagerySpell
|
||||
{
|
||||
private static SpellInfo m_Info = new SpellInfo(
|
||||
"Mass Dispel", "Vas An Ort",
|
||||
263,
|
||||
9002,
|
||||
Reagent.Garlic,
|
||||
Reagent.MandrakeRoot,
|
||||
Reagent.BlackPearl,
|
||||
Reagent.SulfurousAsh
|
||||
);
|
||||
|
||||
public override SpellCircle Circle => SpellCircle.Seventh;
|
||||
public MassDispelSpell(Mobile caster, Item scroll) : base(caster, scroll, m_Info)
|
||||
{
|
||||
}
|
||||
|
||||
public MassDispelSpell( Mobile caster, Item scroll ) : base( caster, scroll, m_Info )
|
||||
{
|
||||
}
|
||||
public override SpellCircle Circle => SpellCircle.Seventh;
|
||||
|
||||
public override void OnCast()
|
||||
{
|
||||
Caster.Target = new InternalTarget( this );
|
||||
}
|
||||
public override void OnCast()
|
||||
{
|
||||
Caster.Target = new InternalTarget(this);
|
||||
}
|
||||
|
||||
public void Target( IPoint3D p )
|
||||
{
|
||||
if ( !Caster.CanSee( p ) )
|
||||
{
|
||||
Caster.SendLocalizedMessage( 500237 ); // Target can not be seen.
|
||||
}
|
||||
else if ( CheckSequence() )
|
||||
{
|
||||
SpellHelper.Turn( Caster, p );
|
||||
public void Target(IPoint3D p)
|
||||
{
|
||||
if (!Caster.CanSee(p))
|
||||
{
|
||||
Caster.SendLocalizedMessage(500237); // Target can not be seen.
|
||||
}
|
||||
else if (CheckSequence())
|
||||
{
|
||||
SpellHelper.Turn(Caster, p);
|
||||
|
||||
SpellHelper.GetSurfaceTop( ref p );
|
||||
SpellHelper.GetSurfaceTop(ref p);
|
||||
|
||||
List<Mobile> targets = new List<Mobile>();
|
||||
List<Mobile> targets = new List<Mobile>();
|
||||
|
||||
Map map = Caster.Map;
|
||||
Map map = Caster.Map;
|
||||
|
||||
if ( map != null )
|
||||
{
|
||||
IPooledEnumerable<BaseCreature> eable = map.GetMobilesInRange<BaseCreature>( new Point3D( p ), 8 );
|
||||
if (map != null)
|
||||
{
|
||||
IPooledEnumerable<BaseCreature> eable = map.GetMobilesInRange<BaseCreature>(new Point3D(p), 8);
|
||||
|
||||
foreach ( BaseCreature m in eable )
|
||||
if ( m.IsDispellable && Caster.CanBeHarmful( m, false ) )
|
||||
targets.Add( m );
|
||||
foreach (BaseCreature m in eable)
|
||||
if (m.IsDispellable && Caster.CanBeHarmful(m, false))
|
||||
targets.Add(m);
|
||||
|
||||
eable.Free();
|
||||
}
|
||||
eable.Free();
|
||||
}
|
||||
|
||||
for ( int i = 0; i < targets.Count; ++i )
|
||||
{
|
||||
Mobile m = targets[i];
|
||||
for (int i = 0; i < targets.Count; ++i)
|
||||
{
|
||||
Mobile m = targets[i];
|
||||
|
||||
BaseCreature bc = m as BaseCreature;
|
||||
BaseCreature bc = m as BaseCreature;
|
||||
|
||||
if ( bc == null )
|
||||
continue;
|
||||
if (bc == null)
|
||||
continue;
|
||||
|
||||
double dispelChance = (50.0 + ((100 * (Caster.Skills.Magery.Value - bc.DispelDifficulty)) / (bc.DispelFocus*2))) / 100;
|
||||
double dispelChance =
|
||||
(50.0 + 100 * (Caster.Skills.Magery.Value - bc.DispelDifficulty) / (bc.DispelFocus * 2)) / 100;
|
||||
|
||||
if ( dispelChance > Utility.RandomDouble() )
|
||||
{
|
||||
Effects.SendLocationParticles( EffectItem.Create( m.Location, m.Map, EffectItem.DefaultDuration ), 0x3728, 8, 20, 5042 );
|
||||
Effects.PlaySound( m, m.Map, 0x201 );
|
||||
if (dispelChance > Utility.RandomDouble())
|
||||
{
|
||||
Effects.SendLocationParticles(EffectItem.Create(m.Location, m.Map, EffectItem.DefaultDuration),
|
||||
0x3728, 8, 20, 5042);
|
||||
Effects.PlaySound(m, m.Map, 0x201);
|
||||
|
||||
m.Delete();
|
||||
}
|
||||
else
|
||||
{
|
||||
Caster.DoHarmful( m );
|
||||
m.Delete();
|
||||
}
|
||||
else
|
||||
{
|
||||
Caster.DoHarmful(m);
|
||||
|
||||
m.FixedEffect( 0x3779, 10, 20 );
|
||||
}
|
||||
}
|
||||
}
|
||||
m.FixedEffect(0x3779, 10, 20);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
FinishSequence();
|
||||
}
|
||||
FinishSequence();
|
||||
}
|
||||
|
||||
private class InternalTarget : Target
|
||||
{
|
||||
private MassDispelSpell m_Owner;
|
||||
private class InternalTarget : Target
|
||||
{
|
||||
private MassDispelSpell m_Owner;
|
||||
|
||||
public InternalTarget( MassDispelSpell owner ) : base( Core.ML ? 10 : 12, true, TargetFlags.None )
|
||||
{
|
||||
m_Owner = owner;
|
||||
}
|
||||
public InternalTarget(MassDispelSpell owner) : base(Core.ML ? 10 : 12, true, TargetFlags.None)
|
||||
{
|
||||
m_Owner = owner;
|
||||
}
|
||||
|
||||
protected override void OnTarget( Mobile from, object o )
|
||||
{
|
||||
IPoint3D p = o as IPoint3D;
|
||||
protected override void OnTarget(Mobile from, object o)
|
||||
{
|
||||
IPoint3D p = o as IPoint3D;
|
||||
|
||||
if ( p != null )
|
||||
m_Owner.Target( p );
|
||||
}
|
||||
if (p != null)
|
||||
m_Owner.Target(p);
|
||||
}
|
||||
|
||||
protected override void OnTargetFinish( Mobile from )
|
||||
{
|
||||
m_Owner.FinishSequence();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
protected override void OnTargetFinish(Mobile from)
|
||||
{
|
||||
m_Owner.FinishSequence();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -3,134 +3,133 @@ using Server.Targeting;
|
|||
|
||||
namespace Server.Spells.Seventh
|
||||
{
|
||||
public class MeteorSwarmSpell : MagerySpell
|
||||
{
|
||||
private static SpellInfo m_Info = new SpellInfo(
|
||||
"Meteor Swarm", "Flam Kal Des Ylem",
|
||||
233,
|
||||
9042,
|
||||
false,
|
||||
Reagent.Bloodmoss,
|
||||
Reagent.MandrakeRoot,
|
||||
Reagent.SulfurousAsh,
|
||||
Reagent.SpidersSilk
|
||||
);
|
||||
public class MeteorSwarmSpell : MagerySpell
|
||||
{
|
||||
private static SpellInfo m_Info = new SpellInfo(
|
||||
"Meteor Swarm", "Flam Kal Des Ylem",
|
||||
233,
|
||||
9042,
|
||||
false,
|
||||
Reagent.Bloodmoss,
|
||||
Reagent.MandrakeRoot,
|
||||
Reagent.SulfurousAsh,
|
||||
Reagent.SpidersSilk
|
||||
);
|
||||
|
||||
public override SpellCircle Circle => SpellCircle.Seventh;
|
||||
public MeteorSwarmSpell(Mobile caster, Item scroll) : base(caster, scroll, m_Info)
|
||||
{
|
||||
}
|
||||
|
||||
public MeteorSwarmSpell( Mobile caster, Item scroll ) : base( caster, scroll, m_Info )
|
||||
{
|
||||
}
|
||||
public override SpellCircle Circle => SpellCircle.Seventh;
|
||||
|
||||
public override void OnCast()
|
||||
{
|
||||
Caster.Target = new InternalTarget( this );
|
||||
}
|
||||
public override bool DelayedDamage => true;
|
||||
|
||||
public override bool DelayedDamage => true;
|
||||
public override void OnCast()
|
||||
{
|
||||
Caster.Target = new InternalTarget(this);
|
||||
}
|
||||
|
||||
public void Target( IPoint3D p )
|
||||
{
|
||||
if ( !Caster.CanSee( p ) )
|
||||
{
|
||||
Caster.SendLocalizedMessage( 500237 ); // Target can not be seen.
|
||||
}
|
||||
else if ( SpellHelper.CheckTown( p, Caster ) && CheckSequence() )
|
||||
{
|
||||
SpellHelper.Turn( Caster, p );
|
||||
public void Target(IPoint3D p)
|
||||
{
|
||||
if (!Caster.CanSee(p))
|
||||
{
|
||||
Caster.SendLocalizedMessage(500237); // Target can not be seen.
|
||||
}
|
||||
else if (SpellHelper.CheckTown(p, Caster) && CheckSequence())
|
||||
{
|
||||
SpellHelper.Turn(Caster, p);
|
||||
|
||||
if ( p is Item )
|
||||
p = ((Item)p).GetWorldLocation();
|
||||
if (p is Item)
|
||||
p = ((Item)p).GetWorldLocation();
|
||||
|
||||
List<Mobile> targets = new List<Mobile>();
|
||||
List<Mobile> targets = new List<Mobile>();
|
||||
|
||||
Map map = Caster.Map;
|
||||
Map map = Caster.Map;
|
||||
|
||||
bool playerVsPlayer = false;
|
||||
bool playerVsPlayer = false;
|
||||
|
||||
if ( map != null )
|
||||
{
|
||||
IPooledEnumerable<Mobile> eable = map.GetMobilesInRange( new Point3D( p ), 2 );
|
||||
if (map != null)
|
||||
{
|
||||
IPooledEnumerable<Mobile> eable = map.GetMobilesInRange(new Point3D(p), 2);
|
||||
|
||||
foreach ( Mobile m in eable )
|
||||
{
|
||||
if ( Caster != m && SpellHelper.ValidIndirectTarget( Caster, m ) && Caster.CanBeHarmful( m, false ) )
|
||||
{
|
||||
if ( Core.AOS && !Caster.InLOS( m ) )
|
||||
continue;
|
||||
foreach (Mobile m in eable)
|
||||
if (Caster != m && SpellHelper.ValidIndirectTarget(Caster, m) && Caster.CanBeHarmful(m, false))
|
||||
{
|
||||
if (Core.AOS && !Caster.InLOS(m))
|
||||
continue;
|
||||
|
||||
targets.Add( m );
|
||||
targets.Add(m);
|
||||
|
||||
if ( m.Player )
|
||||
playerVsPlayer = true;
|
||||
}
|
||||
}
|
||||
if (m.Player)
|
||||
playerVsPlayer = true;
|
||||
}
|
||||
|
||||
eable.Free();
|
||||
}
|
||||
eable.Free();
|
||||
}
|
||||
|
||||
double damage;
|
||||
double damage;
|
||||
|
||||
if ( Core.AOS )
|
||||
damage = GetNewAosDamage( 51, 1, 5, playerVsPlayer );
|
||||
else
|
||||
damage = Utility.Random( 27, 22 );
|
||||
if (Core.AOS)
|
||||
damage = GetNewAosDamage(51, 1, 5, playerVsPlayer);
|
||||
else
|
||||
damage = Utility.Random(27, 22);
|
||||
|
||||
if ( targets.Count > 0 )
|
||||
{
|
||||
Effects.PlaySound( p, Caster.Map, 0x160 );
|
||||
if (targets.Count > 0)
|
||||
{
|
||||
Effects.PlaySound(p, Caster.Map, 0x160);
|
||||
|
||||
if ( Core.AOS && targets.Count > 2 )
|
||||
damage = (damage * 2) / targets.Count;
|
||||
else if ( !Core.AOS )
|
||||
damage /= targets.Count;
|
||||
if (Core.AOS && targets.Count > 2)
|
||||
damage = damage * 2 / targets.Count;
|
||||
else if (!Core.AOS)
|
||||
damage /= targets.Count;
|
||||
|
||||
double toDeal;
|
||||
for ( int i = 0; i < targets.Count; ++i )
|
||||
{
|
||||
Mobile m = targets[i];
|
||||
double toDeal;
|
||||
for (int i = 0; i < targets.Count; ++i)
|
||||
{
|
||||
Mobile m = targets[i];
|
||||
|
||||
toDeal = damage;
|
||||
toDeal = damage;
|
||||
|
||||
if ( !Core.AOS && CheckResisted( m ) )
|
||||
{
|
||||
damage *= 0.5;
|
||||
if (!Core.AOS && CheckResisted(m))
|
||||
{
|
||||
damage *= 0.5;
|
||||
|
||||
m.SendLocalizedMessage( 501783 ); // You feel yourself resisting magical energy.
|
||||
}
|
||||
toDeal *= GetDamageScalar( m );
|
||||
Caster.DoHarmful( m );
|
||||
SpellHelper.Damage( this, m, toDeal, 0, 100, 0, 0, 0 );
|
||||
m.SendLocalizedMessage(501783); // You feel yourself resisting magical energy.
|
||||
}
|
||||
|
||||
Caster.MovingParticles( m, 0x36D4, 7, 0, false, true, 9501, 1, 0, 0x100 );
|
||||
}
|
||||
}
|
||||
}
|
||||
toDeal *= GetDamageScalar(m);
|
||||
Caster.DoHarmful(m);
|
||||
SpellHelper.Damage(this, m, toDeal, 0, 100, 0, 0, 0);
|
||||
|
||||
FinishSequence();
|
||||
}
|
||||
Caster.MovingParticles(m, 0x36D4, 7, 0, false, true, 9501, 1, 0, 0x100);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private class InternalTarget : Target
|
||||
{
|
||||
private MeteorSwarmSpell m_Owner;
|
||||
FinishSequence();
|
||||
}
|
||||
|
||||
public InternalTarget( MeteorSwarmSpell owner ) : base( Core.ML ? 10 : 12, true, TargetFlags.None )
|
||||
{
|
||||
m_Owner = owner;
|
||||
}
|
||||
private class InternalTarget : Target
|
||||
{
|
||||
private MeteorSwarmSpell m_Owner;
|
||||
|
||||
protected override void OnTarget( Mobile from, object o )
|
||||
{
|
||||
IPoint3D p = o as IPoint3D;
|
||||
public InternalTarget(MeteorSwarmSpell owner) : base(Core.ML ? 10 : 12, true, TargetFlags.None)
|
||||
{
|
||||
m_Owner = owner;
|
||||
}
|
||||
|
||||
if ( p != null )
|
||||
m_Owner.Target( p );
|
||||
}
|
||||
protected override void OnTarget(Mobile from, object o)
|
||||
{
|
||||
IPoint3D p = o as IPoint3D;
|
||||
|
||||
protected override void OnTargetFinish( Mobile from )
|
||||
{
|
||||
m_Owner.FinishSequence();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if (p != null)
|
||||
m_Owner.Target(p);
|
||||
}
|
||||
|
||||
protected override void OnTargetFinish(Mobile from)
|
||||
{
|
||||
m_Owner.FinishSequence();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1,215 +1,221 @@
|
|||
using System;
|
||||
using System.Collections;
|
||||
using Server.Items;
|
||||
using Server.Factions;
|
||||
using Server.Gumps;
|
||||
using Server.Items;
|
||||
using Server.Mobiles;
|
||||
using Server.Spells.Fifth;
|
||||
|
||||
namespace Server.Spells.Seventh
|
||||
{
|
||||
public class PolymorphSpell : MagerySpell
|
||||
{
|
||||
private static SpellInfo m_Info = new SpellInfo(
|
||||
"Polymorph", "Vas Ylem Rel",
|
||||
221,
|
||||
9002,
|
||||
Reagent.Bloodmoss,
|
||||
Reagent.SpidersSilk,
|
||||
Reagent.MandrakeRoot
|
||||
);
|
||||
public class PolymorphSpell : MagerySpell
|
||||
{
|
||||
private static SpellInfo m_Info = new SpellInfo(
|
||||
"Polymorph", "Vas Ylem Rel",
|
||||
221,
|
||||
9002,
|
||||
Reagent.Bloodmoss,
|
||||
Reagent.SpidersSilk,
|
||||
Reagent.MandrakeRoot
|
||||
);
|
||||
|
||||
public override SpellCircle Circle => SpellCircle.Seventh;
|
||||
private static Hashtable m_Timers = new Hashtable();
|
||||
|
||||
private int m_NewBody;
|
||||
private int m_NewBody;
|
||||
|
||||
public PolymorphSpell( Mobile caster, Item scroll, int body ) : base( caster, scroll, m_Info )
|
||||
{
|
||||
m_NewBody = body;
|
||||
}
|
||||
public PolymorphSpell(Mobile caster, Item scroll, int body) : base(caster, scroll, m_Info)
|
||||
{
|
||||
m_NewBody = body;
|
||||
}
|
||||
|
||||
public PolymorphSpell( Mobile caster, Item scroll ) : this(caster,scroll,0)
|
||||
{
|
||||
}
|
||||
public PolymorphSpell(Mobile caster, Item scroll) : this(caster, scroll, 0)
|
||||
{
|
||||
}
|
||||
|
||||
public override bool CheckCast()
|
||||
{
|
||||
/*if ( Caster.Mounted )
|
||||
{
|
||||
Caster.SendLocalizedMessage( 1042561 ); //Please dismount first.
|
||||
return false;
|
||||
}
|
||||
else */
|
||||
if ( Factions.Sigil.ExistsOn( Caster ) )
|
||||
{
|
||||
Caster.SendLocalizedMessage( 1010521 ); // You cannot polymorph while you have a Town Sigil
|
||||
return false;
|
||||
}
|
||||
public override SpellCircle Circle => SpellCircle.Seventh;
|
||||
|
||||
if ( TransformationSpellHelper.UnderTransformation( Caster ) )
|
||||
{
|
||||
Caster.SendLocalizedMessage( 1061633 ); // You cannot polymorph while in that form.
|
||||
return false;
|
||||
}
|
||||
if ( DisguiseTimers.IsDisguised( Caster ) )
|
||||
{
|
||||
Caster.SendLocalizedMessage( 502167 ); // You cannot polymorph while disguised.
|
||||
return false;
|
||||
}
|
||||
if ( Caster.BodyMod == 183 || Caster.BodyMod == 184 )
|
||||
{
|
||||
Caster.SendLocalizedMessage( 1042512 ); // You cannot polymorph while wearing body paint
|
||||
return false;
|
||||
}
|
||||
if ( !Caster.CanBeginAction( typeof( PolymorphSpell ) ) )
|
||||
{
|
||||
if ( Core.ML )
|
||||
EndPolymorph( Caster );
|
||||
else
|
||||
Caster.SendLocalizedMessage( 1005559 ); // This spell is already in effect.
|
||||
return false;
|
||||
}
|
||||
if ( m_NewBody == 0 )
|
||||
{
|
||||
Gump gump;
|
||||
if ( Core.SE )
|
||||
gump = new NewPolymorphGump( Caster, Scroll );
|
||||
else
|
||||
gump = new PolymorphGump( Caster, Scroll );
|
||||
public override bool CheckCast()
|
||||
{
|
||||
/*if ( Caster.Mounted )
|
||||
{
|
||||
Caster.SendLocalizedMessage( 1042561 ); //Please dismount first.
|
||||
return false;
|
||||
}
|
||||
else */
|
||||
if (Sigil.ExistsOn(Caster))
|
||||
{
|
||||
Caster.SendLocalizedMessage(1010521); // You cannot polymorph while you have a Town Sigil
|
||||
return false;
|
||||
}
|
||||
|
||||
Caster.SendGump( gump );
|
||||
return false;
|
||||
}
|
||||
if (TransformationSpellHelper.UnderTransformation(Caster))
|
||||
{
|
||||
Caster.SendLocalizedMessage(1061633); // You cannot polymorph while in that form.
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
if (DisguiseTimers.IsDisguised(Caster))
|
||||
{
|
||||
Caster.SendLocalizedMessage(502167); // You cannot polymorph while disguised.
|
||||
return false;
|
||||
}
|
||||
|
||||
public override void OnCast()
|
||||
{
|
||||
/*if ( Caster.Mounted )
|
||||
{
|
||||
Caster.SendLocalizedMessage( 1042561 ); //Please dismount first.
|
||||
}
|
||||
else */
|
||||
if ( Factions.Sigil.ExistsOn( Caster ) )
|
||||
{
|
||||
Caster.SendLocalizedMessage( 1010521 ); // You cannot polymorph while you have a Town Sigil
|
||||
}
|
||||
else if ( !Caster.CanBeginAction( typeof( PolymorphSpell ) ) )
|
||||
{
|
||||
if ( Core.ML )
|
||||
EndPolymorph( Caster );
|
||||
else
|
||||
Caster.SendLocalizedMessage( 1005559 ); // This spell is already in effect.
|
||||
}
|
||||
else if ( TransformationSpellHelper.UnderTransformation( Caster ) )
|
||||
{
|
||||
Caster.SendLocalizedMessage( 1061633 ); // You cannot polymorph while in that form.
|
||||
}
|
||||
else if ( DisguiseTimers.IsDisguised( Caster ) )
|
||||
{
|
||||
Caster.SendLocalizedMessage( 502167 ); // You cannot polymorph while disguised.
|
||||
}
|
||||
else if ( Caster.BodyMod == 183 || Caster.BodyMod == 184 )
|
||||
{
|
||||
Caster.SendLocalizedMessage( 1042512 ); // You cannot polymorph while wearing body paint
|
||||
}
|
||||
else if ( !Caster.CanBeginAction( typeof( IncognitoSpell ) ) || Caster.IsBodyMod )
|
||||
{
|
||||
DoFizzle();
|
||||
}
|
||||
else if ( CheckSequence() )
|
||||
{
|
||||
if ( Caster.BeginAction( typeof( PolymorphSpell ) ) )
|
||||
{
|
||||
if ( m_NewBody != 0 )
|
||||
{
|
||||
if ( !((Body)m_NewBody).IsHuman )
|
||||
{
|
||||
Mobiles.IMount mt = Caster.Mount;
|
||||
if (Caster.BodyMod == 183 || Caster.BodyMod == 184)
|
||||
{
|
||||
Caster.SendLocalizedMessage(1042512); // You cannot polymorph while wearing body paint
|
||||
return false;
|
||||
}
|
||||
|
||||
if ( mt != null )
|
||||
mt.Rider = null;
|
||||
}
|
||||
if (!Caster.CanBeginAction(typeof(PolymorphSpell)))
|
||||
{
|
||||
if (Core.ML)
|
||||
EndPolymorph(Caster);
|
||||
else
|
||||
Caster.SendLocalizedMessage(1005559); // This spell is already in effect.
|
||||
return false;
|
||||
}
|
||||
|
||||
Caster.BodyMod = m_NewBody;
|
||||
if (m_NewBody == 0)
|
||||
{
|
||||
Gump gump;
|
||||
if (Core.SE)
|
||||
gump = new NewPolymorphGump(Caster, Scroll);
|
||||
else
|
||||
gump = new PolymorphGump(Caster, Scroll);
|
||||
|
||||
if ( m_NewBody == 400 || m_NewBody == 401 )
|
||||
Caster.HueMod = Utility.RandomSkinHue();
|
||||
else
|
||||
Caster.HueMod = 0;
|
||||
Caster.SendGump(gump);
|
||||
return false;
|
||||
}
|
||||
|
||||
BaseArmor.ValidateMobile( Caster );
|
||||
BaseClothing.ValidateMobile( Caster );
|
||||
return true;
|
||||
}
|
||||
|
||||
if ( !Core.ML )
|
||||
{
|
||||
StopTimer( Caster );
|
||||
public override void OnCast()
|
||||
{
|
||||
/*if ( Caster.Mounted )
|
||||
{
|
||||
Caster.SendLocalizedMessage( 1042561 ); //Please dismount first.
|
||||
}
|
||||
else */
|
||||
if (Sigil.ExistsOn(Caster))
|
||||
{
|
||||
Caster.SendLocalizedMessage(1010521); // You cannot polymorph while you have a Town Sigil
|
||||
}
|
||||
else if (!Caster.CanBeginAction(typeof(PolymorphSpell)))
|
||||
{
|
||||
if (Core.ML)
|
||||
EndPolymorph(Caster);
|
||||
else
|
||||
Caster.SendLocalizedMessage(1005559); // This spell is already in effect.
|
||||
}
|
||||
else if (TransformationSpellHelper.UnderTransformation(Caster))
|
||||
{
|
||||
Caster.SendLocalizedMessage(1061633); // You cannot polymorph while in that form.
|
||||
}
|
||||
else if (DisguiseTimers.IsDisguised(Caster))
|
||||
{
|
||||
Caster.SendLocalizedMessage(502167); // You cannot polymorph while disguised.
|
||||
}
|
||||
else if (Caster.BodyMod == 183 || Caster.BodyMod == 184)
|
||||
{
|
||||
Caster.SendLocalizedMessage(1042512); // You cannot polymorph while wearing body paint
|
||||
}
|
||||
else if (!Caster.CanBeginAction(typeof(IncognitoSpell)) || Caster.IsBodyMod)
|
||||
{
|
||||
DoFizzle();
|
||||
}
|
||||
else if (CheckSequence())
|
||||
{
|
||||
if (Caster.BeginAction(typeof(PolymorphSpell)))
|
||||
{
|
||||
if (m_NewBody != 0)
|
||||
{
|
||||
if (!((Body)m_NewBody).IsHuman)
|
||||
{
|
||||
IMount mt = Caster.Mount;
|
||||
|
||||
Timer t = new InternalTimer( Caster );
|
||||
if (mt != null)
|
||||
mt.Rider = null;
|
||||
}
|
||||
|
||||
m_Timers[Caster] = t;
|
||||
Caster.BodyMod = m_NewBody;
|
||||
|
||||
t.Start();
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
Caster.SendLocalizedMessage( 1005559 ); // This spell is already in effect.
|
||||
}
|
||||
}
|
||||
if (m_NewBody == 400 || m_NewBody == 401)
|
||||
Caster.HueMod = Utility.RandomSkinHue();
|
||||
else
|
||||
Caster.HueMod = 0;
|
||||
|
||||
FinishSequence();
|
||||
}
|
||||
BaseArmor.ValidateMobile(Caster);
|
||||
BaseClothing.ValidateMobile(Caster);
|
||||
|
||||
private static Hashtable m_Timers = new Hashtable();
|
||||
if (!Core.ML)
|
||||
{
|
||||
StopTimer(Caster);
|
||||
|
||||
public static bool StopTimer( Mobile m )
|
||||
{
|
||||
Timer t = (Timer)m_Timers[m];
|
||||
Timer t = new InternalTimer(Caster);
|
||||
|
||||
if ( t != null )
|
||||
{
|
||||
t.Stop();
|
||||
m_Timers.Remove( m );
|
||||
}
|
||||
m_Timers[Caster] = t;
|
||||
|
||||
return ( t != null );
|
||||
}
|
||||
t.Start();
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
Caster.SendLocalizedMessage(1005559); // This spell is already in effect.
|
||||
}
|
||||
}
|
||||
|
||||
private static void EndPolymorph( Mobile m )
|
||||
{
|
||||
if ( !m.CanBeginAction( typeof( PolymorphSpell ) ) )
|
||||
{
|
||||
m.BodyMod = 0;
|
||||
m.HueMod = -1;
|
||||
m.EndAction( typeof( PolymorphSpell ) );
|
||||
FinishSequence();
|
||||
}
|
||||
|
||||
BaseArmor.ValidateMobile( m );
|
||||
BaseClothing.ValidateMobile( m );
|
||||
}
|
||||
}
|
||||
public static bool StopTimer(Mobile m)
|
||||
{
|
||||
Timer t = (Timer)m_Timers[m];
|
||||
|
||||
private class InternalTimer : Timer
|
||||
{
|
||||
private Mobile m_Owner;
|
||||
if (t != null)
|
||||
{
|
||||
t.Stop();
|
||||
m_Timers.Remove(m);
|
||||
}
|
||||
|
||||
public InternalTimer( Mobile owner ) : base( TimeSpan.FromSeconds( 0 ) )
|
||||
{
|
||||
m_Owner = owner;
|
||||
return t != null;
|
||||
}
|
||||
|
||||
int val = (int)owner.Skills[SkillName.Magery].Value;
|
||||
private static void EndPolymorph(Mobile m)
|
||||
{
|
||||
if (!m.CanBeginAction(typeof(PolymorphSpell)))
|
||||
{
|
||||
m.BodyMod = 0;
|
||||
m.HueMod = -1;
|
||||
m.EndAction(typeof(PolymorphSpell));
|
||||
|
||||
if ( val > 120 )
|
||||
val = 120;
|
||||
BaseArmor.ValidateMobile(m);
|
||||
BaseClothing.ValidateMobile(m);
|
||||
}
|
||||
}
|
||||
|
||||
Delay = TimeSpan.FromSeconds( val );
|
||||
Priority = TimerPriority.OneSecond;
|
||||
}
|
||||
private class InternalTimer : Timer
|
||||
{
|
||||
private Mobile m_Owner;
|
||||
|
||||
protected override void OnTick()
|
||||
{
|
||||
EndPolymorph( m_Owner );
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
public InternalTimer(Mobile owner) : base(TimeSpan.FromSeconds(0))
|
||||
{
|
||||
m_Owner = owner;
|
||||
|
||||
int val = (int)owner.Skills[SkillName.Magery].Value;
|
||||
|
||||
if (val > 120)
|
||||
val = 120;
|
||||
|
||||
Delay = TimeSpan.FromSeconds(val);
|
||||
Priority = TimerPriority.OneSecond;
|
||||
}
|
||||
|
||||
protected override void OnTick()
|
||||
{
|
||||
EndPolymorph(m_Owner);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue