Overwrite

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

View File

@@ -0,0 +1,129 @@
using System;
using System.Collections.Generic;
using System.Linq;
using Server.Targeting;
using Server.Mobiles;
namespace Server.Spells.Seventh
{
public class ChainLightningSpell : MagerySpell
{
public override DamageType SpellDamageType { get { return DamageType.SpellAOE; } }
private static readonly SpellInfo m_Info = new SpellInfo(
"Chain Lightning", "Vas Ort Grav",
209,
9022,
false,
Reagent.BlackPearl,
Reagent.Bloodmoss,
Reagent.MandrakeRoot,
Reagent.SulfurousAsh);
public ChainLightningSpell(Mobile caster, Item scroll)
: base(caster, scroll, m_Info)
{
}
public override SpellCircle Circle
{
get
{
return SpellCircle.Seventh;
}
}
public override bool DelayedDamage
{
get
{
return true;
}
}
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) && CheckSequence())
{
SpellHelper.Turn(Caster, p);
if (p is Item)
p = ((Item)p).GetWorldLocation();
var targets = AcquireIndirectTargets(p, 2).ToList();
var count = Math.Max(1, targets.Count);
foreach (var dam in targets)
{
var id = dam;
var m = id as Mobile;
double damage;
if (Core.AOS)
damage = GetNewAosDamage(51, 1, 5, id is PlayerMobile, id);
else
damage = Utility.Random(27, 22);
if (Core.AOS && count > 2)
damage = (damage * 2) / count;
else if (!Core.AOS)
damage /= count;
if (!Core.AOS && m != null && CheckResisted(m))
{
damage *= 0.5;
m.SendLocalizedMessage(501783); // You feel yourself resisting magical energy.
}
Mobile source = Caster;
SpellHelper.CheckReflect((int)Circle, ref source, ref id, SpellDamageType);
if (m != null)
{
damage *= GetDamageScalar(m);
}
Effects.SendBoltEffect(id, true, 0, false);
Caster.DoHarmful(id);
SpellHelper.Damage(this, id, damage, 0, 0, 0, 0, 100);
}
ColUtility.Free(targets);
}
FinishSequence();
}
private class InternalTarget : Target
{
private readonly ChainLightningSpell m_Owner;
public InternalTarget(ChainLightningSpell owner)
: base(Core.ML ? 10 : 12, true, TargetFlags.None)
{
m_Owner = owner;
}
protected override void OnTarget(Mobile from, object o)
{
IPoint3D p = o as IPoint3D;
if (p != null)
m_Owner.Target(p);
}
protected override void OnTargetFinish(Mobile from)
{
m_Owner.FinishSequence();
}
}
}
}

View File

