#W# Initial Commit: Avatars Conquest

This commit is contained in:
WarrentyExpired 2026-07-03 20:19:48 -04:00
commit 8eae46895e
7512 changed files with 416187 additions and 0 deletions

View file

@ -0,0 +1,125 @@
using System;
using System.Collections.Generic;
using Server.Network;
using Server.Items;
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 override SpellCircle Circle { get { return SpellCircle.Seventh; } }
public ChainLightningSpell( Mobile caster, Item scroll ) : base( caster, scroll, m_Info )
{
}
public override void OnCast()
{
Caster.Target = new InternalTarget( this );
}
public override bool DelayedDamage{ get{ return true; } }
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();
List<Mobile> targets = new List<Mobile>();
Map map = Caster.Map;
if ( map != null )
{
IPooledEnumerable eable = map.GetMobilesInRange( new Point3D( p ), 2 );
foreach ( Mobile m in eable )
{
if ( SpellHelper.ValidIndirectTarget( Caster, m ) && Caster.CanBeHarmful( m, false ) )
{
targets.Add( m );
}
}
eable.Free();
}
double damage = Utility.Random( 27, 22 );
if ( targets.Count > 0 )
{
damage /= targets.Count;
double toDeal;
for ( int i = 0; i < targets.Count; ++i )
{
toDeal = damage;
Mobile m = targets[i];
toDeal *= GetDamageScalar( m );
if ( 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 );
m.BoltEffect( 0 );
}
}
else
{
Caster.PlaySound ( 0x29 );
}
}
FinishSequence();
}
private class InternalTarget : Target
{
private ChainLightningSpell m_Owner;
public InternalTarget( ChainLightningSpell owner ) : base( 12, true, TargetFlags.None )
{
m_Owner = owner;
}
protected override void OnTarget( Mobile from, object o )
{
IPoint3D p = o as IPoint3D;
if ( p != null )
m_Owner.Target( p );
}
protected override void OnTargetFinish( Mobile from )
{
m_Owner.FinishSequence();
}
}
}
}

View file

@ -0,0 +1,193 @@
using System;
using Server.Targeting;
using Server.Network;
using Server.Misc;
using Server.Items;
using Server.Mobiles;
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 override SpellCircle Circle { get { return SpellCircle.Seventh; } }
public EnergyFieldSpell( Mobile caster, Item scroll ) : base( caster, scroll, m_Info )
{
}
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 );
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;
bool eastToWest;
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 );
Caster.CheckSkill( SkillName.Concentration, 0.0, 100.0 ); // PASSIVE CHECK
// (28% of concentration) + (28% of magery) + 2.0 seconds
TimeSpan duration = TimeSpan.FromSeconds( (Caster.Skills[SkillName.Concentration].Value * 0.28) + (Caster.Skills[SkillName.Magery].Value * 0.28) + 2.0 );
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 );
if ( !canFit )
continue;
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 );
}
}
FinishSequence();
}
[DispellableField]
private class InternalItem : Item
{
private Timer m_Timer;
private Mobile m_Caster;
public override bool BlocksFit{ get{ return true; } }
public InternalItem( Point3D loc, Map map, TimeSpan duration, int itemID, Mobile caster ) : base( itemID )
{
Visible = false;
Movable = false;
Light = LightType.Circle300;
MoveToWorld( loc, map );
m_Caster = caster;
if ( caster.InLOS( this ) )
Visible = true;
else
Delete();
if ( Deleted )
return;
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 override void Serialize( GenericWriter writer )
{
base.Serialize( writer );
writer.Write( (int) 0 ); // version
}
public override void Deserialize( GenericReader reader )
{
base.Deserialize( reader );
int version = reader.ReadInt();
}
public override void OnAfterDelete()
{
base.OnAfterDelete();
if ( m_Timer != null )
m_Timer.Stop();
}
private class InternalTimer : Timer
{
private InternalItem m_Item;
public InternalTimer( InternalItem item, TimeSpan duration ) : base( duration )
{
Priority = TimerPriority.OneSecond;
m_Item = item;
}
protected override void OnTick()
{
m_Item.Delete();
}
}
}
private class InternalTarget : Target
{
private EnergyFieldSpell m_Owner;
public InternalTarget( EnergyFieldSpell owner ) : base( 12, true, TargetFlags.None )
{
m_Owner = owner;
}
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();
}
}
}
}

View file

@ -0,0 +1,85 @@
using System;
using Server.Targeting;
using Server.Network;
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 override SpellCircle Circle { get { return SpellCircle.Seventh; } }
public FlameStrikeSpell( Mobile caster, Item scroll ) : base( caster, scroll, m_Info )
{
}
public override void OnCast()
{
Caster.Target = new InternalTarget( this );
}
public override bool DelayedDamage{ get{ return true; } }
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)this.Circle, Caster, ref m );
double damage = Utility.Random( 27, 22 );
if ( CheckResisted( m ) )
{
damage *= 0.6;
m.SendLocalizedMessage( 501783 ); // You feel yourself resisting magical energy.
}
damage *= GetDamageScalar( m );
m.FixedParticles( 0x3709, 10, 30, 5052, EffectLayer.LeftFoot );
m.PlaySound( 0x208 );
SpellHelper.Damage( this, m, damage );
}
FinishSequence();
}
private class InternalTarget : Target
{
private FlameStrikeSpell m_Owner;
public InternalTarget( FlameStrikeSpell owner ) : base( 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 OnTargetFinish( Mobile from )
{
m_Owner.FinishSequence();
}
}
}
}

View file

@ -0,0 +1,192 @@
using System;
using Server.Network;
using Server.Multis;
using Server.Items;
using Server.Targeting;
using Server.Misc;
using Server.Regions;
using Server.Mobiles;
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 override SpellCircle Circle { get { return SpellCircle.Seventh; } }
public GateTravelSpell( Mobile caster, Item scroll ) : base( caster, scroll, m_Info )
{
}
public override void OnCast()
{
Caster.Target = new InternalTarget( this );
}
public override bool CheckCast()
{
if ( Server.Engines.Harvest.Fishing.IsOnBoat( Caster ) )
{
Caster.SendMessage( "The waves of the sea are distracting you from casting this spell!" );
Caster.FixedEffect( 0x3735, 6, 30 );
Caster.PlaySound( 0x5C );
return false;
}
else if ( SpellHelper.CheckCombat( Caster ) )
{
Caster.SendLocalizedMessage( 1005564, "", 0x22 ); // Wouldst thou flee during the heat of battle??
return false;
}
return true;
}
private bool GateExistsAt(Map map, Point3D loc )
{
bool _gateFound = false;
IPooledEnumerable eable = map.GetItemsInRange( loc, 0 );
foreach ( Item item in eable )
{
if ( item is Magicgate )
{
_gateFound = true;
break;
}
}
eable.Free();
return _gateFound;
}
public void Effect( Point3D loc, Map map, bool checkMulti )
{
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 ( GateExistsAt( Caster.Map, Caster.Location ) )
{
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( Caster.Location, Caster.Map, 0x20E );
InternalItem firstGate = new InternalItem( loc, map );
firstGate.MoveToWorld( Caster.Location, Caster.Map );
Effects.PlaySound( loc, map, 0x20E );
InternalItem secondGate = new InternalItem( Caster.Location, Caster.Map );
secondGate.MoveToWorld( loc, map );
}
FinishSequence();
}
[DispellableField]
private class InternalItem : Magicgate
{
public InternalItem( Point3D target, Map map ) : base( target, map )
{
Map = map;
Dispellable = true;
InternalTimer t = new InternalTimer( this );
t.Start();
}
public InternalItem( Serial serial ) : base( serial )
{
}
public override void Serialize( GenericWriter writer )
{
base.Serialize( writer );
}
public override void Deserialize( GenericReader reader )
{
base.Deserialize( reader );
Delete();
}
private class InternalTimer : Timer
{
private Item m_Item;
public InternalTimer( Item item ) : base( TimeSpan.FromSeconds( 30.0 ) )
{
Priority = TimerPriority.OneSecond;
m_Item = item;
}
protected override void OnTick()
{
m_Item.Delete();
}
}
}
private class InternalTarget : Target
{
private GateTravelSpell m_Owner;
public InternalTarget( GateTravelSpell owner ) : base( 12, false, TargetFlags.None )
{
m_Owner = owner;
owner.Caster.LocalOverheadMessage( MessageType.Regular, 0x3B2, 501029 ); // Select Marked item.
}
protected override void OnTarget( Mobile from, object o )
{
if ( o is MagicRune )
{
MagicRune rune = (MagicRune)o;
if ( rune.Marked && rune.Owner != from )
from.SendMessage( "This rune belongs to someone else." );
else if ( rune.Marked )
m_Owner.Effect( rune.Target, rune.TargetMap, true );
else
from.SendLocalizedMessage( 501803 ); // That rune is not yet marked.
}
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();
}
}
}
}

View file

@ -0,0 +1,97 @@
using System;
using Server.Targeting;
using Server.Network;
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 override SpellCircle Circle { get { return SpellCircle.Seventh; } }
public ManaVampireSpell( Mobile caster, Item scroll ) : base( caster, scroll, m_Info )
{
}
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 );
SpellHelper.CheckReflect( (int)this.Circle, Caster, ref m );
if ( m.Spell != null )
m.Spell.OnCasterHurt();
m.Paralyzed = false;
int toDrain = 0;
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;
m.Mana -= toDrain;
Caster.Mana += toDrain;
m.FixedParticles( 0x374A, 10, 15, 5054, EffectLayer.Head );
m.PlaySound( 0x1F9 );
HarmfulSpell( m );
}
FinishSequence();
}
public override double GetResistPercent( Mobile target )
{
return 98.0;
}
private class InternalTarget : Target
{
private ManaVampireSpell m_Owner;
public InternalTarget( ManaVampireSpell owner ) : base( 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 OnTargetFinish( Mobile from )
{
m_Owner.FinishSequence();
}
}
}
}

View file

@ -0,0 +1,116 @@
using System;
using System.Collections.Generic;
using Server.Misc;
using Server.Network;
using Server.Items;
using Server.Targeting;
using Server.Mobiles;
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 override SpellCircle Circle { get { return SpellCircle.Seventh; } }
public MassDispelSpell( Mobile caster, Item scroll ) : base( caster, scroll, m_Info )
{
}
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 );
SpellHelper.GetSurfaceTop( ref p );
List<Mobile> targets = new List<Mobile>();
Map map = Caster.Map;
if ( map != null )
{
Caster.CheckSkill( SkillName.Concentration, 0.0, 100.0 ); // PASSIVE CHECK
IPooledEnumerable eable = map.GetMobilesInRange( new Point3D( p ), (8+(int)(Caster.Skills[SkillName.Concentration].Value/20)) );
foreach ( Mobile m in eable )
if ( m is BaseCreature && (m as BaseCreature).IsDispellable && Caster.CanBeHarmful( m, false ) )
targets.Add( m );
eable.Free();
}
for ( int i = 0; i < targets.Count; ++i )
{
Mobile m = targets[i];
BaseCreature bc = m as BaseCreature;
if ( bc == null )
continue;
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 );
m.Delete();
}
else
{
Caster.DoHarmful( m );
m.FixedEffect( 0x3779, 10, 20 );
}
}
}
FinishSequence();
}
private class InternalTarget : Target
{
private MassDispelSpell m_Owner;
public InternalTarget( MassDispelSpell owner ) : base( 12, true, TargetFlags.None )
{
m_Owner = owner;
}
protected override void OnTarget( Mobile from, object o )
{
IPoint3D p = o as IPoint3D;
if ( p != null )
m_Owner.Target( p );
}
protected override void OnTargetFinish( Mobile from )
{
m_Owner.FinishSequence();
}
}
}
}

View file

