Fixes code according to modern code style. Fixes a few expression bugs.

This commit is contained in:
Kamron Batman 2018-09-15 09:58:51 -07:00
parent 89eea25e5f
commit 970fd563b2
3324 changed files with 441118 additions and 433755 deletions

View file

@ -4,103 +4,103 @@ using Server.Targeting;
namespace Server.Spells.Fifth
{
public class BladeSpiritsSpell : MagerySpell
{
private static SpellInfo m_Info = new SpellInfo(
"Blade Spirits", "In Jux Hur Ylem",
266,
9040,
false,
Reagent.BlackPearl,
Reagent.MandrakeRoot,
Reagent.Nightshade
);
public class BladeSpiritsSpell : MagerySpell
{
private static SpellInfo m_Info = new SpellInfo(
"Blade Spirits", "In Jux Hur Ylem",
266,
9040,
false,
Reagent.BlackPearl,
Reagent.MandrakeRoot,
Reagent.Nightshade
);
public override SpellCircle Circle => SpellCircle.Fifth;
public BladeSpiritsSpell(Mobile caster, Item scroll) : base(caster, scroll, m_Info)
{
}
public BladeSpiritsSpell( Mobile caster, Item scroll ) : base( caster, scroll, m_Info )
{
}
public override SpellCircle Circle => SpellCircle.Fifth;
public override TimeSpan GetCastDelay()
{
if ( Core.AOS )
return TimeSpan.FromTicks( base.GetCastDelay().Ticks * ((Core.SE) ? 3 : 5) );
public override TimeSpan GetCastDelay()
{
if (Core.AOS)
return TimeSpan.FromTicks(base.GetCastDelay().Ticks * (Core.SE ? 3 : 5));
return base.GetCastDelay() + TimeSpan.FromSeconds( 6.0 );
}
return base.GetCastDelay() + TimeSpan.FromSeconds(6.0);
}
public override bool CheckCast()
{
if ( !base.CheckCast() )
return false;
public override bool CheckCast()
{
if (!base.CheckCast())
return false;
if ( (Caster.Followers + (Core.SE ? 2 : 1)) > Caster.FollowersMax )
{
Caster.SendLocalizedMessage( 1049645 ); // You have too many followers to summon that creature.
return false;
}
if (Caster.Followers + (Core.SE ? 2 : 1) > Caster.FollowersMax)
{
Caster.SendLocalizedMessage(1049645); // You have too many followers to summon that creature.
return false;
}
return true;
}
return true;
}
public override void OnCast()
{
Caster.Target = new InternalTarget( this );
}
public override void OnCast()
{
Caster.Target = new InternalTarget(this);
}
public void Target( IPoint3D p )
{
Map map = Caster.Map;
public void Target(IPoint3D p)
{
Map map = Caster.Map;
SpellHelper.GetSurfaceTop( ref p );
SpellHelper.GetSurfaceTop(ref p);
if ( map == null || !map.CanSpawnMobile( p.X, p.Y, p.Z ) )
{
Caster.SendLocalizedMessage( 501942 ); // That location is blocked.
}
else if ( SpellHelper.CheckTown( p, Caster ) && CheckSequence() )
{
TimeSpan duration;
if (map == null || !map.CanSpawnMobile(p.X, p.Y, p.Z))
{
Caster.SendLocalizedMessage(501942); // That location is blocked.
}
else if (SpellHelper.CheckTown(p, Caster) && CheckSequence())
{
TimeSpan duration;
if ( Core.AOS )
duration = TimeSpan.FromSeconds( 120 );
else
duration = TimeSpan.FromSeconds( Utility.Random( 80, 40 ) );
if (Core.AOS)
duration = TimeSpan.FromSeconds(120);
else
duration = TimeSpan.FromSeconds(Utility.Random(80, 40));
BaseCreature.Summon( new BladeSpirits(), false, Caster, new Point3D( p ), 0x212, duration );
}
BaseCreature.Summon(new BladeSpirits(), false, Caster, new Point3D(p), 0x212, duration);
}
FinishSequence();
}
FinishSequence();
}
private class InternalTarget : Target
{
private BladeSpiritsSpell m_Owner;
private class InternalTarget : Target
{
private BladeSpiritsSpell m_Owner;
public InternalTarget( BladeSpiritsSpell owner ) : base( Core.ML ? 10 : 12, true, TargetFlags.None )
{
m_Owner = owner;
}
public InternalTarget(BladeSpiritsSpell owner) : base(Core.ML ? 10 : 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 OnTarget(Mobile from, object o)
{
if (o is IPoint3D)
m_Owner.Target((IPoint3D)o);
}
protected override void OnTargetOutOfLOS( Mobile from, object o )
{
from.SendLocalizedMessage( 501943 ); // Target cannot be seen. Try again.
from.Target = new InternalTarget( m_Owner );
from.Target.BeginTimeout( from, TimeoutTime - DateTime.UtcNow );
m_Owner = null;
}
protected override void OnTargetOutOfLOS(Mobile from, object o)
{
from.SendLocalizedMessage(501943); // Target cannot be seen. Try again.
from.Target = new InternalTarget(m_Owner);
from.Target.BeginTimeout(from, TimeoutTime - DateTime.UtcNow);
m_Owner = null;
}
protected override void OnTargetFinish( Mobile from )
{
m_Owner?.FinishSequence();
}
}
}
}
protected override void OnTargetFinish(Mobile from)
{
m_Owner?.FinishSequence();
}
}
}
}

View file