@@ -0,0 +1,225 @@
using System;
using Server.Items;
using Server.Misc;
using Server.Mobiles;
using Server.Targeting;
namespace Server.Spells.Seventh
{
public class EnergyFieldSpell : MagerySpell
{
private static readonly SpellInfo m_Info = new SpellInfo(
"Energy Field", "In Sanct Grav",
221,
9022,
false,
Reagent.BlackPearl,
Reagent.MandrakeRoot,
Reagent.SpidersSilk,
Reagent.SulfurousAsh);
public EnergyFieldSpell(Mobile caster, Item scroll)
: base(caster, scroll, m_Info)
{
}
public override SpellCircle Circle
{
get
{
return SpellCircle.Seventh;
}
}
public override void OnCast()
{
Caster.Target = new InternalTarget(this);
}
public void Target(IPoint3D p)
{
if (!Caster.CanSee(p))
{
Caster.SendLocalizedMessage(500237); // Target can not be seen.
}
else if (SpellHelper.CheckTown(p, Caster) && SpellHelper.CheckWater(new Point3D(p), Caster.Map) && CheckSequence())
{
SpellHelper.Turn(Caster, p);
SpellHelper.GetSurfaceTop(ref p);
int dx = Caster.Location.X - p.X;
int dy = Caster.Location.Y - p.Y;
int rx = (dx - dy) * 44;
int ry = (dx + dy) * 44;
bool eastToWest;
if (rx >= 0 && ry >= 0)
{
eastToWest = false;
}
else if (rx >= 0)
{
eastToWest = true;
}
else if (ry >= 0)
{
eastToWest = true;
}
else
{
eastToWest = false;
}
Effects.PlaySound(p, Caster.Map, 0x20B);
TimeSpan duration;
if (Core.AOS)
duration = TimeSpan.FromSeconds((15 + (Caster.Skills.Magery.Fixed / 5)) / 7);
else
duration = TimeSpan.FromSeconds(Caster.Skills[SkillName.Magery].Value * 0.28 + 2.0); // (28% of magery) + 2.0 seconds
Point3D pnt = new Point3D(p);
int itemID = eastToWest ? 0x3946 : 0x3956;
if (SpellHelper.CheckField(pnt, Caster.Map))
new InternalItem(itemID, pnt, Caster, Caster.Map, duration);
for (int i = 1; i <= 2; ++i)
{
Timer.DelayCall<int>(TimeSpan.FromMilliseconds(i * 300), index =>
{
Point3D point = new Point3D(eastToWest ? pnt.X + index : pnt.X, eastToWest ? pnt.Y : pnt.Y + index, pnt.Z);
SpellHelper.AdjustField(ref point, Caster.Map, 16, false);
if (SpellHelper.CheckField(point, Caster.Map))
new InternalItem(itemID, point, Caster, Caster.Map, duration);
point = new Point3D(eastToWest ? pnt.X + -index : pnt.X, eastToWest ? pnt.Y : pnt.Y + -index, pnt.Z);
SpellHelper.AdjustField(ref point, Caster.Map, 16, false);
if (SpellHelper.CheckField(point, Caster.Map))
new InternalItem(itemID, point, Caster, Caster.Map, duration);
}, i);
}
}
FinishSequence();
}
[DispellableField]
private class InternalItem : Item
{
private readonly Timer m_Timer;
private readonly Mobile m_Caster;
public InternalItem(int itemID, Point3D loc, Mobile caster, Map map, TimeSpan duration)
: base(itemID)
{
Movable = false;
Light = LightType.Circle300;
MoveToWorld(loc, map);
Effects.SendLocationParticles(EffectItem.Create(loc, map, EffectItem.DefaultDuration), 0x376A, 9, 10, 5029);
m_Caster = caster;
if (Deleted)
return;
m_Timer = new InternalTimer(this, duration);
m_Timer.Start();
}
public InternalItem(Serial serial)
: base(serial)
{
m_Timer = new InternalTimer(this, TimeSpan.FromSeconds(5.0));
m_Timer.Start();
}
public override bool BlocksFit
{
get
{
return true;
}
}
public override void Serialize(GenericWriter writer)
{
base.Serialize(writer);
writer.Write((int)0); // version
}
public override void Deserialize(GenericReader reader)
{
base.Deserialize(reader);
int version = reader.ReadInt();
}
public override bool OnMoveOver(Mobile m)
{
int noto;
if (m is PlayerMobile)
{
noto = Notoriety.Compute(m_Caster, m);
if (noto == Notoriety.Enemy || noto == Notoriety.Ally)
return false;
if (m.Map != null && (m.Map.Rules & MapRules.FreeMovement) == 0)
return false;
}
return base.OnMoveOver(m);
}
public override void OnAfterDelete()
{
base.OnAfterDelete();
if (m_Timer != null)
m_Timer.Stop();
}
private class InternalTimer : Timer
{
private readonly InternalItem m_Item;
public InternalTimer(InternalItem item, TimeSpan duration)
: base(duration)
{
Priority = TimerPriority.OneSecond;
m_Item = item;
}
protected override void OnTick()
{
m_Item.Delete();
}
}
}
public class InternalTarget : Target
{
private readonly EnergyFieldSpell m_Owner;
public InternalTarget(EnergyFieldSpell owner)
: base(Core.TOL ? 15 : Core.ML ? 10 : 12, true, TargetFlags.None)
{
m_Owner = owner;
}
protected override void OnTarget(Mobile from, object o)
{
if (o is IPoint3D)
m_Owner.Target((IPoint3D)o);
}
protected override void OnTargetFinish(Mobile from)
{
m_Owner.FinishSequence();
}
}
}
}

