Reorganizes Project (#41)
This commit is contained in:
parent
08bf44af9a
commit
3614a66aee
3499 changed files with 79 additions and 55 deletions
70
Projects/Scripts/Spells/Third/Bless.cs
Normal file
70
Projects/Scripts/Spells/Third/Bless.cs
Normal file
|
|
@ -0,0 +1,70 @@
|
|||
using System;
|
||||
using Server.Engines.ConPVP;
|
||||
using Server.Targeting;
|
||||
|
||||
namespace Server.Spells.Third
|
||||
{
|
||||
public class BlessSpell : MagerySpell, ISpellTargetingMobile
|
||||
{
|
||||
private static SpellInfo m_Info = new SpellInfo(
|
||||
"Bless", "Rel Sanct",
|
||||
203,
|
||||
9061,
|
||||
Reagent.Garlic,
|
||||
Reagent.MandrakeRoot
|
||||
);
|
||||
|
||||
public BlessSpell(Mobile caster, Item scroll = null) : base(caster, scroll, m_Info)
|
||||
{
|
||||
}
|
||||
|
||||
public override SpellCircle Circle => SpellCircle.Third;
|
||||
|
||||
public override bool CheckCast()
|
||||
{
|
||||
if (DuelContext.CheckSuddenDeath(Caster))
|
||||
{
|
||||
Caster.SendMessage(0x22, "You cannot cast this spell when in sudden death.");
|
||||
return false;
|
||||
}
|
||||
|
||||
return base.CheckCast();
|
||||
}
|
||||
|
||||
public override void OnCast()
|
||||
{
|
||||
Caster.Target = new SpellTargetMobile(this, TargetFlags.Beneficial, Core.ML ? 10 : 12);
|
||||
}
|
||||
|
||||
public void Target(Mobile m)
|
||||
{
|
||||
if (m == null)
|
||||
return;
|
||||
|
||||
if (!Caster.CanSee(m))
|
||||
Caster.SendLocalizedMessage(500237); // Target can not be seen.
|
||||
else if (CheckBSequence(m))
|
||||
{
|
||||
SpellHelper.Turn(Caster, m);
|
||||
|
||||
SpellHelper.AddStatBonus(Caster, m, StatType.Str);
|
||||
SpellHelper.DisableSkillCheck = true;
|
||||
SpellHelper.AddStatBonus(Caster, m, StatType.Dex);
|
||||
SpellHelper.AddStatBonus(Caster, m, StatType.Int);
|
||||
SpellHelper.DisableSkillCheck = false;
|
||||
|
||||
m.FixedParticles(0x373A, 10, 15, 5018, EffectLayer.Waist);
|
||||
m.PlaySound(0x1EA);
|
||||
|
||||
int percentage = (int)(SpellHelper.GetOffsetScalar(Caster, m, false) * 100);
|
||||
TimeSpan length = SpellHelper.GetDuration(Caster, m);
|
||||
|
||||
string args = $"{percentage}\t{percentage}\t{percentage}";
|
||||
|
||||
BuffInfo.AddBuff(m, new BuffInfo(BuffIcon.Bless, 1075847, 1075848, length, m, args));
|
||||
}
|
||||
|
||||
FinishSequence();
|
||||
}
|
||||
}
|
||||
}
|
||||
71
Projects/Scripts/Spells/Third/Fireball.cs
Normal file
71
Projects/Scripts/Spells/Third/Fireball.cs
Normal file
|
|
@ -0,0 +1,71 @@
|
|||
using Server.Targeting;
|
||||
|
||||
namespace Server.Spells.Third
|
||||
{
|
||||
public class FireballSpell : MagerySpell, ISpellTargetingMobile
|
||||
{
|
||||
private static SpellInfo m_Info = new SpellInfo(
|
||||
"Fireball", "Vas Flam",
|
||||
203,
|
||||
9041,
|
||||
Reagent.BlackPearl
|
||||
);
|
||||
|
||||
public FireballSpell(Mobile caster, Item scroll = null) : base(caster, scroll, m_Info)
|
||||
{
|
||||
}
|
||||
|
||||
public override SpellCircle Circle => SpellCircle.Third;
|
||||
|
||||
public override bool DelayedDamage => true;
|
||||
|
||||
public override void OnCast()
|
||||
{
|
||||
Caster.Target = new SpellTargetMobile(this, TargetFlags.Harmful, Core.ML ? 10 : 12);
|
||||
}
|
||||
|
||||
public void Target(Mobile m)
|
||||
{
|
||||
if (m == null)
|
||||
return;
|
||||
|
||||
if (!Caster.CanSee(m))
|
||||
Caster.SendLocalizedMessage(500237); // Target can not be seen.
|
||||
else if (CheckHSequence(m))
|
||||
{
|
||||
Mobile source = Caster;
|
||||
|
||||
SpellHelper.Turn(source, m);
|
||||
|
||||
SpellHelper.CheckReflect((int)Circle, ref source, ref m);
|
||||
|
||||
double damage;
|
||||
|
||||
if (Core.AOS)
|
||||
{
|
||||
damage = GetNewAosDamage(19, 1, 5, m);
|
||||
}
|
||||
else
|
||||
{
|
||||
damage = Utility.Random(10, 7);
|
||||
|
||||
if (CheckResisted(m))
|
||||
{
|
||||
damage *= 0.75;
|
||||
|
||||
m.SendLocalizedMessage(501783); // You feel yourself resisting magical energy.
|
||||
}
|
||||
|
||||
damage *= GetDamageScalar(m);
|
||||
}
|
||||
|
||||
source.MovingParticles(m, 0x36D4, 7, 0, false, true, 9502, 4019, 0x160);
|
||||
source.PlaySound(Core.AOS ? 0x15E : 0x44B);
|
||||
|
||||
SpellHelper.Damage(this, m, damage, 0, 100, 0, 0, 0);
|
||||
}
|
||||
|
||||
FinishSequence();
|
||||
}
|
||||
}
|
||||
}
|
||||
60
Projects/Scripts/Spells/Third/MagicLock.cs
Normal file
60
Projects/Scripts/Spells/Third/MagicLock.cs
Normal file
|
|
@ -0,0 +1,60 @@
|
|||
using Server.Items;
|
||||
using Server.Multis;
|
||||
using Server.Network;
|
||||
using Server.Targeting;
|
||||
|
||||
namespace Server.Spells.Third
|
||||
{
|
||||
public class MagicLockSpell : MagerySpell, ISpellTargetingItem
|
||||
{
|
||||
private static SpellInfo m_Info = new SpellInfo(
|
||||
"Magic Lock", "An Por",
|
||||
215,
|
||||
9001,
|
||||
Reagent.Garlic,
|
||||
Reagent.Bloodmoss,
|
||||
Reagent.SulfurousAsh
|
||||
);
|
||||
|
||||
public MagicLockSpell(Mobile caster, Item scroll = null) : base(caster, scroll, m_Info)
|
||||
{
|
||||
}
|
||||
|
||||
public override SpellCircle Circle => SpellCircle.Third;
|
||||
|
||||
public override void OnCast()
|
||||
{
|
||||
Caster.Target = new SpellTargetItem(this, TargetFlags.None, Core.ML ? 10 : 12);
|
||||
}
|
||||
|
||||
public void Target(Item item)
|
||||
{
|
||||
if (!(item is LockableContainer cont))
|
||||
Caster.SendLocalizedMessage(501762); // Target must be an unlocked chest.
|
||||
else if (BaseHouse.CheckLockedDownOrSecured(cont))
|
||||
Caster.LocalOverheadMessage(MessageType.Regular, 0x22, 501761); // You cannot cast this on a locked down item.
|
||||
else if (cont.Locked || cont.LockLevel == 0 || cont is ParagonChest)
|
||||
Caster.SendLocalizedMessage(501762); // Target must be an unlocked chest.
|
||||
else if (CheckSequence())
|
||||
{
|
||||
SpellHelper.Turn(Caster, cont);
|
||||
|
||||
Point3D loc = cont.GetWorldLocation();
|
||||
|
||||
Effects.SendLocationParticles(
|
||||
EffectItem.Create(loc, cont.Map, EffectItem.DefaultDuration),
|
||||
0x376A, 9, 32, 5020);
|
||||
|
||||
Effects.PlaySound(loc, cont.Map, 0x1FA);
|
||||
|
||||
// The chest is now locked!
|
||||
Caster.LocalOverheadMessage(MessageType.Regular, 0x3B2, 501763);
|
||||
|
||||
cont.LockLevel = -255; // signal magic lock
|
||||
cont.Locked = true;
|
||||
}
|
||||
|
||||
FinishSequence();
|
||||
}
|
||||
}
|
||||
}
|
||||
121
Projects/Scripts/Spells/Third/Poison.cs
Normal file
121
Projects/Scripts/Spells/Third/Poison.cs
Normal file
|
|
@ -0,0 +1,121 @@
|
|||
using Server.Mobiles;
|
||||
using Server.Targeting;
|
||||
|
||||
namespace Server.Spells.Third
|
||||
{
|
||||
public class PoisonSpell : MagerySpell, ISpellTargetingMobile
|
||||
{
|
||||
private static SpellInfo m_Info = new SpellInfo(
|
||||
"Poison", "In Nox",
|
||||
203,
|
||||
9051,
|
||||
Reagent.Nightshade
|
||||
);
|
||||
|
||||
public PoisonSpell(Mobile caster, Item scroll = null) : base(caster, scroll, m_Info)
|
||||
{
|
||||
}
|
||||
|
||||
public override SpellCircle Circle => SpellCircle.Third;
|
||||
|
||||
public override void OnCast()
|
||||
{
|
||||
Caster.Target = new SpellTargetMobile(this, TargetFlags.Harmful, Core.ML ? 10 : 12);
|
||||
}
|
||||
|
||||
public void Target(Mobile m)
|
||||
{
|
||||
if (m == null)
|
||||
return;
|
||||
|
||||
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);
|
||||
|
||||
m.Spell?.OnCasterHurt();
|
||||
|
||||
m.Paralyzed = false;
|
||||
|
||||
if (CheckResisted(m))
|
||||
{
|
||||
m.SendLocalizedMessage(501783); // You feel yourself resisting magical energy.
|
||||
}
|
||||
else
|
||||
{
|
||||
int level;
|
||||
|
||||
if (Core.AOS)
|
||||
{
|
||||
if (Caster.InRange(m, 2))
|
||||
{
|
||||
int total = (Caster.Skills.Magery.Fixed + Caster.Skills.Poisoning.Fixed) / 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.Magery.Value + Caster.Skills.Poisoning.Value;
|
||||
|
||||
#region Dueling
|
||||
|
||||
double total = Caster.Skills.Magery.Value;
|
||||
|
||||
if (Caster is PlayerMobile pm)
|
||||
{
|
||||
if (pm.DuelContext == null || !pm.DuelContext.Started || pm.DuelContext.Finished ||
|
||||
pm.DuelContext.Ruleset.GetOption("Skills", "Poisoning"))
|
||||
{
|
||||
total += pm.Skills.Poisoning.Value;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
total += Caster.Skills.Poisoning.Value;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
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();
|
||||
}
|
||||
}
|
||||
}
|
||||
83
Projects/Scripts/Spells/Third/Telekinesis.cs
Normal file
83
Projects/Scripts/Spells/Third/Telekinesis.cs
Normal file
|
|
@ -0,0 +1,83 @@
|
|||
using Server.Items;
|
||||
using Server.Targeting;
|
||||
|
||||
namespace Server.Spells.Third
|
||||
{
|
||||
public class TelekinesisSpell : MagerySpell, ISpellTargetingItem
|
||||
{
|
||||
private static SpellInfo m_Info = new SpellInfo(
|
||||
"Telekinesis", "Ort Por Ylem",
|
||||
203,
|
||||
9031,
|
||||
Reagent.Bloodmoss,
|
||||
Reagent.MandrakeRoot
|
||||
);
|
||||
|
||||
public TelekinesisSpell(Mobile caster, Item scroll = null) : base(caster, scroll, m_Info)
|
||||
{
|
||||
}
|
||||
|
||||
public override SpellCircle Circle => SpellCircle.Third;
|
||||
|
||||
public override void OnCast()
|
||||
{
|
||||
Caster.Target = new SpellTargetItem(this, TargetFlags.None, Core.ML ? 10 : 12);
|
||||
}
|
||||
|
||||
public void Target(Item item)
|
||||
{
|
||||
ITelekinesisable t = item as ITelekinesisable;
|
||||
if (!(t != null || item is Container))
|
||||
{
|
||||
Caster.SendLocalizedMessage(501857); // This spell won't work on that!
|
||||
return;
|
||||
}
|
||||
|
||||
if (CheckSequence())
|
||||
{
|
||||
if (t != null)
|
||||
{
|
||||
SpellHelper.Turn(Caster, t);
|
||||
t.OnTelekinesis(Caster);
|
||||
}
|
||||
else
|
||||
{
|
||||
SpellHelper.Turn(Caster, item);
|
||||
|
||||
if (!item.IsAccessibleTo(Caster))
|
||||
{
|
||||
item.OnDoubleClickNotAccessible(Caster);
|
||||
}
|
||||
else if (!item.CheckItemUse(Caster, item))
|
||||
{
|
||||
}
|
||||
else if (item.RootParent is Mobile && item.RootParent != Caster)
|
||||
{
|
||||
item.OnSnoop(Caster);
|
||||
}
|
||||
else if (item is Corpse corpse && !corpse.CheckLoot(Caster, null))
|
||||
{
|
||||
}
|
||||
else if (Caster.Region.OnDoubleClick(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(Caster, item);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
FinishSequence();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
namespace Server
|
||||
{
|
||||
public interface ITelekinesisable : IPoint3D
|
||||
{
|
||||
void OnTelekinesis(Mobile from);
|
||||
}
|
||||
}
|
||||
122
Projects/Scripts/Spells/Third/Teleport.cs
Normal file
122
Projects/Scripts/Spells/Third/Teleport.cs
Normal file
|
|
@ -0,0 +1,122 @@
|
|||
using Server.Factions;
|
||||
using Server.Items;
|
||||
using Server.Misc;
|
||||
using Server.Regions;
|
||||
using Server.Spells.Fifth;
|
||||
using Server.Spells.Fourth;
|
||||
using Server.Spells.Sixth;
|
||||
using Server.Targeting;
|
||||
|
||||
namespace Server.Spells.Third
|
||||
{
|
||||
public class TeleportSpell : MagerySpell, ISpellTargetingPoint3D
|
||||
{
|
||||
private static SpellInfo m_Info = new SpellInfo(
|
||||
"Teleport", "Rel Por",
|
||||
215,
|
||||
9031,
|
||||
Reagent.Bloodmoss,
|
||||
Reagent.MandrakeRoot
|
||||
);
|
||||
|
||||
public TeleportSpell(Mobile caster, Item scroll = null) : base(caster, scroll, m_Info)
|
||||
{
|
||||
}
|
||||
|
||||
public override SpellCircle Circle => SpellCircle.Third;
|
||||
|
||||
public override bool CheckCast()
|
||||
{
|
||||
if (Sigil.ExistsOn(Caster))
|
||||
{
|
||||
Caster.SendLocalizedMessage(1061632); // You can't do that while carrying the sigil.
|
||||
return false;
|
||||
}
|
||||
|
||||
if (WeightOverloading.IsOverloaded(Caster))
|
||||
{
|
||||
Caster.SendLocalizedMessage(502359, "", 0x22); // Thou art too encumbered to move.
|
||||
return false;
|
||||
}
|
||||
|
||||
return SpellHelper.CheckTravel(Caster, TravelCheckType.TeleportFrom);
|
||||
}
|
||||
|
||||
public override void OnCast()
|
||||
{
|
||||
Caster.Target = new SpellTargetPoint3D(this, TargetFlags.None, Core.ML ? 10 : 12);
|
||||
}
|
||||
|
||||
public void Target(IPoint3D p)
|
||||
{
|
||||
IPoint3D orig = p;
|
||||
Map map = Caster.Map;
|
||||
|
||||
SpellHelper.GetSurfaceTop(ref p);
|
||||
|
||||
Point3D from = Caster.Location;
|
||||
Point3D to = new Point3D(p);
|
||||
|
||||
if (Sigil.ExistsOn(Caster))
|
||||
{
|
||||
Caster.SendLocalizedMessage(1061632); // You can't do that while carrying the sigil.
|
||||
}
|
||||
else if (WeightOverloading.IsOverloaded(Caster))
|
||||
{
|
||||
Caster.SendLocalizedMessage(502359, "", 0x22); // Thou art too encumbered to move.
|
||||
}
|
||||
else if (!SpellHelper.CheckTravel(Caster, TravelCheckType.TeleportFrom))
|
||||
{
|
||||
}
|
||||
else if (!SpellHelper.CheckTravel(Caster, map, to, TravelCheckType.TeleportTo))
|
||||
{
|
||||
}
|
||||
else if (map == null || !map.CanSpawnMobile(p.X, p.Y, p.Z))
|
||||
{
|
||||
Caster.SendLocalizedMessage(501942); // That location is blocked.
|
||||
}
|
||||
else if (SpellHelper.CheckMulti(to, map))
|
||||
{
|
||||
Caster.SendLocalizedMessage(502831); // Cannot teleport to that spot.
|
||||
}
|
||||
else if (Region.Find(to, map).IsPartOf<HouseRegion>())
|
||||
{
|
||||
Caster.SendLocalizedMessage(502829); // Cannot teleport to that spot.
|
||||
}
|
||||
else if (CheckSequence())
|
||||
{
|
||||
SpellHelper.Turn(Caster, orig);
|
||||
|
||||
Mobile m = 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<Item> eable = m.GetItemsInRange(0);
|
||||
|
||||
foreach (Item item in eable)
|
||||
if (item is ParalyzeFieldSpell.InternalItem || item is PoisonFieldSpell.InternalItem ||
|
||||
item is FireFieldSpell.FireFieldItem)
|
||||
item.OnMoveOver(m);
|
||||
|
||||
eable.Free();
|
||||
}
|
||||
|
||||
FinishSequence();
|
||||
}
|
||||
}
|
||||
}
|
||||
75
Projects/Scripts/Spells/Third/Unlock.cs
Normal file
75
Projects/Scripts/Spells/Third/Unlock.cs
Normal file
|
|
@ -0,0 +1,75 @@
|
|||
using Server.Items;
|
||||
using Server.Multis;
|
||||
using Server.Network;
|
||||
using Server.Targeting;
|
||||
|
||||
namespace Server.Spells.Third
|
||||
{
|
||||
public class UnlockSpell : MagerySpell, ISpellTargetingPoint3D
|
||||
{
|
||||
private static SpellInfo m_Info = new SpellInfo(
|
||||
"Unlock Spell", "Ex Por",
|
||||
215,
|
||||
9001,
|
||||
Reagent.Bloodmoss,
|
||||
Reagent.SulfurousAsh
|
||||
);
|
||||
|
||||
public UnlockSpell(Mobile caster, Item scroll = null) : base(caster, scroll, m_Info)
|
||||
{
|
||||
}
|
||||
|
||||
public override SpellCircle Circle => SpellCircle.Third;
|
||||
|
||||
public override void OnCast()
|
||||
{
|
||||
Caster.Target = new SpellTargetPoint3D(this, TargetFlags.None, Core.ML ? 10 : 12);
|
||||
}
|
||||
|
||||
public void Target(IPoint3D p)
|
||||
{
|
||||
if (CheckSequence())
|
||||
{
|
||||
SpellHelper.Turn(Caster, p);
|
||||
|
||||
Effects.SendLocationParticles(EffectItem.Create(new Point3D(p), Caster.Map, EffectItem.DefaultDuration),
|
||||
0x376A, 9, 32, 5024);
|
||||
|
||||
Effects.PlaySound(p, Caster.Map, 0x1FF);
|
||||
|
||||
if (p is Mobile)
|
||||
Caster.LocalOverheadMessage(MessageType.Regular, 0x3B2, 503101); // That did not need to be unlocked.
|
||||
else if (!(p is LockableContainer cont))
|
||||
Caster.SendLocalizedMessage(501666); // You can't unlock that!
|
||||
else
|
||||
{
|
||||
if (BaseHouse.CheckSecured(cont))
|
||||
Caster.SendLocalizedMessage(503098); // You cannot cast this on a secure item.
|
||||
else if (!cont.Locked)
|
||||
Caster.LocalOverheadMessage(MessageType.Regular, 0x3B2,
|
||||
503101); // That did not need to be unlocked.
|
||||
else if (cont.LockLevel == 0)
|
||||
Caster.SendLocalizedMessage(501666); // You can't unlock that!
|
||||
else
|
||||
{
|
||||
int level = (int)(Caster.Skills.Magery.Value * 0.8) - 4;
|
||||
|
||||
if (level >= cont.RequiredSkill &&
|
||||
!(cont is TreasureMapChest chest && chest.Level > 2))
|
||||
{
|
||||
cont.Locked = false;
|
||||
|
||||
if (cont.LockLevel == -255)
|
||||
cont.LockLevel = cont.RequiredSkill - 10;
|
||||
}
|
||||
else
|
||||
Caster.LocalOverheadMessage(MessageType.Regular, 0x3B2,
|
||||
503099); // My spell does not seem to have an effect on that lock.
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
FinishSequence();
|
||||
}
|
||||
}
|
||||
}
|
||||
193
Projects/Scripts/Spells/Third/WallOfStone.cs
Normal file
193
Projects/Scripts/Spells/Third/WallOfStone.cs
Normal file
|
|
@ -0,0 +1,193 @@
|
|||
using System;
|
||||
using Server.Misc;
|
||||
using Server.Mobiles;
|
||||
using Server.Targeting;
|
||||
|
||||
namespace Server.Spells.Third
|
||||
{
|
||||
public class WallOfStoneSpell : MagerySpell, ISpellTargetingPoint3D
|
||||
{
|
||||
private static SpellInfo m_Info = new SpellInfo(
|
||||
"Wall of Stone", "In Sanct Ylem",
|
||||
227,
|
||||
9011,
|
||||
false,
|
||||
Reagent.Bloodmoss,
|
||||
Reagent.Garlic
|
||||
);
|
||||
|
||||
public WallOfStoneSpell(Mobile caster, Item scroll = null) : base(caster, scroll, m_Info)
|
||||
{
|
||||
}
|
||||
|
||||
public override SpellCircle Circle => SpellCircle.Third;
|
||||
|
||||
public override void OnCast()
|
||||
{
|
||||
Caster.Target = new SpellTargetPoint3D(this, TargetFlags.None, Core.ML ? 10 : 12);
|
||||
}
|
||||
|
||||
public void Target(IPoint3D p)
|
||||
{
|
||||
if (!Caster.CanSee(p))
|
||||
{
|
||||
Caster.SendLocalizedMessage(500237); // Target can not be seen.
|
||||
}
|
||||
else if (SpellHelper.CheckTown(p, Caster) && CheckSequence())
|
||||
{
|
||||
SpellHelper.Turn(Caster, p);
|
||||
|
||||
SpellHelper.GetSurfaceTop(ref p);
|
||||
|
||||
int dx = Caster.Location.X - p.X;
|
||||
int dy = Caster.Location.Y - p.Y;
|
||||
int rx = (dx - dy) * 44;
|
||||
int ry = (dx + dy) * 44;
|
||||
|
||||
bool eastToWest;
|
||||
|
||||
if (rx >= 0 && ry >= 0)
|
||||
eastToWest = false;
|
||||
else if (rx >= 0)
|
||||
eastToWest = true;
|
||||
else if (ry >= 0)
|
||||
eastToWest = true;
|
||||
else
|
||||
eastToWest = false;
|
||||
|
||||
Effects.PlaySound(p, Caster.Map, 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);
|
||||
bool canFit = SpellHelper.AdjustField(ref loc, Caster.Map, 22, true);
|
||||
|
||||
//Effects.SendLocationParticles( EffectItem.Create( loc, Caster.Map, EffectItem.DefaultDuration ), 0x376A, 9, 10, 5025 );
|
||||
|
||||
if (!canFit)
|
||||
continue;
|
||||
|
||||
Item item = new InternalItem(loc, Caster.Map, Caster);
|
||||
|
||||
Effects.SendLocationParticles(item, 0x376A, 9, 10, 5025);
|
||||
|
||||
//new InternalItem( loc, Caster.Map, Caster );
|
||||
}
|
||||
}
|
||||
|
||||
FinishSequence();
|
||||
}
|
||||
|
||||
[DispellableField]
|
||||
private class InternalItem : Item
|
||||
{
|
||||
private Mobile m_Caster;
|
||||
private DateTime m_End;
|
||||
private Timer m_Timer;
|
||||
|
||||
public InternalItem(Point3D loc, Map map, Mobile caster) : base(0x82)
|
||||
{
|
||||
Visible = false;
|
||||
Movable = false;
|
||||
|
||||
MoveToWorld(loc, map);
|
||||
|
||||
m_Caster = caster;
|
||||
|
||||
if (caster.InLOS(this))
|
||||
Visible = true;
|
||||
else
|
||||
Delete();
|
||||
|
||||
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 => true;
|
||||
|
||||
public override void Serialize(GenericWriter writer)
|
||||
{
|
||||
base.Serialize(writer);
|
||||
|
||||
writer.Write(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)
|
||||
{
|
||||
if (m is PlayerMobile)
|
||||
{
|
||||
int noto = Notoriety.Compute(m_Caster, m);
|
||||
if (noto == Notoriety.Enemy || noto == Notoriety.Ally)
|
||||
return false;
|
||||
}
|
||||
|
||||
return base.OnMoveOver(m);
|
||||
}
|
||||
|
||||
public override void OnAfterDelete()
|
||||
{
|
||||
base.OnAfterDelete();
|
||||
|
||||
m_Timer?.Stop();
|
||||
}
|
||||
|
||||
private class InternalTimer : Timer
|
||||
{
|
||||
private InternalItem m_Item;
|
||||
|
||||
public InternalTimer(InternalItem item, TimeSpan duration) : base(duration)
|
||||
{
|
||||
Priority = TimerPriority.OneSecond;
|
||||
m_Item = item;
|
||||
}
|
||||
|
||||
protected override void OnTick()
|
||||
{
|
||||
m_Item.Delete();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue