Overwrite

Complete Overwrite of the Folder with the free shard. ServUO 57.3 has been added.
This commit is contained in:
Unstable Kitsune
2023-11-28 23:20:26 -05:00
parent 3cd54811de
commit b918192e4e
11608 changed files with 2644205 additions and 47 deletions

View File

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

View File

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

View File

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

View File

@@ -0,0 +1,161 @@
using System;
using System.Collections;
namespace Server.Spells.Fifth
{
public class MagicReflectSpell : MagerySpell
{
private static readonly SpellInfo m_Info = new SpellInfo(
"Magic Reflection", "In Jux Sanct",
242,
9012,
Reagent.Garlic,
Reagent.MandrakeRoot,
Reagent.SpidersSilk);
private static readonly Hashtable m_Table = new Hashtable();
public MagicReflectSpell(Mobile caster, Item scroll)
: base(caster, scroll, m_Info)
{
}
public override SpellCircle Circle
{
get
{
return SpellCircle.Fifth;
}
}
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]);
}
m_Table.Remove(m);
BuffInfo.RemoveBuff(m, BuffIcon.MagicReflection);
}
}
public override bool CheckCast()
{
if (Core.AOS)
return true;
if (this.Caster.MagicDamageAbsorb > 0)
{
this.Caster.SendLocalizedMessage(1005559); // This spell is already in effect.
return false;
}
else if (!this.Caster.CanBeginAction(typeof(DefensiveSpell)))
{
this.Caster.SendLocalizedMessage(1005385); // The spell will not adhere to you at this time.
return false;
}
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<6F>even after logging out, even after dying<6E>until you <20>turn them off<66> by casting them again.
*/
if (this.CheckSequence())
{
Mobile targ = this.Caster;
ResistanceMod[] mods = (ResistanceMod[])m_Table[targ];
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;
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;
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);
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);
for (int i = 0; i < mods.Length; ++i)
targ.RemoveResistanceMod(mods[i]);
BuffInfo.RemoveBuff(targ, BuffIcon.MagicReflection);
}
}
this.FinishSequence();
}
else
{
if (this.Caster.MagicDamageAbsorb > 0)
{
this.Caster.SendLocalizedMessage(1005559); // This spell is already in effect.
}
else if (!this.Caster.CanBeginAction(typeof(DefensiveSpell)))
{
this.Caster.SendLocalizedMessage(1005385); // The spell will not adhere to you at this time.
}
else if (this.CheckSequence())
{
if (this.Caster.BeginAction(typeof(DefensiveSpell)))
{
int value = (int)(this.Caster.Skills[SkillName.Magery].Value + this.Caster.Skills[SkillName.Inscribe].Value);
value = (int)(8 + (value / 200) * 7.0);//absorb from 8 to 15 "circles"
this.Caster.MagicDamageAbsorb = value;
this.Caster.FixedParticles(0x375A, 10, 15, 5037, EffectLayer.Waist);
this.Caster.PlaySound(0x1E9);
}
else
{
this.Caster.SendLocalizedMessage(1005385); // The spell will not adhere to you at this time.
}
}
this.FinishSequence();
}
}
#region SA
public static bool HasReflect(Mobile m)
{
return m_Table.ContainsKey(m);
}
#endregion
}
}

View File