View File

@@ -0,0 +1,110 @@
using System;
using Server.Targeting;
namespace Server.Spells.Seventh
{
public class FlameStrikeSpell : MagerySpell
{
private static readonly SpellInfo m_Info = new SpellInfo(
"Flame Strike", "Kal Vas Flam",
245,
9042,
Reagent.SpidersSilk,
Reagent.SulfurousAsh);
public FlameStrikeSpell(Mobile caster, Item scroll)
: base(caster, scroll, m_Info)
{
}
public override SpellCircle Circle
{
get
{
return SpellCircle.Seventh;
}
}
public override bool DelayedDamage
{
get
{
return true;
}
}
public override void OnCast()
{
this.Caster.Target = new InternalTarget(this);
}
public void Target(IDamageable 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);
Mobile source = this.Caster;
SpellHelper.CheckReflect((int)this.Circle, ref source, ref m);
double damage = 0;
if (Core.AOS)
{
damage = GetNewAosDamage(48, 1, 5, m);
}
else if (m is Mobile)
{
damage = Utility.Random(27, 22);
if (this.CheckResisted((Mobile)m))
{
damage *= 0.6;
((Mobile)m).SendLocalizedMessage(501783); // You feel yourself resisting magical energy.
}
damage *= this.GetDamageScalar((Mobile)m);
}
if (m != null)
{
m.FixedParticles(0x3709, 10, 30, 5052, EffectLayer.LeftFoot);
m.PlaySound(0x208);
}
if (damage > 0)
{
SpellHelper.Damage(this, m, damage, 0, 100, 0, 0, 0);
}
}
this.FinishSequence();
}
private class InternalTarget : Target
{
private readonly FlameStrikeSpell m_Owner;
public InternalTarget(FlameStrikeSpell owner)
: base(Core.ML ? 10 : 12, false, TargetFlags.Harmful)
{
this.m_Owner = owner;
}
protected override void OnTarget(Mobile from, object o)
{
if (o is IDamageable)
{
this.m_Owner.Target((IDamageable)o);
}
}
protected override void OnTargetFinish(Mobile from)
{
this.m_Owner.FinishSequence();
}
}
}
}

View File

