Reorganizes Project (#41)
This commit is contained in:
parent
08bf44af9a
commit
3614a66aee
3499 changed files with 79 additions and 55 deletions
76
Projects/Scripts/Spells/Fifth/BladeSpirits.cs
Normal file
76
Projects/Scripts/Spells/Fifth/BladeSpirits.cs
Normal file
|
|
@ -0,0 +1,76 @@
|
|||
using System;
|
||||
using Server.Mobiles;
|
||||
|
||||
namespace Server.Spells.Fifth
|
||||
{
|
||||
public class BladeSpiritsSpell : MagerySpell, ISpellTargetingPoint3D
|
||||
{
|
||||
private static SpellInfo m_Info = new SpellInfo(
|
||||
"Blade Spirits", "In Jux Hur Ylem",
|
||||
266,
|
||||
9040,
|
||||
false,
|
||||
Reagent.BlackPearl,
|
||||
Reagent.MandrakeRoot,
|
||||
Reagent.Nightshade
|
||||
);
|
||||
|
||||
public BladeSpiritsSpell(Mobile caster, Item scroll = null) : base(caster, scroll, m_Info)
|
||||
{
|
||||
}
|
||||
|
||||
public override SpellCircle Circle => SpellCircle.Fifth;
|
||||
|
||||
public override TimeSpan GetCastDelay()
|
||||
{
|
||||
if (Core.AOS)
|
||||
return TimeSpan.FromTicks(base.GetCastDelay().Ticks * (Core.SE ? 3 : 5));
|
||||
|
||||
return base.GetCastDelay() + TimeSpan.FromSeconds(6.0);
|
||||
}
|
||||
|
||||
public override bool CheckCast()
|
||||
{
|
||||
if (!base.CheckCast())
|
||||
return false;
|
||||
|
||||
if (Caster.Followers + (Core.SE ? 2 : 1) > Caster.FollowersMax)
|
||||
{
|
||||
Caster.SendLocalizedMessage(1049645); // You have too many followers to summon that creature.
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public override void OnCast()
|
||||
{
|
||||
Caster.Target = new SpellTargetPoint3D(this);
|
||||
}
|
||||
|
||||
public void Target(IPoint3D p)
|
||||
{
|
||||
Map map = Caster.Map;
|
||||
|
||||
SpellHelper.GetSurfaceTop(ref p);
|
||||
|
||||
if (map == null || !map.CanSpawnMobile(p.X, p.Y, p.Z))
|
||||
{
|
||||
Caster.SendLocalizedMessage(501942); // That location is blocked.
|
||||
}
|
||||
else if (SpellHelper.CheckTown(p, Caster) && CheckSequence())
|
||||
{
|
||||
TimeSpan duration;
|
||||
|
||||
if (Core.AOS)
|
||||
duration = TimeSpan.FromSeconds(120);
|
||||
else
|
||||
duration = TimeSpan.FromSeconds(Utility.Random(80, 40));
|
||||
|
||||
BaseCreature.Summon(new BladeSpirits(), false, Caster, new Point3D(p), 0x212, duration);
|
||||
}
|
||||
|
||||
FinishSequence();
|
||||
}
|
||||
}
|
||||
}
|
||||
54
Projects/Scripts/Spells/Fifth/DispelField.cs
Normal file
54
Projects/Scripts/Spells/Fifth/DispelField.cs
Normal file
|
|
@ -0,0 +1,54 @@
|
|||
using Server.Items;
|
||||
using Server.Misc;
|
||||
using Server.Targeting;
|
||||
|
||||
namespace Server.Spells.Fifth
|
||||
{
|
||||
public class DispelFieldSpell : MagerySpell, ISpellTargetingItem
|
||||
{
|
||||
private static SpellInfo m_Info = new SpellInfo(
|
||||
"Dispel Field", "An Grav",
|
||||
206,
|
||||
9002,
|
||||
Reagent.BlackPearl,
|
||||
Reagent.SpidersSilk,
|
||||
Reagent.SulfurousAsh,
|
||||
Reagent.Garlic
|
||||
);
|
||||
|
||||
public DispelFieldSpell(Mobile caster, Item scroll = null) : base(caster, scroll, m_Info)
|
||||
{
|
||||
}
|
||||
|
||||
public override SpellCircle Circle => SpellCircle.Fifth;
|
||||
|
||||
public override void OnCast()
|
||||
{
|
||||
Caster.Target = new SpellTargetItem(this, TargetFlags.None, Core.ML ? 10 : 12);
|
||||
}
|
||||
|
||||
public void Target(Item item)
|
||||
{
|
||||
if (item == null)
|
||||
Caster.SendLocalizedMessage(1005049); // That cannot be dispelled.
|
||||
else if (!Caster.CanSee(item))
|
||||
Caster.SendLocalizedMessage(500237); // Target can not be seen.
|
||||
else if (!item.GetType().IsDefined(typeof(DispellableFieldAttribute), false))
|
||||
Caster.SendLocalizedMessage(1005049); // That cannot be dispelled.
|
||||
else if (item is Moongate moongate && !moongate.Dispellable)
|
||||
Caster.SendLocalizedMessage(1005047); // That magic is too chaotic
|
||||
else if (CheckSequence())
|
||||
{
|
||||
SpellHelper.Turn(Caster, item);
|
||||
|
||||
Effects.SendLocationParticles(EffectItem.Create(item.Location, item.Map, EffectItem.DefaultDuration), 0x376A,
|
||||
9, 20, 5042);
|
||||
Effects.PlaySound(item.GetWorldLocation(), item.Map, 0x201);
|
||||
|
||||
item.Delete();
|
||||
}
|
||||
|
||||
FinishSequence();
|
||||
}
|
||||
}
|
||||
}
|
||||
171
Projects/Scripts/Spells/Fifth/Incognito.cs
Normal file
171
Projects/Scripts/Spells/Fifth/Incognito.cs
Normal file
|
|
@ -0,0 +1,171 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using Server.Factions;
|
||||
using Server.Items;
|
||||
using Server.Mobiles;
|
||||
using Server.Spells.Seventh;
|
||||
|
||||
namespace Server.Spells.Fifth
|
||||
{
|
||||
public class IncognitoSpell : MagerySpell
|
||||
{
|
||||
private static SpellInfo m_Info = new SpellInfo(
|
||||
"Incognito", "Kal In Ex",
|
||||
206,
|
||||
9002,
|
||||
Reagent.Bloodmoss,
|
||||
Reagent.Garlic,
|
||||
Reagent.Nightshade
|
||||
);
|
||||
|
||||
private static Dictionary<Mobile, InternalTimer> m_Timers = new Dictionary<Mobile, InternalTimer>();
|
||||
|
||||
public IncognitoSpell(Mobile caster, Item scroll = null) : base(caster, scroll, m_Info)
|
||||
{
|
||||
}
|
||||
|
||||
public override SpellCircle Circle => SpellCircle.Fifth;
|
||||
|
||||
public override bool CheckCast()
|
||||
{
|
||||
if (Sigil.ExistsOn(Caster))
|
||||
{
|
||||
Caster.SendLocalizedMessage(1010445); // You cannot incognito if you have a sigil
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!Caster.CanBeginAction<IncognitoSpell>())
|
||||
{
|
||||
Caster.SendLocalizedMessage(1005559); // This spell is already in effect.
|
||||
return false;
|
||||
}
|
||||
|
||||
if (Caster.BodyMod == 183 || Caster.BodyMod == 184)
|
||||
{
|
||||
Caster.SendLocalizedMessage(1042402); // You cannot use incognito while wearing body paint
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public override void OnCast()
|
||||
{
|
||||
if (Sigil.ExistsOn(Caster))
|
||||
{
|
||||
Caster.SendLocalizedMessage(1010445); // You cannot incognito if you have a sigil
|
||||
}
|
||||
else if (!Caster.CanBeginAction<IncognitoSpell>())
|
||||
{
|
||||
Caster.SendLocalizedMessage(1005559); // This spell is already in effect.
|
||||
}
|
||||
else if (Caster.BodyMod == 183 || Caster.BodyMod == 184)
|
||||
{
|
||||
Caster.SendLocalizedMessage(1042402); // You cannot use incognito while wearing body paint
|
||||
}
|
||||
else if (DisguiseTimers.IsDisguised(Caster))
|
||||
{
|
||||
Caster.SendLocalizedMessage(1061631); // You can't do that while disguised.
|
||||
}
|
||||
else if (!Caster.CanBeginAction<PolymorphSpell>() || Caster.IsBodyMod)
|
||||
{
|
||||
DoFizzle();
|
||||
}
|
||||
else if (CheckSequence())
|
||||
{
|
||||
if (Caster.BeginAction<IncognitoSpell>())
|
||||
{
|
||||
DisguiseTimers.StopTimer(Caster);
|
||||
|
||||
Caster.HueMod = Caster.Race.RandomSkinHue();
|
||||
Caster.NameMod = Caster.Female ? NameList.RandomName("female") : NameList.RandomName("male");
|
||||
|
||||
PlayerMobile pm = Caster as PlayerMobile;
|
||||
|
||||
if (pm?.Race != null)
|
||||
{
|
||||
pm.SetHairMods(pm.Race.RandomHair(pm.Female), pm.Race.RandomFacialHair(pm.Female));
|
||||
pm.HairHue = pm.Race.RandomHairHue();
|
||||
pm.FacialHairHue = pm.Race.RandomHairHue();
|
||||
}
|
||||
|
||||
Caster.FixedParticles(0x373A, 10, 15, 5036, EffectLayer.Head);
|
||||
Caster.PlaySound(0x3BD);
|
||||
|
||||
BaseArmor.ValidateMobile(Caster);
|
||||
BaseClothing.ValidateMobile(Caster);
|
||||
|
||||
StopTimer(Caster);
|
||||
|
||||
|
||||
int timeVal = 6 * Caster.Skills.Magery.Fixed / 50 + 1;
|
||||
|
||||
if (timeVal > 144)
|
||||
timeVal = 144;
|
||||
|
||||
TimeSpan length = TimeSpan.FromSeconds(timeVal);
|
||||
|
||||
|
||||
InternalTimer t = new InternalTimer(Caster, length);
|
||||
m_Timers[Caster] = t;
|
||||
|
||||
t.Start();
|
||||
|
||||
BuffInfo.AddBuff(Caster, new BuffInfo(BuffIcon.Incognito, 1075819, length, Caster));
|
||||
}
|
||||
else
|
||||
{
|
||||
Caster.SendLocalizedMessage(1079022); // You're already incognitoed!
|
||||
}
|
||||
}
|
||||
|
||||
FinishSequence();
|
||||
}
|
||||
|
||||
public static void StopTimer(Mobile m)
|
||||
{
|
||||
if (!m_Timers.TryGetValue(m, out InternalTimer t))
|
||||
return;
|
||||
|
||||
t.Stop();
|
||||
m_Timers.Remove(m);
|
||||
BuffInfo.RemoveBuff(m, BuffIcon.Incognito);
|
||||
}
|
||||
|
||||
private class InternalTimer : Timer
|
||||
{
|
||||
private Mobile m_Owner;
|
||||
|
||||
public InternalTimer(Mobile owner, TimeSpan length) : base(length)
|
||||
{
|
||||
m_Owner = owner;
|
||||
|
||||
/*
|
||||
int val = ((6 * owner.Skills.Magery.Fixed) / 50) + 1;
|
||||
|
||||
if ( val > 144 )
|
||||
val = 144;
|
||||
|
||||
Delay = TimeSpan.FromSeconds( val );
|
||||
* */
|
||||
Priority = TimerPriority.OneSecond;
|
||||
}
|
||||
|
||||
protected override void OnTick()
|
||||
{
|
||||
if (m_Owner.CanBeginAction<IncognitoSpell>())
|
||||
return;
|
||||
|
||||
(m_Owner as PlayerMobile)?.SetHairMods(-1, -1);
|
||||
|
||||
m_Owner.BodyMod = 0;
|
||||
m_Owner.HueMod = -1;
|
||||
m_Owner.NameMod = null;
|
||||
m_Owner.EndAction<IncognitoSpell>();
|
||||
|
||||
BaseArmor.ValidateMobile(m_Owner);
|
||||
BaseClothing.ValidateMobile(m_Owner);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
145
Projects/Scripts/Spells/Fifth/MagicReflect.cs
Normal file
145
Projects/Scripts/Spells/Fifth/MagicReflect.cs
Normal file
|
|
@ -0,0 +1,145 @@
|
|||
using System.Collections.Generic;
|
||||
|
||||
namespace Server.Spells.Fifth
|
||||
{
|
||||
public class MagicReflectSpell : MagerySpell
|
||||
{
|
||||
private static SpellInfo m_Info = new SpellInfo(
|
||||
"Magic Reflection", "In Jux Sanct",
|
||||
242,
|
||||
9012,
|
||||
Reagent.Garlic,
|
||||
Reagent.MandrakeRoot,
|
||||
Reagent.SpidersSilk
|
||||
);
|
||||
|
||||
private static Dictionary<Mobile, ResistanceMod[]> m_Table = new Dictionary<Mobile, ResistanceMod[]>();
|
||||
|
||||
public MagicReflectSpell(Mobile caster, Item scroll = null) : base(caster, scroll, m_Info)
|
||||
{
|
||||
}
|
||||
|
||||
public override SpellCircle Circle => SpellCircle.Fifth;
|
||||
|
||||
public override bool CheckCast()
|
||||
{
|
||||
if (Core.AOS)
|
||||
return true;
|
||||
|
||||
if (Caster.MagicDamageAbsorb > 0)
|
||||
{
|
||||
Caster.SendLocalizedMessage(1005559); // This spell is already in effect.
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!Caster.CanBeginAction<DefensiveSpell>())
|
||||
{
|
||||
Caster.SendLocalizedMessage(1005385); // The spell will not adhere to you at this time.
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public override void OnCast()
|
||||
{
|
||||
if (Core.AOS)
|
||||
{
|
||||
/* The magic reflection spell decreases the caster's physical resistance, while increasing the caster's elemental resistances.
|
||||
* Physical decrease = 25 - (Inscription/20).
|
||||
* Elemental resistance = +10 (-20 physical, +10 elemental at GM Inscription)
|
||||
* The magic reflection spell has an indefinite duration, becoming active when cast, and deactivated when re-cast.
|
||||
* Reactive Armor, Protection, and Magic Reflection will stay on<EFBFBD>even after logging out, even after dying<EFBFBD>until you <EFBFBD>turn them off<EFBFBD> by casting them again.
|
||||
*/
|
||||
|
||||
if (CheckSequence())
|
||||
{
|
||||
Mobile targ = Caster;
|
||||
|
||||
if (!m_Table.TryGetValue(targ, out ResistanceMod[] mods))
|
||||
{
|
||||
targ.PlaySound(0x1E9);
|
||||
targ.FixedParticles(0x375A, 10, 15, 5037, EffectLayer.Waist);
|
||||
|
||||
int physiMod = -25 + (int)(targ.Skills.Inscribe.Value / 20);
|
||||
int otherMod = 10;
|
||||
|
||||
mods = new[]
|
||||
{
|
||||
new ResistanceMod(ResistanceType.Physical, physiMod),
|
||||
new ResistanceMod(ResistanceType.Fire, otherMod),
|
||||
new ResistanceMod(ResistanceType.Cold, otherMod),
|
||||
new ResistanceMod(ResistanceType.Poison, otherMod),
|
||||
new ResistanceMod(ResistanceType.Energy, otherMod)
|
||||
};
|
||||
|
||||
m_Table[targ] = mods;
|
||||
|
||||
for (int i = 0; i < mods.Length; ++i)
|
||||
targ.AddResistanceMod(mods[i]);
|
||||
|
||||
string buffFormat = $"{physiMod}\t+{otherMod}\t+{otherMod}\t+{otherMod}\t+{otherMod}";
|
||||
|
||||
BuffInfo.AddBuff(targ, new BuffInfo(BuffIcon.MagicReflection, 1075817, buffFormat, true));
|
||||
}
|
||||
else
|
||||
{
|
||||
targ.PlaySound(0x1ED);
|
||||
targ.FixedParticles(0x375A, 10, 15, 5037, EffectLayer.Waist);
|
||||
|
||||
m_Table.Remove(targ);
|
||||
|
||||
for (int i = 0; i < mods.Length; ++i)
|
||||
targ.RemoveResistanceMod(mods[i]);
|
||||
|
||||
BuffInfo.RemoveBuff(targ, BuffIcon.MagicReflection);
|
||||
}
|
||||
}
|
||||
|
||||
FinishSequence();
|
||||
}
|
||||
else
|
||||
{
|
||||
if (Caster.MagicDamageAbsorb > 0)
|
||||
{
|
||||
Caster.SendLocalizedMessage(1005559); // This spell is already in effect.
|
||||
}
|
||||
else if (!Caster.CanBeginAction<DefensiveSpell>())
|
||||
{
|
||||
Caster.SendLocalizedMessage(1005385); // The spell will not adhere to you at this time.
|
||||
}
|
||||
else if (CheckSequence())
|
||||
{
|
||||
if (Caster.BeginAction<DefensiveSpell>())
|
||||
{
|
||||
int value = (int)(Caster.Skills.Magery.Value + Caster.Skills.Inscribe.Value);
|
||||
value = (int)(8 + value / 200.0 * 7.0); //absorb from 8 to 15 "circles"
|
||||
|
||||
Caster.MagicDamageAbsorb = value;
|
||||
|
||||
Caster.FixedParticles(0x375A, 10, 15, 5037, EffectLayer.Waist);
|
||||
Caster.PlaySound(0x1E9);
|
||||
}
|
||||
else
|
||||
{
|
||||
Caster.SendLocalizedMessage(1005385); // The spell will not adhere to you at this time.
|
||||
}
|
||||
}
|
||||
|
||||
FinishSequence();
|
||||
}
|
||||
}
|
||||
|
||||
public static void EndReflect(Mobile m)
|
||||
{
|
||||
if (!m_Table.TryGetValue(m, out ResistanceMod[] mods))
|
||||
return;
|
||||
|
||||
for (int i = 0; i < mods?.Length; ++i)
|
||||
m.RemoveResistanceMod(mods[i]);
|
||||
|
||||
m_Table.Remove(m);
|
||||
BuffInfo.RemoveBuff(m, BuffIcon.MagicReflection);
|
||||
}
|
||||
}
|
||||
}
|
||||
127
Projects/Scripts/Spells/Fifth/MindBlast.cs
Normal file
127
Projects/Scripts/Spells/Fifth/MindBlast.cs
Normal file
|
|
@ -0,0 +1,127 @@
|
|||
using System;
|
||||
using Server.Targeting;
|
||||
|
||||
namespace Server.Spells.Fifth
|
||||
{
|
||||
public class MindBlastSpell : MagerySpell, ISpellTargetingMobile
|
||||
{
|
||||
private static SpellInfo m_Info = new SpellInfo(
|
||||
"Mind Blast", "Por Corp Wis",
|
||||
218,
|
||||
Core.AOS ? 9002 : 9032,
|
||||
Reagent.BlackPearl,
|
||||
Reagent.MandrakeRoot,
|
||||
Reagent.Nightshade,
|
||||
Reagent.SulfurousAsh
|
||||
);
|
||||
|
||||
public MindBlastSpell(Mobile caster, Item scroll = null) : base(caster, scroll, m_Info)
|
||||
{
|
||||
if (Core.AOS)
|
||||
m_Info.LeftHandEffect = m_Info.RightHandEffect = 9002;
|
||||
}
|
||||
|
||||
public override SpellCircle Circle => SpellCircle.Fifth;
|
||||
|
||||
public override bool DelayedDamage => !Core.AOS;
|
||||
|
||||
public override void OnCast()
|
||||
{
|
||||
Caster.Target = new SpellTargetMobile(this, TargetFlags.Harmful, Core.ML ? 10 : 12);
|
||||
}
|
||||
|
||||
private void AosDelay_Callback(Mobile caster, Mobile target, Mobile defender, int damage)
|
||||
{
|
||||
if (caster.HarmfulCheck(defender))
|
||||
{
|
||||
SpellHelper.Damage(this, target, Utility.RandomMinMax(damage, damage + 4), 0, 0, 100, 0, 0);
|
||||
|
||||
target.FixedParticles(0x374A, 10, 15, 5038, 1181, 2, EffectLayer.Head);
|
||||
target.PlaySound(0x213);
|
||||
}
|
||||
}
|
||||
|
||||
public void Target(Mobile m)
|
||||
{
|
||||
if (m == null)
|
||||
return;
|
||||
|
||||
if (!Caster.CanSee(m))
|
||||
Caster.SendLocalizedMessage(500237); // Target can not be seen.
|
||||
else if (Core.AOS)
|
||||
{
|
||||
if (Caster.CanBeHarmful(m) && CheckSequence())
|
||||
{
|
||||
Mobile from = Caster, target = m;
|
||||
|
||||
SpellHelper.Turn(from, target);
|
||||
|
||||
SpellHelper.CheckReflect((int)Circle, ref from, ref target);
|
||||
|
||||
int damage = (int)((Caster.Skills.Magery.Value + Caster.Int) / 5);
|
||||
|
||||
if (damage > 60)
|
||||
damage = 60;
|
||||
|
||||
Timer.DelayCall(TimeSpan.FromSeconds(1.0),
|
||||
() => AosDelay_Callback(Caster, target, m, damage));
|
||||
}
|
||||
}
|
||||
else if (CheckHSequence(m))
|
||||
{
|
||||
Mobile from = Caster, target = m;
|
||||
|
||||
SpellHelper.Turn(from, target);
|
||||
|
||||
SpellHelper.CheckReflect((int)Circle, ref from, ref target);
|
||||
|
||||
// Algorithm: (highestStat - lowestStat) / 2 [- 50% if resisted]
|
||||
|
||||
int highestStat = target.Str, lowestStat = target.Str;
|
||||
|
||||
if (target.Dex > highestStat)
|
||||
highestStat = target.Dex;
|
||||
|
||||
if (target.Dex < lowestStat)
|
||||
lowestStat = target.Dex;
|
||||
|
||||
if (target.Int > highestStat)
|
||||
highestStat = target.Int;
|
||||
|
||||
if (target.Int < lowestStat)
|
||||
lowestStat = target.Int;
|
||||
|
||||
if (highestStat > 150)
|
||||
highestStat = 150;
|
||||
|
||||
if (lowestStat > 150)
|
||||
lowestStat = 150;
|
||||
|
||||
double damage = GetDamageScalar(m) * (highestStat - lowestStat) / 2; // Many users prefer 3 or 4
|
||||
|
||||
if (damage > 45)
|
||||
damage = 45;
|
||||
|
||||
if (CheckResisted(target))
|
||||
{
|
||||
damage /= 2;
|
||||
target.SendLocalizedMessage(501783); // You feel yourself resisting magical energy.
|
||||
}
|
||||
|
||||
from.FixedParticles(0x374A, 10, 15, 2038, EffectLayer.Head);
|
||||
|
||||
target.FixedParticles(0x374A, 10, 15, 5038, EffectLayer.Head);
|
||||
target.PlaySound(0x213);
|
||||
|
||||
SpellHelper.Damage(this, target, damage, 0, 0, 100, 0, 0);
|
||||
}
|
||||
|
||||
FinishSequence();
|
||||
}
|
||||
|
||||
public override double GetSlayerDamageScalar(Mobile target)
|
||||
{
|
||||
return 1.0; //This spell isn't affected by slayer spellbooks
|
||||
}
|
||||
}
|
||||
}
|
||||
92
Projects/Scripts/Spells/Fifth/Paralyze.cs
Normal file
92
Projects/Scripts/Spells/Fifth/Paralyze.cs
Normal file
|
|
@ -0,0 +1,92 @@
|
|||
using System;
|
||||
using Server.Mobiles;
|
||||
using Server.Spells.Chivalry;
|
||||
using Server.Targeting;
|
||||
|
||||
namespace Server.Spells.Fifth
|
||||
{
|
||||
public class ParalyzeSpell : MagerySpell, ISpellTargetingMobile
|
||||
{
|
||||
private static SpellInfo m_Info = new SpellInfo(
|
||||
"Paralyze", "An Ex Por",
|
||||
218,
|
||||
9012,
|
||||
Reagent.Garlic,
|
||||
Reagent.MandrakeRoot,
|
||||
Reagent.SpidersSilk
|
||||
);
|
||||
|
||||
public ParalyzeSpell(Mobile caster, Item scroll = null) : base(caster, scroll, m_Info)
|
||||
{
|
||||
}
|
||||
|
||||
public override SpellCircle Circle => SpellCircle.Fifth;
|
||||
|
||||
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 (Core.AOS && (m.Frozen || m.Paralyzed ||
|
||||
m.Spell != null && m.Spell.IsCasting && !(m.Spell is PaladinSpell)))
|
||||
{
|
||||
Caster.SendLocalizedMessage(1061923); // The target is already frozen.
|
||||
}
|
||||
else if (CheckHSequence(m))
|
||||
{
|
||||
SpellHelper.Turn(Caster, m);
|
||||
|
||||
SpellHelper.CheckReflect((int)Circle, Caster, ref m);
|
||||
|
||||
double duration;
|
||||
|
||||
if (Core.AOS)
|
||||
{
|
||||
int secs = (int)(GetDamageSkill(Caster) / 10 - GetResistSkill(m) / 10);
|
||||
|
||||
if (!Core.SE)
|
||||
secs += 2;
|
||||
|
||||
if (!m.Player)
|
||||
secs *= 3;
|
||||
|
||||
if (secs < 0)
|
||||
secs = 0;
|
||||
|
||||
duration = secs;
|
||||
}
|
||||
else
|
||||
{
|
||||
// Algorithm: ((20% of magery) + 7) seconds [- 50% if resisted]
|
||||
|
||||
duration = 7.0 + Caster.Skills.Magery.Value * 0.2;
|
||||
|
||||
if (CheckResisted(m))
|
||||
duration *= 0.75;
|
||||
}
|
||||
|
||||
if (m is PlagueBeastLord lord)
|
||||
{
|
||||
lord.OnParalyzed(Caster);
|
||||
duration = 120;
|
||||
}
|
||||
|
||||
m.Paralyze(TimeSpan.FromSeconds(duration));
|
||||
|
||||
m.PlaySound(0x204);
|
||||
m.FixedEffect(0x376A, 6, 1);
|
||||
|
||||
HarmfulSpell(m);
|
||||
}
|
||||
|
||||
FinishSequence();
|
||||
}
|
||||
}
|
||||
}
|
||||
273
Projects/Scripts/Spells/Fifth/PoisonField.cs
Normal file
273
Projects/Scripts/Spells/Fifth/PoisonField.cs
Normal file
|
|
@ -0,0 +1,273 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using Server.Items;
|
||||
using Server.Misc;
|
||||
using Server.Mobiles;
|
||||
using Server.Targeting;
|
||||
|
||||
namespace Server.Spells.Fifth
|
||||
{
|
||||
public class PoisonFieldSpell : MagerySpell, ISpellTargetingPoint3D
|
||||
{
|
||||
private static SpellInfo m_Info = new SpellInfo(
|
||||
"Poison Field", "In Nox Grav",
|
||||
230,
|
||||
9052,
|
||||
false,
|
||||
Reagent.BlackPearl,
|
||||
Reagent.Nightshade,
|
||||
Reagent.SpidersSilk
|
||||
);
|
||||
|
||||
public PoisonFieldSpell(Mobile caster, Item scroll = null) : base(caster, scroll, m_Info)
|
||||
{
|
||||
}
|
||||
|
||||
public override SpellCircle Circle => SpellCircle.Fifth;
|
||||
|
||||
public override void OnCast()
|
||||
{
|
||||
Caster.Target = new SpellTargetPoint3D(this, TargetFlags.None, Core.ML ? 10 : 12, false);
|
||||
}
|
||||
|
||||
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, 0x20B);
|
||||
|
||||
int itemID = eastToWest ? 0x3915 : 0x3922;
|
||||
|
||||
TimeSpan duration = TimeSpan.FromSeconds(3 + Caster.Skills.Magery.Fixed / 25);
|
||||
|
||||
for (int i = -2; i <= 2; ++i)
|
||||
{
|
||||
Point3D loc = new Point3D(eastToWest ? p.X + i : p.X, eastToWest ? p.Y : p.Y + i, p.Z);
|
||||
|
||||
new InternalItem(itemID, loc, Caster, Caster.Map, duration, i);
|
||||
}
|
||||
}
|
||||
|
||||
FinishSequence();
|
||||
}
|
||||
|
||||
[DispellableField]
|
||||
public class InternalItem : Item
|
||||
{
|
||||
private Mobile m_Caster;
|
||||
private DateTime m_End;
|
||||
private Timer m_Timer;
|
||||
|
||||
public InternalItem(int itemID, Point3D loc, Mobile caster, Map map, TimeSpan duration, int val) : base(itemID)
|
||||
{
|
||||
bool canFit = SpellHelper.AdjustField(ref loc, map, 12, false);
|
||||
|
||||
Visible = false;
|
||||
Movable = false;
|
||||
Light = LightType.Circle300;
|
||||
|
||||
MoveToWorld(loc, map);
|
||||
|
||||
m_Caster = caster;
|
||||
|
||||
m_End = DateTime.UtcNow + duration;
|
||||
|
||||
m_Timer = new InternalTimer(this, TimeSpan.FromSeconds(Math.Abs(val) * 0.2), caster.InLOS(this), canFit);
|
||||
m_Timer.Start();
|
||||
}
|
||||
|
||||
public InternalItem(Serial serial) : base(serial)
|
||||
{
|
||||
}
|
||||
|
||||
public override bool BlocksFit => true;
|
||||
|
||||
public override void OnAfterDelete()
|
||||
{
|
||||
base.OnAfterDelete();
|
||||
|
||||
m_Timer?.Stop();
|
||||
}
|
||||
|
||||
public override void Serialize(GenericWriter writer)
|
||||
{
|
||||
base.Serialize(writer);
|
||||
|
||||
writer.Write(1); // version
|
||||
|
||||
writer.Write(m_Caster);
|
||||
writer.WriteDeltaTime(m_End);
|
||||
}
|
||||
|
||||
public override void Deserialize(GenericReader reader)
|
||||
{
|
||||
base.Deserialize(reader);
|
||||
|
||||
int version = reader.ReadInt();
|
||||
|
||||
switch (version)
|
||||
{
|
||||
case 1:
|
||||
{
|
||||
m_Caster = reader.ReadMobile();
|
||||
|
||||
goto case 0;
|
||||
}
|
||||
case 0:
|
||||
{
|
||||
m_End = reader.ReadDeltaTime();
|
||||
|
||||
m_Timer = new InternalTimer(this, TimeSpan.Zero, true, true);
|
||||
m_Timer.Start();
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void ApplyPoisonTo(Mobile m)
|
||||
{
|
||||
if (m_Caster == null)
|
||||
return;
|
||||
|
||||
Poison p;
|
||||
|
||||
if (Core.AOS)
|
||||
{
|
||||
int total = (m_Caster.Skills.Magery.Fixed + m_Caster.Skills.Poisoning.Fixed) / 2;
|
||||
|
||||
if (total >= 1000)
|
||||
p = Poison.Deadly;
|
||||
else if (total > 850)
|
||||
p = Poison.Greater;
|
||||
else if (total > 650)
|
||||
p = Poison.Regular;
|
||||
else
|
||||
p = Poison.Lesser;
|
||||
}
|
||||
else
|
||||
{
|
||||
p = Poison.Regular;
|
||||
}
|
||||
|
||||
if (m.ApplyPoison(m_Caster, p) == ApplyPoisonResult.Poisoned)
|
||||
if (SpellHelper.CanRevealCaster(m))
|
||||
m_Caster.RevealingAction();
|
||||
|
||||
(m as BaseCreature)?.OnHarmfulSpell(m_Caster);
|
||||
}
|
||||
|
||||
public override bool OnMoveOver(Mobile m)
|
||||
{
|
||||
if (Visible && m_Caster != null && (!Core.AOS || m != m_Caster) &&
|
||||
SpellHelper.ValidIndirectTarget(m_Caster, m) && m_Caster.CanBeHarmful(m, false))
|
||||
{
|
||||
m_Caster.DoHarmful(m);
|
||||
|
||||
ApplyPoisonTo(m);
|
||||
m.PlaySound(0x474);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
private class InternalTimer : Timer
|
||||
{
|
||||
private static Queue<Mobile> m_Queue = new Queue<Mobile>();
|
||||
private bool m_InLOS, m_CanFit;
|
||||
private InternalItem m_Item;
|
||||
|
||||
public InternalTimer(InternalItem item, TimeSpan delay, bool inLOS, bool canFit) : base(delay,
|
||||
TimeSpan.FromSeconds(1.5))
|
||||
{
|
||||
m_Item = item;
|
||||
m_InLOS = inLOS;
|
||||
m_CanFit = canFit;
|
||||
|
||||
Priority = TimerPriority.FiftyMS;
|
||||
}
|
||||
|
||||
protected override void OnTick()
|
||||
{
|
||||
if (m_Item.Deleted)
|
||||
return;
|
||||
|
||||
if (!m_Item.Visible)
|
||||
{
|
||||
if (m_InLOS && m_CanFit)
|
||||
m_Item.Visible = true;
|
||||
else
|
||||
m_Item.Delete();
|
||||
|
||||
if (!m_Item.Deleted)
|
||||
{
|
||||
m_Item.ProcessDelta();
|
||||
Effects.SendLocationParticles(
|
||||
EffectItem.Create(m_Item.Location, m_Item.Map, EffectItem.DefaultDuration), 0x376A, 9, 10,
|
||||
5040);
|
||||
}
|
||||
}
|
||||
else if (DateTime.UtcNow > m_Item.m_End)
|
||||
{
|
||||
m_Item.Delete();
|
||||
Stop();
|
||||
}
|
||||
else
|
||||
{
|
||||
Map map = m_Item.Map;
|
||||
Mobile caster = m_Item.m_Caster;
|
||||
|
||||
if (map != null && caster != null)
|
||||
{
|
||||
bool eastToWest = m_Item.ItemID == 0x3915;
|
||||
IPooledEnumerable<Mobile> eable = map.GetMobilesInBounds(
|
||||
new Rectangle2D(m_Item.X - (eastToWest ? 0 : 1), m_Item.Y - (eastToWest ? 1 : 0),
|
||||
eastToWest ? 1 : 2, eastToWest ? 2 : 1));
|
||||
|
||||
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 = m_Queue.Dequeue();
|
||||
|
||||
caster.DoHarmful(m);
|
||||
|
||||
m_Item.ApplyPoisonTo(m);
|
||||
m.PlaySound(0x474);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
95
Projects/Scripts/Spells/Fifth/SummonCreature.cs
Normal file
95
Projects/Scripts/Spells/Fifth/SummonCreature.cs
Normal file
|
|
@ -0,0 +1,95 @@
|
|||
using System;
|
||||
using Server.Mobiles;
|
||||
|
||||
namespace Server.Spells.Fifth
|
||||
{
|
||||
public class SummonCreatureSpell : MagerySpell
|
||||
{
|
||||
private static SpellInfo m_Info = new SpellInfo(
|
||||
"Summon Creature", "Kal Xen",
|
||||
16,
|
||||
false,
|
||||
Reagent.Bloodmoss,
|
||||
Reagent.MandrakeRoot,
|
||||
Reagent.SpidersSilk
|
||||
);
|
||||
|
||||
// NOTE: Creature list based on 1hr of summon/release on OSI.
|
||||
|
||||
private static Type[] m_Types =
|
||||
{
|
||||
typeof(PolarBear),
|
||||
typeof(GrizzlyBear),
|
||||
typeof(BlackBear),
|
||||
typeof(Horse),
|
||||
typeof(Walrus),
|
||||
typeof(Chicken),
|
||||
typeof(Scorpion),
|
||||
typeof(GiantSerpent),
|
||||
typeof(Llama),
|
||||
typeof(Alligator),
|
||||
typeof(GreyWolf),
|
||||
typeof(Slime),
|
||||
typeof(Eagle),
|
||||
typeof(Gorilla),
|
||||
typeof(SnowLeopard),
|
||||
typeof(Pig),
|
||||
typeof(Hind),
|
||||
typeof(Rabbit)
|
||||
};
|
||||
|
||||
public SummonCreatureSpell(Mobile caster, Item scroll = null) : base(caster, scroll, m_Info)
|
||||
{
|
||||
}
|
||||
|
||||
public override SpellCircle Circle => SpellCircle.Fifth;
|
||||
|
||||
public override bool CheckCast()
|
||||
{
|
||||
if (!base.CheckCast())
|
||||
return false;
|
||||
|
||||
if (Caster.Followers + 2 > Caster.FollowersMax)
|
||||
{
|
||||
Caster.SendLocalizedMessage(1049645); // You have too many followers to summon that creature.
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public override void OnCast()
|
||||
{
|
||||
if (CheckSequence())
|
||||
try
|
||||
{
|
||||
BaseCreature creature = (BaseCreature)Activator.CreateInstance(m_Types[Utility.Random(m_Types.Length)]);
|
||||
|
||||
//creature.ControlSlots = 2;
|
||||
|
||||
TimeSpan duration;
|
||||
|
||||
if (Core.AOS)
|
||||
duration = TimeSpan.FromSeconds(2 * Caster.Skills.Magery.Fixed / 5);
|
||||
else
|
||||
duration = TimeSpan.FromSeconds(4.0 * Caster.Skills.Magery.Value);
|
||||
|
||||
SpellHelper.Summon(creature, Caster, 0x215, duration, false, false);
|
||||
}
|
||||
catch
|
||||
{
|
||||
// ignored
|
||||
}
|
||||
|
||||
FinishSequence();
|
||||
}
|
||||
|
||||
public override TimeSpan GetCastDelay()
|
||||
{
|
||||
if (Core.AOS)
|
||||
return TimeSpan.FromTicks(base.GetCastDelay().Ticks * 5);
|
||||
|
||||
return base.GetCastDelay() + TimeSpan.FromSeconds(6.0);
|
||||
}
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue