Overwrite
Complete Overwrite of the Folder with the free shard. ServUO 57.3 has been added.
This commit is contained in:
196
Scripts/Spells/Fourth/ArchCure.cs
Normal file
196
Scripts/Spells/Fourth/ArchCure.cs
Normal file
@@ -0,0 +1,196 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using Server.Mobiles;
|
||||
using Server.Targeting;
|
||||
|
||||
namespace Server.Spells.Fourth
|
||||
{
|
||||
public class ArchCureSpell : MagerySpell
|
||||
{
|
||||
private static readonly SpellInfo m_Info = new SpellInfo(
|
||||
"Arch Cure", "Vas An Nox",
|
||||
215,
|
||||
9061,
|
||||
Reagent.Garlic,
|
||||
Reagent.Ginseng,
|
||||
Reagent.MandrakeRoot);
|
||||
public ArchCureSpell(Mobile caster, Item scroll)
|
||||
: base(caster, scroll, m_Info)
|
||||
{
|
||||
}
|
||||
|
||||
public override SpellCircle Circle
|
||||
{
|
||||
get
|
||||
{
|
||||
return SpellCircle.Fourth;
|
||||
}
|
||||
}
|
||||
// Arch cure is now 1/4th of a second faster
|
||||
public override TimeSpan CastDelayBase
|
||||
{
|
||||
get
|
||||
{
|
||||
return base.CastDelayBase - TimeSpan.FromSeconds(0.25);
|
||||
}
|
||||
}
|
||||
public override void OnCast()
|
||||
{
|
||||
this.Caster.Target = new InternalTarget(this);
|
||||
}
|
||||
|
||||
public void Target(IPoint3D p)
|
||||
{
|
||||
if (!this.Caster.CanSee(p))
|
||||
{
|
||||
this.Caster.SendLocalizedMessage(500237); // Target can not be seen.
|
||||
}
|
||||
else if (this.CheckSequence())
|
||||
{
|
||||
SpellHelper.Turn(this.Caster, p);
|
||||
|
||||
SpellHelper.GetSurfaceTop(ref p);
|
||||
|
||||
List<Mobile> targets = new List<Mobile>();
|
||||
|
||||
Map map = this.Caster.Map;
|
||||
Mobile directTarget = p as Mobile;
|
||||
|
||||
if (map != null)
|
||||
{
|
||||
bool feluccaRules = (map.Rules == MapRules.FeluccaRules);
|
||||
|
||||
// You can target any living mobile directly, beneficial checks apply
|
||||
if (directTarget != null && this.Caster.CanBeBeneficial(directTarget, false))
|
||||
targets.Add(directTarget);
|
||||
|
||||
IPooledEnumerable eable = map.GetMobilesInRange(new Point3D(p), 2);
|
||||
|
||||
foreach (Mobile m in eable)
|
||||
{
|
||||
if (m == directTarget)
|
||||
continue;
|
||||
|
||||
if (this.AreaCanTarget(m, feluccaRules))
|
||||
targets.Add(m);
|
||||
}
|
||||
|
||||
eable.Free();
|
||||
}
|
||||
|
||||
Effects.PlaySound(p, this.Caster.Map, 0x299);
|
||||
|
||||
if (targets.Count > 0)
|
||||
{
|
||||
int cured = 0;
|
||||
|
||||
for (int i = 0; i < targets.Count; ++i)
|
||||
{
|
||||
Mobile m = targets[i];
|
||||
|
||||
this.Caster.DoBeneficial(m);
|
||||
|
||||
Poison poison = m.Poison;
|
||||
|
||||
if (poison != null)
|
||||
{
|
||||
int chanceToCure = 10000 + (int)(this.Caster.Skills[SkillName.Magery].Value * 75) - ((poison.RealLevel + 1) * 1750);
|
||||
chanceToCure /= 100;
|
||||
chanceToCure -= 1;
|
||||
|
||||
if (chanceToCure > Utility.Random(100) && m.CurePoison(this.Caster))
|
||||
++cured;
|
||||
}
|
||||
|
||||
m.FixedParticles(0x373A, 10, 15, 5012, EffectLayer.Waist);
|
||||
m.PlaySound(0x1E0);
|
||||
}
|
||||
|
||||
if (cured > 0)
|
||||
this.Caster.SendLocalizedMessage(1010058); // You have cured the target of all poisons!
|
||||
}
|
||||
}
|
||||
|
||||
this.FinishSequence();
|
||||
}
|
||||
|
||||
private static bool IsInnocentTo(Mobile from, Mobile to)
|
||||
{
|
||||
return (Notoriety.Compute(from, (Mobile)to) == Notoriety.Innocent);
|
||||
}
|
||||
|
||||
private static bool IsAllyTo(Mobile from, Mobile to)
|
||||
{
|
||||
return (Notoriety.Compute(from, (Mobile)to) == Notoriety.Ally);
|
||||
}
|
||||
|
||||
private bool AreaCanTarget(Mobile target, bool feluccaRules)
|
||||
{
|
||||
/* Arch cure area effect won't cure aggressors, victims, murderers, criminals or monsters.
|
||||
* In Felucca, it will also not cure summons and pets.
|
||||
* For red players it will only cure themselves and guild members.
|
||||
*/
|
||||
if (!this.Caster.CanBeBeneficial(target, false))
|
||||
return false;
|
||||
|
||||
if (Core.AOS && target != this.Caster)
|
||||
{
|
||||
if (this.IsAggressor(target) || this.IsAggressed(target))
|
||||
return false;
|
||||
|
||||
if ((!IsInnocentTo(this.Caster, target) || !IsInnocentTo(target, this.Caster)) && !IsAllyTo(this.Caster, target))
|
||||
return false;
|
||||
|
||||
if (feluccaRules && !(target is PlayerMobile))
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
private bool IsAggressor(Mobile m)
|
||||
{
|
||||
foreach (AggressorInfo info in this.Caster.Aggressors)
|
||||
{
|
||||
if (m == info.Attacker && !info.Expired)
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
private bool IsAggressed(Mobile m)
|
||||
{
|
||||
foreach (AggressorInfo info in this.Caster.Aggressed)
|
||||
{
|
||||
if (m == info.Defender && !info.Expired)
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
public class InternalTarget : Target
|
||||
{
|
||||
private readonly ArchCureSpell m_Owner;
|
||||
public InternalTarget(ArchCureSpell owner)
|
||||
: base(Core.ML ? 10 : 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();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
175
Scripts/Spells/Fourth/ArchProtection.cs
Normal file
175
Scripts/Spells/Fourth/ArchProtection.cs
Normal file
@@ -0,0 +1,175 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using Server.Engines.PartySystem;
|
||||
using Server.Targeting;
|
||||
|
||||
namespace Server.Spells.Fourth
|
||||
{
|
||||
public class ArchProtectionSpell : MagerySpell
|
||||
{
|
||||
private static readonly SpellInfo m_Info = new SpellInfo(
|
||||
"Arch Protection", "Vas Uus Sanct",
|
||||
Core.AOS ? 239 : 215,
|
||||
9011,
|
||||
Reagent.Garlic,
|
||||
Reagent.Ginseng,
|
||||
Reagent.MandrakeRoot,
|
||||
Reagent.SulfurousAsh);
|
||||
public ArchProtectionSpell(Mobile caster, Item scroll)
|
||||
: base(caster, scroll, m_Info)
|
||||
{
|
||||
}
|
||||
|
||||
public override SpellCircle Circle
|
||||
{
|
||||
get
|
||||
{
|
||||
return SpellCircle.Fourth;
|
||||
}
|
||||
}
|
||||
public override void OnCast()
|
||||
{
|
||||
this.Caster.Target = new InternalTarget(this);
|
||||
}
|
||||
|
||||
public void Target(IPoint3D p)
|
||||
{
|
||||
if (!this.Caster.CanSee(p))
|
||||
{
|
||||
this.Caster.SendLocalizedMessage(500237); // Target can not be seen.
|
||||
}
|
||||
else if (this.CheckSequence())
|
||||
{
|
||||
SpellHelper.Turn(this.Caster, p);
|
||||
|
||||
SpellHelper.GetSurfaceTop(ref p);
|
||||
|
||||
List<Mobile> targets = new List<Mobile>();
|
||||
|
||||
Map map = this.Caster.Map;
|
||||
|
||||
if (map != null)
|
||||
{
|
||||
IPooledEnumerable eable = map.GetMobilesInRange(new Point3D(p), Core.AOS ? 2 : 3);
|
||||
|
||||
foreach (Mobile m in eable)
|
||||
{
|
||||
if (this.Caster.CanBeBeneficial(m, false))
|
||||
targets.Add(m);
|
||||
}
|
||||
|
||||
eable.Free();
|
||||
}
|
||||
|
||||
if (Core.AOS)
|
||||
{
|
||||
Party party = Party.Get(this.Caster);
|
||||
|
||||
for (int i = 0; i < targets.Count; ++i)
|
||||
{
|
||||
Mobile m = targets[i];
|
||||
|
||||
if (m == this.Caster || (party != null && party.Contains(m)))
|
||||
{
|
||||
this.Caster.DoBeneficial(m);
|
||||
Spells.Second.ProtectionSpell.Toggle(this.Caster, m, true);
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
Effects.PlaySound(p, this.Caster.Map, 0x299);
|
||||
|
||||
int val = (int)(this.Caster.Skills[SkillName.Magery].Value / 10.0 + 1);
|
||||
|
||||
if (targets.Count > 0)
|
||||
{
|
||||
for (int i = 0; i < targets.Count; ++i)
|
||||
{
|
||||
Mobile m = targets[i];
|
||||
|
||||
if (m.BeginAction(typeof(ArchProtectionSpell)))
|
||||
{
|
||||
this.Caster.DoBeneficial(m);
|
||||
m.VirtualArmorMod += val;
|
||||
|
||||
AddEntry(m, val);
|
||||
new InternalTimer(m, this.Caster).Start();
|
||||
|
||||
m.FixedParticles(0x375A, 9, 20, 5027, EffectLayer.Waist);
|
||||
m.PlaySound(0x1F7);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
this.FinishSequence();
|
||||
}
|
||||
|
||||
private static Dictionary<Mobile, Int32> _Table = new Dictionary<Mobile, Int32>();
|
||||
|
||||
private static void AddEntry(Mobile m, Int32 v)
|
||||
{
|
||||
_Table[m] = v;
|
||||
}
|
||||
|
||||
public static void RemoveEntry(Mobile m)
|
||||
{
|
||||
if (_Table.ContainsKey(m))
|
||||
{
|
||||
int v = _Table[m];
|
||||
_Table.Remove(m);
|
||||
m.EndAction(typeof(ArchProtectionSpell));
|
||||
m.VirtualArmorMod -= v;
|
||||
if (m.VirtualArmorMod < 0)
|
||||
m.VirtualArmorMod = 0;
|
||||
}
|
||||
}
|
||||
|
||||
private class InternalTimer : Timer
|
||||
{
|
||||
private readonly Mobile m_Owner;
|
||||
|
||||
public InternalTimer(Mobile target, Mobile caster)
|
||||
: base(TimeSpan.FromSeconds(0))
|
||||
{
|
||||
double time = caster.Skills[SkillName.Magery].Value * 1.2;
|
||||
if (time > 144)
|
||||
time = 144;
|
||||
this.Delay = TimeSpan.FromSeconds(time);
|
||||
this.Priority = TimerPriority.OneSecond;
|
||||
|
||||
this.m_Owner = target;
|
||||
}
|
||||
|
||||
protected override void OnTick()
|
||||
{
|
||||
ArchProtectionSpell.RemoveEntry(this.m_Owner);
|
||||
}
|
||||
}
|
||||
|
||||
private class InternalTarget : Target
|
||||
{
|
||||
private readonly ArchProtectionSpell m_Owner;
|
||||
public InternalTarget(ArchProtectionSpell owner)
|
||||
: base(Core.ML ? 10 : 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();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
200
Scripts/Spells/Fourth/Curse.cs
Normal file
200
Scripts/Spells/Fourth/Curse.cs
Normal file
@@ -0,0 +1,200 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using Server.Targeting;
|
||||
using Server.Spells.First;
|
||||
|
||||
namespace Server.Spells.Fourth
|
||||
{
|
||||
public class CurseSpell : MagerySpell
|
||||
{
|
||||
private static readonly SpellInfo m_Info = new SpellInfo(
|
||||
"Curse", "Des Sanct",
|
||||
227,
|
||||
9031,
|
||||
Reagent.Nightshade,
|
||||
Reagent.Garlic,
|
||||
Reagent.SulfurousAsh);
|
||||
|
||||
private static readonly Dictionary<Mobile, Timer> m_UnderEffect = new Dictionary<Mobile, Timer>();
|
||||
|
||||
public CurseSpell(Mobile caster, Item scroll)
|
||||
: base(caster, scroll, m_Info)
|
||||
{
|
||||
}
|
||||
|
||||
public override SpellCircle Circle
|
||||
{
|
||||
get
|
||||
{
|
||||
return SpellCircle.Fourth;
|
||||
}
|
||||
}
|
||||
|
||||
public static void AddEffect(Mobile m, TimeSpan duration, int strOffset, int dexOffset, int intOffset)
|
||||
{
|
||||
if (m == null)
|
||||
return;
|
||||
|
||||
if (m_UnderEffect.ContainsKey(m))
|
||||
{
|
||||
m_UnderEffect[m].Stop();
|
||||
m_UnderEffect[m] = null;
|
||||
}
|
||||
|
||||
// my spell is stronger, so lets remove the lesser spell
|
||||
if (WeakenSpell.IsUnderEffects(m) && SpellHelper.GetCurseOffset(m, StatType.Str) <= strOffset)
|
||||
{
|
||||
WeakenSpell.RemoveEffects(m, false);
|
||||
}
|
||||
|
||||
if (ClumsySpell.IsUnderEffects(m) && SpellHelper.GetCurseOffset(m, StatType.Dex) <= dexOffset)
|
||||
{
|
||||
ClumsySpell.RemoveEffects(m, false);
|
||||
}
|
||||
|
||||
if (FeeblemindSpell.IsUnderEffects(m) && SpellHelper.GetCurseOffset(m, StatType.Int) <= intOffset)
|
||||
{
|
||||
FeeblemindSpell.RemoveEffects(m, false);
|
||||
}
|
||||
|
||||
m_UnderEffect[m] = Timer.DelayCall<Mobile>(duration, RemoveEffect, m); //= new CurseTimer(m, duration, strOffset, dexOffset, intOffset);
|
||||
m.UpdateResistances();
|
||||
}
|
||||
|
||||
public static void RemoveEffect(Mobile m)
|
||||
{
|
||||
if(!WeakenSpell.IsUnderEffects(m))
|
||||
m.RemoveStatMod("[Magic] Str Curse");
|
||||
|
||||
if(!ClumsySpell.IsUnderEffects(m))
|
||||
m.RemoveStatMod("[Magic] Dex Curse");
|
||||
|
||||
if(!FeeblemindSpell.IsUnderEffects(m))
|
||||
m.RemoveStatMod("[Magic] Int Curse");
|
||||
|
||||
BuffInfo.RemoveBuff(m, BuffIcon.Curse);
|
||||
|
||||
if(m_UnderEffect.ContainsKey(m))
|
||||
{
|
||||
Timer t = m_UnderEffect[m];
|
||||
|
||||
if(t != null)
|
||||
t.Stop();
|
||||
|
||||
m_UnderEffect.Remove(m);
|
||||
}
|
||||
|
||||
m.UpdateResistances();
|
||||
}
|
||||
|
||||
public static bool UnderEffect(Mobile m)
|
||||
{
|
||||
return m_UnderEffect.ContainsKey(m);
|
||||
}
|
||||
|
||||
public override void OnCast()
|
||||
{
|
||||
Caster.Target = new InternalTarget(this);
|
||||
}
|
||||
|
||||
public static bool DoCurse(Mobile caster, Mobile m, bool masscurse)
|
||||
{
|
||||
if (Mysticism.StoneFormSpell.CheckImmunity(m))
|
||||
{
|
||||
caster.SendLocalizedMessage(1080192); // Your target resists your ability reduction magic.
|
||||
return true;
|
||||
}
|
||||
|
||||
int oldStr = SpellHelper.GetCurseOffset(m, StatType.Str);
|
||||
int oldDex = SpellHelper.GetCurseOffset(m, StatType.Dex);
|
||||
int oldInt = SpellHelper.GetCurseOffset(m, StatType.Int);
|
||||
|
||||
int newStr = SpellHelper.GetOffset(caster, m, StatType.Str, true, true);
|
||||
int newDex = SpellHelper.GetOffset(caster, m, StatType.Dex, true, true);
|
||||
int newInt = SpellHelper.GetOffset(caster, m, StatType.Int, true, true);
|
||||
|
||||
if ((-newStr > oldStr && -newDex > oldDex && -newInt > oldInt) ||
|
||||
(newStr == 0 && newDex == 0 && newInt == 0))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
SpellHelper.AddStatCurse(caster, m, StatType.Str, false);
|
||||
SpellHelper.AddStatCurse(caster, m, StatType.Dex, true);
|
||||
SpellHelper.AddStatCurse(caster, m, StatType.Int, true);
|
||||
|
||||
int percentage = (int)(SpellHelper.GetOffsetScalar(caster, m, true) * 100);
|
||||
TimeSpan length = SpellHelper.GetDuration(caster, m);
|
||||
string args;
|
||||
|
||||
if (masscurse)
|
||||
{
|
||||
args = String.Format("{0}\t{0}\t{0}", percentage);
|
||||
BuffInfo.AddBuff(m, new BuffInfo(BuffIcon.MassCurse, 1075839, length, m, args));
|
||||
}
|
||||
else
|
||||
{
|
||||
args = String.Format("{0}\t{1}\t{2}\t{3}\t{4}\t{5}\t{6}", percentage, percentage, percentage, 10, 10, 10, 10);
|
||||
BuffInfo.AddBuff(m, new BuffInfo(BuffIcon.Curse, 1075835, 1075836, length, m, args.ToString()));
|
||||
}
|
||||
|
||||
AddEffect(m, SpellHelper.GetDuration(caster, m), oldStr, oldDex, oldInt);
|
||||
|
||||
if (m.Spell != null)
|
||||
m.Spell.OnCasterHurt();
|
||||
|
||||
m.Paralyzed = false;
|
||||
|
||||
m.FixedParticles(0x374A, 10, 15, 5028, EffectLayer.Waist);
|
||||
m.PlaySound(0x1E1);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public void Target(Mobile m)
|
||||
{
|
||||
if (!Caster.CanSee(m))
|
||||
{
|
||||
Caster.SendLocalizedMessage(500237); // Target can not be seen.
|
||||
}
|
||||
else if (CheckHSequence(m))
|
||||
{
|
||||
SpellHelper.Turn(Caster, m);
|
||||
|
||||
SpellHelper.CheckReflect((int)Circle, Caster, ref m);
|
||||
|
||||
if (DoCurse(Caster, m, false))
|
||||
{
|
||||
HarmfulSpell(m);
|
||||
}
|
||||
else
|
||||
{
|
||||
DoHurtFizzle();
|
||||
}
|
||||
}
|
||||
|
||||
FinishSequence();
|
||||
}
|
||||
|
||||
private class InternalTarget : Target
|
||||
{
|
||||
private readonly CurseSpell m_Owner;
|
||||
public InternalTarget(CurseSpell 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();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
334
Scripts/Spells/Fourth/FireField.cs
Normal file
334
Scripts/Spells/Fourth/FireField.cs
Normal file
@@ -0,0 +1,334 @@
|
||||
using System;
|
||||
using System.Collections;
|
||||
using Server.Items;
|
||||
using Server.Misc;
|
||||
using Server.Mobiles;
|
||||
using Server.Targeting;
|
||||
|
||||
namespace Server.Spells.Fourth
|
||||
{
|
||||
public class FireFieldSpell : MagerySpell
|
||||
{
|
||||
private static readonly SpellInfo m_Info = new SpellInfo(
|
||||
"Fire Field", "In Flam Grav",
|
||||
215,
|
||||
9041,
|
||||
false,
|
||||
Reagent.BlackPearl,
|
||||
Reagent.SpidersSilk,
|
||||
Reagent.SulfurousAsh);
|
||||
public FireFieldSpell(Mobile caster, Item scroll)
|
||||
: base(caster, scroll, m_Info)
|
||||
{
|
||||
}
|
||||
|
||||
public override SpellCircle Circle
|
||||
{
|
||||
get
|
||||
{
|
||||
return SpellCircle.Fourth;
|
||||
}
|
||||
}
|
||||
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, 0x20C);
|
||||
|
||||
int itemID = eastToWest ? 0x398C : 0x3996;
|
||||
TimeSpan duration;
|
||||
|
||||
if (Core.AOS)
|
||||
duration = TimeSpan.FromSeconds((15 + (Caster.Skills.Magery.Fixed / 5)) / 4);
|
||||
else
|
||||
duration = TimeSpan.FromSeconds(4.0 + (Caster.Skills[SkillName.Magery].Value * 0.5));
|
||||
|
||||
Point3D pnt = new Point3D(p);
|
||||
|
||||
if (SpellHelper.CheckField(pnt, Caster.Map))
|
||||
new FireFieldItem(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 FireFieldItem(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 FireFieldItem(itemID, point, Caster, Caster.Map, duration);
|
||||
}, i);
|
||||
}
|
||||
}
|
||||
|
||||
FinishSequence();
|
||||
}
|
||||
|
||||
[DispellableField]
|
||||
public class FireFieldItem : Item
|
||||
{
|
||||
private Timer m_Timer;
|
||||
private DateTime m_End;
|
||||
private Mobile m_Caster;
|
||||
private int m_Damage;
|
||||
|
||||
public Mobile Caster { get { return m_Caster; } }
|
||||
|
||||
public FireFieldItem(int itemID, Point3D loc, Mobile caster, Map map, TimeSpan duration)
|
||||
: this(itemID, loc, caster, map, duration, 2)
|
||||
{
|
||||
}
|
||||
|
||||
public FireFieldItem(int itemID, Point3D loc, Mobile caster, Map map, TimeSpan duration, int damage)
|
||||
: 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_Damage = damage;
|
||||
|
||||
m_End = DateTime.UtcNow + duration;
|
||||
|
||||
m_Timer = new InternalTimer(this, caster.InLOS(this), canFit);
|
||||
m_Timer.Start();
|
||||
}
|
||||
|
||||
public FireFieldItem(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)2); // version
|
||||
|
||||
writer.Write(m_Damage);
|
||||
writer.Write(m_Caster);
|
||||
writer.WriteDeltaTime(m_End);
|
||||
}
|
||||
|
||||
public override void Deserialize(GenericReader reader)
|
||||
{
|
||||
base.Deserialize(reader);
|
||||
|
||||
int version = reader.ReadInt();
|
||||
|
||||
switch ( version )
|
||||
{
|
||||
case 2:
|
||||
{
|
||||
m_Damage = reader.ReadInt();
|
||||
goto case 1;
|
||||
}
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
||||
if (version < 2)
|
||||
m_Damage = 2;
|
||||
}
|
||||
|
||||
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))
|
||||
{
|
||||
if (SpellHelper.CanRevealCaster(m))
|
||||
m_Caster.RevealingAction();
|
||||
|
||||
m_Caster.DoHarmful(m);
|
||||
|
||||
int damage = m_Damage;
|
||||
|
||||
if (!Core.AOS && m.CheckSkill(SkillName.MagicResist, 0.0, 30.0))
|
||||
{
|
||||
damage = 1;
|
||||
|
||||
m.SendLocalizedMessage(501783); // You feel yourself resisting magical energy.
|
||||
}
|
||||
|
||||
AOS.Damage(m, m_Caster, damage, 0, 100, 0, 0, 0);
|
||||
m.PlaySound(0x208);
|
||||
|
||||
if (m is BaseCreature)
|
||||
((BaseCreature)m).OnHarmfulSpell(m_Caster);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
private class InternalTimer : Timer
|
||||
{
|
||||
private static readonly Queue m_Queue = new Queue();
|
||||
private readonly FireFieldItem m_Item;
|
||||
private readonly bool m_InLOS;
|
||||
private readonly bool m_CanFit;
|
||||
|
||||
public InternalTimer(FireFieldItem item, bool inLOS, bool canFit)
|
||||
: base(TimeSpan.FromMilliseconds(500), TimeSpan.FromSeconds(1.0))
|
||||
{
|
||||
m_Item = item;
|
||||
m_InLOS = inLOS;
|
||||
m_CanFit = canFit;
|
||||
|
||||
Priority = TimerPriority.FiftyMS;
|
||||
}
|
||||
|
||||
protected override void OnTick()
|
||||
{
|
||||
if (m_Item.Deleted)
|
||||
return;
|
||||
|
||||
if (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)
|
||||
{
|
||||
IPooledEnumerable eable = m_Item.GetMobilesInRange(0);
|
||||
|
||||
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();
|
||||
|
||||
if (SpellHelper.CanRevealCaster(m))
|
||||
caster.RevealingAction();
|
||||
|
||||
caster.DoHarmful(m);
|
||||
|
||||
int damage = m_Item.m_Damage;
|
||||
|
||||
if (!Core.AOS && m.CheckSkill(SkillName.MagicResist, 0.0, 30.0))
|
||||
{
|
||||
damage = 1;
|
||||
|
||||
m.SendLocalizedMessage(501783); // You feel yourself resisting magical energy.
|
||||
}
|
||||
|
||||
AOS.Damage(m, caster, damage, 0, 100, 0, 0, 0);
|
||||
m.PlaySound(0x208);
|
||||
|
||||
if (m is BaseCreature)
|
||||
((BaseCreature)m).OnHarmfulSpell(caster);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public class InternalTarget : Target
|
||||
{
|
||||
private readonly FireFieldSpell m_Owner;
|
||||
public InternalTarget(FireFieldSpell 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();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
100
Scripts/Spells/Fourth/GreaterHeal.cs
Normal file
100
Scripts/Spells/Fourth/GreaterHeal.cs
Normal file
@@ -0,0 +1,100 @@
|
||||
using System;
|
||||
using Server.Mobiles;
|
||||
using Server.Network;
|
||||
using Server.Targeting;
|
||||
|
||||
namespace Server.Spells.Fourth
|
||||
{
|
||||
public class GreaterHealSpell : MagerySpell
|
||||
{
|
||||
private static readonly SpellInfo m_Info = new SpellInfo(
|
||||
"Greater Heal", "In Vas Mani",
|
||||
204,
|
||||
9061,
|
||||
Reagent.Garlic,
|
||||
Reagent.Ginseng,
|
||||
Reagent.MandrakeRoot,
|
||||
Reagent.SpidersSilk);
|
||||
public GreaterHealSpell(Mobile caster, Item scroll)
|
||||
: base(caster, scroll, m_Info)
|
||||
{
|
||||
}
|
||||
|
||||
public override SpellCircle Circle
|
||||
{
|
||||
get
|
||||
{
|
||||
return SpellCircle.Fourth;
|
||||
}
|
||||
}
|
||||
|
||||
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 (m is BaseCreature && ((BaseCreature)m).IsAnimatedDead)
|
||||
{
|
||||
this.Caster.SendLocalizedMessage(1061654); // You cannot heal that which is not alive.
|
||||
}
|
||||
else if (m.IsDeadBondedPet)
|
||||
{
|
||||
this.Caster.SendLocalizedMessage(1060177); // You cannot heal a creature that is already dead!
|
||||
}
|
||||
else if (m is IRepairableMobile)
|
||||
{
|
||||
this.Caster.LocalOverheadMessage(MessageType.Regular, 0x3B2, 500951); // You cannot heal that.
|
||||
}
|
||||
else if (m.Poisoned || Server.Items.MortalStrike.IsWounded(m))
|
||||
{
|
||||
this.Caster.LocalOverheadMessage(MessageType.Regular, 0x22, (this.Caster == m) ? 1005000 : 1010398);
|
||||
}
|
||||
else if (this.CheckBSequence(m))
|
||||
{
|
||||
SpellHelper.Turn(this.Caster, m);
|
||||
|
||||
// Algorithm: (40% of magery) + (1-10)
|
||||
|
||||
int toHeal = (int)(this.Caster.Skills[SkillName.Magery].Value * 0.4);
|
||||
toHeal += Utility.Random(1, 10);
|
||||
|
||||
//m.Heal( toHeal, Caster );
|
||||
SpellHelper.Heal(toHeal, m, this.Caster);
|
||||
|
||||
m.FixedParticles(0x376A, 9, 32, 5030, EffectLayer.Waist);
|
||||
m.PlaySound(0x202);
|
||||
}
|
||||
|
||||
this.FinishSequence();
|
||||
}
|
||||
|
||||
public class InternalTarget : Target
|
||||
{
|
||||
private readonly GreaterHealSpell m_Owner;
|
||||
public InternalTarget(GreaterHealSpell 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();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
113
Scripts/Spells/Fourth/Lightning.cs
Normal file
113
Scripts/Spells/Fourth/Lightning.cs
Normal file
@@ -0,0 +1,113 @@
|
||||
using System;
|
||||
using Server.Targeting;
|
||||
using Server.Mobiles;
|
||||
|
||||
namespace Server.Spells.Fourth
|
||||
{
|
||||
public class LightningSpell : MagerySpell
|
||||
{
|
||||
private static readonly SpellInfo m_Info = new SpellInfo(
|
||||
"Lightning", "Por Ort Grav",
|
||||
239,
|
||||
9021,
|
||||
Reagent.MandrakeRoot,
|
||||
Reagent.SulfurousAsh);
|
||||
public LightningSpell(Mobile caster, Item scroll)
|
||||
: base(caster, scroll, m_Info)
|
||||
{
|
||||
}
|
||||
|
||||
public override SpellCircle Circle
|
||||
{
|
||||
get
|
||||
{
|
||||
return SpellCircle.Fourth;
|
||||
}
|
||||
}
|
||||
public override bool DelayedDamage
|
||||
{
|
||||
get
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
public override void OnCast()
|
||||
{
|
||||
Caster.Target = new InternalTarget(this);
|
||||
}
|
||||
|
||||
public void Target(IDamageable m)
|
||||
{
|
||||
Mobile mob = m as Mobile;
|
||||
|
||||
if (!Caster.CanSee(m))
|
||||
{
|
||||
Caster.SendLocalizedMessage(500237); // Target can not be seen.
|
||||
}
|
||||
else if (CheckHSequence(m))
|
||||
{
|
||||
Mobile source = Caster;
|
||||
SpellHelper.Turn(Caster, m.Location);
|
||||
|
||||
SpellHelper.CheckReflect((int)Circle, ref source, ref m);
|
||||
|
||||
double damage = 0;
|
||||
|
||||
if (Core.AOS)
|
||||
{
|
||||
damage = GetNewAosDamage(23, 1, 4, m);
|
||||
}
|
||||
else if (mob != null)
|
||||
{
|
||||
damage = Utility.Random(12, 9);
|
||||
|
||||
if (CheckResisted(mob))
|
||||
{
|
||||
damage *= 0.75;
|
||||
|
||||
mob.SendLocalizedMessage(501783); // You feel yourself resisting magical energy.
|
||||
}
|
||||
|
||||
damage *= GetDamageScalar(mob);
|
||||
}
|
||||
|
||||
if (m is Mobile)
|
||||
{
|
||||
Effects.SendBoltEffect(m, true, 0, false);
|
||||
}
|
||||
else
|
||||
{
|
||||
Effects.SendBoltEffect(EffectMobile.Create(m.Location, m.Map, EffectMobile.DefaultDuration), true, 0, false);
|
||||
}
|
||||
|
||||
if (damage > 0)
|
||||
{
|
||||
SpellHelper.Damage(this, m, damage, 0, 0, 0, 0, 100);
|
||||
}
|
||||
}
|
||||
|
||||
FinishSequence();
|
||||
}
|
||||
|
||||
private class InternalTarget : Target
|
||||
{
|
||||
private readonly LightningSpell m_Owner;
|
||||
public InternalTarget(LightningSpell 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();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
136
Scripts/Spells/Fourth/ManaDrain.cs
Normal file
136
Scripts/Spells/Fourth/ManaDrain.cs
Normal file
@@ -0,0 +1,136 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using Server.Targeting;
|
||||
|
||||
namespace Server.Spells.Fourth
|
||||
{
|
||||
public class ManaDrainSpell : MagerySpell
|
||||
{
|
||||
private static readonly SpellInfo m_Info = new SpellInfo(
|
||||
"Mana Drain", "Ort Rel",
|
||||
215,
|
||||
9031,
|
||||
Reagent.BlackPearl,
|
||||
Reagent.MandrakeRoot,
|
||||
Reagent.SpidersSilk);
|
||||
private static readonly Dictionary<Mobile, Timer> m_Table = new Dictionary<Mobile, Timer>();
|
||||
public ManaDrainSpell(Mobile caster, Item scroll)
|
||||
: base(caster, scroll, m_Info)
|
||||
{
|
||||
}
|
||||
|
||||
public override SpellCircle Circle
|
||||
{
|
||||
get
|
||||
{
|
||||
return SpellCircle.Fourth;
|
||||
}
|
||||
}
|
||||
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.CheckHSequence(m))
|
||||
{
|
||||
SpellHelper.Turn(this.Caster, m);
|
||||
|
||||
SpellHelper.CheckReflect((int)this.Circle, this.Caster, ref m);
|
||||
|
||||
if (m.Spell != null)
|
||||
m.Spell.OnCasterHurt();
|
||||
|
||||
m.Paralyzed = false;
|
||||
|
||||
if (Core.AOS)
|
||||
{
|
||||
int toDrain = 40 + (int)(this.GetDamageSkill(this.Caster) - this.GetResistSkill(m));
|
||||
|
||||
if (toDrain < 0)
|
||||
toDrain = 0;
|
||||
else if (toDrain > m.Mana)
|
||||
toDrain = m.Mana;
|
||||
|
||||
if (m_Table.ContainsKey(m))
|
||||
toDrain = 0;
|
||||
|
||||
m.FixedParticles(0x3789, 10, 25, 5032, EffectLayer.Head);
|
||||
m.PlaySound(0x1F8);
|
||||
|
||||
if (toDrain > 0)
|
||||
{
|
||||
m.Mana -= toDrain;
|
||||
|
||||
m_Table[m] = Timer.DelayCall(TimeSpan.FromSeconds(5.0), new TimerStateCallback(AosDelay_Callback), new object[] { m, toDrain });
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (this.CheckResisted(m))
|
||||
m.SendLocalizedMessage(501783); // You feel yourself resisting magical energy.
|
||||
else if (m.Mana >= 100)
|
||||
m.Mana -= Utility.Random(1, 100);
|
||||
else
|
||||
m.Mana -= Utility.Random(1, m.Mana);
|
||||
|
||||
m.FixedParticles(0x374A, 10, 15, 5032, EffectLayer.Head);
|
||||
m.PlaySound(0x1F8);
|
||||
}
|
||||
|
||||
this.HarmfulSpell(m);
|
||||
}
|
||||
|
||||
this.FinishSequence();
|
||||
}
|
||||
|
||||
public override double GetResistPercent(Mobile target)
|
||||
{
|
||||
return 99.0;
|
||||
}
|
||||
|
||||
private void AosDelay_Callback(object state)
|
||||
{
|
||||
object[] states = (object[])state;
|
||||
|
||||
Mobile m = (Mobile)states[0];
|
||||
int mana = (int)states[1];
|
||||
|
||||
if (m.Alive && !m.IsDeadBondedPet)
|
||||
{
|
||||
m.Mana += mana;
|
||||
|
||||
m.FixedEffect(0x3779, 10, 25);
|
||||
m.PlaySound(0x28E);
|
||||
}
|
||||
|
||||
m_Table.Remove(m);
|
||||
}
|
||||
|
||||
private class InternalTarget : Target
|
||||
{
|
||||
private readonly ManaDrainSpell m_Owner;
|
||||
public InternalTarget(ManaDrainSpell 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();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
318
Scripts/Spells/Fourth/Recall.cs
Normal file
318
Scripts/Spells/Fourth/Recall.cs
Normal file
@@ -0,0 +1,318 @@
|
||||
using System;
|
||||
using Server.Items;
|
||||
using Server.Mobiles;
|
||||
using Server.Multis;
|
||||
using Server.Network;
|
||||
using Server.Spells.Necromancy;
|
||||
using Server.Targeting;
|
||||
|
||||
namespace Server.Spells.Fourth
|
||||
{
|
||||
public class RecallSpell : MagerySpell
|
||||
{
|
||||
private static readonly SpellInfo m_Info = new SpellInfo(
|
||||
"Recall", "Kal Ort Por",
|
||||
239,
|
||||
9031,
|
||||
Reagent.BlackPearl,
|
||||
Reagent.Bloodmoss,
|
||||
Reagent.MandrakeRoot);
|
||||
|
||||
private readonly RunebookEntry m_Entry;
|
||||
private readonly Runebook m_Book;
|
||||
private readonly VendorSearchMap m_SearchMap;
|
||||
private readonly AuctionMap m_AuctionMap;
|
||||
|
||||
public bool NoSkillRequirement { get { return (Core.SE && (m_Book != null || m_AuctionMap != null || m_SearchMap != null)) || TransformationSpellHelper.UnderTransformation(Caster, typeof(WraithFormSpell)); } }
|
||||
|
||||
public RecallSpell(Mobile caster, Item scroll)
|
||||
: this(caster, scroll, null, null)
|
||||
{
|
||||
}
|
||||
|
||||
public RecallSpell(Mobile caster, Item scroll, RunebookEntry entry, Runebook book)
|
||||
: base(caster, scroll, m_Info)
|
||||
{
|
||||
m_Entry = entry;
|
||||
m_Book = book;
|
||||
}
|
||||
|
||||
public RecallSpell(Mobile caster, Item scroll, VendorSearchMap map)
|
||||
: base(caster, scroll, m_Info)
|
||||
{
|
||||
m_SearchMap = map;
|
||||
}
|
||||
|
||||
public RecallSpell(Mobile caster, Item scroll, AuctionMap map)
|
||||
: base(caster, scroll, m_Info)
|
||||
{
|
||||
m_AuctionMap = map;
|
||||
}
|
||||
|
||||
public override SpellCircle Circle
|
||||
{
|
||||
get
|
||||
{
|
||||
return SpellCircle.Fourth;
|
||||
}
|
||||
}
|
||||
public override void GetCastSkills(out double min, out double max)
|
||||
{
|
||||
if (NoSkillRequirement) //recall using Runebook charge, wraith form or using vendor search map
|
||||
min = max = 0;
|
||||
else
|
||||
base.GetCastSkills(out min, out max);
|
||||
}
|
||||
|
||||
public override void OnCast()
|
||||
{
|
||||
if (m_Entry == null && m_SearchMap == null && m_AuctionMap == null)
|
||||
{
|
||||
Caster.Target = new InternalTarget(this);
|
||||
}
|
||||
else
|
||||
{
|
||||
Point3D loc;
|
||||
Map map;
|
||||
|
||||
if (m_Entry != null)
|
||||
{
|
||||
if (m_Entry.Type != RecallRuneType.Ship)
|
||||
{
|
||||
loc = m_Entry.Location;
|
||||
map = m_Entry.Map;
|
||||
}
|
||||
else
|
||||
{
|
||||
Effect(m_Entry.Galleon);
|
||||
return;
|
||||
}
|
||||
}
|
||||
else if (m_SearchMap != null)
|
||||
{
|
||||
loc = m_SearchMap.GetLocation(Caster);
|
||||
map = m_SearchMap.GetMap();
|
||||
}
|
||||
else
|
||||
{
|
||||
loc = m_AuctionMap.GetLocation(Caster);
|
||||
map = m_AuctionMap.GetMap();
|
||||
}
|
||||
|
||||
Effect(loc, map, true, false);
|
||||
}
|
||||
}
|
||||
|
||||
public override bool CheckCast()
|
||||
{
|
||||
if (Factions.Sigil.ExistsOn(Caster))
|
||||
{
|
||||
Caster.SendLocalizedMessage(1061632); // You can't do that while carrying the sigil.
|
||||
return false;
|
||||
}
|
||||
else if (Caster.Criminal)
|
||||
{
|
||||
Caster.SendLocalizedMessage(1005561, "", 0x22); // Thou'rt a criminal and cannot escape so easily.
|
||||
return false;
|
||||
}
|
||||
else if (SpellHelper.CheckCombat(Caster))
|
||||
{
|
||||
Caster.SendLocalizedMessage(1005564, "", 0x22); // Wouldst thou flee during the heat of battle??
|
||||
return false;
|
||||
}
|
||||
else if (Misc.WeightOverloading.IsOverloaded(Caster))
|
||||
{
|
||||
Caster.SendLocalizedMessage(502359, "", 0x22); // Thou art too encumbered to move.
|
||||
return false;
|
||||
}
|
||||
|
||||
return SpellHelper.CheckTravel(Caster, TravelCheckType.RecallFrom);
|
||||
}
|
||||
|
||||
public void Effect(BaseGalleon galleon)
|
||||
{
|
||||
if (galleon == null)
|
||||
{
|
||||
Caster.SendLocalizedMessage(1116767); // The ship could not be located.
|
||||
}
|
||||
else if (galleon.Map == Map.Internal)
|
||||
{
|
||||
Caster.SendLocalizedMessage(1149569); // That ship is in dry dock.
|
||||
}
|
||||
else if (!galleon.HasAccess(Caster))
|
||||
{
|
||||
Caster.SendLocalizedMessage(1116617); // You do not have permission to board this ship.
|
||||
}
|
||||
else
|
||||
{
|
||||
Effect(galleon.GetMarkedLocation(), galleon.Map, false, true);
|
||||
}
|
||||
}
|
||||
|
||||
public void Effect(Point3D loc, Map map, bool checkMulti, bool isboatkey = false)
|
||||
{
|
||||
if (Factions.Sigil.ExistsOn(Caster))
|
||||
{
|
||||
Caster.SendLocalizedMessage(1061632); // You can't do that while carrying the sigil.
|
||||
}
|
||||
else if (map == null || (!Core.AOS && Caster.Map != map))
|
||||
{
|
||||
Caster.SendLocalizedMessage(1005569); // You can not recall to another facet.
|
||||
}
|
||||
else if (!SpellHelper.CheckTravel(Caster, TravelCheckType.RecallFrom))
|
||||
{
|
||||
}
|
||||
else if (!SpellHelper.CheckTravel(Caster, map, loc, TravelCheckType.RecallTo))
|
||||
{
|
||||
}
|
||||
else if (map == Map.Felucca && Caster is PlayerMobile && ((PlayerMobile)Caster).Young)
|
||||
{
|
||||
Caster.SendLocalizedMessage(1049543); // You decide against traveling to Felucca while you are still young.
|
||||
}
|
||||
else if (SpellHelper.RestrictRedTravel && Caster.Murderer && map.Rules != MapRules.FeluccaRules)
|
||||
{
|
||||
Caster.SendLocalizedMessage(1019004); // You are not allowed to travel there.
|
||||
}
|
||||
else if (Caster.Criminal)
|
||||
{
|
||||
Caster.SendLocalizedMessage(1005561, "", 0x22); // Thou'rt a criminal and cannot escape so easily.
|
||||
}
|
||||
else if (SpellHelper.CheckCombat(Caster))
|
||||
{
|
||||
Caster.SendLocalizedMessage(1005564, "", 0x22); // Wouldst thou flee during the heat of battle??
|
||||
}
|
||||
else if (Misc.WeightOverloading.IsOverloaded(Caster))
|
||||
{
|
||||
Caster.SendLocalizedMessage(502359, "", 0x22); // Thou art too encumbered to move.
|
||||
}
|
||||
else if (!map.CanSpawnMobile(loc.X, loc.Y, loc.Z) && !isboatkey)
|
||||
{
|
||||
Caster.SendLocalizedMessage(501025); // Something is blocking the location.
|
||||
}
|
||||
else if (checkMulti && SpellHelper.CheckMulti(loc, map) && !isboatkey)
|
||||
{
|
||||
Caster.SendLocalizedMessage(501025); // Something is blocking the location.
|
||||
}
|
||||
else if (m_Book != null && m_Book.CurCharges <= 0)
|
||||
{
|
||||
Caster.SendLocalizedMessage(502412); // There are no charges left on that item.
|
||||
}
|
||||
else if (Caster.Holding != null)
|
||||
{
|
||||
Caster.SendLocalizedMessage(1071955); // You cannot teleport while dragging an object.
|
||||
}
|
||||
else if (Engines.CityLoyalty.CityTradeSystem.HasTrade(Caster))
|
||||
{
|
||||
Caster.SendLocalizedMessage(1151733); // You cannot do that while carrying a Trade Order.
|
||||
}
|
||||
else if (CheckSequence())
|
||||
{
|
||||
BaseCreature.TeleportPets(Caster, loc, map, true);
|
||||
|
||||
if (m_Book != null)
|
||||
--m_Book.CurCharges;
|
||||
|
||||
if (m_SearchMap != null)
|
||||
m_SearchMap.OnBeforeTravel(Caster);
|
||||
|
||||
if (m_AuctionMap != null)
|
||||
m_AuctionMap.OnBeforeTravel(Caster);
|
||||
|
||||
Caster.PlaySound(0x1FC);
|
||||
Caster.MoveToWorld(loc, map);
|
||||
Caster.PlaySound(0x1FC);
|
||||
}
|
||||
|
||||
FinishSequence();
|
||||
}
|
||||
|
||||
private class InternalTarget : Target
|
||||
{
|
||||
private readonly RecallSpell m_Owner;
|
||||
|
||||
public InternalTarget(RecallSpell owner)
|
||||
: base(Core.ML ? 10 : 12, false, TargetFlags.None)
|
||||
{
|
||||
m_Owner = owner;
|
||||
|
||||
owner.Caster.LocalOverheadMessage(MessageType.Regular, 0x3B2, 501029); // Select Marked item.
|
||||
}
|
||||
|
||||
protected override void OnTarget(Mobile from, object o)
|
||||
{
|
||||
if (o is RecallRune)
|
||||
{
|
||||
RecallRune rune = (RecallRune)o;
|
||||
|
||||
if (rune.Marked)
|
||||
{
|
||||
if (rune.Type == RecallRuneType.Ship)
|
||||
{
|
||||
m_Owner.Effect(rune.Galleon);
|
||||
}
|
||||
else
|
||||
{
|
||||
m_Owner.Effect(rune.Target, rune.TargetMap, true);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
from.SendLocalizedMessage(501805); // That rune is not yet marked.
|
||||
}
|
||||
}
|
||||
else if (o is Runebook)
|
||||
{
|
||||
RunebookEntry e = ((Runebook)o).Default;
|
||||
|
||||
if (e != null)
|
||||
{
|
||||
if (e.Type == RecallRuneType.Ship)
|
||||
{
|
||||
m_Owner.Effect(e.Galleon);
|
||||
}
|
||||
else
|
||||
{
|
||||
m_Owner.Effect(e.Location, e.Map, true);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
from.SendLocalizedMessage(502354); // Target is not marked.
|
||||
}
|
||||
}
|
||||
else if (o is Key && ((Key)o).KeyValue != 0 && ((Key)o).Link is BaseBoat)
|
||||
{
|
||||
BaseBoat boat = ((Key)o).Link as BaseBoat;
|
||||
|
||||
if (!boat.Deleted && boat.CheckKey(((Key)o).KeyValue))
|
||||
m_Owner.Effect(boat.GetMarkedLocation(), boat.Map, false, true);
|
||||
else
|
||||
from.Send(new MessageLocalized(from.Serial, from.Body, MessageType.Regular, 0x3B2, 3, 502357, from.Name, "")); // I can not recall from that object.
|
||||
}
|
||||
else if (o is Engines.NewMagincia.WritOfLease)
|
||||
{
|
||||
Engines.NewMagincia.WritOfLease lease = (Engines.NewMagincia.WritOfLease)o;
|
||||
|
||||
if (lease.RecallLoc != Point3D.Zero && lease.Facet != null && lease.Facet != Map.Internal)
|
||||
m_Owner.Effect(lease.RecallLoc, lease.Facet, false);
|
||||
else
|
||||
from.Send(new MessageLocalized(from.Serial, from.Body, MessageType.Regular, 0x3B2, 3, 502357, from.Name, "")); // I can not recall from that object.
|
||||
}
|
||||
|
||||
else
|
||||
{
|
||||
from.Send(new MessageLocalized(from.Serial, from.Body, MessageType.Regular, 0x3B2, 3, 502357, from.Name, "")); // I can not recall from that object.
|
||||
}
|
||||
}
|
||||
|
||||
protected override void OnNonlocalTarget(Mobile from, object o)
|
||||
{
|
||||
}
|
||||
|
||||
protected override void OnTargetFinish(Mobile from)
|
||||
{
|
||||
m_Owner.FinishSequence();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user