@@ -0,0 +1,377 @@
using System;
using Server.Items;
using Server.Misc;
using Server.Mobiles;
using Server.Network;
using Server.Targeting;
using Server.Multis;
namespace Server.Spells.Seventh
{
public class GateTravelSpell : MagerySpell
{
private static readonly SpellInfo m_Info = new SpellInfo(
"Gate Travel", "Vas Rel Por",
263,
9032,
Reagent.BlackPearl,
Reagent.MandrakeRoot,
Reagent.SulfurousAsh);
private readonly RunebookEntry m_Entry;
public GateTravelSpell(Mobile caster, Item scroll)
: this(caster, scroll, null)
{
}
public GateTravelSpell(Mobile caster, Item scroll, RunebookEntry entry)
: base(caster, scroll, m_Info)
{
m_Entry = entry;
}
public override SpellCircle Circle
{
get
{
return SpellCircle.Seventh;
}
}
public override void OnCast()
{
if (m_Entry == null)
{
Caster.Target = new InternalTarget(this);
}
else
{
if (m_Entry.Type == RecallRuneType.Ship)
{
Effect(m_Entry.Galleon);
}
else
{
Effect(m_Entry.Location, m_Entry.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;
}
return SpellHelper.CheckTravel(Caster, TravelCheckType.GateFrom);
}
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(1005570); // You can not gate to another facet.
}
else if (!SpellHelper.CheckTravel(Caster, TravelCheckType.GateFrom))
{
}
else if (!SpellHelper.CheckTravel(Caster, map, loc, TravelCheckType.GateTo))
{
}
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 && !Siege.SiegeShard)
{
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 (!map.CanSpawnMobile(loc.X, loc.Y, loc.Z) && !isboatkey)
{
Caster.SendLocalizedMessage(501942); // That location is blocked.
}
else if ((checkMulti && SpellHelper.CheckMulti(loc, map)) && !isboatkey)
{
Caster.SendLocalizedMessage(501942); // That location is blocked.
}
else if (Core.SE && (GateExistsAt(map, loc) || GateExistsAt(Caster.Map, Caster.Location))) // SE restricted stacking gates
{
Caster.SendLocalizedMessage(1071242); // There is already a gate there.
}
else if (Engines.CityLoyalty.CityTradeSystem.HasTrade(Caster))
{
Caster.SendLocalizedMessage(1151733); // You cannot do that while carrying a Trade Order.
}
else if (CheckSequence())
{
Timer.DelayCall(TimeSpan.FromSeconds(1), () =>
{
Caster.SendLocalizedMessage(501024); // You open a magical gate to another location
Effects.PlaySound(Caster.Location, Caster.Map, 0x20E);
InternalItem firstGate = new InternalItem(loc, map);
firstGate.MoveToWorld(Caster.Location, Caster.Map);
Effects.PlaySound(loc, map, 0x20E);
InternalItem secondGate = new InternalItem(Caster.Location, Caster.Map);
secondGate.MoveToWorld(loc, map);
firstGate.LinkedGate = secondGate;
secondGate.LinkedGate = firstGate;
firstGate.BoatGate = BaseBoat.FindBoatAt(firstGate, firstGate.Map) != null;
secondGate.BoatGate = BaseBoat.FindBoatAt(secondGate, secondGate.Map) != null;
});
}
FinishSequence();
}
private bool GateExistsAt(Map map, Point3D loc)
{
bool _gateFound = false;
IPooledEnumerable eable = map.GetItemsInRange(loc, 0);
foreach (Item item in eable)
{
if (item is Moongate || item is PublicMoongate)
{
_gateFound = true;
break;
}
}
eable.Free();
return _gateFound;
}
[DispellableField]
private class InternalItem : Moongate
{
[CommandProperty(AccessLevel.GameMaster)]
public Moongate LinkedGate { get; set; }
[CommandProperty(AccessLevel.GameMaster)]
public bool BoatGate { get; set; }
public InternalItem(Point3D target, Map map)
: base(target, map)
{
Map = map;
if (ShowFeluccaWarning && map == Map.Felucca)
ItemID = 0xDDA;
Dispellable = true;
InternalTimer t = new InternalTimer(this);
t.Start();
}
public override void UseGate(Mobile m)
{
if (LinkedGate == null || !(LinkedGate is InternalItem) || !((InternalItem)LinkedGate).BoatGate || !LinkedGate.Deleted)
{
if (LinkedGate != null && ((InternalItem)LinkedGate).BoatGate)
{
BaseBoat boat = BaseBoat.FindBoatAt(LinkedGate);
if (boat != null && !boat.HasAccess(m))
{
m.SendLocalizedMessage(1116617); // You do not have permission to board this ship.
return;
}
}
base.UseGate(m);
}
else
m.SendMessage("The other gate no longer exists.");
}
public override void OnLocationChange(Point3D old)
{
if (!BoatGate)
base.OnLocationChange(old);
else if (LinkedGate != null)
LinkedGate.Target = Location;
}
public override void OnMapChange()
{
if (!BoatGate)
base.OnMapChange();
else if (LinkedGate != null)
LinkedGate.TargetMap = Map;
}
public InternalItem(Serial serial)
: base(serial)
{
}
public override bool ShowFeluccaWarning
{
get
{
return Core.AOS;
}
}
public override void Serialize(GenericWriter writer)
{
base.Serialize(writer);
}
public override void Deserialize(GenericReader reader)
{
base.Deserialize(reader);
Delete();
}
private class InternalTimer : Timer
{
private readonly Item m_Item;
public InternalTimer(Item item)
: base(TimeSpan.FromSeconds(30.0))
{
Priority = TimerPriority.OneSecond;
m_Item = item;
}
protected override void OnTick()
{
m_Item.Delete();
}
}
}
private class InternalTarget : Target
{
private readonly GateTravelSpell m_Owner;
public InternalTarget(GateTravelSpell owner)
: base(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 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, 501030, from.Name, "")); // I can not gate travel from that object.
}
}
protected override void OnNonlocalTarget(Mobile from, object o)
{
}
protected override void OnTargetFinish(Mobile from)
{
m_Owner.FinishSequence();
}
}
}
}

