This commit is contained in:
mark 2006-06-15 04:14:30 +00:00
commit 47711d616e
2644 changed files with 479454 additions and 0 deletions

View file

@ -0,0 +1,144 @@
using System;
using System.Collections;
using Server.Network;
using Server.Items;
using Server.Targeting;
namespace Server.Spells.Fourth
{
public class ArchCureSpell : Spell
{
private static SpellInfo m_Info = new SpellInfo(
"Arch Cure", "Vas An Nox",
SpellCircle.Fourth,
215,
9061,
Reagent.Garlic,
Reagent.Ginseng,
Reagent.MandrakeRoot
);
public ArchCureSpell( Mobile caster, Item scroll ) : base( caster, scroll, m_Info )
{
}
public override void OnCast()
{
Caster.Target = new InternalTarget( this );
}
// Archcure is now 1/4th of a second faster
public override int CastDelayBase{ get{ return base.CastDelayBase - 1; } }
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 );
ArrayList targets = new ArrayList();
Map map = Caster.Map;
if ( map != null )
{
IPooledEnumerable eable = map.GetMobilesInRange( new Point3D( p ), 2 );
foreach ( Mobile m in eable )
{
// Archcure doesn't cure aggressors or victims
if ( Caster.CanBeBeneficial( m, false ) && (!Core.AOS || !IsAggressor( m ) && !IsAggressed( m )) )
targets.Add( m );
}
eable.Free();
}
Effects.PlaySound( p, Caster.Map, 0x299 );
if ( targets.Count > 0 )
{
int cured = 0;
for ( int i = 0; i < targets.Count; ++i )
{
Mobile m = (Mobile)targets[i];
Caster.DoBeneficial( m );
Poison poison = m.Poison;
if ( poison != null )
{
int chanceToCure = 10000 + (int)(Caster.Skills[SkillName.Magery].Value * 75) - ((poison.Level + 1) * 1750);
chanceToCure /= 100;
chanceToCure -= 1;
if ( chanceToCure > Utility.Random( 100 ) && m.CurePoison( Caster ) )
++cured;
}
m.FixedParticles( 0x373A, 10, 15, 5012, EffectLayer.Waist );
m.PlaySound( 0x1E0 );
}
if ( cured > 0 )
Caster.SendLocalizedMessage( 1010058 ); // You have cured the target of all poisons!
}
}
FinishSequence();
}
private bool IsAggressor( Mobile m )
{
foreach ( AggressorInfo info in Caster.Aggressors )
{
if ( m == info.Attacker && !info.Expired )
return true;
}
return false;
}
private bool IsAggressed( Mobile m )
{
foreach ( AggressorInfo info in Caster.Aggressed )
{
if ( m == info.Defender && !info.Expired )
return true;
}
return false;
}
private class InternalTarget : Target
{
private ArchCureSpell m_Owner;
public InternalTarget( ArchCureSpell 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,154 @@
using System;
using System.Collections;
using Server.Network;
using Server.Items;
using Server.Targeting;
using Server.Engines.PartySystem;
namespace Server.Spells.Fourth
{
public class ArchProtectionSpell : Spell
{
private static SpellInfo m_Info = new SpellInfo(
"Arch Protection", "Vas Uus Sanct",
SpellCircle.Fourth,
Core.AOS ? 239 : 215,
9011,
Reagent.Garlic,
Reagent.Ginseng,
Reagent.MandrakeRoot,
Reagent.SulfurousAsh
);
public ArchProtectionSpell( 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 );
ArrayList targets = new ArrayList();
Map map = Caster.Map;
if ( map != null )
{
IPooledEnumerable eable = map.GetMobilesInRange( new Point3D( p ), Core.AOS ? 2 : 3 );
foreach ( Mobile m in eable )
{
if ( Caster.CanBeBeneficial( m, false ) )
targets.Add( m );
}
eable.Free();
}
if ( Core.AOS )
{
Party party = Party.Get( Caster );
for ( int i = 0; i < targets.Count; ++i )
{
Mobile m = (Mobile)targets[i];
if ( m == Caster || (party != null && party.Contains( m )) )
{
Caster.DoBeneficial( m );
Spells.Second.ProtectionSpell.Toggle( Caster, m );
}
}
}
else
{
Effects.PlaySound( p, Caster.Map, 0x299 );
int val = (int)(Caster.Skills[SkillName.Magery].Value/10.0 + 1);
if ( targets.Count > 0 )
{
for ( int i = 0; i < targets.Count; ++i )
{
Mobile m = (Mobile)targets[i];
if ( m.BeginAction( typeof( ArchProtectionSpell ) ) )
{
Caster.DoBeneficial( m );
m.VirtualArmorMod += val;
new InternalTimer( m, Caster, val ).Start();
m.FixedParticles( 0x375A, 9, 20, 5027, EffectLayer.Waist );
m.PlaySound( 0x1F7 );
}
}
}
}
}
FinishSequence();
}
private class InternalTimer : Timer
{
private Mobile m_Owner;
private int m_Val;
public InternalTimer( Mobile target, Mobile caster, int val ) : base( TimeSpan.FromSeconds( 0 ) )
{
double time = caster.Skills[SkillName.Magery].Value * 1.2;
if ( time > 144 )
time = 144;
Delay = TimeSpan.FromSeconds( time );
Priority = TimerPriority.OneSecond;
m_Owner = target;
m_Val = val;
}
protected override void OnTick()
{
m_Owner.EndAction( typeof( ArchProtectionSpell ) );
m_Owner.VirtualArmorMod -= m_Val;
if ( m_Owner.VirtualArmorMod < 0 )
m_Owner.VirtualArmorMod = 0;
}
}
private class InternalTarget : Target
{
private ArchProtectionSpell m_Owner;
public InternalTarget( ArchProtectionSpell 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,103 @@
using System;
using System.Collections;
using Server.Targeting;
using Server.Network;
namespace Server.Spells.Fourth
{
public class CurseSpell : Spell
{
private static SpellInfo m_Info = new SpellInfo(
"Curse", "Des Sanct",
SpellCircle.Fourth,
227,
9031,
Reagent.Nightshade,
Reagent.Garlic,
Reagent.SulfurousAsh
);
public CurseSpell( Mobile caster, Item scroll ) : base( caster, scroll, m_Info )
{
}
public override void OnCast()
{
Caster.Target = new InternalTarget( this );
}
private static Hashtable m_UnderEffect = new Hashtable();
public static void RemoveEffect( object state )
{
Mobile m = (Mobile)state;
m_UnderEffect.Remove( m );
m.UpdateResistances();
}
public static bool UnderEffect( Mobile m )
{
return m_UnderEffect.Contains( 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)this.Circle, Caster, ref m );
SpellHelper.AddStatCurse( Caster, m, StatType.Str ); SpellHelper.DisableSkillCheck = true;
SpellHelper.AddStatCurse( Caster, m, StatType.Dex );
SpellHelper.AddStatCurse( Caster, m, StatType.Int ); SpellHelper.DisableSkillCheck = false;
Timer t = (Timer)m_UnderEffect[m];
if ( Caster.Player && m.Player /*&& Caster != m */ && t == null ) //On OSI you CAN curse yourself and get this effect.
{
TimeSpan duration = SpellHelper.GetDuration( Caster, m );
m_UnderEffect[m] = t = Timer.DelayCall( duration, new TimerStateCallback( RemoveEffect ), m );
m.UpdateResistances();
}
if ( m.Spell != null )
m.Spell.OnCasterHurt();
m.Paralyzed = false;
m.FixedParticles( 0x374A, 10, 15, 5028, EffectLayer.Waist );
m.PlaySound( 0x1EA );
}
FinishSequence();
}
private class InternalTarget : Target
{
private CurseSpell m_Owner;
public InternalTarget( CurseSpell 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,284 @@
using System;
using System.Collections;
using Server.Targeting;
using Server.Network;
using Server.Misc;
using Server.Items;
namespace Server.Spells.Fourth
{
public class FireFieldSpell : Spell
{
private static SpellInfo m_Info = new SpellInfo(
"Fire Field", "In Flam Grav",
SpellCircle.Fourth,
215,
9041,
false,
Reagent.BlackPearl,
Reagent.SpidersSilk,
Reagent.SulfurousAsh
);
public FireFieldSpell( 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, 0x20C );
int itemID = eastToWest ? 0x398C : 0x3996;
TimeSpan duration;
if ( Core.AOS )
duration = TimeSpan.FromSeconds( (15 + (Caster.Skills.Magery.Fixed / 5)) / 4 );
else
duration = TimeSpan.FromSeconds( 4.0 + (Caster.Skills[SkillName.Magery].Value * 0.5) );
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 );
new InternalItem( itemID, loc, Caster, Caster.Map, duration, i );
}
}
FinishSequence();
}
[DispellableField]
private class InternalItem : Item
{
private Timer m_Timer;
private DateTime m_End;
private Mobile m_Caster;
public override bool BlocksFit{ get{ return true; } }
public InternalItem( int itemID, Point3D loc, Mobile caster, Map map, TimeSpan duration, int val ) : base( itemID )
{
bool canFit = SpellHelper.AdjustField( ref loc, map, 12, false );
Visible = false;
Movable = false;
Light = LightType.Circle300;
MoveToWorld( loc, map );
m_Caster = caster;
m_End = DateTime.Now + duration;
m_Timer = new InternalTimer( this, TimeSpan.FromSeconds( Math.Abs( val ) * 0.2 ), caster.InLOS( this ), canFit );
m_Timer.Start();
}
public override void OnAfterDelete()
{
base.OnAfterDelete();
if ( m_Timer != null )
m_Timer.Stop();
}
public InternalItem( Serial serial ) : base( serial )
{
}
public override void Serialize( GenericWriter writer )
{
base.Serialize( writer );
writer.Write( (int) 1 ); // version
writer.Write( m_Caster );
writer.WriteDeltaTime( m_End );
}
public override void Deserialize( GenericReader reader )
{
base.Deserialize( reader );
int version = reader.ReadInt();
switch ( version )
{
case 1:
{
m_Caster = reader.ReadMobile();
goto case 0;
}
case 0:
{
m_End = reader.ReadDeltaTime();
m_Timer = new InternalTimer( this, TimeSpan.Zero, true, true );
m_Timer.Start();
break;
}
}
}
public override bool OnMoveOver( Mobile m )
{
if ( Visible && m_Caster != null && (!Core.AOS || m != m_Caster) && SpellHelper.ValidIndirectTarget( m_Caster, m ) && m_Caster.CanBeHarmful( m, false ) )
{
m_Caster.DoHarmful( m );
int damage = 2;
if ( !Core.AOS && m.CheckSkill( SkillName.MagicResist, 0.0, 30.0 ) )
{
damage = 1;
m.SendLocalizedMessage( 501783 ); // You feel yourself resisting magical energy.
}
AOS.Damage( m, m_Caster, damage, 0, 100, 0, 0, 0 );
m.PlaySound( 0x208 );
}
return true;
}
private class InternalTimer : Timer
{
private InternalItem m_Item;
private bool m_InLOS, m_CanFit;
private static Queue m_Queue = new Queue();
public InternalTimer( InternalItem item, TimeSpan delay, bool inLOS, bool canFit ) : base( delay, TimeSpan.FromSeconds( 1.0 ) )
{
m_Item = item;
m_InLOS = inLOS;
m_CanFit = canFit;
Priority = TimerPriority.FiftyMS;
}
protected override void OnTick()
{
if ( m_Item.Deleted )
return;
if ( !m_Item.Visible )
{
if ( m_InLOS && m_CanFit )
m_Item.Visible = true;
else
m_Item.Delete();
if ( !m_Item.Deleted )
{
m_Item.ProcessDelta();
Effects.SendLocationParticles( EffectItem.Create( m_Item.Location, m_Item.Map, EffectItem.DefaultDuration ), 0x376A, 9, 10, 5029 );
}
}
else if ( DateTime.Now > m_Item.m_End )
{
m_Item.Delete();
Stop();
}
else
{
Map map = m_Item.Map;
Mobile caster = m_Item.m_Caster;
if ( map != null && caster != null )
{
foreach ( Mobile m in m_Item.GetMobilesInRange( 0 ) )
{
if ( (m.Z + 16) > m_Item.Z && (m_Item.Z + 12) > m.Z && (!Core.AOS || m != caster) && SpellHelper.ValidIndirectTarget( caster, m ) && caster.CanBeHarmful( m, false ) )
m_Queue.Enqueue( m );
}
while ( m_Queue.Count > 0 )
{
Mobile m = (Mobile)m_Queue.Dequeue();
caster.DoHarmful( m );
int damage = 2;
if ( !Core.AOS && m.CheckSkill( SkillName.MagicResist, 0.0, 30.0 ) )
{
damage = 1;
m.SendLocalizedMessage( 501783 ); // You feel yourself resisting magical energy.
}
AOS.Damage( m, caster, damage, 0, 100, 0, 0, 0 );
m.PlaySound( 0x208 );
}
}
}
}
}
}
private class InternalTarget : Target
{
private FireFieldSpell m_Owner;
public InternalTarget( FireFieldSpell 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,94 @@
using System;
using Server;
using Server.Targeting;
using Server.Network;
using Server.Mobiles;
namespace Server.Spells.Fourth
{
public class GreaterHealSpell : Spell
{
private static SpellInfo m_Info = new SpellInfo(
"Greater Heal", "In Vas Mani",
SpellCircle.Fourth,
204,
9061,
Reagent.Garlic,
Reagent.Ginseng,
Reagent.MandrakeRoot,
Reagent.SpidersSilk
);
public GreaterHealSpell( 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 ( m is BaseCreature && ((BaseCreature)m).IsAnimatedDead )
{
Caster.SendLocalizedMessage( 1061654 ); // You cannot heal that which is not alive.
}
else if ( m.IsDeadBondedPet )
{
Caster.SendLocalizedMessage( 1060177 ); // You cannot heal a creature that is already dead!
}
else if ( m is Golem )
{
Caster.LocalOverheadMessage( MessageType.Regular, 0x3B2, 500951 ); // You cannot heal that.
}
else if ( m.Poisoned || Server.Items.MortalStrike.IsWounded( m ) )
{
Caster.LocalOverheadMessage( MessageType.Regular, 0x22, (Caster == m) ? 1005000 : 1010398 );
}
else if ( CheckBSequence( m ) )
{
SpellHelper.Turn( Caster, m );
// Algorithm: (40% of magery) + (1-10)
int toHeal = (int)(Caster.Skills[SkillName.Magery].Value * 0.4);
toHeal += Utility.Random( 1, 10 );
m.Heal( toHeal );
m.FixedParticles( 0x376A, 9, 32, 5030, EffectLayer.Waist );
m.PlaySound( 0x202 );
}
FinishSequence();
}
public class InternalTarget : Target
{
private GreaterHealSpell m_Owner;
public InternalTarget( GreaterHealSpell owner ) : base( 12, false, TargetFlags.Beneficial )
{
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,90 @@
using System;
using Server.Targeting;
using Server.Network;
namespace Server.Spells.Fourth
{
public class LightningSpell : Spell
{
private static SpellInfo m_Info = new SpellInfo(
"Lightning", "Por Ort Grav",
SpellCircle.Fourth,
239,
9021,
Reagent.MandrakeRoot,
Reagent.SulfurousAsh
);
public LightningSpell( Mobile caster, Item scroll ) : base( caster, scroll, m_Info )
{
}
public override void OnCast()
{
Caster.Target = new InternalTarget( this );
}
public override bool DelayedDamage{ get{ return false; } }
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;
if ( Core.AOS )
{
damage = GetNewAosDamage( 23, 1, 4, m );
}
else
{
damage = Utility.Random( 12, 9 );
if ( CheckResisted( m ) )
{
damage *= 0.75;
m.SendLocalizedMessage( 501783 ); // You feel yourself resisting magical energy.
}
damage *= GetDamageScalar( m );
}
m.BoltEffect( 0 );
SpellHelper.Damage( this, m, damage, 0, 0, 0, 0, 100 );
}
FinishSequence();
}
private class InternalTarget : Target
{
private LightningSpell m_Owner;
public InternalTarget( LightningSpell 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,131 @@
using System;
using System.Collections;
using Server.Targeting;
using Server.Network;
namespace Server.Spells.Fourth
{
public class ManaDrainSpell : Spell
{
private static SpellInfo m_Info = new SpellInfo(
"Mana Drain", "Ort Rel",
SpellCircle.Fourth,
215,
9031,
Reagent.BlackPearl,
Reagent.MandrakeRoot,
Reagent.SpidersSilk
);
public ManaDrainSpell( Mobile caster, Item scroll ) : base( caster, scroll, m_Info )
{
}
public override void OnCast()
{
Caster.Target = new InternalTarget( this );
}
private Hashtable m_Table = new Hashtable();
private void AosDelay_Callback( object state )
{
object[] states = (object[])state;
Mobile m = (Mobile)states[0];
int mana = (int)states[1];
if ( m.Alive && !m.IsDeadBondedPet )
{
m.Mana += mana;
m.FixedEffect( 0x3779, 10, 25 );
m.PlaySound( 0x28E );
}
m_Table.Remove( 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)this.Circle, Caster, ref m );
if ( m.Spell != null )
m.Spell.OnCasterHurt();
m.Paralyzed = false;
if ( Core.AOS )
{
int toDrain = 40 + (int)(GetDamageSkill( Caster ) - GetResistSkill( m ));
if ( toDrain < 0 )
toDrain = 0;
else if ( toDrain > m.Mana )
toDrain = m.Mana;
if ( m_Table.Contains( m ) )
toDrain = 0;
m.FixedParticles( 0x3789, 10, 25, 5032, EffectLayer.Head );
m.PlaySound( 0x1F8 );
if ( toDrain > 0 )
{
m.Mana -= toDrain;
m_Table[m] = Timer.DelayCall( TimeSpan.FromSeconds( 5.0 ), new TimerStateCallback( AosDelay_Callback ), new object[]{ m, toDrain } );
}
}
else
{
if ( CheckResisted( m ) )
m.SendLocalizedMessage( 501783 ); // You feel yourself resisting magical energy.
else if ( m.Mana >= 100 )
m.Mana -= Utility.Random( 1, 100 );
else
m.Mana -= Utility.Random( 1, m.Mana );
m.FixedParticles( 0x374A, 10, 15, 5032, EffectLayer.Head );
m.PlaySound( 0x1F8 );
}
}
FinishSequence();
}
public override double GetResistPercent( Mobile target )
{
return 99.0;
}
private class InternalTarget : Target
{
private ManaDrainSpell m_Owner;
public InternalTarget( ManaDrainSpell 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,196 @@
using System;
using Server.Items;
using Server.Multis;
using Server.Mobiles;
using Server.Network;
using Server.Targeting;
using Server.Regions;
using Server.Spells.Necromancy;
namespace Server.Spells.Fourth
{
public class RecallSpell : Spell
{
private static SpellInfo m_Info = new SpellInfo(
"Recall", "Kal Ort Por",
SpellCircle.Fourth,
239,
9031,
Reagent.BlackPearl,
Reagent.Bloodmoss,
Reagent.MandrakeRoot
);
private RunebookEntry m_Entry;
private Runebook m_Book;
public RecallSpell( Mobile caster, Item scroll ) : this( caster, scroll, null, null )
{
}
public RecallSpell( Mobile caster, Item scroll, RunebookEntry entry, Runebook book ) : base( caster, scroll, m_Info )
{
m_Entry = entry;
m_Book = book;
}
public override void GetCastSkills( out double min, out double max )
{
if ( TransformationSpell.UnderTransformation( Caster, typeof( WraithFormSpell ) ) )
min = max = 0;
else if( Core.SE && m_Book != null ) //recall using Runebook charge
min = max = 0;
else
base.GetCastSkills( out min, out max );
}
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;
}
else if ( Caster.Criminal )
{
Caster.SendLocalizedMessage( 1005561, "", 0x22 ); // Thou'rt a criminal and cannot escape so easily.
return false;
}
else if ( SpellHelper.CheckCombat( Caster ) )
{
Caster.SendLocalizedMessage( 1005564, "", 0x22 ); // Wouldst thou flee during the heat of battle??
return false;
}
else if ( Server.Misc.WeightOverloading.IsOverloaded( Caster ) )
{
Caster.SendLocalizedMessage( 502359, "", 0x22 ); // Thou art too encumbered to move.
return false;
}
return SpellHelper.CheckTravel( Caster, TravelCheckType.RecallFrom );
}
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( 1005569 ); // You can not recall to another facet.
}
else if ( !SpellHelper.CheckTravel( Caster, TravelCheckType.RecallFrom ) )
{
}
else if ( !SpellHelper.CheckTravel( Caster, map, loc, TravelCheckType.RecallTo ) )
{
}
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 ( Server.Misc.WeightOverloading.IsOverloaded( Caster ) )
{
Caster.SendLocalizedMessage( 502359, "", 0x22 ); // Thou art too encumbered to move.
}
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 ( m_Book != null && m_Book.CurCharges <= 0 )
{
Caster.SendLocalizedMessage( 502412 ); // There are no charges left on that item.
}
else if ( CheckSequence() )
{
BaseCreature.TeleportPets( Caster, loc, map, true );
if ( m_Book != null )
--m_Book.CurCharges;
Caster.PlaySound( 0x1FC );
Caster.MoveToWorld( loc, map );
Caster.PlaySound( 0x1FC );
}
FinishSequence();
}
private class InternalTarget : Target
{
private RecallSpell m_Owner;
public InternalTarget( RecallSpell 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 RecallRune )
{
RecallRune rune = (RecallRune)o;
if ( rune.Marked )
m_Owner.Effect( rune.Target, rune.TargetMap, true );
else
from.SendLocalizedMessage( 501805 ); // That rune is not yet marked.
}
else if ( o is Runebook )
{
RunebookEntry e = ((Runebook)o).Default;
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;
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, 502357, from.Name, "" ) ); // I can not recall from that object.
}
else
{
from.Send( new MessageLocalized( from.Serial, from.Body, MessageType.Regular, 0x3B2, 3, 502357, from.Name, "" ) ); // I can not recall from that object.
}
}
protected override void OnTargetFinish( Mobile from )
{
m_Owner.FinishSequence();
}
}
}
}