@@ -0,0 +1,171 @@
using System;
using Server.Targeting;
namespace Server.Spells.Fifth
{
public class MindBlastSpell : MagerySpell
{
private static readonly SpellInfo m_Info = new SpellInfo(
"Mind Blast", "Por Corp Wis",
218,
Core.AOS ? 9002 : 9032,
Reagent.BlackPearl,
Reagent.MandrakeRoot,
Reagent.Nightshade,
Reagent.SulfurousAsh);
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
{
get
{
return SpellCircle.Fifth;
}
}
public override bool DelayedDamage
{
get
{
return !Core.AOS;
}
}
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)
{
if (Caster.CanBeHarmful(m) && CheckSequence())
{
Mobile from = Caster, target = m;
SpellHelper.Turn(from, target);
SpellHelper.CheckReflect((int)Circle, ref from, ref target);
int intel = Math.Min(200, Caster.Int);
int damage = (int)((Caster.Skills[SkillName.Magery].Value + intel) / 5) + Utility.RandomMinMax(2, 6);
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;
SpellHelper.Turn(from, target);
if(target != null)
SpellHelper.CheckReflect((int)Circle, ref from, ref target);
// Algorithm: (highestStat - lowestStat) / 2 [- 50% if resisted]
int highestStat = target.Str, lowestStat = target.Str;
if (target.Dex > highestStat)
highestStat = target.Dex;
if (target.Dex < lowestStat)
lowestStat = target.Dex;
if (target.Int > highestStat)
highestStat = target.Int;
if (target.Int < lowestStat)
lowestStat = target.Int;
if (highestStat > 150)
highestStat = 150;
if (lowestStat > 150)
lowestStat = 150;
double damage;
if (Core.AOS)
{
damage = GetDamageScalar(m)*(highestStat - lowestStat)/4; //less damage
}
else
{
damage = GetDamageScalar(m) * (highestStat - lowestStat) / 2; //less damage
}
if (damage > 45)
damage = 45;
if (CheckResisted(target))
{
damage /= 2;
target.SendLocalizedMessage(501783); // You feel yourself resisting magical energy.
}
from.FixedParticles(0x374A, 10, 15, 2038, EffectLayer.Head);
target.FixedParticles(0x374A, 10, 15, 5038, EffectLayer.Head);
target.PlaySound(0x213);
SpellHelper.Damage(this, target, damage, 0, 0, 100, 0, 0);
}
FinishSequence();
}
public override double GetSlayerDamageScalar(Mobile target)
{
return 1.0; //This spell isn't affected by slayer spellbooks
}
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];
if (caster.HarmfulCheck(defender))
{
target.FixedParticles(0x374A, 10, 15, 5038, 1181, 2, EffectLayer.Head);
target.PlaySound(0x213);
SpellHelper.Damage(this, target, Utility.RandomMinMax(damage, damage + 4), 0, 0, 100, 0, 0);
}
}
private class InternalTarget : Target
{
private readonly MindBlastSpell m_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 OnTargetFinish(Mobile from)
{
m_Owner.FinishSequence();
}
}
}
}

View File

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

View File