View File

@@ -0,0 +1,125 @@
using System;
using Server.Targeting;
namespace Server.Spells.Seventh
{
public class ManaVampireSpell : MagerySpell
{
private static readonly SpellInfo m_Info = new SpellInfo(
"Mana Vampire", "Ort Sanct",
221,
9032,
Reagent.BlackPearl,
Reagent.Bloodmoss,
Reagent.MandrakeRoot,
Reagent.SpidersSilk);
public ManaVampireSpell(Mobile caster, Item scroll)
: base(caster, scroll, m_Info)
{
}
public override SpellCircle Circle
{
get
{
return SpellCircle.Seventh;
}
}
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;
int toDrain = 0;
if (Core.AOS)
{
toDrain = (int)(this.GetDamageSkill(this.Caster) - this.GetResistSkill(m));
if (!m.Player)
toDrain /= 2;
if (toDrain < 0)
toDrain = 0;
else if (toDrain > m.Mana)
toDrain = m.Mana;
}
else
{
if (this.CheckResisted(m))
m.SendLocalizedMessage(501783); // You feel yourself resisting magical energy.
else
toDrain = m.Mana;
}
if (toDrain > (this.Caster.ManaMax - this.Caster.Mana))
toDrain = this.Caster.ManaMax - this.Caster.Mana;
m.Mana -= toDrain;
this.Caster.Mana += toDrain;
if (Core.AOS)
{
m.FixedParticles(0x374A, 1, 15, 5054, 23, 7, EffectLayer.Head);
m.PlaySound(0x1F9);
this.Caster.FixedParticles(0x0000, 10, 5, 2054, EffectLayer.Head);
}
else
{
m.FixedParticles(0x374A, 10, 15, 5054, EffectLayer.Head);
m.PlaySound(0x1F9);
}
this.HarmfulSpell(m);
}
this.FinishSequence();
}
public override double GetResistPercent(Mobile target)
{
return 98.0;
}
private class InternalTarget : Target
{
private readonly ManaVampireSpell m_Owner;
public InternalTarget(ManaVampireSpell owner)
: base(Core.ML ? 10 : 12, false, TargetFlags.Harmful)
{
this.m_Owner = owner;
}
protected override void OnTarget(Mobile from, object o)
{
if (o is Mobile)
{
this.m_Owner.Target((Mobile)o);
}
}
protected override void OnTargetFinish(Mobile from)
{
this.m_Owner.FinishSequence();
}
}
}
}

View File

