Overwrite
Complete Overwrite of the Folder with the free shard. ServUO 57.3 has been added.
This commit is contained in:
149
Scripts/Spells/Third/Bless.cs
Normal file
149
Scripts/Spells/Third/Bless.cs
Normal file
@@ -0,0 +1,149 @@
|
||||
using System;
|
||||
using Server.Targeting;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace Server.Spells.Third
|
||||
{
|
||||
public class BlessSpell : MagerySpell
|
||||
{
|
||||
private static readonly SpellInfo m_Info = new SpellInfo(
|
||||
"Bless", "Rel Sanct",
|
||||
203,
|
||||
9061,
|
||||
Reagent.Garlic,
|
||||
Reagent.MandrakeRoot);
|
||||
|
||||
private static Dictionary<Mobile, InternalTimer> _Table;
|
||||
|
||||
public static bool IsBlessed(Mobile m)
|
||||
{
|
||||
return _Table != null && _Table.ContainsKey(m);
|
||||
}
|
||||
|
||||
public static void AddBless(Mobile m, TimeSpan duration)
|
||||
{
|
||||
if (_Table == null)
|
||||
_Table = new Dictionary<Mobile, InternalTimer>();
|
||||
|
||||
if (_Table.ContainsKey(m))
|
||||
{
|
||||
_Table[m].Stop();
|
||||
}
|
||||
|
||||
_Table[m] = new InternalTimer(m, duration);
|
||||
}
|
||||
|
||||
public static void RemoveBless(Mobile m, bool early = false)
|
||||
{
|
||||
if (_Table != null && _Table.ContainsKey(m))
|
||||
{
|
||||
_Table[m].Stop();
|
||||
m.Delta(MobileDelta.Stat);
|
||||
|
||||
_Table.Remove(m);
|
||||
}
|
||||
}
|
||||
|
||||
public BlessSpell(Mobile caster, Item scroll)
|
||||
: base(caster, scroll, m_Info)
|
||||
{
|
||||
}
|
||||
|
||||
public override SpellCircle Circle
|
||||
{
|
||||
get
|
||||
{
|
||||
return SpellCircle.Third;
|
||||
}
|
||||
}
|
||||
|
||||
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 (this.CheckBSequence(m))
|
||||
{
|
||||
SpellHelper.Turn(this.Caster, m);
|
||||
|
||||
int oldStr = SpellHelper.GetBuffOffset(m, StatType.Str);
|
||||
int oldDex = SpellHelper.GetBuffOffset(m, StatType.Dex);
|
||||
int oldInt = SpellHelper.GetBuffOffset(m, StatType.Int);
|
||||
|
||||
int newStr = SpellHelper.GetOffset(Caster, m, StatType.Str, false, true);
|
||||
int newDex = SpellHelper.GetOffset(Caster, m, StatType.Dex, false, true);
|
||||
int newInt = SpellHelper.GetOffset(Caster, m, StatType.Int, false, true);
|
||||
|
||||
if ((newStr < oldStr && newDex < oldDex && newInt < oldInt) ||
|
||||
(newStr == 0 && newDex == 0 && newInt == 0))
|
||||
{
|
||||
DoHurtFizzle();
|
||||
}
|
||||
else
|
||||
{
|
||||
SpellHelper.AddStatBonus(this.Caster, m, false, StatType.Str);
|
||||
SpellHelper.AddStatBonus(this.Caster, m, true, StatType.Dex);
|
||||
SpellHelper.AddStatBonus(this.Caster, m, true, StatType.Int);
|
||||
|
||||
int percentage = (int)(SpellHelper.GetOffsetScalar(this.Caster, m, false) * 100);
|
||||
TimeSpan length = SpellHelper.GetDuration(this.Caster, m);
|
||||
string args = String.Format("{0}\t{1}\t{2}", percentage, percentage, percentage);
|
||||
BuffInfo.AddBuff(m, new BuffInfo(BuffIcon.Bless, 1075847, 1075848, length, m, args.ToString()));
|
||||
|
||||
m.FixedParticles(0x373A, 10, 15, 5018, EffectLayer.Waist);
|
||||
m.PlaySound(0x1EA);
|
||||
|
||||
AddBless(Caster, length + TimeSpan.FromMilliseconds(50));
|
||||
}
|
||||
}
|
||||
|
||||
this.FinishSequence();
|
||||
}
|
||||
|
||||
private class InternalTarget : Target
|
||||
{
|
||||
private readonly BlessSpell m_Owner;
|
||||
public InternalTarget(BlessSpell owner)
|
||||
: base(Core.ML ? 10 : 12, false, TargetFlags.Beneficial)
|
||||
{
|
||||
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();
|
||||
}
|
||||
}
|
||||
|
||||
private class InternalTimer : Timer
|
||||
{
|
||||
public Mobile Mobile { get; set; }
|
||||
|
||||
public InternalTimer(Mobile m, TimeSpan duration)
|
||||
: base(duration)
|
||||
{
|
||||
Mobile = m;
|
||||
Start();
|
||||
}
|
||||
|
||||
protected override void OnTick()
|
||||
{
|
||||
BlessSpell.RemoveBless(Mobile);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
112
Scripts/Spells/Third/Fireball.cs
Normal file
112
Scripts/Spells/Third/Fireball.cs
Normal file
@@ -0,0 +1,112 @@
|
||||
using System;
|
||||
using Server.Targeting;
|
||||
|
||||
namespace Server.Spells.Third
|
||||
{
|
||||
public class FireballSpell : MagerySpell
|
||||
{
|
||||
private static readonly SpellInfo m_Info = new SpellInfo(
|
||||
"Fireball", "Vas Flam",
|
||||
203,
|
||||
9041,
|
||||
Reagent.BlackPearl);
|
||||
public FireballSpell(Mobile caster, Item scroll)
|
||||
: base(caster, scroll, m_Info)
|
||||
{
|
||||
}
|
||||
|
||||
public override SpellCircle Circle
|
||||
{
|
||||
get
|
||||
{
|
||||
return SpellCircle.Third;
|
||||
}
|
||||
}
|
||||
public override bool DelayedDamage
|
||||
{
|
||||
get
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
public override void OnCast()
|
||||
{
|
||||
Caster.Target = new InternalTarget(this);
|
||||
}
|
||||
|
||||
public void Target(IDamageable m)
|
||||
{
|
||||
if (!Caster.CanSee(m))
|
||||
{
|
||||
Caster.SendLocalizedMessage(500237); // Target can not be seen.
|
||||
}
|
||||
else if (CheckHSequence(m))
|
||||
{
|
||||
IDamageable source = Caster;
|
||||
IDamageable target = m;
|
||||
|
||||
SpellHelper.Turn(Caster, m);
|
||||
|
||||
if (SpellHelper.CheckReflect((int)Circle, ref source, ref target))
|
||||
{
|
||||
Timer.DelayCall(TimeSpan.FromSeconds(.5), () =>
|
||||
{
|
||||
source.MovingParticles(target, 0x36D4, 7, 0, false, true, 9502, 4019, 0x160);
|
||||
source.PlaySound(Core.AOS ? 0x15E : 0x44B);
|
||||
});
|
||||
}
|
||||
|
||||
double damage = 0;
|
||||
|
||||
if (Core.AOS)
|
||||
{
|
||||
damage = GetNewAosDamage(19, 1, 5, m);
|
||||
}
|
||||
else if (m is Mobile)
|
||||
{
|
||||
damage = Utility.Random(10, 7);
|
||||
|
||||
if (CheckResisted((Mobile)m))
|
||||
{
|
||||
damage *= 0.75;
|
||||
|
||||
((Mobile)m).SendLocalizedMessage(501783); // You feel yourself resisting magical energy.
|
||||
}
|
||||
|
||||
damage *= GetDamageScalar((Mobile)m);
|
||||
}
|
||||
|
||||
if (damage > 0)
|
||||
{
|
||||
Caster.MovingParticles(m, 0x36D4, 7, 0, false, true, 9502, 4019, 0x160);
|
||||
Caster.PlaySound(Core.AOS ? 0x15E : 0x44B);
|
||||
|
||||
SpellHelper.Damage(this, target, damage, 0, 100, 0, 0, 0);
|
||||
}
|
||||
}
|
||||
|
||||
FinishSequence();
|
||||
}
|
||||
|
||||
private class InternalTarget : Target
|
||||
{
|
||||
private readonly FireballSpell m_Owner;
|
||||
public InternalTarget(FireballSpell owner)
|
||||
: base(Core.ML ? 10 : 12, false, TargetFlags.Harmful)
|
||||
{
|
||||
m_Owner = owner;
|
||||
}
|
||||
|
||||
protected override void OnTarget(Mobile from, object o)
|
||||
{
|
||||
if (o is IDamageable)
|
||||
m_Owner.Target((IDamageable)o);
|
||||
}
|
||||
|
||||
protected override void OnTargetFinish(Mobile from)
|
||||
{
|
||||
m_Owner.FinishSequence();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
91
Scripts/Spells/Third/MagicLock.cs
Normal file
91
Scripts/Spells/Third/MagicLock.cs
Normal file
@@ -0,0 +1,91 @@
|
||||
using System;
|
||||
using Server.Items;
|
||||
using Server.Network;
|
||||
using Server.Targeting;
|
||||
|
||||
namespace Server.Spells.Third
|
||||
{
|
||||
public class MagicLockSpell : MagerySpell
|
||||
{
|
||||
private static readonly SpellInfo m_Info = new SpellInfo(
|
||||
"Magic Lock", "An Por",
|
||||
215,
|
||||
9001,
|
||||
Reagent.Garlic,
|
||||
Reagent.Bloodmoss,
|
||||
Reagent.SulfurousAsh);
|
||||
public MagicLockSpell(Mobile caster, Item scroll)
|
||||
: base(caster, scroll, m_Info)
|
||||
{
|
||||
}
|
||||
|
||||
public override SpellCircle Circle
|
||||
{
|
||||
get
|
||||
{
|
||||
return SpellCircle.Third;
|
||||
}
|
||||
}
|
||||
public override void OnCast()
|
||||
{
|
||||
this.Caster.Target = new InternalTarget(this);
|
||||
}
|
||||
|
||||
public void Target(LockableContainer targ)
|
||||
{
|
||||
if (Multis.BaseHouse.CheckLockedDownOrSecured(targ))
|
||||
{
|
||||
// You cannot cast this on a locked down item.
|
||||
this.Caster.LocalOverheadMessage(MessageType.Regular, 0x22, 501761);
|
||||
}
|
||||
else if (targ.Locked || targ.LockLevel == 0 || targ is ParagonChest)
|
||||
{
|
||||
// Target must be an unlocked chest.
|
||||
this.Caster.SendLocalizedMessage(501762);
|
||||
}
|
||||
else if (this.CheckSequence())
|
||||
{
|
||||
SpellHelper.Turn(this.Caster, targ);
|
||||
|
||||
Point3D loc = targ.GetWorldLocation();
|
||||
|
||||
Effects.SendLocationParticles(
|
||||
EffectItem.Create(loc, targ.Map, EffectItem.DefaultDuration),
|
||||
0x376A, 9, 32, 5020);
|
||||
|
||||
Effects.PlaySound(loc, targ.Map, 0x1FA);
|
||||
|
||||
// The chest is now locked!
|
||||
this.Caster.LocalOverheadMessage(MessageType.Regular, 0x3B2, 501763);
|
||||
|
||||
targ.LockLevel = -255; // signal magic lock
|
||||
targ.Locked = true;
|
||||
}
|
||||
|
||||
this.FinishSequence();
|
||||
}
|
||||
|
||||
private class InternalTarget : Target
|
||||
{
|
||||
private readonly MagicLockSpell m_Owner;
|
||||
public InternalTarget(MagicLockSpell owner)
|
||||
: base(Core.ML ? 10 : 12, false, TargetFlags.None)
|
||||
{
|
||||
this.m_Owner = owner;
|
||||
}
|
||||
|
||||
protected override void OnTarget(Mobile from, object o)
|
||||
{
|
||||
if (o is LockableContainer)
|
||||
this.m_Owner.Target((LockableContainer)o);
|
||||
else
|
||||
from.SendLocalizedMessage(501762); // Target must be an unlocked chest.
|
||||
}
|
||||
|
||||
protected override void OnTargetFinish(Mobile from)
|
||||
{
|
||||
this.m_Owner.FinishSequence();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
150
Scripts/Spells/Third/Poison.cs
Normal file
150
Scripts/Spells/Third/Poison.cs
Normal file
@@ -0,0 +1,150 @@
|
||||
using System;
|
||||
using Server.Targeting;
|
||||
|
||||
namespace Server.Spells.Third
|
||||
{
|
||||
public class PoisonSpell : MagerySpell
|
||||
{
|
||||
private static readonly SpellInfo m_Info = new SpellInfo(
|
||||
"Poison", "In Nox",
|
||||
203,
|
||||
9051,
|
||||
Reagent.Nightshade);
|
||||
|
||||
public override SpellCircle Circle
|
||||
{
|
||||
get
|
||||
{
|
||||
return SpellCircle.Third;
|
||||
}
|
||||
}
|
||||
|
||||
public PoisonSpell(Mobile caster, Item scroll)
|
||||
: base(caster, scroll, m_Info)
|
||||
{
|
||||
}
|
||||
|
||||
public override void OnCast()
|
||||
{
|
||||
Caster.Target = new InternalTarget(this);
|
||||
}
|
||||
|
||||
public void Target(Mobile m)
|
||||
{
|
||||
if (!Caster.CanSee(m))
|
||||
{
|
||||
Caster.SendLocalizedMessage(500237); // Target can not be seen.
|
||||
}
|
||||
else if (CheckHSequence(m))
|
||||
{
|
||||
SpellHelper.Turn(Caster, m);
|
||||
|
||||
SpellHelper.CheckReflect((int)Circle, Caster, ref m);
|
||||
|
||||
if (m.Spell != null)
|
||||
m.Spell.OnCasterHurt();
|
||||
|
||||
m.Paralyzed = false;
|
||||
|
||||
if (CheckResisted(m) || Server.Spells.Mysticism.StoneFormSpell.CheckImmunity(m))
|
||||
{
|
||||
m.SendLocalizedMessage(501783); // You feel yourself resisting magical energy.
|
||||
}
|
||||
else
|
||||
{
|
||||
int level;
|
||||
|
||||
if (Core.AOS)
|
||||
{
|
||||
int total = (Caster.Skills.Magery.Fixed + Caster.Skills.Poisoning.Fixed) / 2;
|
||||
|
||||
if (Core.SA && Caster.InRange(m, 8))
|
||||
{
|
||||
int range = (int)Caster.GetDistanceToSqrt(m.Location);
|
||||
|
||||
if (total >= 1000)
|
||||
level = Utility.RandomDouble() <= .1 ? 4 : 3;
|
||||
else if (total > 850)
|
||||
level = 2;
|
||||
else if (total > 650)
|
||||
level = 1;
|
||||
else
|
||||
level = 0;
|
||||
|
||||
if (!Caster.InRange(m, 2))
|
||||
level -= range / 2;
|
||||
|
||||
if (level < 0)
|
||||
level = 0;
|
||||
}
|
||||
else if (Caster.InRange(m, 2))
|
||||
{
|
||||
if (total >= 1000)
|
||||
level = 3;
|
||||
else if (total > 850)
|
||||
level = 2;
|
||||
else if (total > 650)
|
||||
level = 1;
|
||||
else
|
||||
level = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
level = 0;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
double total = Caster.Skills[SkillName.Magery].Value + Caster.Skills[SkillName.Poisoning].Value;
|
||||
double dist = Caster.GetDistanceToSqrt(m);
|
||||
|
||||
if (dist >= 3.0)
|
||||
total -= (dist - 3.0) * 10.0;
|
||||
|
||||
if (total >= 200.0 && 1 > Utility.Random(10))
|
||||
level = 3;
|
||||
else if (total > (Core.AOS ? 170.1 : 170.0))
|
||||
level = 2;
|
||||
else if (total > (Core.AOS ? 130.1 : 130.0))
|
||||
level = 1;
|
||||
else
|
||||
level = 0;
|
||||
}
|
||||
|
||||
m.ApplyPoison(Caster, Poison.GetPoison(level));
|
||||
}
|
||||
|
||||
m.FixedParticles(0x374A, 10, 15, 5021, EffectLayer.Waist);
|
||||
m.PlaySound(0x205);
|
||||
|
||||
HarmfulSpell(m);
|
||||
}
|
||||
|
||||
FinishSequence();
|
||||
}
|
||||
|
||||
private class InternalTarget : Target
|
||||
{
|
||||
private readonly PoisonSpell m_Owner;
|
||||
|
||||
public InternalTarget(PoisonSpell 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();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
111
Scripts/Spells/Third/Telekinesis.cs
Normal file
111
Scripts/Spells/Third/Telekinesis.cs
Normal file
@@ -0,0 +1,111 @@
|
||||
using System;
|
||||
using Server.Items;
|
||||
using Server.Targeting;
|
||||
|
||||
namespace Server.Spells.Third
|
||||
{
|
||||
public class TelekinesisSpell : MagerySpell
|
||||
{
|
||||
private static readonly SpellInfo m_Info = new SpellInfo(
|
||||
"Telekinesis", "Ort Por Ylem",
|
||||
203,
|
||||
9031,
|
||||
Reagent.Bloodmoss,
|
||||
Reagent.MandrakeRoot);
|
||||
public TelekinesisSpell(Mobile caster, Item scroll)
|
||||
: base(caster, scroll, m_Info)
|
||||
{
|
||||
}
|
||||
|
||||
public override SpellCircle Circle
|
||||
{
|
||||
get
|
||||
{
|
||||
return SpellCircle.Third;
|
||||
}
|
||||
}
|
||||
public override void OnCast()
|
||||
{
|
||||
this.Caster.Target = new InternalTarget(this);
|
||||
}
|
||||
|
||||
public void Target(ITelekinesisable obj)
|
||||
{
|
||||
if (this.CheckSequence())
|
||||
{
|
||||
SpellHelper.Turn(this.Caster, obj);
|
||||
|
||||
obj.OnTelekinesis(this.Caster);
|
||||
}
|
||||
|
||||
this.FinishSequence();
|
||||
}
|
||||
|
||||
public void Target(Container item)
|
||||
{
|
||||
if (this.CheckSequence())
|
||||
{
|
||||
SpellHelper.Turn(this.Caster, item);
|
||||
|
||||
object root = item.RootParent;
|
||||
|
||||
if (!item.IsAccessibleTo(this.Caster))
|
||||
{
|
||||
item.OnDoubleClickNotAccessible(this.Caster);
|
||||
}
|
||||
else if (!item.CheckItemUse(this.Caster, item))
|
||||
{
|
||||
}
|
||||
else if (root != null && root is Mobile && root != this.Caster)
|
||||
{
|
||||
item.OnSnoop(this.Caster);
|
||||
}
|
||||
else if (item is Corpse && !((Corpse)item).CheckLoot(this.Caster, null))
|
||||
{
|
||||
}
|
||||
else if (this.Caster.Region.OnDoubleClick(this.Caster, item))
|
||||
{
|
||||
Effects.SendLocationParticles(EffectItem.Create(item.Location, item.Map, EffectItem.DefaultDuration), 0x376A, 9, 32, 5022);
|
||||
Effects.PlaySound(item.Location, item.Map, 0x1F5);
|
||||
|
||||
item.OnItemUsed(this.Caster, item);
|
||||
}
|
||||
}
|
||||
|
||||
this.FinishSequence();
|
||||
}
|
||||
|
||||
public class InternalTarget : Target
|
||||
{
|
||||
private readonly TelekinesisSpell m_Owner;
|
||||
public InternalTarget(TelekinesisSpell owner)
|
||||
: base(Core.ML ? 10 : 12, false, TargetFlags.None)
|
||||
{
|
||||
this.m_Owner = owner;
|
||||
}
|
||||
|
||||
protected override void OnTarget(Mobile from, object o)
|
||||
{
|
||||
if (o is ITelekinesisable && (!(o is Container) || !Siege.SiegeShard))
|
||||
this.m_Owner.Target((ITelekinesisable)o);
|
||||
else if (o is Container && !Siege.SiegeShard)
|
||||
this.m_Owner.Target((Container)o);
|
||||
else
|
||||
from.SendLocalizedMessage(501857); // This spell won't work on that!
|
||||
}
|
||||
|
||||
protected override void OnTargetFinish(Mobile from)
|
||||
{
|
||||
this.m_Owner.FinishSequence();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
namespace Server
|
||||
{
|
||||
public interface ITelekinesisable : IPoint3D
|
||||
{
|
||||
void OnTelekinesis(Mobile from);
|
||||
}
|
||||
}
|
||||
143
Scripts/Spells/Third/Teleport.cs
Normal file
143
Scripts/Spells/Third/Teleport.cs
Normal file
@@ -0,0 +1,143 @@
|
||||
using System;
|
||||
using Server.Items;
|
||||
using Server.Regions;
|
||||
using Server.Targeting;
|
||||
|
||||
namespace Server.Spells.Third
|
||||
{
|
||||
public class TeleportSpell : MagerySpell
|
||||
{
|
||||
private static readonly SpellInfo m_Info = new SpellInfo(
|
||||
"Teleport", "Rel Por",
|
||||
215,
|
||||
9031,
|
||||
Reagent.Bloodmoss,
|
||||
Reagent.MandrakeRoot);
|
||||
public TeleportSpell(Mobile caster, Item scroll)
|
||||
: base(caster, scroll, m_Info)
|
||||
{
|
||||
}
|
||||
|
||||
public override SpellCircle Circle
|
||||
{
|
||||
get
|
||||
{
|
||||
return SpellCircle.Third;
|
||||
}
|
||||
}
|
||||
public override bool CheckCast()
|
||||
{
|
||||
if (Factions.Sigil.ExistsOn(this.Caster))
|
||||
{
|
||||
this.Caster.SendLocalizedMessage(1061632); // You can't do that while carrying the sigil.
|
||||
return false;
|
||||
}
|
||||
else if (Server.Misc.WeightOverloading.IsOverloaded(this.Caster))
|
||||
{
|
||||
this.Caster.SendLocalizedMessage(502359, "", 0x22); // Thou art too encumbered to move.
|
||||
return false;
|
||||
}
|
||||
|
||||
return SpellHelper.CheckTravel(this.Caster, TravelCheckType.TeleportFrom);
|
||||
}
|
||||
|
||||
public override void OnCast()
|
||||
{
|
||||
this.Caster.Target = new InternalTarget(this);
|
||||
}
|
||||
|
||||
public void Target(IPoint3D p)
|
||||
{
|
||||
IPoint3D orig = p;
|
||||
Map map = this.Caster.Map;
|
||||
|
||||
SpellHelper.GetSurfaceTop(ref p);
|
||||
|
||||
Point3D from = this.Caster.Location;
|
||||
Point3D to = new Point3D(p);
|
||||
|
||||
if (Factions.Sigil.ExistsOn(this.Caster))
|
||||
{
|
||||
this.Caster.SendLocalizedMessage(1061632); // You can't do that while carrying the sigil.
|
||||
}
|
||||
else if (Server.Misc.WeightOverloading.IsOverloaded(this.Caster))
|
||||
{
|
||||
this.Caster.SendLocalizedMessage(502359, "", 0x22); // Thou art too encumbered to move.
|
||||
}
|
||||
else if (!SpellHelper.CheckTravel(this.Caster, TravelCheckType.TeleportFrom))
|
||||
{
|
||||
}
|
||||
else if (!SpellHelper.CheckTravel(this.Caster, map, to, TravelCheckType.TeleportTo))
|
||||
{
|
||||
}
|
||||
else if (map == null || !map.CanSpawnMobile(p.X, p.Y, p.Z))
|
||||
{
|
||||
this.Caster.SendLocalizedMessage(501942); // That location is blocked.
|
||||
}
|
||||
else if (SpellHelper.CheckMulti(to, map))
|
||||
{
|
||||
this.Caster.SendLocalizedMessage(502831); // Cannot teleport to that spot.
|
||||
}
|
||||
else if (Region.Find(to, map).GetRegion(typeof(HouseRegion)) != null)
|
||||
{
|
||||
this.Caster.SendLocalizedMessage(502829); // Cannot teleport to that spot.
|
||||
}
|
||||
else if (this.CheckSequence())
|
||||
{
|
||||
SpellHelper.Turn(this.Caster, orig);
|
||||
|
||||
Mobile m = this.Caster;
|
||||
|
||||
m.Location = to;
|
||||
m.ProcessDelta();
|
||||
|
||||
if (m.Player)
|
||||
{
|
||||
Effects.SendLocationParticles(EffectItem.Create(from, m.Map, EffectItem.DefaultDuration), 0x3728, 10, 10, 2023);
|
||||
Effects.SendLocationParticles(EffectItem.Create(to, m.Map, EffectItem.DefaultDuration), 0x3728, 10, 10, 5023);
|
||||
}
|
||||
else
|
||||
{
|
||||
m.FixedParticles(0x376A, 9, 32, 0x13AF, EffectLayer.Waist);
|
||||
}
|
||||
|
||||
m.PlaySound(0x1FE);
|
||||
|
||||
IPooledEnumerable eable = m.GetItemsInRange(0);
|
||||
|
||||
foreach (Item item in eable)
|
||||
{
|
||||
if (item is Server.Spells.Fifth.PoisonFieldSpell.InternalItem || item is Server.Spells.Fourth.FireFieldSpell.FireFieldItem)
|
||||
item.OnMoveOver(m);
|
||||
}
|
||||
|
||||
eable.Free();
|
||||
}
|
||||
|
||||
this.FinishSequence();
|
||||
}
|
||||
|
||||
public class InternalTarget : Target
|
||||
{
|
||||
private readonly TeleportSpell m_Owner;
|
||||
public InternalTarget(TeleportSpell owner)
|
||||
: base(Core.ML ? 11 : 12, true, TargetFlags.None)
|
||||
{
|
||||
this.m_Owner = owner;
|
||||
}
|
||||
|
||||
protected override void OnTarget(Mobile from, object o)
|
||||
{
|
||||
IPoint3D p = o as IPoint3D;
|
||||
|
||||
if (p != null)
|
||||
this.m_Owner.Target(p);
|
||||
}
|
||||
|
||||
protected override void OnTargetFinish(Mobile from)
|
||||
{
|
||||
this.m_Owner.FinishSequence();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
125
Scripts/Spells/Third/Unlock.cs
Normal file
125
Scripts/Spells/Third/Unlock.cs
Normal file
@@ -0,0 +1,125 @@
|
||||
using System;
|
||||
using Server.Items;
|
||||
using Server.Network;
|
||||
using Server.Targeting;
|
||||
|
||||
namespace Server.Spells.Third
|
||||
{
|
||||
public interface IMageUnlockable
|
||||
{
|
||||
void OnMageUnlock(Mobile from);
|
||||
}
|
||||
|
||||
public class UnlockSpell : MagerySpell
|
||||
{
|
||||
private static readonly SpellInfo m_Info = new SpellInfo(
|
||||
"Unlock Spell", "Ex Por",
|
||||
215,
|
||||
9001,
|
||||
Reagent.Bloodmoss,
|
||||
Reagent.SulfurousAsh);
|
||||
public UnlockSpell(Mobile caster, Item scroll)
|
||||
: base(caster, scroll, m_Info)
|
||||
{
|
||||
}
|
||||
|
||||
public override SpellCircle Circle
|
||||
{
|
||||
get
|
||||
{
|
||||
return SpellCircle.Third;
|
||||
}
|
||||
}
|
||||
public override void OnCast()
|
||||
{
|
||||
this.Caster.Target = new InternalTarget(this);
|
||||
}
|
||||
|
||||
private class InternalTarget : Target
|
||||
{
|
||||
private readonly UnlockSpell m_Owner;
|
||||
public InternalTarget(UnlockSpell owner)
|
||||
: base(Core.ML ? 10 : 12, false, TargetFlags.None)
|
||||
{
|
||||
this.m_Owner = owner;
|
||||
}
|
||||
|
||||
protected override void OnTarget(Mobile from, object o)
|
||||
{
|
||||
IPoint3D loc = o as IPoint3D;
|
||||
|
||||
if (loc == null)
|
||||
return;
|
||||
|
||||
if (this.m_Owner.CheckSequence())
|
||||
{
|
||||
SpellHelper.Turn(from, o);
|
||||
|
||||
Effects.SendLocationParticles(EffectItem.Create(new Point3D(loc), from.Map, EffectItem.DefaultDuration), 0x376A, 9, 32, 5024);
|
||||
|
||||
Effects.PlaySound(loc, from.Map, 0x1FF);
|
||||
|
||||
if (o is Mobile)
|
||||
from.LocalOverheadMessage(MessageType.Regular, 0x3B2, 503101); // That did not need to be unlocked.
|
||||
else if (o is IMageUnlockable)
|
||||
((IMageUnlockable)o).OnMageUnlock(from);
|
||||
else if (!(o is LockableContainer))
|
||||
from.SendLocalizedMessage(501666); // You can't unlock that!
|
||||
else
|
||||
{
|
||||
LockableContainer cont = (LockableContainer)o;
|
||||
|
||||
if (Multis.BaseHouse.CheckSecured(cont))
|
||||
from.SendLocalizedMessage(503098); // You cannot cast this on a secure item.
|
||||
else if (!cont.Locked)
|
||||
from.LocalOverheadMessage(MessageType.Regular, 0x3B2, 503101); // That did not need to be unlocked.
|
||||
else if (cont.LockLevel == 0)
|
||||
from.SendLocalizedMessage(501666); // You can't unlock that!
|
||||
else if (cont is TreasureMapChest && ((TreasureMapChest)cont).Level > 2)
|
||||
from.LocalOverheadMessage(MessageType.Regular, 0x3B2, 503099); // My spell does not seem to have an effect on that lock.
|
||||
else
|
||||
{
|
||||
int level;
|
||||
int reqSkill;
|
||||
|
||||
if (cont is TreasureMapChest && TreasureMapInfo.NewSystem)
|
||||
{
|
||||
level = (int)from.Skills[SkillName.Magery].Value;
|
||||
|
||||
switch (((TreasureMapChest)cont).Level)
|
||||
{
|
||||
default:
|
||||
case 0: reqSkill = 50; break;
|
||||
case 1: reqSkill = 80; break;
|
||||
case 2: reqSkill = 100; break;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
level = (int)(from.Skills[SkillName.Magery].Value * 0.8) - 4;
|
||||
reqSkill = cont.RequiredSkill;
|
||||
}
|
||||
|
||||
if (level >= reqSkill)
|
||||
{
|
||||
cont.Locked = false;
|
||||
|
||||
if (cont.LockLevel == -255)
|
||||
cont.LockLevel = cont.RequiredSkill - 10;
|
||||
}
|
||||
else
|
||||
from.LocalOverheadMessage(MessageType.Regular, 0x3B2, 503099); // My spell does not seem to have an effect on that lock.
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
this.m_Owner.FinishSequence();
|
||||
}
|
||||
|
||||
protected override void OnTargetFinish(Mobile from)
|
||||
{
|
||||
this.m_Owner.FinishSequence();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
225
Scripts/Spells/Third/WallOfStone.cs
Normal file
225
Scripts/Spells/Third/WallOfStone.cs
Normal file
@@ -0,0 +1,225 @@
|
||||
using System;
|
||||
using Server.Misc;
|
||||
using Server.Mobiles;
|
||||
using Server.Targeting;
|
||||
|
||||
namespace Server.Spells.Third
|
||||
{
|
||||
public class WallOfStoneSpell : MagerySpell
|
||||
{
|
||||
private static readonly SpellInfo m_Info = new SpellInfo(
|
||||
"Wall of Stone", "In Sanct Ylem",
|
||||
227,
|
||||
9011,
|
||||
false,
|
||||
Reagent.Bloodmoss,
|
||||
Reagent.Garlic);
|
||||
public WallOfStoneSpell(Mobile caster, Item scroll)
|
||||
: base(caster, scroll, m_Info)
|
||||
{
|
||||
}
|
||||
|
||||
public override SpellCircle Circle
|
||||
{
|
||||
get
|
||||
{
|
||||
return SpellCircle.Third;
|
||||
}
|
||||
}
|
||||
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, 0x1F6);
|
||||
|
||||
for (int i = -1; i <= 1; ++i)
|
||||
{
|
||||
Point3D loc = new Point3D(eastToWest ? p.X + i : p.X, eastToWest ? p.Y : p.Y + i, p.Z);
|
||||
|
||||
if (SpellHelper.CheckWater(loc, Caster.Map) && SpellHelper.CheckField(loc, Caster.Map))
|
||||
{
|
||||
Item item = new InternalItem(loc, Caster.Map, Caster);
|
||||
Effects.SendLocationParticles(item, 0x376A, 9, 10, 5025);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
FinishSequence();
|
||||
}
|
||||
|
||||
[DispellableField]
|
||||
private class InternalItem : Item
|
||||
{
|
||||
private readonly Mobile m_Caster;
|
||||
private Timer m_Timer;
|
||||
private DateTime m_End;
|
||||
public InternalItem(Point3D loc, Map map, Mobile caster)
|
||||
: base(0x82)
|
||||
{
|
||||
Movable = false;
|
||||
|
||||
MoveToWorld(loc, map);
|
||||
|
||||
m_Caster = caster;
|
||||
|
||||
if (Deleted)
|
||||
return;
|
||||
|
||||
m_Timer = new InternalTimer(this, TimeSpan.FromSeconds(10.0));
|
||||
m_Timer.Start();
|
||||
|
||||
m_End = DateTime.UtcNow + TimeSpan.FromSeconds(10.0);
|
||||
}
|
||||
|
||||
public InternalItem(Serial serial)
|
||||
: base(serial)
|
||||
{
|
||||
}
|
||||
|
||||
public override bool BlocksFit
|
||||
{
|
||||
get
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
public override void Serialize(GenericWriter writer)
|
||||
{
|
||||
base.Serialize(writer);
|
||||
|
||||
writer.Write((int)1); // version
|
||||
|
||||
writer.WriteDeltaTime(m_End);
|
||||
}
|
||||
|
||||
public override void Deserialize(GenericReader reader)
|
||||
{
|
||||
base.Deserialize(reader);
|
||||
|
||||
int version = reader.ReadInt();
|
||||
|
||||
switch ( version )
|
||||
{
|
||||
case 1:
|
||||
{
|
||||
m_End = reader.ReadDeltaTime();
|
||||
|
||||
m_Timer = new InternalTimer(this, m_End - DateTime.UtcNow);
|
||||
m_Timer.Start();
|
||||
|
||||
break;
|
||||
}
|
||||
case 0:
|
||||
{
|
||||
TimeSpan duration = TimeSpan.FromSeconds(10.0);
|
||||
|
||||
m_Timer = new InternalTimer(this, duration);
|
||||
m_Timer.Start();
|
||||
|
||||
m_End = DateTime.UtcNow + duration;
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public override bool OnMoveOver(Mobile m)
|
||||
{
|
||||
int noto;
|
||||
|
||||
if (m is PlayerMobile)
|
||||
{
|
||||
noto = Notoriety.Compute(m_Caster, m);
|
||||
if (noto == Notoriety.Enemy || noto == Notoriety.Ally)
|
||||
return false;
|
||||
|
||||
if (m.Map != null && (m.Map.Rules & MapRules.FreeMovement) == 0)
|
||||
return false;
|
||||
}
|
||||
return base.OnMoveOver(m);
|
||||
}
|
||||
|
||||
public override void OnAfterDelete()
|
||||
{
|
||||
base.OnAfterDelete();
|
||||
|
||||
if (m_Timer != null)
|
||||
m_Timer.Stop();
|
||||
}
|
||||
|
||||
private class InternalTimer : Timer
|
||||
{
|
||||
private readonly InternalItem m_Item;
|
||||
public InternalTimer(InternalItem item, TimeSpan duration)
|
||||
: base(duration)
|
||||
{
|
||||
Priority = TimerPriority.OneSecond;
|
||||
m_Item = item;
|
||||
}
|
||||
|
||||
protected override void OnTick()
|
||||
{
|
||||
m_Item.Delete();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public class InternalTarget : Target
|
||||
{
|
||||
private readonly WallOfStoneSpell m_Owner;
|
||||
public InternalTarget(WallOfStoneSpell 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();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user