@ -1,87 +1,84 @@
using System;
using Server.Targeting;
using Server.Items;
using Server.Misc;
using Server.Targeting;
namespace Server.Spells.Fifth
{
public class DispelFieldSpell : MagerySpell
{
private static SpellInfo m_Info = new SpellInfo(
"Dispel Field", "An Grav",
206,
9002,
Reagent.BlackPearl,
Reagent.SpidersSilk,
Reagent.SulfurousAsh,
Reagent.Garlic
);
public class DispelFieldSpell : MagerySpell
{
private static SpellInfo m_Info = new SpellInfo(
"Dispel Field", "An Grav",
206,
9002,
Reagent.BlackPearl,
Reagent.SpidersSilk,
Reagent.SulfurousAsh,
Reagent.Garlic
);
public override SpellCircle Circle => SpellCircle.Fifth;
public DispelFieldSpell(Mobile caster, Item scroll) : base(caster, scroll, m_Info)
{
}
public DispelFieldSpell( Mobile caster, Item scroll ) : base( caster, scroll, m_Info )
{
}
public override SpellCircle Circle => SpellCircle.Fifth;
public override void OnCast()
{
Caster.Target = new InternalTarget( this );
}
public override void OnCast()
{
Caster.Target = new InternalTarget(this);
}
public void Target( Item item )
{
Type t = item.GetType();
public void Target(Item item)
{
Type t = item.GetType();
if ( !Caster.CanSee( item ) )
{
Caster.SendLocalizedMessage( 500237 ); // Target can not be seen.
}
else if ( !t.IsDefined( typeof( DispellableFieldAttribute ), false ) )
{
Caster.SendLocalizedMessage( 1005049 ); // That cannot be dispelled.
}
else if ( item is Moongate && !((Moongate)item).Dispellable )
{
Caster.SendLocalizedMessage( 1005047 ); // That magic is too chaotic
}
else if ( CheckSequence() )
{
SpellHelper.Turn( Caster, item );
if (!Caster.CanSee(item))
{
Caster.SendLocalizedMessage(500237); // Target can not be seen.
}
else if (!t.IsDefined(typeof(DispellableFieldAttribute), false))
{
Caster.SendLocalizedMessage(1005049); // That cannot be dispelled.
}
else if (item is Moongate && !((Moongate)item).Dispellable)
{
Caster.SendLocalizedMessage(1005047); // That magic is too chaotic
}
else if (CheckSequence())
{
SpellHelper.Turn(Caster, item);
Effects.SendLocationParticles( EffectItem.Create( item.Location, item.Map, EffectItem.DefaultDuration ), 0x376A, 9, 20, 5042 );
Effects.PlaySound( item.GetWorldLocation(), item.Map, 0x201 );
Effects.SendLocationParticles(EffectItem.Create(item.Location, item.Map, EffectItem.DefaultDuration), 0x376A,
9, 20, 5042);
Effects.PlaySound(item.GetWorldLocation(), item.Map, 0x201);
item.Delete();
}
item.Delete();
}
FinishSequence();
}
FinishSequence();
}
private class InternalTarget : Target
{
private DispelFieldSpell m_Owner;
private class InternalTarget : Target
{
private DispelFieldSpell m_Owner;
public InternalTarget( DispelFieldSpell owner ) : base( Core.ML ? 10 : 12, false, TargetFlags.None )
{
m_Owner = owner;
}
public InternalTarget(DispelFieldSpell owner) : base(Core.ML ? 10 : 12, false, TargetFlags.None)
{
m_Owner = owner;
}
protected override void OnTarget( Mobile from, object o )
{
if ( o is Item )
{
m_Owner.Target( (Item)o );
}
else
{
m_Owner.Caster.SendLocalizedMessage( 1005049 ); // That cannot be dispelled.
}
}
protected override void OnTarget(Mobile from, object o)
{
if (o is Item)
m_Owner.Target((Item)o);
else
m_Owner.Caster.SendLocalizedMessage(1005049); // That cannot be dispelled.
}
protected override void OnTargetFinish( Mobile from )
{
m_Owner.FinishSequence();
}
}
}
}
protected override void OnTargetFinish(Mobile from)
{
m_Owner.FinishSequence();
}
}
}
}

View file

@ -1,188 +1,191 @@
using System;
using System.Collections;
using Server.Mobiles;
using Server.Factions;
using Server.Items;
using Server.Mobiles;
using Server.Spells.Seventh;
namespace Server.Spells.Fifth
{
public class IncognitoSpell : MagerySpell
{
private static SpellInfo m_Info = new SpellInfo(
"Incognito", "Kal In Ex",
206,
9002,
Reagent.Bloodmoss,
Reagent.Garlic,
Reagent.Nightshade
);
public class IncognitoSpell : MagerySpell
{
private static SpellInfo m_Info = new SpellInfo(
"Incognito", "Kal In Ex",
206,
9002,
Reagent.Bloodmoss,
Reagent.Garlic,
Reagent.Nightshade
);
public override SpellCircle Circle => SpellCircle.Fifth;
private static Hashtable m_Timers = new Hashtable();
public IncognitoSpell( Mobile caster, Item scroll ) : base( caster, scroll, m_Info )
{
}
private static int[] m_HairIDs =
{
0x2044, 0x2045, 0x2046,
0x203C, 0x203B, 0x203D,
0x2047, 0x2048, 0x2049,
0x204A, 0x0000
};
public override bool CheckCast()
{
if ( Factions.Sigil.ExistsOn( Caster ) )
{
Caster.SendLocalizedMessage( 1010445 ); // You cannot incognito if you have a sigil
return false;
}
private static int[] m_BeardIDs =
{
0x203E, 0x203F, 0x2040,
0x2041, 0x204B, 0x204C,
0x204D, 0x0000
};
if ( !Caster.CanBeginAction( typeof( IncognitoSpell ) ) )
{
Caster.SendLocalizedMessage( 1005559 ); // This spell is already in effect.
return false;
}
if ( Caster.BodyMod == 183 || Caster.BodyMod == 184 )
{
Caster.SendLocalizedMessage( 1042402 ); // You cannot use incognito while wearing body paint
return false;
}
public IncognitoSpell(Mobile caster, Item scroll) : base(caster, scroll, m_Info)
{
}
return true;
}
public override SpellCircle Circle => SpellCircle.Fifth;
public override void OnCast()
{
if ( Factions.Sigil.ExistsOn( Caster ) )
{
Caster.SendLocalizedMessage( 1010445 ); // You cannot incognito if you have a sigil
}
else if ( !Caster.CanBeginAction( typeof( IncognitoSpell ) ) )
{
Caster.SendLocalizedMessage( 1005559 ); // This spell is already in effect.
}
else if ( Caster.BodyMod == 183 || Caster.BodyMod == 184 )
{
Caster.SendLocalizedMessage( 1042402 ); // You cannot use incognito while wearing body paint
}
else if ( DisguiseTimers.IsDisguised( Caster ) )
{
Caster.SendLocalizedMessage( 1061631 ); // You can't do that while disguised.
}
else if ( !Caster.CanBeginAction( typeof( PolymorphSpell ) ) || Caster.IsBodyMod )
{
DoFizzle();
}
else if ( CheckSequence() )
{
if ( Caster.BeginAction( typeof( IncognitoSpell ) ) )
{
DisguiseTimers.StopTimer( Caster );
public override bool CheckCast()
{
if (Sigil.ExistsOn(Caster))
{
Caster.SendLocalizedMessage(1010445); // You cannot incognito if you have a sigil
return false;
}
Caster.HueMod = Caster.Race.RandomSkinHue();
Caster.NameMod = Caster.Female ? NameList.RandomName( "female" ) : NameList.RandomName( "male" );
if (!Caster.CanBeginAction(typeof(IncognitoSpell)))
{
Caster.SendLocalizedMessage(1005559); // This spell is already in effect.
return false;
}
PlayerMobile pm = Caster as PlayerMobile;
if (Caster.BodyMod == 183 || Caster.BodyMod == 184)
{
Caster.SendLocalizedMessage(1042402); // You cannot use incognito while wearing body paint
return false;
}
if ( pm?.Race != null )
{
pm.SetHairMods( pm.Race.RandomHair( pm.Female ), pm.Race.RandomFacialHair( pm.Female ) );
pm.HairHue = pm.Race.RandomHairHue();
pm.FacialHairHue = pm.Race.RandomHairHue();
}
return true;
}
Caster.FixedParticles( 0x373A, 10, 15, 5036, EffectLayer.Head );
Caster.PlaySound( 0x3BD );
public override void OnCast()
{
if (Sigil.ExistsOn(Caster))
{
Caster.SendLocalizedMessage(1010445); // You cannot incognito if you have a sigil
}
else if (!Caster.CanBeginAction(typeof(IncognitoSpell)))
{
Caster.SendLocalizedMessage(1005559); // This spell is already in effect.
}
else if (Caster.BodyMod == 183 || Caster.BodyMod == 184)
{
Caster.SendLocalizedMessage(1042402); // You cannot use incognito while wearing body paint
}
else if (DisguiseTimers.IsDisguised(Caster))
{
Caster.SendLocalizedMessage(1061631); // You can't do that while disguised.
}
else if (!Caster.CanBeginAction(typeof(PolymorphSpell)) || Caster.IsBodyMod)
{
DoFizzle();
}
else if (CheckSequence())
{
if (Caster.BeginAction(typeof(IncognitoSpell)))
{
DisguiseTimers.StopTimer(Caster);
BaseArmor.ValidateMobile( Caster );
BaseClothing.ValidateMobile( Caster );
Caster.HueMod = Caster.Race.RandomSkinHue();
Caster.NameMod = Caster.Female ? NameList.RandomName("female") : NameList.RandomName("male");
StopTimer( Caster );
PlayerMobile pm = Caster as PlayerMobile;
if (pm?.Race != null)
{
pm.SetHairMods(pm.Race.RandomHair(pm.Female), pm.Race.RandomFacialHair(pm.Female));
pm.HairHue = pm.Race.RandomHairHue();
pm.FacialHairHue = pm.Race.RandomHairHue();
}
Caster.FixedParticles(0x373A, 10, 15, 5036, EffectLayer.Head);
Caster.PlaySound(0x3BD);
BaseArmor.ValidateMobile(Caster);
BaseClothing.ValidateMobile(Caster);
StopTimer(Caster);
int timeVal = ((6 * Caster.Skills.Magery.Fixed) / 50) + 1;
int timeVal = 6 * Caster.Skills.Magery.Fixed / 50 + 1;
if ( timeVal > 144 )
timeVal = 144;
if (timeVal > 144)
timeVal = 144;
TimeSpan length = TimeSpan.FromSeconds( timeVal );
TimeSpan length = TimeSpan.FromSeconds(timeVal);
Timer t = new InternalTimer( Caster, length );
Timer t = new InternalTimer(Caster, length);
m_Timers[Caster] = t;
m_Timers[Caster] = t;
t.Start();
t.Start();
BuffInfo.AddBuff( Caster, new BuffInfo( BuffIcon.Incognito, 1075819, length, Caster ) );
BuffInfo.AddBuff(Caster, new BuffInfo(BuffIcon.Incognito, 1075819, length, Caster));
}
else
{
Caster.SendLocalizedMessage(1079022); // You're already incognitoed!
}
}
}
else
{
Caster.SendLocalizedMessage( 1079022 ); // You're already incognitoed!
}
}
FinishSequence();
}
FinishSequence();
}
public static bool StopTimer(Mobile m)
{
Timer t = (Timer)m_Timers[m];
private static Hashtable m_Timers = new Hashtable();
if (t != null)
{
t.Stop();
m_Timers.Remove(m);
BuffInfo.RemoveBuff(m, BuffIcon.Incognito);
}
public static bool StopTimer( Mobile m )
{
Timer t = (Timer)m_Timers[m];
return t != null;
}
if ( t != null )
{
t.Stop();
m_Timers.Remove( m );
BuffInfo.RemoveBuff( m, BuffIcon.Incognito );
}
private class InternalTimer : Timer
{
private Mobile m_Owner;
return ( t != null );
}
public InternalTimer(Mobile owner, TimeSpan length) : base(length)
{
m_Owner = owner;
private static int[] m_HairIDs = {
0x2044, 0x2045, 0x2046,
0x203C, 0x203B, 0x203D,
0x2047, 0x2048, 0x2049,
0x204A, 0x0000
};
/*
int val = ((6 * owner.Skills.Magery.Fixed) / 50) + 1;
private static int[] m_BeardIDs = {
0x203E, 0x203F, 0x2040,
0x2041, 0x204B, 0x204C,
0x204D, 0x0000
};
if ( val > 144 )
val = 144;
private class InternalTimer : Timer
{
private Mobile m_Owner;
Delay = TimeSpan.FromSeconds( val );
* */
Priority = TimerPriority.OneSecond;
}
public InternalTimer( Mobile owner, TimeSpan length ) : base( length )
{
m_Owner = owner;
protected override void OnTick()
{
if (!m_Owner.CanBeginAction(typeof(IncognitoSpell)))
{
(m_Owner as PlayerMobile)?.SetHairMods(-1, -1);
/*
int val = ((6 * owner.Skills.Magery.Fixed) / 50) + 1;
m_Owner.BodyMod = 0;
m_Owner.HueMod = -1;
m_Owner.NameMod = null;
m_Owner.EndAction(typeof(IncognitoSpell));
if ( val > 144 )
val = 144;
Delay = TimeSpan.FromSeconds( val );
* */
Priority = TimerPriority.OneSecond;
}
protected override void OnTick()
{
if ( !m_Owner.CanBeginAction( typeof( IncognitoSpell ) ) )
{
(m_Owner as PlayerMobile)?.SetHairMods( -1, -1 );
m_Owner.BodyMod = 0;
m_Owner.HueMod = -1;
m_Owner.NameMod = null;
m_Owner.EndAction( typeof( IncognitoSpell ) );
BaseArmor.ValidateMobile( m_Owner );
BaseClothing.ValidateMobile( m_Owner );
}
}
}
}
}
BaseArmor.ValidateMobile(m_Owner);
BaseClothing.ValidateMobile(m_Owner);
}
}
}
}
}

View file

@ -1,153 +1,150 @@
using System;
using System.Collections;
namespace Server.Spells.Fifth
{
public class MagicReflectSpell : MagerySpell
{
private static SpellInfo m_Info = new SpellInfo(
"Magic Reflection", "In Jux Sanct",
242,
9012,
Reagent.Garlic,
Reagent.MandrakeRoot,
Reagent.SpidersSilk
);
public class MagicReflectSpell : MagerySpell
{
private static SpellInfo m_Info = new SpellInfo(
"Magic Reflection", "In Jux Sanct",
242,
9012,
Reagent.Garlic,
Reagent.MandrakeRoot,
Reagent.SpidersSilk
);
public override SpellCircle Circle => SpellCircle.Fifth;
private static Hashtable m_Table = new Hashtable();
public MagicReflectSpell( Mobile caster, Item scroll ) : base( caster, scroll, m_Info )
{
}
public MagicReflectSpell(Mobile caster, Item scroll) : base(caster, scroll, m_Info)
{
}
public override bool CheckCast()
{
if ( Core.AOS )
return true;
public override SpellCircle Circle => SpellCircle.Fifth;
if ( Caster.MagicDamageAbsorb > 0 )
{
Caster.SendLocalizedMessage( 1005559 ); // This spell is already in effect.
return false;
}
public override bool CheckCast()
{
if (Core.AOS)
return true;
if ( !Caster.CanBeginAction( typeof( DefensiveSpell ) ) )
{
Caster.SendLocalizedMessage( 1005385 ); // The spell will not adhere to you at this time.
return false;
}
if (Caster.MagicDamageAbsorb > 0)
{
Caster.SendLocalizedMessage(1005559); // This spell is already in effect.
return false;
}
return true;
}
if (!Caster.CanBeginAction(typeof(DefensiveSpell)))
{
Caster.SendLocalizedMessage(1005385); // The spell will not adhere to you at this time.
return false;
}
private static Hashtable m_Table = new Hashtable();
return true;
}
public override void OnCast()
{
if ( Core.AOS )
{
/* The magic reflection spell decreases the caster's physical resistance, while increasing the caster's elemental resistances.
* Physical decrease = 25 - (Inscription/20).
* Elemental resistance = +10 (-20 physical, +10 elemental at GM Inscription)
* The magic reflection spell has an indefinite duration, becoming active when cast, and deactivated when re-cast.
* Reactive Armor, Protection, and Magic Reflection will stay on<EFBFBD>even after logging out, even after dying<EFBFBD>until you <EFBFBD>turn them off<EFBFBD> by casting them again.
*/
public override void OnCast()
{
if (Core.AOS)
{
/* The magic reflection spell decreases the caster's physical resistance, while increasing the caster's elemental resistances.
* Physical decrease = 25 - (Inscription/20).
* Elemental resistance = +10 (-20 physical, +10 elemental at GM Inscription)
* The magic reflection spell has an indefinite duration, becoming active when cast, and deactivated when re-cast.
* Reactive Armor, Protection, and Magic Reflection will stay on<EFBFBD>even after logging out, even after dying<EFBFBD>until you <EFBFBD>turn them off<EFBFBD> by casting them again.
*/
if ( CheckSequence() )
{
Mobile targ = Caster;
if (CheckSequence())
{
Mobile targ = Caster;
ResistanceMod[] mods = (ResistanceMod[])m_Table[targ];
ResistanceMod[] mods = (ResistanceMod[])m_Table[targ];
if ( mods == null )
{
targ.PlaySound( 0x1E9 );
targ.FixedParticles( 0x375A, 10, 15, 5037, EffectLayer.Waist );
if (mods == null)
{
targ.PlaySound(0x1E9);
targ.FixedParticles(0x375A, 10, 15, 5037, EffectLayer.Waist);
int physiMod = -25 + (int)(targ.Skills[SkillName.Inscribe].Value / 20);
int otherMod = 10;
int physiMod = -25 + (int)(targ.Skills[SkillName.Inscribe].Value / 20);
int otherMod = 10;
mods = new ResistanceMod[5]
{
new ResistanceMod( ResistanceType.Physical, physiMod ),
new ResistanceMod( ResistanceType.Fire, otherMod ),
new ResistanceMod( ResistanceType.Cold, otherMod ),
new ResistanceMod( ResistanceType.Poison, otherMod ),
new ResistanceMod( ResistanceType.Energy, otherMod )
};
mods = new ResistanceMod[5]
{
new ResistanceMod(ResistanceType.Physical, physiMod),
new ResistanceMod(ResistanceType.Fire, otherMod),
new ResistanceMod(ResistanceType.Cold, otherMod),
new ResistanceMod(ResistanceType.Poison, otherMod),
new ResistanceMod(ResistanceType.Energy, otherMod)
};
m_Table[targ] = mods;
m_Table[targ] = mods;
for ( int i = 0; i < mods.Length; ++i )
targ.AddResistanceMod( mods[i] );
for (int i = 0; i < mods.Length; ++i)
targ.AddResistanceMod(mods[i]);
string buffFormat = string.Format( "{0}\t+{1}\t+{1}\t+{1}\t+{1}", physiMod, otherMod );
string buffFormat = string.Format("{0}\t+{1}\t+{1}\t+{1}\t+{1}", physiMod, otherMod);
BuffInfo.AddBuff( targ, new BuffInfo( BuffIcon.MagicReflection, 1075817, buffFormat, true ) );
}
else
{
targ.PlaySound( 0x1ED );
targ.FixedParticles( 0x375A, 10, 15, 5037, EffectLayer.Waist );
BuffInfo.AddBuff(targ, new BuffInfo(BuffIcon.MagicReflection, 1075817, buffFormat, true));
}
else
{
targ.PlaySound(0x1ED);
targ.FixedParticles(0x375A, 10, 15, 5037, EffectLayer.Waist);
m_Table.Remove( targ );
m_Table.Remove(targ);
for ( int i = 0; i < mods.Length; ++i )
targ.RemoveResistanceMod( mods[i] );
for (int i = 0; i < mods.Length; ++i)
targ.RemoveResistanceMod(mods[i]);
BuffInfo.RemoveBuff( targ, BuffIcon.MagicReflection );
}
}
BuffInfo.RemoveBuff(targ, BuffIcon.MagicReflection);
}
}
FinishSequence();
}
else
{
if ( Caster.MagicDamageAbsorb > 0 )
{
Caster.SendLocalizedMessage( 1005559 ); // This spell is already in effect.
}
else if ( !Caster.CanBeginAction( typeof( DefensiveSpell ) ) )
{
Caster.SendLocalizedMessage( 1005385 ); // The spell will not adhere to you at this time.
}
else if ( CheckSequence() )
{
if ( Caster.BeginAction( typeof( DefensiveSpell ) ) )
{
int value = (int)(Caster.Skills[SkillName.Magery].Value + Caster.Skills[SkillName.Inscribe].Value);
value = (int)(8 + (value/200)*7.0);//absorb from 8 to 15 "circles"
FinishSequence();
}
else
{
if (Caster.MagicDamageAbsorb > 0)
{
Caster.SendLocalizedMessage(1005559); // This spell is already in effect.
}
else if (!Caster.CanBeginAction(typeof(DefensiveSpell)))
{
Caster.SendLocalizedMessage(1005385); // The spell will not adhere to you at this time.
}
else if (CheckSequence())
{
if (Caster.BeginAction(typeof(DefensiveSpell)))
{
int value = (int)(Caster.Skills[SkillName.Magery].Value + Caster.Skills[SkillName.Inscribe].Value);
value = (int)(8 + value / 200 * 7.0); //absorb from 8 to 15 "circles"
Caster.MagicDamageAbsorb = value;
Caster.MagicDamageAbsorb = value;
Caster.FixedParticles( 0x375A, 10, 15, 5037, EffectLayer.Waist );
Caster.PlaySound( 0x1E9 );
}
else
{
Caster.SendLocalizedMessage( 1005385 ); // The spell will not adhere to you at this time.
}
}
Caster.FixedParticles(0x375A, 10, 15, 5037, EffectLayer.Waist);
Caster.PlaySound(0x1E9);
}
else
{
Caster.SendLocalizedMessage(1005385); // The spell will not adhere to you at this time.
}
}
FinishSequence();
}
}
FinishSequence();
}
}
public static void EndReflect( Mobile m )
{
if ( m_Table.Contains( m ) )
{
ResistanceMod[] mods = (ResistanceMod[]) m_Table[ m ];
public static void EndReflect(Mobile m)
{
if (m_Table.Contains(m))
{
ResistanceMod[] mods = (ResistanceMod[])m_Table[m];
if ( mods != null )
{
for ( int i = 0; i < mods.Length; ++i )
m.RemoveResistanceMod( mods[ i ] );
}
if (mods != null)
for (int i = 0; i < mods.Length; ++i)
m.RemoveResistanceMod(mods[i]);
m_Table.Remove( m );
BuffInfo.RemoveBuff( m, BuffIcon.MagicReflection );
}
}
}
}
m_Table.Remove(m);
BuffInfo.RemoveBuff(m, BuffIcon.MagicReflection);
}
}
}
}