@@ -0,0 +1,119 @@
using System;
using System.Collections.Generic;
using Server.Items;
using Server.Mobiles;
using Server.Targeting;
namespace Server.Spells.Seventh
{
public class MassDispelSpell : MagerySpell
{
private static readonly SpellInfo m_Info = new SpellInfo(
"Mass Dispel", "Vas An Ort",
263,
9002,
Reagent.Garlic,
Reagent.MandrakeRoot,
Reagent.BlackPearl,
Reagent.SulfurousAsh);
public MassDispelSpell(Mobile caster, Item scroll)
: base(caster, scroll, m_Info)
{
}
public override SpellCircle Circle
{
get
{
return SpellCircle.Seventh;
}
}
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), 8);
foreach (Mobile m in eable)
if (m is BaseCreature && (m as BaseCreature).IsDispellable && (((BaseCreature)m).SummonMaster == this.Caster || this.Caster.CanBeHarmful(m, false)))
targets.Add(m);
eable.Free();
}
for (int i = 0; i < targets.Count; ++i)
{
Mobile m = targets[i];
BaseCreature bc = m as BaseCreature;
if (bc == null)
continue;
double dispelChance = (50.0 + ((100 * (this.Caster.Skills.Magery.Value - bc.GetDispelDifficulty())) / (bc.DispelFocus * 2))) / 100;
// Skill Masteries
dispelChance -= ((double)SkillMasteries.MasteryInfo.EnchantedSummoningBonus(bc) / 100);
if (dispelChance > Utility.RandomDouble())
{
Effects.SendLocationParticles(EffectItem.Create(m.Location, m.Map, EffectItem.DefaultDuration), 0x3728, 8, 20, 5042);
Effects.PlaySound(m, m.Map, 0x201);
m.Delete();
}
else
{
this.Caster.DoHarmful(m);
m.FixedEffect(0x3779, 10, 20);
}
}
}
this.FinishSequence();
}
public class InternalTarget : Target
{
private readonly MassDispelSpell m_Owner;
public InternalTarget(MassDispelSpell 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();
}
}
}
}

View File

@@ -0,0 +1,174 @@
using System;
using System.Collections.Generic;
using System.Linq;
using Server.Targeting;
using Server.Mobiles;
using Server.Items;
namespace Server.Spells.Seventh
{
public class MeteorSwarmSpell : MagerySpell
{
public override DamageType SpellDamageType { get { return DamageType.SpellAOE; } }
public Item Item { get; set; }
private static readonly SpellInfo m_Info = new SpellInfo(
"Meteor Swarm", "Flam Kal Des Ylem",
233,
9042,
false,
Reagent.Bloodmoss,
Reagent.MandrakeRoot,
Reagent.SulfurousAsh,
Reagent.SpidersSilk);
public MeteorSwarmSpell(Mobile caster, Item scroll, Item item)
: base(caster, scroll, m_Info)
{
Item = item;
}
public MeteorSwarmSpell(Mobile caster, Item scroll)
: base(caster, scroll, m_Info)
{
}
public override int GetMana()
{
if (Item != null)
return 0;
return base.GetMana();
}
public override SpellCircle Circle
{
get
{
return SpellCircle.Seventh;
}
}
public override bool DelayedDamage
{
get
{
return true;
}
}
public override void OnCast()
{
Caster.Target = new InternalTarget(this, Item);
}
public void Target(IPoint3D p, Item item)
{
if (!Caster.CanSee(p))
{
Caster.SendLocalizedMessage(500237); // Target can not be seen.
}
else if (SpellHelper.CheckTown(p, Caster) && (item != null || CheckSequence()))
{
if (item != null)
{
if (item is MaskOfKhalAnkur)
{
((MaskOfKhalAnkur)item).Charges--;
}
if (item is PendantOfKhalAnkur)
{
((PendantOfKhalAnkur)item).Charges--;
}
}
SpellHelper.Turn(Caster, p);
if (p is Item)
p = ((Item)p).GetWorldLocation();
var targets = AcquireIndirectTargets(p, 2).ToList();
var count = Math.Max(1, targets.Count);
if (count > 0)
{
Effects.PlaySound(p, Caster.Map, 0x160);
}
foreach (var id in targets)
{
Mobile m = id as Mobile;
double damage;
if (Core.AOS)
damage = GetNewAosDamage(51, 1, 5, id is PlayerMobile, id);
else
damage = Utility.Random(27, 22);
if (Core.AOS && count > 2)
damage = (damage * 2) / count;
else if (!Core.AOS)
damage /= count;
if (!Core.AOS && m != null && CheckResisted(m))
{
damage *= 0.5;
m.SendLocalizedMessage(501783); // You feel yourself resisting magical energy.
}
IDamageable source = Caster;
IDamageable target = id;
if (SpellHelper.CheckReflect((int)Circle, ref source, ref target, SpellDamageType))
{
Timer.DelayCall(TimeSpan.FromSeconds(.5), () =>
{
source.MovingParticles(target, item != null ? 0xA1ED : 0x36D4, 7, 0, false, true, 9501, 1, 0, 0x100);
});
}
if (m != null)
{
damage *= GetDamageScalar(m);
}
Caster.DoHarmful(id);
SpellHelper.Damage(this, target, damage, 0, 100, 0, 0, 0);
Caster.MovingParticles(id, item != null ? 0xA1ED : 0x36D4, 7, 0, false, true, 9501, 1, 0, 0x100);
}
ColUtility.Free(targets);
}
FinishSequence();
}
private class InternalTarget : Target
{
private readonly MeteorSwarmSpell m_Owner;
private readonly Item m_Item;
public InternalTarget(MeteorSwarmSpell owner, Item item)
: base(Core.ML ? 10 : 12, true, TargetFlags.None)
{
m_Owner = owner;
m_Item = item;
}
protected override void OnTarget(Mobile from, object o)
{
IPoint3D p = o as IPoint3D;
if (p != null)
m_Owner.Target(p, m_Item);
}
protected override void OnTargetFinish(Mobile from)
{
m_Owner.FinishSequence();
}
}
}
}