@@ -0,0 +1,314 @@
using System;
using System.Collections;
using Server.Items;
using Server.Misc;
using Server.Mobiles;
using Server.Targeting;
namespace Server.Spells.Fifth
{
public class PoisonFieldSpell : MagerySpell
{
private static readonly SpellInfo m_Info = new SpellInfo(
"Poison Field", "In Nox Grav",
230,
9052,
false,
Reagent.BlackPearl,
Reagent.Nightshade,
Reagent.SpidersSilk);
public PoisonFieldSpell(Mobile caster, Item scroll)
: base(caster, scroll, m_Info)
{
}
public override SpellCircle Circle
{
get
{
return SpellCircle.Fifth;
}
}
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) && SpellHelper.CheckWater(new Point3D(p), Caster.Map) && 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);
int itemID = eastToWest ? 0x3915 : 0x3922;
Point3D pnt = new Point3D(p);
TimeSpan duration = TimeSpan.FromSeconds(3 + (Caster.Skills.Magery.Fixed / 25));
if (SpellHelper.CheckField(pnt, Caster.Map))
new InternalItem(itemID, pnt, Caster, Caster.Map, duration);
for (int i = 1; i <= 2; ++i)
{
Timer.DelayCall<int>(TimeSpan.FromMilliseconds(i * 300), index =>
{
Point3D point = new Point3D(eastToWest ? pnt.X + index : pnt.X, eastToWest ? pnt.Y : pnt.Y + index, pnt.Z);
SpellHelper.AdjustField(ref point, Caster.Map, 16, false);
if (SpellHelper.CheckField(point, Caster.Map))
new InternalItem(itemID, point, Caster, Caster.Map, duration);
point = new Point3D(eastToWest ? pnt.X + -index : pnt.X, eastToWest ? pnt.Y : pnt.Y + -index, pnt.Z);
SpellHelper.AdjustField(ref point, Caster.Map, 16, false);
if (SpellHelper.CheckField(point, Caster.Map))
new InternalItem(itemID, point, Caster, Caster.Map, duration);
}, i);
}
}
FinishSequence();
}
[DispellableField]
public class InternalItem : Item
{
private Timer m_Timer;
private DateTime m_End;
private Mobile m_Caster;
public Mobile Caster { get { return m_Caster; } }
public InternalItem(int itemID, Point3D loc, Mobile caster, Map map, TimeSpan duration)
: base(itemID)
{
bool canFit = SpellHelper.AdjustField(ref loc, map, 12, false);
Movable = false;
Light = LightType.Circle300;
MoveToWorld(loc, map);
Effects.SendLocationParticles(EffectItem.Create(loc, map, EffectItem.DefaultDuration), 0x376A, 9, 10, 5029);
m_Caster = caster;
m_End = DateTime.UtcNow + duration;
m_Timer = new InternalTimer(this, caster.InLOS(this), canFit);
m_Timer.Start();
}
public InternalItem(Serial serial)
: base(serial)
{
}
public override bool BlocksFit
{
get
{
return true;
}
}
public override void OnAfterDelete()
{
base.OnAfterDelete();
if (m_Timer != null)
m_Timer.Stop();
}
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, true, true);
m_Timer.Start();
break;
}
}
}
public void ApplyPoisonTo(Mobile m)
{
if (m_Caster == null)
return;
Poison p;
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 (m.ApplyPoison(m_Caster, p) == ApplyPoisonResult.Poisoned)
if (SpellHelper.CanRevealCaster(m))
m_Caster.RevealingAction();
if (m is BaseCreature)
((BaseCreature)m).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);
ApplyPoisonTo(m);
m.PlaySound(0x474);
}
return true;
}
private class InternalTimer : Timer
{
private static readonly Queue m_Queue = new Queue();
private readonly InternalItem m_Item;
private readonly bool m_InLOS;
private readonly bool m_CanFit;
public InternalTimer(InternalItem item, bool inLOS, bool canFit)
: base(TimeSpan.FromMilliseconds(500), TimeSpan.FromSeconds(1.5))
{
m_Item = item;
m_InLOS = inLOS;
m_CanFit = canFit;
Priority = TimerPriority.FiftyMS;
}
protected override void OnTick()
{
if (m_Item.Deleted)
return;
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 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);
}
eable.Free();
while (m_Queue.Count > 0)
{
Mobile m = (Mobile)m_Queue.Dequeue();
caster.DoHarmful(m);
m_Item.ApplyPoisonTo(m);
m.PlaySound(0x474);
}
}
}
}
}
}
public class InternalTarget : Target
{
private readonly PoisonFieldSpell m_Owner;
public InternalTarget(PoisonFieldSpell owner)
: base(Core.TOL ? 15 : 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 OnTargetFinish(Mobile from)
{
m_Owner.FinishSequence();
}
}
}
}

View File

@@ -0,0 +1,98 @@
using System;
using Server.Mobiles;
namespace Server.Spells.Fifth
{
public class SummonCreatureSpell : MagerySpell
{
private static readonly SpellInfo m_Info = new SpellInfo(
"Summon Creature", "Kal Xen",
16,
false,
Reagent.Bloodmoss,
Reagent.MandrakeRoot,
Reagent.SpidersSilk);
// NOTE: Creature list based on 1hr of summon/release on OSI.
private static readonly Type[] m_Types = new Type[]
{
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 SummonCreatureSpell(Mobile caster, Item scroll)
: base(caster, scroll, m_Info)
{
}
public override SpellCircle Circle
{
get
{
return SpellCircle.Fifth;
}
}
public override bool CheckCast()
{
if (!base.CheckCast())
return false;
if ((this.Caster.Followers + 2) > this.Caster.FollowersMax)
{
this.Caster.SendLocalizedMessage(1049645); // You have too many followers to summon that creature.
return false;
}
return true;
}
public override void OnCast()
{
if (this.CheckSequence())
{
try
{
BaseCreature creature = (BaseCreature)Activator.CreateInstance(m_Types[Utility.Random(m_Types.Length)]);
//creature.ControlSlots = 2;
TimeSpan duration;
if (Core.AOS)
duration = TimeSpan.FromSeconds((2 * this.Caster.Skills.Magery.Fixed) / 5);
else
duration = TimeSpan.FromSeconds(4.0 * this.Caster.Skills[SkillName.Magery].Value);
SpellHelper.Summon(creature, this.Caster, 0x215, duration, false, false);
}
catch
{
}
}
this.FinishSequence();
}
public override TimeSpan GetCastDelay()
{
if (Core.AOS)
return TimeSpan.FromTicks(base.GetCastDelay().Ticks * 5);
return base.GetCastDelay() + TimeSpan.FromSeconds(6.0);
}
}
}