View file

@ -3,152 +3,152 @@ using Server.Targeting;
namespace Server.Spells.Fifth
{
public class MindBlastSpell : MagerySpell
{
private static SpellInfo m_Info = new SpellInfo(
"Mind Blast", "Por Corp Wis",
218,
Core.AOS ? 9002 : 9032,
Reagent.BlackPearl,
Reagent.MandrakeRoot,
Reagent.Nightshade,
Reagent.SulfurousAsh
);
public class MindBlastSpell : MagerySpell
{
private static SpellInfo m_Info = new SpellInfo(
"Mind Blast", "Por Corp Wis",
218,
Core.AOS ? 9002 : 9032,
Reagent.BlackPearl,
Reagent.MandrakeRoot,
Reagent.Nightshade,
Reagent.SulfurousAsh
);
public override SpellCircle Circle => SpellCircle.Fifth;
public MindBlastSpell(Mobile caster, Item scroll) : base(caster, scroll, m_Info)
{
if (Core.AOS)
m_Info.LeftHandEffect = m_Info.RightHandEffect = 9002;
}
public MindBlastSpell( Mobile caster, Item scroll ) : base( caster, scroll, m_Info )
{
if ( Core.AOS )
m_Info.LeftHandEffect = m_Info.RightHandEffect = 9002;
}
public override SpellCircle Circle => SpellCircle.Fifth;
public override void OnCast()
{
Caster.Target = new InternalTarget( this );
}
public override bool DelayedDamage => !Core.AOS;
private void AosDelay_Callback( object state )
{
object[] states = (object[])state;
Mobile caster = (Mobile)states[0];
Mobile target = (Mobile)states[1];
Mobile defender = (Mobile)states[2];
int damage = (int)states[3];
public override void OnCast()
{
Caster.Target = new InternalTarget(this);
}
if ( caster.HarmfulCheck( defender ) )
{
SpellHelper.Damage( this, target, Utility.RandomMinMax( damage, damage + 4 ), 0, 0, 100, 0, 0 );
private void AosDelay_Callback(object state)
{
object[] states = (object[])state;
Mobile caster = (Mobile)states[0];
Mobile target = (Mobile)states[1];
Mobile defender = (Mobile)states[2];
int damage = (int)states[3];
target.FixedParticles( 0x374A, 10, 15, 5038, 1181, 2, EffectLayer.Head );
target.PlaySound( 0x213 );
}
}
if (caster.HarmfulCheck(defender))
{
SpellHelper.Damage(this, target, Utility.RandomMinMax(damage, damage + 4), 0, 0, 100, 0, 0);
public override bool DelayedDamage => !Core.AOS;
target.FixedParticles(0x374A, 10, 15, 5038, 1181, 2, EffectLayer.Head);
target.PlaySound(0x213);
}
}
public void Target( Mobile m )
{
if ( !Caster.CanSee( m ) )
{
Caster.SendLocalizedMessage( 500237 ); // Target can not be seen.
}
else if ( Core.AOS )
{
if ( Caster.CanBeHarmful( m ) && CheckSequence() )
{
Mobile from = Caster, target = m;
public void Target(Mobile m)
{
if (!Caster.CanSee(m))
{
Caster.SendLocalizedMessage(500237); // Target can not be seen.
}
else if (Core.AOS)
{
if (Caster.CanBeHarmful(m) && CheckSequence())
{
Mobile from = Caster, target = m;
SpellHelper.Turn( from, target );
SpellHelper.Turn(from, target);
SpellHelper.CheckReflect( (int)Circle, ref from, ref target );
SpellHelper.CheckReflect((int)Circle, ref from, ref target);
int damage = (int)((Caster.Skills[SkillName.Magery].Value + Caster.Int) / 5);
int damage = (int)((Caster.Skills[SkillName.Magery].Value + Caster.Int) / 5);
if ( damage > 60 )
damage = 60;
if (damage > 60)
damage = 60;
Timer.DelayCall( TimeSpan.FromSeconds( 1.0 ),
new TimerStateCallback( AosDelay_Callback ),
new object[]{ Caster, target, m, damage } );
}
}
else if ( CheckHSequence( m ) )
{
Mobile from = Caster, target = m;
Timer.DelayCall(TimeSpan.FromSeconds(1.0),
new TimerStateCallback(AosDelay_Callback),
new object[] { Caster, target, m, damage });
}
}
else if (CheckHSequence(m))
{
Mobile from = Caster, target = m;
SpellHelper.Turn( from, target );
SpellHelper.Turn(from, target);
SpellHelper.CheckReflect( (int)Circle, ref from, ref target );
SpellHelper.CheckReflect((int)Circle, ref from, ref target);
// Algorithm: (highestStat - lowestStat) / 2 [- 50% if resisted]
// Algorithm: (highestStat - lowestStat) / 2 [- 50% if resisted]
int highestStat = target.Str, lowestStat = target.Str;
int highestStat = target.Str, lowestStat = target.Str;
if ( target.Dex > highestStat )
highestStat = target.Dex;
if (target.Dex > highestStat)
highestStat = target.Dex;
if ( target.Dex < lowestStat )
lowestStat = target.Dex;
if (target.Dex < lowestStat)
lowestStat = target.Dex;
if ( target.Int > highestStat )
highestStat = target.Int;
if (target.Int > highestStat)
highestStat = target.Int;
if ( target.Int < lowestStat )
lowestStat = target.Int;
if (target.Int < lowestStat)
lowestStat = target.Int;
if ( highestStat > 150 )
highestStat = 150;
if (highestStat > 150)
highestStat = 150;
if ( lowestStat > 150 )
lowestStat = 150;
if (lowestStat > 150)
lowestStat = 150;
double damage = GetDamageScalar(m)*(highestStat - lowestStat) / 2; // Many users prefer 3 or 4
double damage = GetDamageScalar(m) * (highestStat - lowestStat) / 2; // Many users prefer 3 or 4
if ( damage > 45 )
damage = 45;
if (damage > 45)
damage = 45;
if ( CheckResisted( target ) )
{
damage /= 2;
target.SendLocalizedMessage( 501783 ); // You feel yourself resisting magical energy.
}
if (CheckResisted(target))
{
damage /= 2;
target.SendLocalizedMessage(501783); // You feel yourself resisting magical energy.
}
from.FixedParticles( 0x374A, 10, 15, 2038, EffectLayer.Head );
from.FixedParticles(0x374A, 10, 15, 2038, EffectLayer.Head);
target.FixedParticles( 0x374A, 10, 15, 5038, EffectLayer.Head );
target.PlaySound( 0x213 );
target.FixedParticles(0x374A, 10, 15, 5038, EffectLayer.Head);
target.PlaySound(0x213);
SpellHelper.Damage( this, target, damage, 0, 0, 100, 0, 0 );
}
SpellHelper.Damage(this, target, damage, 0, 0, 100, 0, 0);
}
FinishSequence();
}
FinishSequence();
}
public override double GetSlayerDamageScalar( Mobile target )
{
return 1.0; //This spell isn't affected by slayer spellbooks
}
public override double GetSlayerDamageScalar(Mobile target)
{
return 1.0; //This spell isn't affected by slayer spellbooks
}
private class InternalTarget : Target
{
private MindBlastSpell m_Owner;
private class InternalTarget : Target
{
private MindBlastSpell m_Owner;
public InternalTarget( MindBlastSpell owner ) : base( Core.ML ? 10 : 12, false, TargetFlags.Harmful )
{
m_Owner = owner;
}
public InternalTarget(MindBlastSpell 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();
}
}
}
}

View file

@ -1,111 +1,112 @@
using System;
using Server.Mobiles;
using Server.Targeting;
using Server.Spells.Chivalry;
using Server.Targeting;
namespace Server.Spells.Fifth
{
public class ParalyzeSpell : MagerySpell
{
private static SpellInfo m_Info = new SpellInfo(
"Paralyze", "An Ex Por",
218,
9012,
Reagent.Garlic,
Reagent.MandrakeRoot,
Reagent.SpidersSilk
);
public class ParalyzeSpell : MagerySpell
{
private static SpellInfo m_Info = new SpellInfo(
"Paralyze", "An Ex Por",
218,
9012,
Reagent.Garlic,
Reagent.MandrakeRoot,
Reagent.SpidersSilk
);
public override SpellCircle Circle => SpellCircle.Fifth;
public ParalyzeSpell(Mobile caster, Item scroll) : base(caster, scroll, m_Info)
{
}
public ParalyzeSpell( Mobile caster, Item scroll ) : base( caster, scroll, m_Info )
{
}
public override SpellCircle Circle => SpellCircle.Fifth;
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 ( Core.AOS && (m.Frozen || m.Paralyzed || (m.Spell != null && m.Spell.IsCasting && !(m.Spell is PaladinSpell))) )
{
Caster.SendLocalizedMessage( 1061923 ); // The target is already frozen.
}
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 (Core.AOS && (m.Frozen || m.Paralyzed ||
m.Spell != null && m.Spell.IsCasting && !(m.Spell is PaladinSpell)))
{
Caster.SendLocalizedMessage(1061923); // The target is already frozen.
}
else if (CheckHSequence(m))
{
SpellHelper.Turn(Caster, m);
SpellHelper.CheckReflect( (int)Circle, Caster, ref m );
SpellHelper.CheckReflect((int)Circle, Caster, ref m);
double duration;
double duration;
if ( Core.AOS )
{
int secs = (int)((GetDamageSkill( Caster ) / 10) - (GetResistSkill( m ) / 10));
if (Core.AOS)
{
int secs = (int)(GetDamageSkill(Caster) / 10 - GetResistSkill(m) / 10);
if ( !Core.SE )
secs += 2;
if (!Core.SE)
secs += 2;
if ( !m.Player )
secs *= 3;
if (!m.Player)
secs *= 3;
if ( secs < 0 )
secs = 0;
if (secs < 0)
secs = 0;
duration = secs;
}
else
{
// Algorithm: ((20% of magery) + 7) seconds [- 50% if resisted]
duration = secs;
}
else
{
// Algorithm: ((20% of magery) + 7) seconds [- 50% if resisted]
duration = 7.0 + (Caster.Skills[SkillName.Magery].Value * 0.2);
duration = 7.0 + Caster.Skills[SkillName.Magery].Value * 0.2;
if ( CheckResisted( m ) )
duration *= 0.75;
}
if (CheckResisted(m))
duration *= 0.75;
}
if ( m is PlagueBeastLord )
{
( (PlagueBeastLord) m ).OnParalyzed( Caster );
duration = 120;
}
if (m is PlagueBeastLord)
{
((PlagueBeastLord)m).OnParalyzed(Caster);
duration = 120;
}
m.Paralyze( TimeSpan.FromSeconds( duration ) );
m.Paralyze(TimeSpan.FromSeconds(duration));
m.PlaySound( 0x204 );
m.FixedEffect( 0x376A, 6, 1 );
m.PlaySound(0x204);
m.FixedEffect(0x376A, 6, 1);
HarmfulSpell( m );
}
HarmfulSpell(m);
}
FinishSequence();
}
FinishSequence();
}
public class InternalTarget : Target
{
private ParalyzeSpell m_Owner;
public class InternalTarget : Target
{
private ParalyzeSpell m_Owner;
public InternalTarget( ParalyzeSpell owner ) : base( Core.ML ? 10 : 12, false, TargetFlags.Harmful )
{
m_Owner = owner;
}
public InternalTarget(ParalyzeSpell 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();
}
}
}
}

View file

@ -1,298 +1,294 @@
using System;
using System.Collections;
using Server.Targeting;
using Server.Misc;
using Server.Items;
using Server.Misc;
using Server.Mobiles;
using Server.Targeting;
namespace Server.Spells.Fifth
{
public class PoisonFieldSpell : MagerySpell
{
private static SpellInfo m_Info = new SpellInfo(
"Poison Field", "In Nox Grav",
230,
9052,
false,
Reagent.BlackPearl,
Reagent.Nightshade,
Reagent.SpidersSilk
);
public class PoisonFieldSpell : MagerySpell
{
private static SpellInfo m_Info = new SpellInfo(
"Poison Field", "In Nox Grav",
230,
9052,
false,
Reagent.BlackPearl,
Reagent.Nightshade,
Reagent.SpidersSilk
);
public override SpellCircle Circle => SpellCircle.Fifth;
public PoisonFieldSpell(Mobile caster, Item scroll) : base(caster, scroll, m_Info)
{
}
public PoisonFieldSpell( Mobile caster, Item scroll ) : base( caster, scroll, m_Info )
{
}
public override SpellCircle Circle => SpellCircle.Fifth;
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);
int itemID = eastToWest ? 0x3915 : 0x3922;
int itemID = eastToWest ? 0x3915 : 0x3922;
TimeSpan duration = TimeSpan.FromSeconds( 3 + (Caster.Skills.Magery.Fixed / 25) );
TimeSpan duration = TimeSpan.FromSeconds(3 + Caster.Skills.Magery.Fixed / 25);
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 );
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 );
}
}
new InternalItem(itemID, loc, Caster, Caster.Map, duration, i);
}
}
FinishSequence();
}
FinishSequence();
}
[DispellableField]
public class InternalItem : Item
{
private Timer m_Timer;
private DateTime m_End;
private Mobile m_Caster;
[DispellableField]
public class InternalItem : Item
{
private Mobile m_Caster;
private DateTime m_End;
private Timer m_Timer;
public override bool BlocksFit => 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);
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;
Visible = false;
Movable = false;
Light = LightType.Circle300;
MoveToWorld(loc, map);
MoveToWorld( loc, map );
m_Caster = caster;
m_Caster = caster;
m_End = DateTime.UtcNow + duration;
m_End = DateTime.UtcNow + duration;
m_Timer = new InternalTimer(this, TimeSpan.FromSeconds(Math.Abs(val) * 0.2), caster.InLOS(this), canFit);
m_Timer.Start();
}
m_Timer = new InternalTimer( this, TimeSpan.FromSeconds( Math.Abs( val ) * 0.2 ), caster.InLOS( this ), canFit );
m_Timer.Start();
}
public InternalItem(Serial serial) : base(serial)
{
}
public override void OnAfterDelete()
{
base.OnAfterDelete();
public override bool BlocksFit => true;
m_Timer?.Stop();
}
public override void OnAfterDelete()
{
base.OnAfterDelete();
public InternalItem( Serial serial ) : base( serial )
{
}
m_Timer?.Stop();
}
public override void Serialize( GenericWriter writer )
{
base.Serialize( writer );
public override void Serialize(GenericWriter writer)
{
base.Serialize(writer);
writer.Write( (int) 1 ); // version
writer.Write(1); // version
writer.Write( m_Caster );
writer.WriteDeltaTime( m_End );
}
writer.Write(m_Caster);
writer.WriteDeltaTime(m_End);
}
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();
switch ( version )
{
case 1:
{
m_Caster = reader.ReadMobile();
switch (version)
{
case 1:
{
m_Caster = reader.ReadMobile();
goto case 0;
}
case 0:
{
m_End = reader.ReadDeltaTime();
goto case 0;
}
case 0:
{
m_End = reader.ReadDeltaTime();
m_Timer = new InternalTimer( this, TimeSpan.Zero, true, true );
m_Timer.Start();
m_Timer = new InternalTimer(this, TimeSpan.Zero, true, true);
m_Timer.Start();
break;
}
}
}
break;
}
}
}
public void ApplyPoisonTo( Mobile m )
{
if ( m_Caster == null )
return;
public void ApplyPoisonTo(Mobile m)
{
if (m_Caster == null)
return;
Poison p;
Poison p;
if ( Core.AOS )
{
int total = (m_Caster.Skills.Magery.Fixed + m_Caster.Skills.Poisoning.Fixed) / 2;
if (Core.AOS)
{
int total = (m_Caster.Skills.Magery.Fixed + m_Caster.Skills.Poisoning.Fixed) / 2;
if ( total >= 1000 )
p = Poison.Deadly;
else if ( total > 850 )
p = Poison.Greater;
else if ( total > 650 )
p = Poison.Regular;
else
p = Poison.Lesser;
}
else
{
p = Poison.Regular;
}
if (total >= 1000)
p = Poison.Deadly;
else if (total > 850)
p = Poison.Greater;
else if (total > 650)
p = Poison.Regular;
else
p = Poison.Lesser;
}
else
{
p = Poison.Regular;
}
if ( m.ApplyPoison( m_Caster, p ) == ApplyPoisonResult.Poisoned )
if ( SpellHelper.CanRevealCaster( m ) )
m_Caster.RevealingAction();
if (m.ApplyPoison(m_Caster, p) == ApplyPoisonResult.Poisoned)
if (SpellHelper.CanRevealCaster(m))
m_Caster.RevealingAction();
(m as BaseCreature)?.OnHarmfulSpell( m_Caster );
}
(m as BaseCreature)?.OnHarmfulSpell(m_Caster);
}
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 );
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);
ApplyPoisonTo( m );
m.PlaySound( 0x474 );
}
ApplyPoisonTo(m);
m.PlaySound(0x474);
}
return true;
}
return true;
}
private class InternalTimer : Timer
{
private InternalItem m_Item;
private bool m_InLOS, m_CanFit;
private class InternalTimer : Timer
{
private static Queue m_Queue = new Queue();
private bool m_InLOS, m_CanFit;
private InternalItem m_Item;
private static Queue m_Queue = new Queue();
public InternalTimer(InternalItem item, TimeSpan delay, bool inLOS, bool canFit) : base(delay,
TimeSpan.FromSeconds(1.5))
{
m_Item = item;
m_InLOS = inLOS;
m_CanFit = canFit;
public InternalTimer( InternalItem item, TimeSpan delay, bool inLOS, bool canFit ) : base( delay, TimeSpan.FromSeconds( 1.5 ) )
{
m_Item = item;
m_InLOS = inLOS;
m_CanFit = canFit;
Priority = TimerPriority.FiftyMS;
}
Priority = TimerPriority.FiftyMS;
}
protected override void OnTick()
{
if (m_Item.Deleted)
return;
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.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,
5040);
}
}
else if (DateTime.UtcNow > m_Item.m_End)
{
m_Item.Delete();
Stop();
}
else
{
Map map = m_Item.Map;
Mobile caster = m_Item.m_Caster;
if ( !m_Item.Deleted )
{
m_Item.ProcessDelta();
Effects.SendLocationParticles( EffectItem.Create( m_Item.Location, m_Item.Map, EffectItem.DefaultDuration ), 0x376A, 9, 10, 5040 );
}
}
else if ( DateTime.UtcNow > 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)
{
bool eastToWest = m_Item.ItemID == 0x3915;
IPooledEnumerable<Mobile> eable = map.GetMobilesInBounds(
new Rectangle2D(m_Item.X - (eastToWest ? 0 : 1), m_Item.Y - (eastToWest ? 1 : 0),
eastToWest ? 1 : 2, eastToWest ? 2 : 1));
if ( map != null && caster != null )
{
bool eastToWest = ( m_Item.ItemID == 0x3915 );
IPooledEnumerable<Mobile> eable = map.GetMobilesInBounds( new Rectangle2D( m_Item.X - (eastToWest ? 0 : 1), m_Item.Y - (eastToWest ? 1 : 0), (eastToWest ? 1 : 2), (eastToWest ? 2 : 1) ) );
foreach (Mobile m in eable)
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);
foreach ( Mobile m in eable )
{
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 );
}
eable.Free();
eable.Free();
while (m_Queue.Count > 0)
{
Mobile m = (Mobile)m_Queue.Dequeue();
while ( m_Queue.Count > 0 )
{
Mobile m = (Mobile)m_Queue.Dequeue();
caster.DoHarmful(m);
caster.DoHarmful( m );
m_Item.ApplyPoisonTo(m);
m.PlaySound(0x474);
}
}
}
}
}
}
m_Item.ApplyPoisonTo( m );
m.PlaySound( 0x474 );
}
}
}
}
}
}
private class InternalTarget : Target
{
private PoisonFieldSpell m_Owner;
private class InternalTarget : Target
{
private PoisonFieldSpell m_Owner;
public InternalTarget(PoisonFieldSpell owner) : base(Core.ML ? 10 : 12, true, TargetFlags.None)
{
m_Owner = owner;
}
public InternalTarget( PoisonFieldSpell owner ) : base( Core.ML ? 10 : 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 OnTarget( Mobile from, object o )
{
if ( o is IPoint3D )
m_Owner.Target( (IPoint3D)o );
}
protected override void OnTargetFinish( Mobile from )
{
m_Owner.FinishSequence();
}
}
}
}
protected override void OnTargetFinish(Mobile from)
{
m_Owner.FinishSequence();
}
}
}
}