View File

@@ -0,0 +1,253 @@
using System;
using System.Collections;
using Server.Gumps;
using Server.Items;
using Server.Spells.Fifth;
namespace Server.Spells.Seventh
{
public class PolymorphSpell : MagerySpell
{
private static readonly SpellInfo m_Info = new SpellInfo(
"Polymorph", "Vas Ylem Rel",
221,
9002,
Reagent.Bloodmoss,
Reagent.SpidersSilk,
Reagent.MandrakeRoot);
private static readonly Hashtable m_Timers = new Hashtable();
private readonly int m_NewBody;
public PolymorphSpell(Mobile caster, Item scroll, int body)
: base(caster, scroll, m_Info)
{
this.m_NewBody = body;
}
public PolymorphSpell(Mobile caster, Item scroll)
: this(caster,scroll,0)
{
}
public override SpellCircle Circle
{
get
{
return SpellCircle.Seventh;
}
}
public static bool StopTimer(Mobile m)
{
Timer t = (Timer)m_Timers[m];
if (t != null)
{
t.Stop();
m_Timers.Remove(m);
}
return (t != null);
}
public override bool CheckCast()
{
if (Caster.Flying)
{
Caster.SendLocalizedMessage(1113415); // You cannot use this ability while flying.
return false;
}
else
if (Factions.Sigil.ExistsOn(this.Caster))
{
this.Caster.SendLocalizedMessage(1010521); // You cannot polymorph while you have a Town Sigil
return false;
}
else if (TransformationSpellHelper.UnderTransformation(this.Caster))
{
this.Caster.SendLocalizedMessage(1061633); // You cannot polymorph while in that form.
return false;
}
else if (DisguiseTimers.IsDisguised(this.Caster))
{
this.Caster.SendLocalizedMessage(502167); // You cannot polymorph while disguised.
return false;
}
else if (this.Caster.BodyMod == 183 || this.Caster.BodyMod == 184)
{
this.Caster.SendLocalizedMessage(1042512); // You cannot polymorph while wearing body paint
return false;
}
else if (!this.Caster.CanBeginAction(typeof(PolymorphSpell)))
{
if (Core.ML)
EndPolymorph(this.Caster);
else
this.Caster.SendLocalizedMessage(1005559); // This spell is already in effect.
return false;
}
else if (this.m_NewBody == 0)
{
Gump gump;
if (Core.SE)
gump = new NewPolymorphGump(this.Caster, this.Scroll);
else
gump = new PolymorphGump(this.Caster, this.Scroll);
this.Caster.SendGump(gump);
return false;
}
return true;
}
public override void OnCast()
{
if (Caster.Flying)
{
Caster.SendLocalizedMessage(1113415); // You cannot use this ability while flying.
}
else
if (Factions.Sigil.ExistsOn(this.Caster))
{
this.Caster.SendLocalizedMessage(1010521); // You cannot polymorph while you have a Town Sigil
}
else if (!this.Caster.CanBeginAction(typeof(PolymorphSpell)))
{
if (Core.ML)
EndPolymorph(this.Caster);
else
this.Caster.SendLocalizedMessage(1005559); // This spell is already in effect.
}
else if (TransformationSpellHelper.UnderTransformation(this.Caster))
{
this.Caster.SendLocalizedMessage(1061633); // You cannot polymorph while in that form.
}
else if (DisguiseTimers.IsDisguised(this.Caster))
{
this.Caster.SendLocalizedMessage(502167); // You cannot polymorph while disguised.
}
else if (this.Caster.BodyMod == 183 || this.Caster.BodyMod == 184)
{
this.Caster.SendLocalizedMessage(1042512); // You cannot polymorph while wearing body paint
}
else if (!this.Caster.CanBeginAction(typeof(IncognitoSpell)) || this.Caster.IsBodyMod)
{
this.DoFizzle();
}
else if (this.CheckSequence())
{
if (this.Caster.BeginAction(typeof(PolymorphSpell)))
{
if (this.m_NewBody != 0)
{
if (!((Body)this.m_NewBody).IsHuman)
{
Mobiles.IMount mt = this.Caster.Mount;
if (mt != null)
mt.Rider = null;
}
this.Caster.BodyMod = this.m_NewBody;
if (this.m_NewBody == 400 || this.m_NewBody == 401)
this.Caster.HueMod = Utility.RandomSkinHue();
else
this.Caster.HueMod = 0;
BaseArmor.ValidateMobile(this.Caster);
BaseClothing.ValidateMobile(this.Caster);
if (!Core.ML)
{
StopTimer(this.Caster);
Timer t = new InternalTimer(this.Caster);
m_Timers[this.Caster] = t;
BuffInfo.AddBuff(Caster, new BuffInfo(BuffIcon.Polymorph, 1075824, 1075823, t.Delay, Caster, String.Format("{0}\t{1}", GetArticleCliloc(m_NewBody), GetFormCliloc(m_NewBody))));
t.Start();
}
}
}
else
{
this.Caster.SendLocalizedMessage(1005559); // This spell is already in effect.
}
}
this.FinishSequence();
}
private static TextDefinition GetArticleCliloc(int body)
{
if (body == 0x11 || body == 0x01)
return "an";
return "a";
}
private static TextDefinition GetFormCliloc(int body)
{
switch (body)
{
case 0xD9: return 1028476; // dog
case 0xE1: return 1028482; // wolf
case 0xD6: return 1028450; // panther
case 0x1D: return 1028437; // gorilla
case 0xD3: return 1028472; // black bear
case 0xD4: return 1028478; // grizzly bear
case 0xD5: return 1018276; // polar bear
case 0x190: return 1028454; // human male
case 0x191: return 1028455; // human female
case 0x11: return 1018110; // orc
case 0x21: return 1018128; // lizardman
case 0x04: return 1018097; // gargoyle
case 0x01: return 1018094; // ogre
case 0x36: return 1018147; // troll
case 0x02: return 1018111; // ettin
case 0x09: return 1018103; // daemon
default: return -1;
}
}
public static void EndPolymorph(Mobile m)
{
if (!m.CanBeginAction(typeof(PolymorphSpell)))
{
m.BodyMod = 0;
m.HueMod = -1;
m.EndAction(typeof(PolymorphSpell));
BaseArmor.ValidateMobile(m);
BaseClothing.ValidateMobile(m);
BuffInfo.RemoveBuff(m, BuffIcon.Polymorph);
}
}
private class InternalTimer : Timer
{
private readonly Mobile m_Owner;
public InternalTimer(Mobile owner)
: base(TimeSpan.FromSeconds(0))
{
this.m_Owner = owner;
int val = (int)owner.Skills[SkillName.Magery].Value;
if (val > 120)
val = 120;
this.Delay = TimeSpan.FromSeconds(val);
this.Priority = TimerPriority.OneSecond;
}
protected override void OnTick()
{
EndPolymorph(this.m_Owner);
}
}
}
}