@ -0,0 +1,124 @@
using System;
using System.Collections.Generic;
using Server.Network;
using Server.Items;
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 override SpellCircle Circle { get { return SpellCircle.Seventh; } }
public MeteorSwarmSpell( Mobile caster, Item scroll ) : base( caster, scroll, m_Info )
{
}
public override void OnCast()
{
Caster.Target = new InternalTarget( this );
}
public override bool DelayedDamage{ get{ return true; } }
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();
List<Mobile> targets = new List<Mobile>();
Map map = Caster.Map;
if ( map != null )
{
IPooledEnumerable eable = map.GetMobilesInRange( new Point3D( p ), 2 );
foreach ( Mobile m in eable )
{
if ( Caster != m && SpellHelper.ValidIndirectTarget( Caster, m ) && Caster.CanBeHarmful( m, false ) )
{
targets.Add( m );
}
}
eable.Free();
}
double damage = Utility.Random( 27, 22 );
if ( targets.Count > 0 )
{
Effects.PlaySound( p, Caster.Map, 0x160 );
damage /= targets.Count;
double toDeal;
for ( int i = 0; i < targets.Count; ++i )
{
Mobile m = targets[i];
toDeal = damage;
toDeal *= GetDamageScalar( m );
if ( 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 );
Caster.MovingParticles( m, 0x36D4, 7, 0, false, true, 9501, 1, 0, 0x100 );
}
}
}
FinishSequence();
}
private class InternalTarget : Target
{
private MeteorSwarmSpell m_Owner;
public InternalTarget( MeteorSwarmSpell owner ) : base( 12, true, TargetFlags.None )
{
m_Owner = owner;
}
protected override void OnTarget( Mobile from, object o )
{
IPoint3D p = o as IPoint3D;
if ( p != null )
m_Owner.Target( p );
}
protected override void OnTargetFinish( Mobile from )
{
m_Owner.FinishSequence();
}
}
}
}

View file

@ -0,0 +1,178 @@
using System;
using System.Collections;
using Server;
using Server.Items;
using Server.Gumps;
using Server.Spells;
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 override SpellCircle Circle { get { return SpellCircle.Seventh; } }
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 ) : this(caster,scroll,0)
{
}
public override bool CheckCast()
{
if( TransformationSpellHelper.UnderTransformation( Caster ) )
{
Caster.SendLocalizedMessage( 1061633 ); // You cannot polymorph while in that form.
return false;
}
else if ( DisguiseTimers.IsDisguised( Caster ) )
{
Caster.SendLocalizedMessage( 502167 ); // You cannot polymorph while disguised.
return false;
}
else if ( !Caster.CanBeginAction( typeof( PolymorphSpell ) ) )
{
Caster.SendLocalizedMessage( 1005559 ); // This spell is already in effect.
return false;
}
else if ( m_NewBody == 0 )
{
Gump gump = new PolymorphGump( Caster, Scroll );
Caster.SendGump( gump );
return false;
}
return true;
}
public override void OnCast()
{
if ( !Caster.CanBeginAction( typeof( PolymorphSpell ) ) )
{
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 ( mt != null )
mt.Rider = null;
}
Caster.BodyMod = m_NewBody;
if ( m_NewBody == 400 || m_NewBody == 401 )
Caster.HueMod = Utility.RandomSkinHue();
else
Caster.HueMod = 0;
BaseArmor.ValidateMobile( Caster );
BaseClothing.ValidateMobile( Caster );
StopTimer( Caster );
Timer t = new InternalTimer( Caster );
m_Timers[Caster] = t;
t.Start();
}
}
else
{
Caster.SendLocalizedMessage( 1005559 ); // This spell is already in effect.
}
}
FinishSequence();
}
private static Hashtable m_Timers = new Hashtable();
public static bool StopTimer( Mobile m )
{
Timer t = (Timer)m_Timers[m];
if ( t != null )
{
t.Stop();
m_Timers.Remove( m );
}
return ( t != null );
}
private static void EndPolymorph( Mobile m )
{
if( !m.CanBeginAction( typeof( PolymorphSpell ) ) )
{
m.BodyMod = 0;
m.HueMod = -1;
m.EndAction( typeof( PolymorphSpell ) );
BaseArmor.ValidateMobile( m );
BaseClothing.ValidateMobile( m );
}
}
private class InternalTimer : Timer
{
private Mobile 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 );
}
}
}
}