View file

@ -3,93 +3,92 @@ using Server.Mobiles;
namespace Server.Spells.Fifth
{
public class SummonCreatureSpell : MagerySpell
{
private static SpellInfo m_Info = new SpellInfo(
"Summon Creature", "Kal Xen",
16,
false,
Reagent.Bloodmoss,
Reagent.MandrakeRoot,
Reagent.SpidersSilk
);
public class SummonCreatureSpell : MagerySpell
{
private static SpellInfo m_Info = new SpellInfo(
"Summon Creature", "Kal Xen",
16,
false,
Reagent.Bloodmoss,
Reagent.MandrakeRoot,
Reagent.SpidersSilk
);
public override SpellCircle Circle => SpellCircle.Fifth;
// NOTE: Creature list based on 1hr of summon/release on OSI.
public SummonCreatureSpell( Mobile caster, Item scroll ) : base( caster, scroll, m_Info )
{
}
private static Type[] m_Types =
{
typeof(PolarBear),
typeof(GrizzlyBear),
typeof(BlackBear),
typeof(Horse),
typeof(Walrus),
typeof(Chicken),
typeof(Scorpion),
typeof(GiantSerpent),
typeof(Llama),
typeof(Alligator),
typeof(GreyWolf),
typeof(Slime),
typeof(Eagle),
typeof(Gorilla),
typeof(SnowLeopard),
typeof(Pig),
typeof(Hind),
typeof(Rabbit)
};
// NOTE: Creature list based on 1hr of summon/release on OSI.
public SummonCreatureSpell(Mobile caster, Item scroll) : base(caster, scroll, m_Info)
{
}
private static Type[] m_Types = {
typeof( PolarBear ),
typeof( GrizzlyBear ),
typeof( BlackBear ),
typeof( Horse ),
typeof( Walrus ),
typeof( Chicken ),
typeof( Scorpion ),
typeof( GiantSerpent ),
typeof( Llama ),
typeof( Alligator ),
typeof( GreyWolf ),
typeof( Slime ),
typeof( Eagle ),
typeof( Gorilla ),
typeof( SnowLeopard ),
typeof( Pig ),
typeof( Hind ),
typeof( Rabbit )
};
public override SpellCircle Circle => SpellCircle.Fifth;
public override bool CheckCast()
{
if ( !base.CheckCast() )
return false;
public override bool CheckCast()
{
if (!base.CheckCast())
return false;
if ( (Caster.Followers + 2) > Caster.FollowersMax )
{
Caster.SendLocalizedMessage( 1049645 ); // You have too many followers to summon that creature.
return false;
}
if (Caster.Followers + 2 > Caster.FollowersMax)
{
Caster.SendLocalizedMessage(1049645); // You have too many followers to summon that creature.
return false;
}
return true;
}
return true;
}
public override void OnCast()
{
if ( CheckSequence() )
{
try
{
BaseCreature creature = (BaseCreature)Activator.CreateInstance( m_Types[Utility.Random( m_Types.Length )] );
public override void OnCast()
{
if (CheckSequence())
try
{
BaseCreature creature = (BaseCreature)Activator.CreateInstance(m_Types[Utility.Random(m_Types.Length)]);
//creature.ControlSlots = 2;
//creature.ControlSlots = 2;
TimeSpan duration;
TimeSpan duration;
if ( Core.AOS )
duration = TimeSpan.FromSeconds( (2 * Caster.Skills.Magery.Fixed) / 5 );
else
duration = TimeSpan.FromSeconds( 4.0 * Caster.Skills[SkillName.Magery].Value );
if (Core.AOS)
duration = TimeSpan.FromSeconds(2 * Caster.Skills.Magery.Fixed / 5);
else
duration = TimeSpan.FromSeconds(4.0 * Caster.Skills[SkillName.Magery].Value);
SpellHelper.Summon( creature, Caster, 0x215, duration, false, false );
}
catch
{
}
}
SpellHelper.Summon(creature, Caster, 0x215, duration, false, false);
}
catch
{
}
FinishSequence();
}
FinishSequence();
}
public override TimeSpan GetCastDelay()
{
if ( Core.AOS )
return TimeSpan.FromTicks( base.GetCastDelay().Ticks * 5 );
public override TimeSpan GetCastDelay()
{
if (Core.AOS)
return TimeSpan.FromTicks(base.GetCastDelay().Ticks * 5);
return base.GetCastDelay() + TimeSpan.FromSeconds( 6.0 );
}
}
}
return base.GetCastDelay() + TimeSpan.FromSeconds(6.0);
}
}
}