Clean up: Bugs, LINQ, constructors, default values, and null checks (#18)

This commit is contained in:
Kamron Batman 2019-03-11 14:29:59 -07:00 committed by GitHub
parent e748af4430
commit 513e54f70e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
1094 changed files with 15913 additions and 21892 deletions

View file

@ -236,7 +236,7 @@ namespace Server.Spells
return false;
}
if (move != null && !move.Validate(m))
if (move?.Validate(m) == false)
{
ClearCurrentMove(m);
return false;

View file

@ -313,13 +313,12 @@ namespace Server.Spells
SlayerEntry atkSlayer = SlayerGroup.GetEntryByName(atkBook.Slayer);
SlayerEntry atkSlayer2 = SlayerGroup.GetEntryByName(atkBook.Slayer2);
if (atkSlayer != null && atkSlayer.Slays(defender) || atkSlayer2 != null && atkSlayer2.Slays(defender))
if (atkSlayer?.Slays(defender) == true || atkSlayer2?.Slays(defender) == true)
{
defender.FixedEffect(0x37B9, 10, 5); //TODO: Confirm this displays on OSIs
scalar = 2.0;
}
TransformContext context = TransformationSpellHelper.GetContext(defender);
if ((atkBook.Slayer == SlayerName.Silver || atkBook.Slayer2 == SlayerName.Silver) && context != null &&
@ -330,18 +329,15 @@ namespace Server.Spells
return scalar;
}
ISlayer defISlayer = Spellbook.FindEquippedSpellbook(defender);
if (defISlayer == null)
defISlayer = defender.Weapon as ISlayer;
ISlayer defISlayer = Spellbook.FindEquippedSpellbook(defender) ?? defender.Weapon as ISlayer;
if (defISlayer != null)
{
SlayerEntry defSlayer = SlayerGroup.GetEntryByName(defISlayer.Slayer);
SlayerEntry defSlayer2 = SlayerGroup.GetEntryByName(defISlayer.Slayer2);
if (defSlayer != null && defSlayer.Group.OppositionSuperSlays(Caster) ||
defSlayer2 != null && defSlayer2.Group.OppositionSuperSlays(Caster))
if (defSlayer?.Group.OppositionSuperSlays(Caster) == true ||
defSlayer2?.Group.OppositionSuperSlays(Caster) == true)
scalar = 2.0;
}

View file

@ -286,7 +286,7 @@ namespace Server.Spells
StatMod mod = target.GetStatMod(name);
if (mod != null && mod.Offset < 0)
if (mod?.Offset < 0)
{
target.AddStatMod(new StatMod(type, name, mod.Offset + offset, duration));
return true;
@ -313,7 +313,7 @@ namespace Server.Spells
StatMod mod = target.GetStatMod(name);
if (mod != null && mod.Offset > 0)
if (mod?.Offset > 0)
{
target.AddStatMod(new StatMod(type, name, mod.Offset + offset, duration));
return true;
@ -420,20 +420,19 @@ namespace Server.Spells
PlayerMobile pmFrom;
PlayerMobile pmTarg;
if (bcFrom != null && bcFrom.Summoned)
if (bcFrom?.Summoned == true)
pmFrom = bcFrom.SummonMaster as PlayerMobile;
else
pmFrom = from as PlayerMobile;
if (bcTarg != null && bcTarg.Summoned)
if (bcTarg?.Summoned == true)
pmTarg = bcTarg.SummonMaster as PlayerMobile;
else
pmTarg = to as PlayerMobile;
if (pmFrom != null && pmTarg != null)
if (pmFrom.DuelContext != null && pmFrom.DuelContext == pmTarg.DuelContext && pmFrom.DuelContext.Started &&
pmFrom.DuelPlayer != null && pmTarg.DuelPlayer != null)
return pmFrom.DuelPlayer.Participant != pmTarg.DuelPlayer.Participant;
if (pmFrom?.DuelContext != null && pmFrom.DuelContext == pmTarg?.DuelContext && pmFrom.DuelContext.Started &&
pmFrom.DuelPlayer != null && pmTarg?.DuelPlayer != null)
return pmFrom.DuelPlayer.Participant != pmTarg.DuelPlayer.Participant;
#endregion
@ -445,7 +444,7 @@ namespace Server.Spells
Party p = Party.Get(from);
if (p != null && p.Contains(to))
if (p?.Contains(to) == true)
return false;
if (bcTarg != null && (bcTarg.Controlled || bcTarg.Summoned))
@ -468,12 +467,8 @@ namespace Server.Spells
return false;
}
if (bcTarg != null && !bcTarg.Controlled && bcTarg.InitialInnocent)
return true;
int noto = Notoriety.Compute(from, to);
return noto != Notoriety.Innocent || from.Kills >= 5;
return bcTarg?.Controlled == false && bcTarg.InitialInnocent ||
Notoriety.Compute(from, to) != Notoriety.Innocent || from.Kills >= 5;
}
public static void Summon(BaseCreature creature, Mobile caster, int sound, TimeSpan duration, bool scaleDuration,
@ -617,7 +612,7 @@ namespace Server.Spells
return false;
}
if (caster != null && caster.AccessLevel == AccessLevel.Player && caster.Region.IsPartOf<Jail>())
if (caster?.AccessLevel == AccessLevel.Player && caster.Region.IsPartOf<Jail>())
{
caster.SendLocalizedMessage(1114345); // You'll need a better jailbreak plan than that!
return false;
@ -722,18 +717,12 @@ namespace Server.Spells
public static bool IsSafeZone(Map map, Point3D loc)
{
#region Duels
if (Region.Find(loc, map).IsPartOf<SafeZone>())
if (Region.Find(loc, map).IsPartOf<SafeZone>() &&
(m_TravelType == TravelCheckType.TeleportTo || m_TravelType == TravelCheckType.TeleportFrom)
&& (m_TravelCaster as PlayerMobile)?.DuelPlayer?.Eliminated == false)
{
if (m_TravelType == TravelCheckType.TeleportTo || m_TravelType == TravelCheckType.TeleportFrom)
{
if (m_TravelCaster is PlayerMobile pm && pm.DuelPlayer != null && !pm.DuelPlayer.Eliminated)
return true;
}
return true;
}
#endregion
return false;
@ -855,22 +844,18 @@ namespace Server.Spells
return false;
#region Dueling
SafeZone sz = Region.Find(loc, map).GetRegion<SafeZone>();
if (sz != null)
if (Region.Find(loc, map).GetRegion<SafeZone>() != null)
{
PlayerMobile pm = caster as PlayerMobile;
if (pm?.DuelContext == null || !pm.DuelContext.Started || pm.DuelPlayer == null || pm.DuelPlayer.Eliminated)
if (pm.DuelContext?.Started != true || pm.DuelPlayer?.Eliminated != false)
return true;
}
#endregion
GuardedRegion reg = Region.Find(loc, map).GetRegion<GuardedRegion>();
return reg != null && !reg.IsDisabled();
return reg?.IsDisabled() == false;
}
public static bool CheckTown(IPoint3D ip, Mobile caster)
@ -1047,6 +1032,7 @@ namespace Server.Spells
int wraithLeech =
5 + (int)(15 * from.Skills.SpiritSpeak.Value / 100); // Wraith form gives 5-20% mana leech
int manaLeech = AOS.Scale(damageGiven, wraithLeech);
if (manaLeech != 0)
{
from.Mana += manaLeech;
@ -1060,12 +1046,7 @@ namespace Server.Spells
}
}
public static void Heal(int amount, Mobile target, Mobile from)
{
Heal(amount, target, from, true);
}
public static void Heal(int amount, Mobile target, Mobile from, bool message)
public static void Heal(int amount, Mobile target, Mobile from, bool message = true)
{
//TODO: All Healing *spells* go through ArcaneEmpowerment
target.Heal(amount, from, message);
@ -1087,7 +1068,7 @@ namespace Server.Spells
m_Damage = damage;
m_Spell = s;
if (m_Spell != null && m_Spell.DelayedDamage && !m_Spell.DelayedDamageStacking)
if (m_Spell?.DelayedDamage == true && !m_Spell.DelayedDamageStacking)
m_Spell.StartDelayedDamageContext(target, this);
Priority = TimerPriority.TwentyFiveMS;
@ -1127,7 +1108,7 @@ namespace Server.Spells
m_Chaos = chaos;
m_DFA = dfa;
m_Spell = s;
if (m_Spell != null && m_Spell.DelayedDamage && !m_Spell.DelayedDamageStacking)
if (m_Spell?.DelayedDamage == true && !m_Spell.DelayedDamageStacking)
m_Spell.StartDelayedDamageContext(target, this);
Priority = TimerPriority.TwentyFiveMS;
@ -1333,9 +1314,7 @@ namespace Server.Spells
public static bool UnderTransformation(Mobile m, Type type)
{
TransformContext context = GetContext(m);
return context != null && context.Type == type;
return GetContext(m)?.Type == type;
}
#endregion

View file

@ -125,7 +125,7 @@ namespace Server.Spells
Type t = m_Types[spellID];
if (t != null && !t.IsSubclassOf(typeof(SpecialMove)))
if (t?.IsSubclassOf(typeof(SpecialMove)) == false)
{
m_Params[0] = caster;
m_Params[1] = scroll;
@ -136,6 +136,7 @@ namespace Server.Spells
}
catch
{
// ignored
}
}
@ -148,7 +149,7 @@ namespace Server.Spells
{
Type t = ScriptCompiler.FindTypeByFullName($"Server.Spells.{m_CircleNames[i]}.{name}");
if (t != null && !t.IsSubclassOf(typeof(SpecialMove)))
if (t?.IsSubclassOf(typeof(SpecialMove)) == false)
{
m_Params[0] = caster;
m_Params[1] = scroll;
@ -159,6 +160,7 @@ namespace Server.Spells
}
catch
{
// ignored
}
}
}

View file

@ -1,5 +1,4 @@
using System;
using System.Collections;
using System.Collections.Generic;
namespace Server.Spells.Bushido

View file

@ -1,5 +1,4 @@
using System;
using System.Collections;
using System.Collections.Generic;
using Server.Items;

View file

@ -1,5 +1,4 @@
using System;
using System.Collections;
using System.Collections.Generic;
using Server.Items;

View file

@ -1,5 +1,4 @@
using System;
using System.Collections;
using System.Collections.Generic;
namespace Server.Spells.Bushido
@ -103,7 +102,7 @@ namespace Server.Spells.Bushido
public int m_SwingBonus;
public Timer m_Timer;
public HonorableExecutionInfo(Mobile from, List<object> mods) : this(from, 0, mods, true)
public HonorableExecutionInfo(Mobile from, List<object> mods) : this(from, 0, mods, mods != null)
{
}

View file

@ -1,4 +1,5 @@
using System.Collections.Generic;
using System.Linq;
using Server.Items;
namespace Server.Spells.Bushido
@ -20,46 +21,35 @@ namespace Server.Spells.Bushido
BaseWeapon weapon = attacker.Weapon as BaseWeapon;
List<Mobile> targets = new List<Mobile>();
List<Mobile> targets = attacker.GetMobilesInRange(weapon.MaxRange)
.Where(m => m != defender).Where(m => m.Combatant == attacker).ToList();
foreach (Mobile m in attacker.GetMobilesInRange(weapon.MaxRange))
{
if (m == defender)
continue;
if (m.Combatant != attacker)
continue;
targets.Add(m);
}
if (targets.Count > 0)
{
if (!CheckMana(attacker, true))
return;
Mobile target = targets[Utility.Random(targets.Count)];
double damageBonus = attacker.Skills.Bushido.Value / 100.0;
if (!defender.Alive)
damageBonus *= 1.5;
attacker.SendLocalizedMessage(1063171); // You transfer the momentum of your weapon into another enemy!
target.SendLocalizedMessage(1063172); // You were hit by the momentum of a Samurai's weapon!
target.FixedParticles(0x37B9, 1, 4, 0x251D, 0, 0, EffectLayer.Waist);
attacker.PlaySound(0x510);
weapon.OnSwing(attacker, target, damageBonus);
CheckGain(attacker);
}
else
if (targets.Count <= 0)
{
attacker.SendLocalizedMessage(1063123); // There are no valid targets to attack!
return;
}
if (!CheckMana(attacker, true))
return;
Mobile target = targets[Utility.Random(targets.Count)];
double damageBonus = attacker.Skills.Bushido.Value / 100.0;
if (!defender.Alive)
damageBonus *= 1.5;
attacker.SendLocalizedMessage(1063171); // You transfer the momentum of your weapon into another enemy!
target.SendLocalizedMessage(1063172); // You were hit by the momentum of a Samurai's weapon!
target.FixedParticles(0x37B9, 1, 4, 0x251D, 0, 0, EffectLayer.Waist);
attacker.PlaySound(0x510);
weapon.OnSwing(attacker, target, damageBonus);
CheckGain(attacker);
}
public override void CheckGain(Mobile m)
@ -67,4 +57,4 @@ namespace Server.Spells.Bushido
m.CheckSkill(MoveSkill, RequiredSkill, 120.0);
}
}
}
}

View file

@ -27,13 +27,7 @@ namespace Server.Spells.Bushido
public static bool CheckExpansion(Mobile from)
{
if (!(from is PlayerMobile))
return true;
if (from.NetState == null)
return false;
return from.NetState.SupportsExpansion(Expansion.SE);
return (from as PlayerMobile)?.NetState?.SupportsExpansion(Expansion.SE) == true;
}
public override bool CheckCast()
@ -129,4 +123,4 @@ namespace Server.Spells.Bushido
caster.Send(new ToggleSpecialAbility(spellID + 1, false));
}
}
}
}

View file

@ -12,7 +12,7 @@ namespace Server.Spells.Chivalry
9002
);
public CleanseByFireSpell(Mobile caster, Item scroll) : base(caster, scroll, m_Info)
public CleanseByFireSpell(Mobile caster, Item scroll = null) : base(caster, scroll, m_Info)
{
}
@ -123,4 +123,4 @@ namespace Server.Spells.Chivalry
}
}
}
}
}

View file

@ -15,7 +15,7 @@ namespace Server.Spells.Chivalry
9002
);
public CloseWoundsSpell(Mobile caster, Item scroll) : base(caster, scroll, m_Info)
public CloseWoundsSpell(Mobile caster, Item scroll = null) : base(caster, scroll, m_Info)
{
}
@ -112,4 +112,4 @@ namespace Server.Spells.Chivalry
}
}
}
}
}

View file

@ -1,5 +1,4 @@
using System;
using System.Collections;
using System.Collections.Generic;
using Server.Items;
@ -15,7 +14,7 @@ namespace Server.Spells.Chivalry
private static Dictionary<BaseWeapon, ExpireTimer> m_Table = new Dictionary<BaseWeapon, ExpireTimer>();
public ConsecrateWeaponSpell(Mobile caster, Item scroll) : base(caster, scroll, m_Info)
public ConsecrateWeaponSpell(Mobile caster, Item scroll = null) : base(caster, scroll, m_Info)
{
}

View file

@ -1,5 +1,6 @@
using System;
using System.Collections.Generic;
using System.Linq;
using Server.Items;
using Server.Mobiles;
using Server.Spells.Necromancy;
@ -14,7 +15,7 @@ namespace Server.Spells.Chivalry
9002
);
public DispelEvilSpell(Mobile caster, Item scroll) : base(caster, scroll, m_Info)
public DispelEvilSpell(Mobile caster, Item scroll = null) : base(caster, scroll, m_Info)
{
}
@ -37,12 +38,6 @@ namespace Server.Spells.Chivalry
{
if (CheckSequence())
{
List<Mobile> targets = new List<Mobile>();
foreach (Mobile m in Caster.GetMobilesInRange(8))
if (Caster != m && SpellHelper.ValidIndirectTarget(Caster, m) && Caster.CanBeHarmful(m, false))
targets.Add(m);
Caster.PlaySound(0xF5);
Caster.PlaySound(0x299);
Caster.FixedParticles(0x37C4, 1, 25, 9922, 14, 3, EffectLayer.Head);
@ -51,10 +46,11 @@ namespace Server.Spells.Chivalry
double chiv = Caster.Skills.Chivalry.Value;
for (int i = 0; i < targets.Count; ++i)
{
Mobile m = targets[i];
IEnumerable<Mobile> targets = Caster.GetMobilesInRange(8)
.Where(m => Caster != m && SpellHelper.ValidIndirectTarget(Caster, m) && Caster.CanBeHarmful(m, false));
foreach (Mobile m in targets)
{
if (m is BaseCreature bc)
{
if (bc.Summoned && !bc.IsAnimatedDead)
@ -106,4 +102,4 @@ namespace Server.Spells.Chivalry
FinishSequence();
}
}
}
}

View file

@ -1,5 +1,4 @@
using System;
using System.Collections;
using System.Collections.Generic;
namespace Server.Spells.Chivalry
@ -14,7 +13,7 @@ namespace Server.Spells.Chivalry
private static Dictionary<Mobile, Timer> m_Table = new Dictionary<Mobile, Timer>();
public DivineFurySpell(Mobile caster, Item scroll) : base(caster, scroll, m_Info)
public DivineFurySpell(Mobile caster, Item scroll = null) : base(caster, scroll, m_Info)
{
}

View file

@ -1,5 +1,4 @@
using System;
using System.Collections;
using System.Collections.Generic;
using Server.Mobiles;
@ -15,7 +14,7 @@ namespace Server.Spells.Chivalry
private static Dictionary<Mobile, Timer> m_Table = new Dictionary<Mobile, Timer>();
public EnemyOfOneSpell(Mobile caster, Item scroll) : base(caster, scroll, m_Info)
public EnemyOfOneSpell(Mobile caster, Item scroll = null) : base(caster, scroll, m_Info)
{
}

View file

@ -1,5 +1,6 @@
using System;
using System.Collections.Generic;
using System.Linq;
using Server.Items;
namespace Server.Spells.Chivalry
@ -12,7 +13,7 @@ namespace Server.Spells.Chivalry
9002
);
public HolyLightSpell(Mobile caster, Item scroll) : base(caster, scroll, m_Info)
public HolyLightSpell(Mobile caster, Item scroll = null) : base(caster, scroll, m_Info)
{
}
@ -30,13 +31,6 @@ namespace Server.Spells.Chivalry
{
if (CheckSequence())
{
List<Mobile> targets = new List<Mobile>();
foreach (Mobile m in Caster.GetMobilesInRange(3))
if (Caster != m && SpellHelper.ValidIndirectTarget(Caster, m) && Caster.CanBeHarmful(m, false) &&
(!Core.AOS || Caster.InLOS(m)))
targets.Add(m);
Caster.PlaySound(0x212);
Caster.PlaySound(0x206);
@ -46,10 +40,12 @@ namespace Server.Spells.Chivalry
EffectItem.Create(new Point3D(Caster.X, Caster.Y, Caster.Z - 7), Caster.Map, EffectItem.DefaultDuration),
0x37C4, 1, 29, 0x47D, 2, 9502, 0);
for (int i = 0; i < targets.Count; ++i)
{
Mobile m = targets[i];
IEnumerable<Mobile> targets = Caster.GetMobilesInRange(3)
.Where(m => Caster != m && SpellHelper.ValidIndirectTarget(Caster, m) && Caster.CanBeHarmful(m, false) &&
(!Core.AOS || Caster.InLOS(m)));
foreach (Mobile m in targets)
{
int damage = ComputePowerValue(10) + Utility.RandomMinMax(0, 2);
// TODO: Should caps be applied?
@ -66,4 +62,4 @@ namespace Server.Spells.Chivalry
FinishSequence();
}
}
}
}

View file

@ -14,7 +14,7 @@ namespace Server.Spells.Chivalry
9002
);
public NobleSacrificeSpell(Mobile caster, Item scroll) : base(caster, scroll, m_Info)
public NobleSacrificeSpell(Mobile caster, Item scroll = null) : base(caster, scroll, m_Info)
{
}
@ -109,21 +109,21 @@ namespace Server.Spells.Chivalry
StatMod mod;
mod = m.GetStatMod("[Magic] Str Offset");
if (mod != null && mod.Offset < 0)
if (mod?.Offset < 0)
{
m.RemoveStatMod("[Magic] Str Offset");
sendEffect = true;
}
mod = m.GetStatMod("[Magic] Dex Offset");
if (mod != null && mod.Offset < 0)
if (mod?.Offset < 0)
{
m.RemoveStatMod("[Magic] Dex Offset");
sendEffect = true;
}
mod = m.GetStatMod("[Magic] Int Offset");
if (mod != null && mod.Offset < 0)
if (mod?.Offset < 0)
{
m.RemoveStatMod("[Magic] Int Offset");
sendEffect = true;
@ -166,4 +166,4 @@ namespace Server.Spells.Chivalry
FinishSequence();
}
}
}
}

View file

@ -15,7 +15,7 @@ namespace Server.Spells.Chivalry
9002
);
public RemoveCurseSpell(Mobile caster, Item scroll) : base(caster, scroll, m_Info)
public RemoveCurseSpell(Mobile caster, Item scroll = null) : base(caster, scroll, m_Info)
{
}
@ -77,15 +77,15 @@ namespace Server.Spells.Chivalry
0x100);
StatMod mod = m.GetStatMod("[Magic] Str Offset");
if (mod != null && mod.Offset < 0)
if (mod?.Offset < 0)
m.RemoveStatMod("[Magic] Str Offset");
mod = m.GetStatMod("[Magic] Dex Offset");
if (mod != null && mod.Offset < 0)
if (mod?.Offset < 0)
m.RemoveStatMod("[Magic] Dex Offset");
mod = m.GetStatMod("[Magic] Int Offset");
if (mod != null && mod.Offset < 0)
if (mod?.Offset < 0)
m.RemoveStatMod("[Magic] Int Offset");
m.Paralyzed = false;
@ -138,4 +138,4 @@ namespace Server.Spells.Chivalry
}
}
}
}
}

View file

@ -21,8 +21,8 @@ namespace Server.Spells.Chivalry
private RunebookEntry m_Entry;
public SacredJourneySpell(Mobile caster, Item scroll, RunebookEntry entry = null, Runebook book = null) : base(caster, scroll,
m_Info)
public SacredJourneySpell(Mobile caster, RunebookEntry entry = null, Runebook book = null, Item scroll = null) :
base(caster, scroll, m_Info)
{
m_Entry = entry;
m_Book = book;
@ -198,4 +198,4 @@ namespace Server.Spells.Chivalry
}
}
}
}
}

View file

@ -15,7 +15,7 @@ namespace Server.Spells.Eighth
Reagent.SpidersSilk
);
public AirElementalSpell(Mobile caster, Item scroll) : base(caster, scroll, m_Info)
public AirElementalSpell(Mobile caster, Item scroll = null) : base(caster, scroll, m_Info)
{
}
@ -50,4 +50,4 @@ namespace Server.Spells.Eighth
FinishSequence();
}
}
}
}

View file

@ -15,7 +15,7 @@ namespace Server.Spells.Eighth
Reagent.SpidersSilk
);
public EarthElementalSpell(Mobile caster, Item scroll) : base(caster, scroll, m_Info)
public EarthElementalSpell(Mobile caster, Item scroll = null) : base(caster, scroll, m_Info)
{
}
@ -50,4 +50,4 @@ namespace Server.Spells.Eighth
FinishSequence();
}
}
}
}

View file

@ -1,5 +1,6 @@
using System;
using System.Collections.Generic;
using System.Linq;
namespace Server.Spells.Eighth
{
@ -16,7 +17,7 @@ namespace Server.Spells.Eighth
Reagent.SulfurousAsh
);
public EarthquakeSpell(Mobile caster, Item scroll) : base(caster, scroll, m_Info)
public EarthquakeSpell(Mobile caster, Item scroll = null) : base(caster, scroll, m_Info)
{
}
@ -28,22 +29,19 @@ namespace Server.Spells.Eighth
{
if (SpellHelper.CheckTown(Caster, Caster) && CheckSequence())
{
List<Mobile> targets = new List<Mobile>();
Map map = Caster.Map;
if (map != null)
foreach (Mobile m in Caster.GetMobilesInRange(1 + (int)(Caster.Skills.Magery.Value / 15.0)))
if (Caster != m && SpellHelper.ValidIndirectTarget(Caster, m) && Caster.CanBeHarmful(m, false) &&
(!Core.AOS || Caster.InLOS(m)))
targets.Add(m);
Caster.PlaySound(0x220);
for (int i = 0; i < targets.Count; ++i)
if (Caster.Map == null)
{
Mobile m = targets[i];
FinishSequence();
return;
}
IEnumerable<Mobile> targets = Caster.GetMobilesInRange(1 + (int)(Caster.Skills.Magery.Value / 15.0))
.Where(m => Caster != m && SpellHelper.ValidIndirectTarget(Caster, m) && Caster.CanBeHarmful(m, false) && (!Core.AOS || Caster.InLOS(m)));
foreach (Mobile m in targets)
{
int damage;
if (Core.AOS)
@ -72,4 +70,4 @@ namespace Server.Spells.Eighth
FinishSequence();
}
}
}
}

View file

@ -17,7 +17,7 @@ namespace Server.Spells.Eighth
Reagent.Nightshade
);
public EnergyVortexSpell(Mobile caster, Item scroll) : base(caster, scroll, m_Info)
public EnergyVortexSpell(Mobile caster, Item scroll = null) : base(caster, scroll, m_Info)
{
}
@ -96,4 +96,4 @@ namespace Server.Spells.Eighth
}
}
}
}
}

View file

@ -16,7 +16,7 @@ namespace Server.Spells.Eighth
Reagent.SulfurousAsh
);
public FireElementalSpell(Mobile caster, Item scroll) : base(caster, scroll, m_Info)
public FireElementalSpell(Mobile caster, Item scroll = null) : base(caster, scroll, m_Info)
{
}
@ -51,4 +51,4 @@ namespace Server.Spells.Eighth
FinishSequence();
}
}
}
}

View file

@ -15,7 +15,7 @@ namespace Server.Spells.Eighth
Reagent.Ginseng
);
public ResurrectionSpell(Mobile caster, Item scroll) : base(caster, scroll, m_Info)
public ResurrectionSpell(Mobile caster, Item scroll = null) : base(caster, scroll, m_Info)
{
}
@ -108,4 +108,4 @@ namespace Server.Spells.Eighth
}
}
}
}
}

View file

@ -16,7 +16,7 @@ namespace Server.Spells.Eighth
Reagent.SulfurousAsh
);
public SummonDaemonSpell(Mobile caster, Item scroll) : base(caster, scroll, m_Info)
public SummonDaemonSpell(Mobile caster, Item scroll = null) : base(caster, scroll, m_Info)
{
}
@ -57,4 +57,4 @@ namespace Server.Spells.Eighth
FinishSequence();
}
}
}
}

View file

@ -15,7 +15,7 @@ namespace Server.Spells.Eighth
Reagent.SpidersSilk
);
public WaterElementalSpell(Mobile caster, Item scroll) : base(caster, scroll, m_Info)
public WaterElementalSpell(Mobile caster, Item scroll = null) : base(caster, scroll, m_Info)
{
}
@ -50,4 +50,4 @@ namespace Server.Spells.Eighth
FinishSequence();
}
}
}
}

View file

@ -16,7 +16,7 @@ namespace Server.Spells.Fifth
Reagent.Nightshade
);
public BladeSpiritsSpell(Mobile caster, Item scroll) : base(caster, scroll, m_Info)
public BladeSpiritsSpell(Mobile caster, Item scroll = null) : base(caster, scroll, m_Info)
{
}
@ -103,4 +103,4 @@ namespace Server.Spells.Fifth
}
}
}
}
}

View file

@ -17,7 +17,7 @@ namespace Server.Spells.Fifth
Reagent.Garlic
);
public DispelFieldSpell(Mobile caster, Item scroll) : base(caster, scroll, m_Info)
public DispelFieldSpell(Mobile caster, Item scroll = null) : base(caster, scroll, m_Info)
{
}
@ -81,4 +81,4 @@ namespace Server.Spells.Fifth
}
}
}
}
}

View file

@ -1,5 +1,4 @@
using System;
using System.Collections;
using System.Collections.Generic;
using Server.Factions;
using Server.Items;
@ -21,7 +20,7 @@ namespace Server.Spells.Fifth
private static Dictionary<Mobile, InternalTimer> m_Timers = new Dictionary<Mobile, InternalTimer>();
public IncognitoSpell(Mobile caster, Item scroll) : base(caster, scroll, m_Info)
public IncognitoSpell(Mobile caster, Item scroll = null) : base(caster, scroll, m_Info)
{
}

View file

@ -1,4 +1,3 @@
using System.Collections;
using System.Collections.Generic;
namespace Server.Spells.Fifth
@ -16,7 +15,7 @@ namespace Server.Spells.Fifth
private static Dictionary<Mobile, ResistanceMod[]> m_Table = new Dictionary<Mobile, ResistanceMod[]>();
public MagicReflectSpell(Mobile caster, Item scroll) : base(caster, scroll, m_Info)
public MagicReflectSpell(Mobile caster, Item scroll = null) : base(caster, scroll, m_Info)
{
}
@ -79,7 +78,7 @@ namespace Server.Spells.Fifth
for (int i = 0; i < mods.Length; ++i)
targ.AddResistanceMod(mods[i]);
string buffFormat = string.Format("{0}\t+{1}\t+{1}\t+{1}\t+{1}", physiMod, otherMod);
string buffFormat = $"{physiMod}\t+{otherMod}\t+{otherMod}\t+{otherMod}\t+{otherMod}";
BuffInfo.AddBuff(targ, new BuffInfo(BuffIcon.MagicReflection, 1075817, buffFormat, true));
}

View file

@ -15,7 +15,7 @@ namespace Server.Spells.Fifth
Reagent.SulfurousAsh
);
public MindBlastSpell(Mobile caster, Item scroll) : base(caster, scroll, m_Info)
public MindBlastSpell(Mobile caster, Item scroll = null) : base(caster, scroll, m_Info)
{
if (Core.AOS)
m_Info.LeftHandEffect = m_Info.RightHandEffect = 9002;
@ -144,4 +144,4 @@ namespace Server.Spells.Fifth
}
}
}
}
}

View file

@ -16,7 +16,7 @@ namespace Server.Spells.Fifth
Reagent.SpidersSilk
);
public ParalyzeSpell(Mobile caster, Item scroll) : base(caster, scroll, m_Info)
public ParalyzeSpell(Mobile caster, Item scroll = null) : base(caster, scroll, m_Info)
{
}
@ -109,4 +109,4 @@ namespace Server.Spells.Fifth
}
}
}
}
}

View file

@ -1,5 +1,6 @@
using System;
using System.Collections;
using System.Collections.Generic;
using Server.Items;
using Server.Misc;
using Server.Mobiles;
@ -19,7 +20,7 @@ namespace Server.Spells.Fifth
Reagent.SpidersSilk
);
public PoisonFieldSpell(Mobile caster, Item scroll) : base(caster, scroll, m_Info)
public PoisonFieldSpell(Mobile caster, Item scroll = null) : base(caster, scroll, m_Info)
{
}
@ -197,7 +198,7 @@ namespace Server.Spells.Fifth
private class InternalTimer : Timer
{
private static Queue m_Queue = new Queue();
private static Queue<Mobile> m_Queue = new Queue<Mobile>();
private bool m_InLOS, m_CanFit;
private InternalItem m_Item;
@ -257,7 +258,7 @@ namespace Server.Spells.Fifth
while (m_Queue.Count > 0)
{
Mobile m = (Mobile)m_Queue.Dequeue();
Mobile m = m_Queue.Dequeue();
caster.DoHarmful(m);
@ -291,4 +292,4 @@ namespace Server.Spells.Fifth
}
}
}
}
}

View file

@ -38,7 +38,7 @@ namespace Server.Spells.Fifth
typeof(Rabbit)
};
public SummonCreatureSpell(Mobile caster, Item scroll) : base(caster, scroll, m_Info)
public SummonCreatureSpell(Mobile caster, Item scroll = null) : base(caster, scroll, m_Info)
{
}
@ -78,6 +78,7 @@ namespace Server.Spells.Fifth
}
catch
{
// ignored
}
FinishSequence();
@ -91,4 +92,4 @@ namespace Server.Spells.Fifth
return base.GetCastDelay() + TimeSpan.FromSeconds(6.0);
}
}
}
}

View file

@ -13,7 +13,7 @@ namespace Server.Spells.First
Reagent.Nightshade
);
public ClumsySpell(Mobile caster, Item scroll) : base(caster, scroll, m_Info)
public ClumsySpell(Mobile caster, Item scroll = null) : base(caster, scroll, m_Info)
{
}
@ -77,4 +77,4 @@ namespace Server.Spells.First
}
}
}
}
}

View file

@ -28,7 +28,7 @@ namespace Server.Spells.First
new FoodInfo(typeof(Peach), "a peach")
};
public CreateFoodSpell(Mobile caster, Item scroll) : base(caster, scroll, m_Info)
public CreateFoodSpell(Mobile caster, Item scroll = null) : base(caster, scroll, m_Info)
{
}
@ -85,4 +85,4 @@ namespace Server.Spells.First
return item;
}
}
}
}

View file

@ -13,7 +13,7 @@ namespace Server.Spells.First
Reagent.Nightshade
);
public FeeblemindSpell(Mobile caster, Item scroll) : base(caster, scroll, m_Info)
public FeeblemindSpell(Mobile caster, Item scroll = null) : base(caster, scroll, m_Info)
{
}
@ -77,4 +77,4 @@ namespace Server.Spells.First
}
}
}
}
}

View file

@ -17,7 +17,7 @@ namespace Server.Spells.First
Reagent.SpidersSilk
);
public HealSpell(Mobile caster, Item scroll) : base(caster, scroll, m_Info)
public HealSpell(Mobile caster, Item scroll = null) : base(caster, scroll, m_Info)
{
}
@ -112,4 +112,4 @@ namespace Server.Spells.First
}
}
}
}
}

View file

@ -11,7 +11,7 @@ namespace Server.Spells.First
Reagent.SulfurousAsh
);
public MagicArrowSpell(Mobile caster, Item scroll) : base(caster, scroll, m_Info)
public MagicArrowSpell(Mobile caster, Item scroll = null) : base(caster, scroll, m_Info)
{
}
@ -90,4 +90,4 @@ namespace Server.Spells.First
}
}
}
}
}

View file

@ -12,7 +12,7 @@ namespace Server.Spells.First
Reagent.SpidersSilk
);
public NightSightSpell(Mobile caster, Item scroll) : base(caster, scroll, m_Info)
public NightSightSpell(Mobile caster, Item scroll = null) : base(caster, scroll, m_Info)
{
}
@ -72,4 +72,4 @@ namespace Server.Spells.First
}
}
}
}
}

View file

@ -1,4 +1,3 @@
using System.Collections;
using System.Collections.Generic;
namespace Server.Spells.First
@ -16,7 +15,7 @@ namespace Server.Spells.First
private static Dictionary<Mobile, ResistanceMod[]> m_Table = new Dictionary<Mobile, ResistanceMod[]>();
public ReactiveArmorSpell(Mobile caster, Item scroll) : base(caster, scroll, m_Info)
public ReactiveArmorSpell(Mobile caster, Item scroll = null) : base(caster, scroll, m_Info)
{
}

View file

@ -13,7 +13,7 @@ namespace Server.Spells.First
Reagent.Nightshade
);
public WeakenSpell(Mobile caster, Item scroll) : base(caster, scroll, m_Info)
public WeakenSpell(Mobile caster, Item scroll = null) : base(caster, scroll, m_Info)
{
}
@ -77,4 +77,4 @@ namespace Server.Spells.First
}
}
}
}
}

View file

@ -1,5 +1,6 @@
using System;
using System.Collections.Generic;
using System.Linq;
using Server.Mobiles;
using Server.Targeting;
@ -16,7 +17,7 @@ namespace Server.Spells.Fourth
Reagent.MandrakeRoot
);
public ArchCureSpell(Mobile caster, Item scroll) : base(caster, scroll, m_Info)
public ArchCureSpell(Mobile caster, Item scroll = null) : base(caster, scroll, m_Info)
{
}
@ -56,15 +57,7 @@ namespace Server.Spells.Fourth
targets.Add(directTarget);
IPooledEnumerable<Mobile> eable = map.GetMobilesInRange(new Point3D(p), 2);
foreach (Mobile m in eable)
{
if (m == directTarget)
continue;
if (AreaCanTarget(m, feluccaRules))
targets.Add(m);
}
targets.AddRange(eable.Where(m => m != directTarget).Where(m => AreaCanTarget(m, feluccaRules)));
eable.Free();
}
@ -180,4 +173,4 @@ namespace Server.Spells.Fourth
}
}
}
}
}

View file

@ -1,5 +1,6 @@
using System;
using System.Collections.Generic;
using System.Linq;
using Server.Engines.PartySystem;
using Server.Spells.Second;
using Server.Targeting;
@ -20,7 +21,7 @@ namespace Server.Spells.Fourth
private static Dictionary<Mobile, int> _Table = new Dictionary<Mobile, int>();
public ArchProtectionSpell(Mobile caster, Item scroll) : base(caster, scroll, m_Info)
public ArchProtectionSpell(Mobile caster, Item scroll = null) : base(caster, scroll, m_Info)
{
}
@ -43,30 +44,25 @@ namespace Server.Spells.Fourth
SpellHelper.GetSurfaceTop(ref p);
List<Mobile> targets = new List<Mobile>();
if (!Core.AOS)
Effects.PlaySound(p, Caster.Map, 0x299);
Map map = Caster.Map;
if (map != null)
if (Caster.Map == null)
{
IPooledEnumerable<Mobile> eable = map.GetMobilesInRange(new Point3D(p), Core.AOS ? 2 : 3);
foreach (Mobile m in eable)
if (Caster.CanBeBeneficial(m, false))
targets.Add(m);
eable.Free();
FinishSequence();
return;
}
IEnumerable<Mobile> targets = Caster.Map.GetMobilesInRange(new Point3D(p), Core.AOS ? 2 : 3)
.Where(m => Caster.CanBeBeneficial(m, false));
if (Core.AOS)
{
Party party = Party.Get(Caster);
for (int i = 0; i < targets.Count; ++i)
foreach (Mobile m in targets)
{
Mobile m = targets[i];
if (m == Caster || party != null && party.Contains(m))
if (m == Caster || party?.Contains(m) == true)
{
Caster.DoBeneficial(m);
ProtectionSpell.Toggle(Caster, m);
@ -75,27 +71,22 @@ namespace Server.Spells.Fourth
}
else
{
Effects.PlaySound(p, Caster.Map, 0x299);
int val = (int)(Caster.Skills.Magery.Value / 10.0 + 1);
if (targets.Count > 0)
for (int i = 0; i < targets.Count; ++i)
foreach (Mobile m in targets)
{
if (m.BeginAction<ArchProtectionSpell>())
{
Mobile m = targets[i];
Caster.DoBeneficial(m);
m.VirtualArmorMod += val;
if (m.BeginAction<ArchProtectionSpell>())
{
Caster.DoBeneficial(m);
m.VirtualArmorMod += val;
AddEntry(m, val);
new InternalTimer(m, Caster).Start();
AddEntry(m, val);
new InternalTimer(m, Caster).Start();
m.FixedParticles(0x375A, 9, 20, 5027, EffectLayer.Waist);
m.PlaySound(0x1F7);
}
m.FixedParticles(0x375A, 9, 20, 5027, EffectLayer.Waist);
m.PlaySound(0x1F7);
}
}
}
}

View file

@ -1,5 +1,4 @@
using System;
using System.Collections;
using System.Collections.Generic;
using Server.Targeting;
@ -18,7 +17,7 @@ namespace Server.Spells.Fourth
private static HashSet<Mobile> m_UnderEffect = new HashSet<Mobile>();
public CurseSpell(Mobile caster, Item scroll) : base(caster, scroll, m_Info)
public CurseSpell(Mobile caster, Item scroll = null) : base(caster, scroll, m_Info)
{
}

View file

@ -19,7 +19,7 @@ namespace Server.Spells.Fourth
Reagent.SulfurousAsh
);
public FireFieldSpell(Mobile caster, Item scroll) : base(caster, scroll, m_Info)
public FireFieldSpell(Mobile caster, Item scroll = null) : base(caster, scroll, m_Info)
{
}
@ -88,13 +88,8 @@ namespace Server.Spells.Fourth
private DateTime m_End;
private Timer m_Timer;
public FireFieldItem(int itemID, Point3D loc, Mobile caster, Map map, TimeSpan duration, int val)
: this(itemID, loc, caster, map, duration, val, 2)
{
}
public FireFieldItem(int itemID, Point3D loc, Mobile caster, Map map, TimeSpan duration, int val,
int damage) : base(itemID)
int damage = 2) : base(itemID)
{
bool canFit = SpellHelper.AdjustField(ref loc, map, 12, false);
@ -248,7 +243,7 @@ namespace Server.Spells.Fourth
if (map == null || caster == null)
return;
foreach (Mobile m in m_Item.GetMobilesInRange(0))
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))
@ -303,4 +298,4 @@ namespace Server.Spells.Fourth
}
}
}
}
}

View file

@ -18,7 +18,7 @@ namespace Server.Spells.Fourth
Reagent.SpidersSilk
);
public GreaterHealSpell(Mobile caster, Item scroll) : base(caster, scroll, m_Info)
public GreaterHealSpell(Mobile caster, Item scroll = null) : base(caster, scroll, m_Info)
{
}
@ -102,4 +102,4 @@ namespace Server.Spells.Fourth
}
}
}
}
}

View file

@ -12,7 +12,7 @@ namespace Server.Spells.Fourth
Reagent.SulfurousAsh
);
public LightningSpell(Mobile caster, Item scroll) : base(caster, scroll, m_Info)
public LightningSpell(Mobile caster, Item scroll = null) : base(caster, scroll, m_Info)
{
}
@ -86,4 +86,4 @@ namespace Server.Spells.Fourth
}
}
}
}
}

View file

@ -17,7 +17,7 @@ namespace Server.Spells.Fourth
private static HashSet<Mobile> m_Table = new HashSet<Mobile>();
public ManaDrainSpell(Mobile caster, Item scroll) : base(caster, scroll, m_Info)
public ManaDrainSpell(Mobile caster, Item scroll = null) : base(caster, scroll, m_Info)
{
}

View file

@ -24,7 +24,8 @@ namespace Server.Spells.Fourth
private RunebookEntry m_Entry;
public RecallSpell(Mobile caster, Item scroll, RunebookEntry entry = null, Runebook book = null) : base(caster, scroll, m_Info)
public RecallSpell(Mobile caster, RunebookEntry entry = null, Runebook book = null, Item scroll = null) :
base(caster, scroll, m_Info)
{
m_Entry = entry;
m_Book = book;
@ -200,4 +201,4 @@ namespace Server.Spells.Fourth
}
}
}
}
}

View file

@ -1,89 +1,89 @@
using System;
using Server.Mobiles;
using Server.Targeting;
namespace Server.Spells.Mysticism
{
public class AnimatedWeaponSpell : MysticSpell
{
private static SpellInfo m_Info = new SpellInfo(
"Animated Weapon", "In Jux Por Ylem",
-1,
9002,
Reagent.Bone,
Reagent.BlackPearl,
Reagent.MandrakeRoot,
Reagent.Nightshade
);
public AnimatedWeaponSpell(Mobile caster, Item scroll)
: base(caster, scroll, m_Info)
{
}
public override TimeSpan CastDelayBase => TimeSpan.FromSeconds(1.5);
public override double RequiredSkill => 33.0;
public override int RequiredMana => 11;
public override void OnCast()
{
Caster.Target = new InternalTarget(this);
}
public void Target(IPoint3D p)
{
if (Caster.Followers + 4 > Caster.FollowersMax)
{
Caster.SendLocalizedMessage(1049645); // You have too many followers to summon that creature.
return;
}
Map map = Caster.Map;
SpellHelper.GetSurfaceTop(ref p);
if (map == null || Caster.Player && !map.CanSpawnMobile(p.X, p.Y, p.Z))
{
Caster.SendLocalizedMessage(501942); // That location is blocked.
}
else if (SpellHelper.CheckTown(p, Caster) && CheckSequence())
{
int level = (int)((GetBaseSkill(Caster) + GetBoostSkill(Caster)) / 2.0);
TimeSpan duration = TimeSpan.FromSeconds(10 + level);
AnimatedWeapon summon = new AnimatedWeapon(Caster, level);
BaseCreature.Summon(summon, false, Caster, new Point3D(p), 0x212, duration);
summon.PlaySound(0x64A);
Effects.SendTargetParticles(summon, 0x3728, 10, 10, 0x13AA, (EffectLayer)255);
}
FinishSequence();
}
public class InternalTarget : Target
{
private AnimatedWeaponSpell m_Owner;
public InternalTarget(AnimatedWeaponSpell owner)
: base(12, true, TargetFlags.None)
{
m_Owner = owner;
}
protected override void OnTarget(Mobile from, object o)
{
if (o is IPoint3D d)
m_Owner.Target(d);
}
protected override void OnTargetFinish(Mobile from)
{
m_Owner.FinishSequence();
}
}
}
}
using System;
using Server.Mobiles;
using Server.Targeting;
namespace Server.Spells.Mysticism
{
public class AnimatedWeaponSpell : MysticSpell
{
private static SpellInfo m_Info = new SpellInfo(
"Animated Weapon", "In Jux Por Ylem",
-1,
9002,
Reagent.Bone,
Reagent.BlackPearl,
Reagent.MandrakeRoot,
Reagent.Nightshade
);
public AnimatedWeaponSpell(Mobile caster, Item scroll = null)
: base(caster, scroll, m_Info)
{
}
public override TimeSpan CastDelayBase => TimeSpan.FromSeconds(1.5);
public override double RequiredSkill => 33.0;
public override int RequiredMana => 11;
public override void OnCast()
{
Caster.Target = new InternalTarget(this);
}
public void Target(IPoint3D p)
{
if (Caster.Followers + 4 > Caster.FollowersMax)
{
Caster.SendLocalizedMessage(1049645); // You have too many followers to summon that creature.
return;
}
Map map = Caster.Map;
SpellHelper.GetSurfaceTop(ref p);
if (map == null || Caster.Player && !map.CanSpawnMobile(p.X, p.Y, p.Z))
{
Caster.SendLocalizedMessage(501942); // That location is blocked.
}
else if (SpellHelper.CheckTown(p, Caster) && CheckSequence())
{
int level = (int)((GetBaseSkill(Caster) + GetBoostSkill(Caster)) / 2.0);
TimeSpan duration = TimeSpan.FromSeconds(10 + level);
AnimatedWeapon summon = new AnimatedWeapon(Caster, level);
BaseCreature.Summon(summon, false, Caster, new Point3D(p), 0x212, duration);
summon.PlaySound(0x64A);
Effects.SendTargetParticles(summon, 0x3728, 10, 10, 0x13AA, (EffectLayer)255);
}
FinishSequence();
}
public class InternalTarget : Target
{
private AnimatedWeaponSpell m_Owner;
public InternalTarget(AnimatedWeaponSpell owner)
: base(12, true, TargetFlags.None)
{
m_Owner = owner;
}
protected override void OnTarget(Mobile from, object o)
{
if (o is IPoint3D d)
m_Owner.Target(d);
}
protected override void OnTargetFinish(Mobile from)
{
m_Owner.FinishSequence();
}
}
}
}

View file

@ -1,88 +1,88 @@
using System;
using Server.Targeting;
namespace Server.Spells.Mysticism
{
public class EagleStrikeSpell : MysticSpell
{
private static SpellInfo m_Info = new SpellInfo(
"Eagle Strike", "Kal Por Xen",
-1,
9002,
Reagent.Bloodmoss,
Reagent.Bone,
Reagent.SpidersSilk,
Reagent.MandrakeRoot
);
public EagleStrikeSpell(Mobile caster, Item scroll)
: base(caster, scroll, m_Info)
{
}
public override TimeSpan CastDelayBase => TimeSpan.FromSeconds(1.25);
public override double RequiredSkill => 20.0;
public override int RequiredMana => 9;
public override void OnCast()
{
Caster.Target = new InternalTarget(this);
}
public void Target(Mobile m)
{
if (CheckHSequence(m))
{
/* Conjures a magical eagle that assaults the Target with
* its talons, dealing energy damage.
*/
SpellHelper.Turn(Caster, m);
SpellHelper.CheckReflect(2, Caster, ref m);
Caster.MovingParticles(m, 0x407A, 7, 0, false, true, 0, 0, 0xBBE, 0xFA6, 0xFFFF, 0);
Caster.PlaySound(0x2EE);
Timer.DelayCall(TimeSpan.FromSeconds(1.0), Damage, m);
}
FinishSequence();
}
private void Damage(Mobile to)
{
if (to == null)
return;
double damage = GetNewAosDamage(19, 1, 5, to);
SpellHelper.Damage(this, to, damage, 0, 0, 0, 0, 100);
to.PlaySound(0x64D);
}
private class InternalTarget : Target
{
private EagleStrikeSpell m_Owner;
public InternalTarget(EagleStrikeSpell owner)
: base(12, false, TargetFlags.Harmful)
{
m_Owner = owner;
}
protected override void OnTarget(Mobile from, object o)
{
if (o is Mobile mobile)
m_Owner.Target(mobile);
}
protected override void OnTargetFinish(Mobile from)
{
m_Owner.FinishSequence();
}
}
}
}
using System;
using Server.Targeting;
namespace Server.Spells.Mysticism
{
public class EagleStrikeSpell : MysticSpell
{
private static SpellInfo m_Info = new SpellInfo(
"Eagle Strike", "Kal Por Xen",
-1,
9002,
Reagent.Bloodmoss,
Reagent.Bone,
Reagent.SpidersSilk,
Reagent.MandrakeRoot
);
public EagleStrikeSpell(Mobile caster, Item scroll = null)
: base(caster, scroll, m_Info)
{
}
public override TimeSpan CastDelayBase => TimeSpan.FromSeconds(1.25);
public override double RequiredSkill => 20.0;
public override int RequiredMana => 9;
public override void OnCast()
{
Caster.Target = new InternalTarget(this);
}
public void Target(Mobile m)
{
if (CheckHSequence(m))
{
/* Conjures a magical eagle that assaults the Target with
* its talons, dealing energy damage.
*/
SpellHelper.Turn(Caster, m);
SpellHelper.CheckReflect(2, Caster, ref m);
Caster.MovingParticles(m, 0x407A, 7, 0, false, true, 0, 0, 0xBBE, 0xFA6, 0xFFFF, 0);
Caster.PlaySound(0x2EE);
Timer.DelayCall(TimeSpan.FromSeconds(1.0), Damage, m);
}
FinishSequence();
}
private void Damage(Mobile to)
{
if (to == null)
return;
double damage = GetNewAosDamage(19, 1, 5, to);
SpellHelper.Damage(this, to, damage, 0, 0, 0, 0, 100);
to.PlaySound(0x64D);
}
private class InternalTarget : Target
{
private EagleStrikeSpell m_Owner;
public InternalTarget(EagleStrikeSpell owner)
: base(12, false, TargetFlags.Harmful)
{
m_Owner = owner;
}
protected override void OnTarget(Mobile from, object o)
{
if (o is Mobile mobile)
m_Owner.Target(mobile);
}
protected override void OnTargetFinish(Mobile from)
{
m_Owner.FinishSequence();
}
}
}
}

View file

@ -1,144 +1,144 @@
using System;
using System.Collections.Generic;
using Server.Network;
using Server.Targeting;
namespace Server.Spells.Mysticism
{
public class HailStormSpell : MysticSpell
{
private static SpellInfo m_Info = new SpellInfo(
"Hail Storm", "Kal Des Ylem",
-1,
9002,
Reagent.DragonsBlood,
Reagent.Bloodmoss,
Reagent.BlackPearl,
Reagent.MandrakeRoot
);
public HailStormSpell(Mobile caster, Item scroll)
: base(caster, scroll, m_Info)
{
}
public override TimeSpan CastDelayBase => TimeSpan.FromSeconds(2.25);
public override double RequiredSkill => 70.0;
public override int RequiredMana => 40;
public override void OnCast()
{
Caster.Target = new InternalTarget(this);
}
public void Target(IPoint3D p)
{
if (SpellHelper.CheckTown(p, Caster) && CheckSequence())
{
/* Summons a storm of hailstones that strikes all Targets
* within a radius around the Target's Location, dealing
* cold damage.
*/
SpellHelper.Turn(Caster, p);
if (p is Item item)
p = item.GetWorldLocation();
List<Mobile> targets = new List<Mobile>();
Map map = Caster.Map;
bool pvp = false;
if (map != null)
{
PlayEffect(p, Caster.Map);
foreach (Mobile m in map.GetMobilesInRange(new Point3D(p), 2))
{
if (m == Caster)
continue;
if (SpellHelper.ValidIndirectTarget(Caster, m) && Caster.CanBeHarmful(m, false) && Caster.CanSee(m))
{
if (!Caster.InLOS(m))
continue;
targets.Add(m);
if (m.Player)
pvp = true;
}
}
}
double damage = GetNewAosDamage(51, 1, 5, pvp);
foreach (Mobile m in targets)
{
Caster.DoHarmful(m);
SpellHelper.Damage(this, m, damage, 0, 0, 100, 0, 0);
}
}
FinishSequence();
}
private static void PlayEffect(IPoint3D p, Map map)
{
Effects.PlaySound(p, map, 0x64F);
PlaySingleEffect(p, map, -1, 1, -1, 1);
PlaySingleEffect(p, map, -2, 0, -3, -1);
PlaySingleEffect(p, map, -3, -1, -1, 1);
PlaySingleEffect(p, map, 1, 3, -1, 1);
PlaySingleEffect(p, map, -1, 1, 1, 3);
}
private static void PlaySingleEffect(IPoint3D p, Map map, int a, int b, int c, int d)
{
int x = p.X, y = p.Y, z = p.Z + 18;
SendEffectPacket(p, map, new Point3D(x + a, y + c, z), new Point3D(x + a, y + c, z));
SendEffectPacket(p, map, new Point3D(x + b, y + c, z), new Point3D(x + b, y + c, z));
SendEffectPacket(p, map, new Point3D(x + b, y + d, z), new Point3D(x + b, y + d, z));
SendEffectPacket(p, map, new Point3D(x + a, y + d, z), new Point3D(x + a, y + d, z));
SendEffectPacket(p, map, new Point3D(x + b, y + c, z), new Point3D(x + a, y + c, z));
SendEffectPacket(p, map, new Point3D(x + b, y + d, z), new Point3D(x + b, y + c, z));
SendEffectPacket(p, map, new Point3D(x + a, y + d, z), new Point3D(x + b, y + d, z));
SendEffectPacket(p, map, new Point3D(x + a, y + c, z), new Point3D(x + a, y + d, z));
}
private static void SendEffectPacket(IPoint3D p, Map map, Point3D orig, Point3D dest)
{
Effects.SendPacket(p, map,
new HuedEffect(EffectType.Moving, Serial.Zero, Serial.Zero, 0x36D4, orig, dest, 0, 0, false, false, 0x63,
0x4));
}
private class InternalTarget : Target
{
private HailStormSpell m_Owner;
public InternalTarget(HailStormSpell owner)
: base(12, true, TargetFlags.None)
{
m_Owner = owner;
}
protected override void OnTarget(Mobile from, object o)
{
if (o is IPoint3D p)
m_Owner.Target(p);
}
protected override void OnTargetFinish(Mobile from)
{
m_Owner.FinishSequence();
}
}
}
}
using System;
using System.Collections.Generic;
using Server.Network;
using Server.Targeting;
namespace Server.Spells.Mysticism
{
public class HailStormSpell : MysticSpell
{
private static SpellInfo m_Info = new SpellInfo(
"Hail Storm", "Kal Des Ylem",
-1,
9002,
Reagent.DragonsBlood,
Reagent.Bloodmoss,
Reagent.BlackPearl,
Reagent.MandrakeRoot
);
public HailStormSpell(Mobile caster, Item scroll = null)
: base(caster, scroll, m_Info)
{
}
public override TimeSpan CastDelayBase => TimeSpan.FromSeconds(2.25);
public override double RequiredSkill => 70.0;
public override int RequiredMana => 40;
public override void OnCast()
{
Caster.Target = new InternalTarget(this);
}
public void Target(IPoint3D p)
{
if (SpellHelper.CheckTown(p, Caster) && CheckSequence())
{
/* Summons a storm of hailstones that strikes all Targets
* within a radius around the Target's Location, dealing
* cold damage.
*/
SpellHelper.Turn(Caster, p);
if (p is Item item)
p = item.GetWorldLocation();
List<Mobile> targets = new List<Mobile>();
Map map = Caster.Map;
bool pvp = false;
if (map != null)
{
PlayEffect(p, Caster.Map);
foreach (Mobile m in map.GetMobilesInRange(new Point3D(p), 2))
{
if (m == Caster)
continue;
if (SpellHelper.ValidIndirectTarget(Caster, m) && Caster.CanBeHarmful(m, false) && Caster.CanSee(m))
{
if (!Caster.InLOS(m))
continue;
targets.Add(m);
if (m.Player)
pvp = true;
}
}
}
double damage = GetNewAosDamage(51, 1, 5, pvp);
foreach (Mobile m in targets)
{
Caster.DoHarmful(m);
SpellHelper.Damage(this, m, damage, 0, 0, 100, 0, 0);
}
}
FinishSequence();
}
private static void PlayEffect(IPoint3D p, Map map)
{
Effects.PlaySound(p, map, 0x64F);
PlaySingleEffect(p, map, -1, 1, -1, 1);
PlaySingleEffect(p, map, -2, 0, -3, -1);
PlaySingleEffect(p, map, -3, -1, -1, 1);
PlaySingleEffect(p, map, 1, 3, -1, 1);
PlaySingleEffect(p, map, -1, 1, 1, 3);
}
private static void PlaySingleEffect(IPoint3D p, Map map, int a, int b, int c, int d)
{
int x = p.X, y = p.Y, z = p.Z + 18;
SendEffectPacket(p, map, new Point3D(x + a, y + c, z), new Point3D(x + a, y + c, z));
SendEffectPacket(p, map, new Point3D(x + b, y + c, z), new Point3D(x + b, y + c, z));
SendEffectPacket(p, map, new Point3D(x + b, y + d, z), new Point3D(x + b, y + d, z));
SendEffectPacket(p, map, new Point3D(x + a, y + d, z), new Point3D(x + a, y + d, z));
SendEffectPacket(p, map, new Point3D(x + b, y + c, z), new Point3D(x + a, y + c, z));
SendEffectPacket(p, map, new Point3D(x + b, y + d, z), new Point3D(x + b, y + c, z));
SendEffectPacket(p, map, new Point3D(x + a, y + d, z), new Point3D(x + b, y + d, z));
SendEffectPacket(p, map, new Point3D(x + a, y + c, z), new Point3D(x + a, y + d, z));
}
private static void SendEffectPacket(IPoint3D p, Map map, Point3D orig, Point3D dest)
{
Effects.SendPacket(p, map,
new HuedEffect(EffectType.Moving, Serial.Zero, Serial.Zero, 0x36D4, orig, dest, 0, 0, false, false, 0x63,
0x4));
}
private class InternalTarget : Target
{
private HailStormSpell m_Owner;
public InternalTarget(HailStormSpell owner)
: base(12, true, TargetFlags.None)
{
m_Owner = owner;
}
protected override void OnTarget(Mobile from, object o)
{
if (o is IPoint3D p)
m_Owner.Target(p);
}
protected override void OnTargetFinish(Mobile from)
{
m_Owner.FinishSequence();
}
}
}
}

View file

@ -1,153 +1,153 @@
using System;
using System.Collections.Generic;
using Server.Network;
using Server.Targeting;
namespace Server.Spells.Mysticism
{
public class NetherCycloneSpell : MysticSpell
{
private static SpellInfo m_Info = new SpellInfo(
"Nether Cyclone", "Grav Hur",
-1,
9002,
Reagent.MandrakeRoot,
Reagent.Nightshade,
Reagent.SulfurousAsh,
Reagent.Bloodmoss
);
public NetherCycloneSpell(Mobile caster, Item scroll)
: base(caster, scroll, m_Info)
{
}
public override TimeSpan CastDelayBase => TimeSpan.FromSeconds(2.5);
public override double RequiredSkill => 83.0;
public override int RequiredMana => 50;
public override void OnCast()
{
Caster.Target = new InternalTarget(this);
}
public void Target(IPoint3D p)
{
if (SpellHelper.CheckTown(p, Caster) && CheckSequence())
{
/* Summons a gale of lethal winds that strikes all Targets within a radius around
* the Target's Location, dealing chaos damage. In addition to inflicting damage,
* each Target of the Nether Cyclone temporarily loses a percentage of mana and
* stamina. The effectiveness of the Nether Cyclone is determined by a comparison
* between the Caster's Mysticism and either Focus or Imbuing (whichever is greater)
* skills and the Resisting Spells skill of the Target.
*/
SpellHelper.Turn(Caster, p);
if (p is Item item)
p = item.GetWorldLocation();
List<Mobile> targets = new List<Mobile>();
Map map = Caster.Map;
bool pvp = false;
if (map != null)
{
PlayEffect(p, Caster.Map);
foreach (Mobile m in map.GetMobilesInRange(new Point3D(p), 2))
{
if (m == Caster)
continue;
if (SpellHelper.ValidIndirectTarget(Caster, m) && Caster.CanBeHarmful(m, false) && Caster.CanSee(m))
{
if (!Caster.InLOS(m))
continue;
targets.Add(m);
if (m.Player)
pvp = true;
}
}
}
int damage = GetNewAosDamage(51, 1, 5, pvp);
double reduction = (GetBaseSkill(Caster) + GetBoostSkill(Caster)) / 1200.0;
foreach (Mobile m in targets)
{
Caster.DoHarmful(m);
SpellHelper.Damage(this, m, damage, 0, 0, 0, 0, 0, 100);
double resistedReduction = reduction - m.Skills.MagicResist.Value / 800.0;
m.Stam -= (int)(m.StamMax * resistedReduction);
m.Mana -= (int)(m.ManaMax * resistedReduction);
}
}
FinishSequence();
}
private static void PlayEffect(IPoint3D p, Map map)
{
Effects.PlaySound(p, map, 0x64F);
PlaySingleEffect(p, map, -1, 1, -1, 1);
PlaySingleEffect(p, map, -2, 0, -3, -1);
PlaySingleEffect(p, map, -3, -1, -1, 1);
PlaySingleEffect(p, map, 1, 3, -1, 1);
PlaySingleEffect(p, map, -1, 1, 1, 3);
}
private static void PlaySingleEffect(IPoint3D p, Map map, int a, int b, int c, int d)
{
int x = p.X, y = p.Y, z = p.Z + 18;
SendEffectPacket(p, map, new Point3D(x + a, y + c, z), new Point3D(x + a, y + c, z));
SendEffectPacket(p, map, new Point3D(x + b, y + c, z), new Point3D(x + b, y + c, z));
SendEffectPacket(p, map, new Point3D(x + b, y + d, z), new Point3D(x + b, y + d, z));
SendEffectPacket(p, map, new Point3D(x + a, y + d, z), new Point3D(x + a, y + d, z));
SendEffectPacket(p, map, new Point3D(x + b, y + c, z), new Point3D(x + a, y + c, z));
SendEffectPacket(p, map, new Point3D(x + b, y + d, z), new Point3D(x + b, y + c, z));
SendEffectPacket(p, map, new Point3D(x + a, y + d, z), new Point3D(x + b, y + d, z));
SendEffectPacket(p, map, new Point3D(x + a, y + c, z), new Point3D(x + a, y + d, z));
}
private static void SendEffectPacket(IPoint3D p, Map map, Point3D orig, Point3D dest)
{
Effects.SendPacket(p, map,
new HuedEffect(EffectType.Moving, Serial.Zero, Serial.Zero, 0x375A, orig, dest, 0, 0, false, false, 0x49A,
0x4));
}
private class InternalTarget : Target
{
private NetherCycloneSpell m_Owner;
public InternalTarget(NetherCycloneSpell owner)
: base(12, true, TargetFlags.None)
{
m_Owner = owner;
}
protected override void OnTarget(Mobile from, object o)
{
if (o is IPoint3D p)
m_Owner.Target(p);
}
protected override void OnTargetFinish(Mobile from)
{
m_Owner.FinishSequence();
}
}
}
}
using System;
using System.Collections.Generic;
using Server.Network;
using Server.Targeting;
namespace Server.Spells.Mysticism
{
public class NetherCycloneSpell : MysticSpell
{
private static SpellInfo m_Info = new SpellInfo(
"Nether Cyclone", "Grav Hur",
-1,
9002,
Reagent.MandrakeRoot,
Reagent.Nightshade,
Reagent.SulfurousAsh,
Reagent.Bloodmoss
);
public NetherCycloneSpell(Mobile caster, Item scroll = null)
: base(caster, scroll, m_Info)
{
}
public override TimeSpan CastDelayBase => TimeSpan.FromSeconds(2.5);
public override double RequiredSkill => 83.0;
public override int RequiredMana => 50;
public override void OnCast()
{
Caster.Target = new InternalTarget(this);
}
public void Target(IPoint3D p)
{
if (SpellHelper.CheckTown(p, Caster) && CheckSequence())
{
/* Summons a gale of lethal winds that strikes all Targets within a radius around
* the Target's Location, dealing chaos damage. In addition to inflicting damage,
* each Target of the Nether Cyclone temporarily loses a percentage of mana and
* stamina. The effectiveness of the Nether Cyclone is determined by a comparison
* between the Caster's Mysticism and either Focus or Imbuing (whichever is greater)
* skills and the Resisting Spells skill of the Target.
*/
SpellHelper.Turn(Caster, p);
if (p is Item item)
p = item.GetWorldLocation();
List<Mobile> targets = new List<Mobile>();
Map map = Caster.Map;
bool pvp = false;
if (map != null)
{
PlayEffect(p, Caster.Map);
foreach (Mobile m in map.GetMobilesInRange(new Point3D(p), 2))
{
if (m == Caster)
continue;
if (SpellHelper.ValidIndirectTarget(Caster, m) && Caster.CanBeHarmful(m, false) && Caster.CanSee(m))
{
if (!Caster.InLOS(m))
continue;
targets.Add(m);
if (m.Player)
pvp = true;
}
}
}
int damage = GetNewAosDamage(51, 1, 5, pvp);
double reduction = (GetBaseSkill(Caster) + GetBoostSkill(Caster)) / 1200.0;
foreach (Mobile m in targets)
{
Caster.DoHarmful(m);
SpellHelper.Damage(this, m, damage, 0, 0, 0, 0, 0, 100);
double resistedReduction = reduction - m.Skills.MagicResist.Value / 800.0;
m.Stam -= (int)(m.StamMax * resistedReduction);
m.Mana -= (int)(m.ManaMax * resistedReduction);
}
}
FinishSequence();
}
private static void PlayEffect(IPoint3D p, Map map)
{
Effects.PlaySound(p, map, 0x64F);
PlaySingleEffect(p, map, -1, 1, -1, 1);
PlaySingleEffect(p, map, -2, 0, -3, -1);
PlaySingleEffect(p, map, -3, -1, -1, 1);
PlaySingleEffect(p, map, 1, 3, -1, 1);
PlaySingleEffect(p, map, -1, 1, 1, 3);
}
private static void PlaySingleEffect(IPoint3D p, Map map, int a, int b, int c, int d)
{
int x = p.X, y = p.Y, z = p.Z + 18;
SendEffectPacket(p, map, new Point3D(x + a, y + c, z), new Point3D(x + a, y + c, z));
SendEffectPacket(p, map, new Point3D(x + b, y + c, z), new Point3D(x + b, y + c, z));
SendEffectPacket(p, map, new Point3D(x + b, y + d, z), new Point3D(x + b, y + d, z));
SendEffectPacket(p, map, new Point3D(x + a, y + d, z), new Point3D(x + a, y + d, z));
SendEffectPacket(p, map, new Point3D(x + b, y + c, z), new Point3D(x + a, y + c, z));
SendEffectPacket(p, map, new Point3D(x + b, y + d, z), new Point3D(x + b, y + c, z));
SendEffectPacket(p, map, new Point3D(x + a, y + d, z), new Point3D(x + b, y + d, z));
SendEffectPacket(p, map, new Point3D(x + a, y + c, z), new Point3D(x + a, y + d, z));
}
private static void SendEffectPacket(IPoint3D p, Map map, Point3D orig, Point3D dest)
{
Effects.SendPacket(p, map,
new HuedEffect(EffectType.Moving, Serial.Zero, Serial.Zero, 0x375A, orig, dest, 0, 0, false, false, 0x49A,
0x4));
}
private class InternalTarget : Target
{
private NetherCycloneSpell m_Owner;
public InternalTarget(NetherCycloneSpell owner)
: base(12, true, TargetFlags.None)
{
m_Owner = owner;
}
protected override void OnTarget(Mobile from, object o)
{
if (o is IPoint3D p)
m_Owner.Target(p);
}
protected override void OnTargetFinish(Mobile from)
{
m_Owner.FinishSequence();
}
}
}
}

View file

@ -1,217 +1,217 @@
using System;
using System.Collections.Generic;
using Server.Targeting;
namespace Server.Spells.Mysticism
{
public class SpellPlagueSpell : MysticSpell
{
private static SpellInfo m_Info = new SpellInfo(
"Spell Plague", "Vas Rel Jux Ort",
-1,
9002,
Reagent.DaemonBone,
Reagent.DragonsBlood,
Reagent.Nightshade,
Reagent.SulfurousAsh
);
private static Dictionary<Mobile, SpellPlagueContext> m_Table = new Dictionary<Mobile, SpellPlagueContext>();
public SpellPlagueSpell(Mobile caster, Item scroll)
: base(caster, scroll, m_Info)
{
}
public override TimeSpan CastDelayBase => TimeSpan.FromSeconds(2.25);
public override double RequiredSkill => 70.0;
public override int RequiredMana => 40;
public static void Initialize()
{
EventSink.PlayerDeath += OnPlayerDeath;
}
public override void OnCast()
{
Caster.Target = new InternalTarget(this);
}
public void Target(Mobile targeted)
{
if (!Caster.CanSee(targeted))
{
Caster.SendLocalizedMessage(500237); // Target can not be seen.
}
else if (CheckHSequence(targeted))
{
SpellHelper.Turn(Caster, targeted);
SpellHelper.CheckReflect(6, Caster, ref targeted);
/* The target is hit with an explosion of chaos damage and then inflicted
* with the spell plague curse. Each time the target is damaged while under
* the effect of the spell plague, they may suffer an explosion of chaos
* damage. The initial chance to trigger the explosion starts at 90% and
* reduces by 30% every time an explosion occurs. Once the target is
* afflicted by 3 explosions or 8 seconds have passed, that spell plague
* is removed from the target. Spell Plague will stack with other spell
* plagues so that they are applied one after the other.
*/
VisualEffect(targeted);
int damage = GetNewAosDamage(33, 1, 5, targeted);
SpellHelper.Damage(this, targeted, damage, 0, 0, 0, 0, 0);
SpellPlagueContext context = new SpellPlagueContext(this, targeted);
if (m_Table.TryGetValue(targeted, out SpellPlagueContext oldContext))
oldContext.SetNext(context);
else
{
m_Table[targeted] = context;
context.Start();
}
}
FinishSequence();
}
public static bool UnderEffect(Mobile m)
{
return m_Table.ContainsKey(m);
}
public static void RemoveEffect(Mobile m)
{
if (m_Table.TryGetValue(m, out SpellPlagueContext context))
context.EndPlague(false);
}
public static void CheckPlague(Mobile m)
{
if (m_Table.TryGetValue(m, out SpellPlagueContext context))
context.OnDamage();
}
private static void OnPlayerDeath(PlayerDeathEventArgs e)
{
RemoveEffect(e.Mobile);
}
protected void VisualEffect(Mobile to)
{
to.PlaySound(0x658);
to.FixedParticles(0x3728, 1, 13, 0x26B8, 0x47E, 7, EffectLayer.Head, 0);
to.FixedParticles(0x3779, 1, 15, 0x251E, 0x43, 7, EffectLayer.Head, 0);
}
private class SpellPlagueContext
{
private int m_Explosions;
private DateTime m_LastExploded;
private SpellPlagueContext m_Next;
private SpellPlagueSpell m_Owner;
private Mobile m_Target;
private Timer m_Timer;
public SpellPlagueContext(SpellPlagueSpell owner, Mobile target)
{
m_Owner = owner;
m_Target = target;
}
public void SetNext(SpellPlagueContext context)
{
if (m_Next == null)
m_Next = context;
else
m_Next.SetNext(context);
}
public void Start()
{
m_Timer = Timer.DelayCall(TimeSpan.FromSeconds(8.0), EndPlague);
m_Timer.Start();
BuffInfo.AddBuff(m_Target,
new BuffInfo(BuffIcon.SpellPlague, 1031690, 1080167, TimeSpan.FromSeconds(8.5), m_Target));
}
public void OnDamage()
{
if (DateTime.Now > m_LastExploded + TimeSpan.FromSeconds(2.0))
{
int exploChance = 90 - m_Explosions * 30;
double resist = m_Target.Skills.MagicResist.Value;
if (resist >= 70)
exploChance -= (int)((resist - 70.0) * 3.0 / 10.0);
if (exploChance > Utility.Random(100))
{
m_Owner.VisualEffect(m_Target);
int damage = m_Owner.GetNewAosDamage(15 + m_Explosions * 3, 1, 5, m_Target);
m_Explosions++;
m_LastExploded = DateTime.Now;
SpellHelper.Damage(m_Owner, m_Target, damage, 0, 0, 0, 0, 0, 100);
if (m_Explosions >= 3)
EndPlague();
}
}
}
private void EndPlague()
{
EndPlague(true);
}
public void EndPlague(bool restart)
{
m_Timer?.Stop();
if (restart && m_Next != null)
{
m_Table[m_Target] = m_Next;
m_Next.Start();
}
else
{
m_Table.Remove(m_Target);
BuffInfo.RemoveBuff(m_Target, BuffIcon.SpellPlague);
}
}
}
private class InternalTarget : Target
{
private SpellPlagueSpell m_Owner;
public InternalTarget(SpellPlagueSpell owner)
: base(12, false, TargetFlags.Harmful)
{
m_Owner = owner;
}
protected override void OnTarget(Mobile from, object o)
{
if (o is Mobile mobile)
m_Owner.Target(mobile);
}
protected override void OnTargetFinish(Mobile from)
{
m_Owner.FinishSequence();
}
}
}
}
using System;
using System.Collections.Generic;
using Server.Targeting;
namespace Server.Spells.Mysticism
{
public class SpellPlagueSpell : MysticSpell
{
private static SpellInfo m_Info = new SpellInfo(
"Spell Plague", "Vas Rel Jux Ort",
-1,
9002,
Reagent.DaemonBone,
Reagent.DragonsBlood,
Reagent.Nightshade,
Reagent.SulfurousAsh
);
private static Dictionary<Mobile, SpellPlagueContext> m_Table = new Dictionary<Mobile, SpellPlagueContext>();
public SpellPlagueSpell(Mobile caster, Item scroll = null)
: base(caster, scroll, m_Info)
{
}
public override TimeSpan CastDelayBase => TimeSpan.FromSeconds(2.25);
public override double RequiredSkill => 70.0;
public override int RequiredMana => 40;
public static void Initialize()
{
EventSink.PlayerDeath += OnPlayerDeath;
}
public override void OnCast()
{
Caster.Target = new InternalTarget(this);
}
public void Target(Mobile targeted)
{
if (!Caster.CanSee(targeted))
{
Caster.SendLocalizedMessage(500237); // Target can not be seen.
}
else if (CheckHSequence(targeted))
{
SpellHelper.Turn(Caster, targeted);
SpellHelper.CheckReflect(6, Caster, ref targeted);
/* The target is hit with an explosion of chaos damage and then inflicted
* with the spell plague curse. Each time the target is damaged while under
* the effect of the spell plague, they may suffer an explosion of chaos
* damage. The initial chance to trigger the explosion starts at 90% and
* reduces by 30% every time an explosion occurs. Once the target is
* afflicted by 3 explosions or 8 seconds have passed, that spell plague
* is removed from the target. Spell Plague will stack with other spell
* plagues so that they are applied one after the other.
*/
VisualEffect(targeted);
int damage = GetNewAosDamage(33, 1, 5, targeted);
SpellHelper.Damage(this, targeted, damage, 0, 0, 0, 0, 0);
SpellPlagueContext context = new SpellPlagueContext(this, targeted);
if (m_Table.TryGetValue(targeted, out SpellPlagueContext oldContext))
oldContext.SetNext(context);
else
{
m_Table[targeted] = context;
context.Start();
}
}
FinishSequence();
}
public static bool UnderEffect(Mobile m)
{
return m_Table.ContainsKey(m);
}
public static void RemoveEffect(Mobile m)
{
if (m_Table.TryGetValue(m, out SpellPlagueContext context))
context.EndPlague(false);
}
public static void CheckPlague(Mobile m)
{
if (m_Table.TryGetValue(m, out SpellPlagueContext context))
context.OnDamage();
}
private static void OnPlayerDeath(PlayerDeathEventArgs e)
{
RemoveEffect(e.Mobile);
}
protected void VisualEffect(Mobile to)
{
to.PlaySound(0x658);
to.FixedParticles(0x3728, 1, 13, 0x26B8, 0x47E, 7, EffectLayer.Head, 0);
to.FixedParticles(0x3779, 1, 15, 0x251E, 0x43, 7, EffectLayer.Head, 0);
}
private class SpellPlagueContext
{
private int m_Explosions;
private DateTime m_LastExploded;
private SpellPlagueContext m_Next;
private SpellPlagueSpell m_Owner;
private Mobile m_Target;
private Timer m_Timer;
public SpellPlagueContext(SpellPlagueSpell owner, Mobile target)
{
m_Owner = owner;
m_Target = target;
}
public void SetNext(SpellPlagueContext context)
{
if (m_Next == null)
m_Next = context;
else
m_Next.SetNext(context);
}
public void Start()
{
m_Timer = Timer.DelayCall(TimeSpan.FromSeconds(8.0), EndPlague);
m_Timer.Start();
BuffInfo.AddBuff(m_Target,
new BuffInfo(BuffIcon.SpellPlague, 1031690, 1080167, TimeSpan.FromSeconds(8.5), m_Target));
}
public void OnDamage()
{
if (DateTime.Now > m_LastExploded + TimeSpan.FromSeconds(2.0))
{
int exploChance = 90 - m_Explosions * 30;
double resist = m_Target.Skills.MagicResist.Value;
if (resist >= 70)
exploChance -= (int)((resist - 70.0) * 3.0 / 10.0);
if (exploChance > Utility.Random(100))
{
m_Owner.VisualEffect(m_Target);
int damage = m_Owner.GetNewAosDamage(15 + m_Explosions * 3, 1, 5, m_Target);
m_Explosions++;
m_LastExploded = DateTime.Now;
SpellHelper.Damage(m_Owner, m_Target, damage, 0, 0, 0, 0, 0, 100);
if (m_Explosions >= 3)
EndPlague();
}
}
}
private void EndPlague()
{
EndPlague(true);
}
public void EndPlague(bool restart)
{
m_Timer?.Stop();
if (restart && m_Next != null)
{
m_Table[m_Target] = m_Next;
m_Next.Start();
}
else
{
m_Table.Remove(m_Target);
BuffInfo.RemoveBuff(m_Target, BuffIcon.SpellPlague);
}
}
}
private class InternalTarget : Target
{
private SpellPlagueSpell m_Owner;
public InternalTarget(SpellPlagueSpell owner)
: base(12, false, TargetFlags.Harmful)
{
m_Owner = owner;
}
protected override void OnTarget(Mobile from, object o)
{
if (o is Mobile mobile)
m_Owner.Target(mobile);
}
protected override void OnTargetFinish(Mobile from)
{
m_Owner.FinishSequence();
}
}
}
}

View file

@ -1,164 +1,163 @@
using System;
using System.Collections;
using System.Collections.Generic;
using Server.Factions;
using Server.Mobiles;
using Server.Spells.Fifth;
using Server.Spells.Ninjitsu;
using Server.Spells.Seventh;
namespace Server.Spells.Mysticism
{
public class StoneFormSpell : MysticSpell
{
private static SpellInfo m_Info = new SpellInfo(
"Stone Form", "In Rel Ylem",
-1,
9002,
Reagent.Bloodmoss,
Reagent.FertileDirt,
Reagent.Garlic
);
private static Dictionary<Mobile, ResistanceMod[]> m_Table = new Dictionary<Mobile, ResistanceMod[]>();
public StoneFormSpell(Mobile caster, Item scroll)
: base(caster, scroll, m_Info)
{
}
public override TimeSpan CastDelayBase => TimeSpan.FromSeconds(1.5);
public override double RequiredSkill => 33.0;
public override int RequiredMana => 11;
public static void Initialize()
{
EventSink.PlayerDeath += OnPlayerDeath;
}
public static bool UnderEffect(Mobile m)
{
return m_Table.ContainsKey(m);
}
public override bool CheckCast()
{
if (Sigil.ExistsOn(Caster))
{
Caster.SendLocalizedMessage(1061632); // You can't do that while carrying the sigil.
return false;
}
if (!Caster.CanBeginAction<PolymorphSpell>())
{
Caster.SendLocalizedMessage(1061628); // You can't do that while polymorphed.
return false;
}
if (AnimalForm.UnderTransformation(Caster))
{
Caster.SendLocalizedMessage(1063218); // You cannot use that ability in this form.
return false;
}
if (Caster.Flying)
{
Caster.SendLocalizedMessage(1113415); // You cannot use this ability while flying.
return false;
}
return base.CheckCast();
}
public override void OnCast()
{
if (Sigil.ExistsOn(Caster))
{
Caster.SendLocalizedMessage(1061632); // You can't do that while carrying the sigil.
}
else if (!Caster.CanBeginAction<PolymorphSpell>())
{
Caster.SendLocalizedMessage(1061628); // You can't do that while polymorphed.
}
else if (!Caster.CanBeginAction<IncognitoSpell>() || Caster.IsBodyMod && !UnderEffect(Caster))
{
Caster.SendLocalizedMessage(1063218); // You cannot use that ability in this form.
}
else if (CheckSequence())
{
if (UnderEffect(Caster))
{
RemoveEffects(Caster);
Caster.PlaySound(0xFA);
Caster.Delta(MobileDelta.Resistances);
}
else
{
IMount mount = Caster.Mount;
if (mount != null)
mount.Rider = null;
Caster.BodyMod = 0x2C1;
Caster.HueMod = 0;
int offset = (int)((GetBaseSkill(Caster) + GetBoostSkill(Caster)) / 24.0);
ResistanceMod[] mods = {
new ResistanceMod(ResistanceType.Physical, offset),
new ResistanceMod(ResistanceType.Fire, offset),
new ResistanceMod(ResistanceType.Cold, offset),
new ResistanceMod(ResistanceType.Poison, offset),
new ResistanceMod(ResistanceType.Energy, offset)
};
for (int i = 0; i < mods.Length; ++i)
Caster.AddResistanceMod(mods[i]);
m_Table[Caster] = mods;
Caster.PlaySound(0x65A);
Caster.Delta(MobileDelta.Resistances);
BuffInfo.AddBuff(Caster, new BuffInfo(BuffIcon.StoneForm, 1080145, 1080146,
$"-10\t-2\t{offset}\t{GetResistCapBonus(Caster)}\t{GetDIBonus(Caster)}", false));
}
}
FinishSequence();
}
public static int GetDIBonus(Mobile m)
{
return (int)((GetBaseSkill(m) + GetBoostSkill(m)) / 12.0);
}
public static int GetResistCapBonus(Mobile m)
{
return (int)((GetBaseSkill(m) + GetBoostSkill(m)) / 48.0);
}
public static void RemoveEffects(Mobile m)
{
if (!m_Table.TryGetValue(m, out ResistanceMod[] mods))
return;
for (int i = 0; i < mods.Length; ++i)
m.RemoveResistanceMod(mods[i]);
m.BodyMod = 0;
m.HueMod = -1;
m_Table.Remove(m);
BuffInfo.RemoveBuff(m, BuffIcon.StoneForm);
}
private static void OnPlayerDeath(PlayerDeathEventArgs e)
{
RemoveEffects(e.Mobile);
}
}
}
using System;
using System.Collections.Generic;
using Server.Factions;
using Server.Mobiles;
using Server.Spells.Fifth;
using Server.Spells.Ninjitsu;
using Server.Spells.Seventh;
namespace Server.Spells.Mysticism
{
public class StoneFormSpell : MysticSpell
{
private static SpellInfo m_Info = new SpellInfo(
"Stone Form", "In Rel Ylem",
-1,
9002,
Reagent.Bloodmoss,
Reagent.FertileDirt,
Reagent.Garlic
);
private static Dictionary<Mobile, ResistanceMod[]> m_Table = new Dictionary<Mobile, ResistanceMod[]>();
public StoneFormSpell(Mobile caster, Item scroll = null)
: base(caster, scroll, m_Info)
{
}
public override TimeSpan CastDelayBase => TimeSpan.FromSeconds(1.5);
public override double RequiredSkill => 33.0;
public override int RequiredMana => 11;
public static void Initialize()
{
EventSink.PlayerDeath += OnPlayerDeath;
}
public static bool UnderEffect(Mobile m)
{
return m_Table.ContainsKey(m);
}
public override bool CheckCast()
{
if (Sigil.ExistsOn(Caster))
{
Caster.SendLocalizedMessage(1061632); // You can't do that while carrying the sigil.
return false;
}
if (!Caster.CanBeginAction<PolymorphSpell>())
{
Caster.SendLocalizedMessage(1061628); // You can't do that while polymorphed.
return false;
}
if (AnimalForm.UnderTransformation(Caster))
{
Caster.SendLocalizedMessage(1063218); // You cannot use that ability in this form.
return false;
}
if (Caster.Flying)
{
Caster.SendLocalizedMessage(1113415); // You cannot use this ability while flying.
return false;
}
return base.CheckCast();
}
public override void OnCast()
{
if (Sigil.ExistsOn(Caster))
{
Caster.SendLocalizedMessage(1061632); // You can't do that while carrying the sigil.
}
else if (!Caster.CanBeginAction<PolymorphSpell>())
{
Caster.SendLocalizedMessage(1061628); // You can't do that while polymorphed.
}
else if (!Caster.CanBeginAction<IncognitoSpell>() || Caster.IsBodyMod && !UnderEffect(Caster))
{
Caster.SendLocalizedMessage(1063218); // You cannot use that ability in this form.
}
else if (CheckSequence())
{
if (UnderEffect(Caster))
{
RemoveEffects(Caster);
Caster.PlaySound(0xFA);
Caster.Delta(MobileDelta.Resistances);
}
else
{
IMount mount = Caster.Mount;
if (mount != null)
mount.Rider = null;
Caster.BodyMod = 0x2C1;
Caster.HueMod = 0;
int offset = (int)((GetBaseSkill(Caster) + GetBoostSkill(Caster)) / 24.0);
ResistanceMod[] mods = {
new ResistanceMod(ResistanceType.Physical, offset),
new ResistanceMod(ResistanceType.Fire, offset),
new ResistanceMod(ResistanceType.Cold, offset),
new ResistanceMod(ResistanceType.Poison, offset),
new ResistanceMod(ResistanceType.Energy, offset)
};
for (int i = 0; i < mods.Length; ++i)
Caster.AddResistanceMod(mods[i]);
m_Table[Caster] = mods;
Caster.PlaySound(0x65A);
Caster.Delta(MobileDelta.Resistances);
BuffInfo.AddBuff(Caster, new BuffInfo(BuffIcon.StoneForm, 1080145, 1080146,
$"-10\t-2\t{offset}\t{GetResistCapBonus(Caster)}\t{GetDIBonus(Caster)}", false));
}
}
FinishSequence();
}
public static int GetDIBonus(Mobile m)
{
return (int)((GetBaseSkill(m) + GetBoostSkill(m)) / 12.0);
}
public static int GetResistCapBonus(Mobile m)
{
return (int)((GetBaseSkill(m) + GetBoostSkill(m)) / 48.0);
}
public static void RemoveEffects(Mobile m)
{
if (!m_Table.TryGetValue(m, out ResistanceMod[] mods))
return;
for (int i = 0; i < mods.Length; ++i)
m.RemoveResistanceMod(mods[i]);
m.BodyMod = 0;
m.HueMod = -1;
m_Table.Remove(m);
BuffInfo.RemoveBuff(m, BuffIcon.StoneForm);
}
private static void OnPlayerDeath(PlayerDeathEventArgs e)
{
RemoveEffects(e.Mobile);
}
}
}

View file

@ -94,7 +94,7 @@ namespace Server.Spells.Necromancy
private static Dictionary<Mobile, List<Mobile>> m_Table = new Dictionary<Mobile, List<Mobile>>();
public AnimateDeadSpell(Mobile caster, Item scroll) : base(caster, scroll, m_Info)
public AnimateDeadSpell(Mobile caster, Item scroll = null) : base(caster, scroll, m_Info)
{
}
@ -142,7 +142,7 @@ namespace Server.Spells.Necromancy
{
QuestObjective objective = qs.FindObjective<AnimateMaabusCorpseObjective>();
if (objective != null && !objective.Completed)
if (objective?.Completed == false)
{
addon.Awake(Caster);
objective.Complete();

View file

@ -1,5 +1,4 @@
using System;
using System.Collections;
using System.Collections.Generic;
using Server.Mobiles;
using Server.Targeting;
@ -18,7 +17,7 @@ namespace Server.Spells.Necromancy
private static Dictionary<Mobile, Mobile> m_OathTable = new Dictionary<Mobile, Mobile>();
private static Dictionary<Mobile, ExpireTimer> m_Table = new Dictionary<Mobile, ExpireTimer>();
public BloodOathSpell(Mobile caster, Item scroll) : base(caster, scroll, m_Info)
public BloodOathSpell(Mobile caster, Item scroll = null) : base(caster, scroll, m_Info)
{
}

View file

@ -1,5 +1,4 @@
using System;
using System.Collections;
using System.Collections.Generic;
using Server.Targeting;
@ -17,7 +16,7 @@ namespace Server.Spells.Necromancy
private static Dictionary<Mobile, ExpireTimer> m_Table = new Dictionary<Mobile, ExpireTimer>();
public CorpseSkinSpell(Mobile caster, Item scroll) : base(caster, scroll, m_Info)
public CorpseSkinSpell(Mobile caster, Item scroll = null) : base(caster, scroll, m_Info)
{
}

View file

@ -1,5 +1,4 @@
using System;
using System.Collections;
using System.Collections.Generic;
using Server.Items;
@ -16,7 +15,7 @@ namespace Server.Spells.Necromancy
private static Dictionary<BaseWeapon, ExpireTimer> m_Table = new Dictionary<BaseWeapon, ExpireTimer>();
public CurseWeaponSpell(Mobile caster, Item scroll) : base(caster, scroll, m_Info)
public CurseWeaponSpell(Mobile caster, Item scroll = null) : base(caster, scroll, m_Info)
{
}

View file

@ -1,5 +1,4 @@
using System;
using System.Collections;
using System.Collections.Generic;
using Server.Mobiles;
using Server.Targeting;
@ -18,7 +17,7 @@ namespace Server.Spells.Necromancy
private static Dictionary<Mobile, DefaultSkillMod> m_Table = new Dictionary<Mobile, DefaultSkillMod>();
public EvilOmenSpell(Mobile caster, Item scroll)
public EvilOmenSpell(Mobile caster, Item scroll = null)
: base(caster, scroll, m_Info)
{
}

View file

@ -1,5 +1,6 @@
using System;
using System.Collections.Generic;
using System.Linq;
using Server.Engines.CannedEvil;
using Server.Engines.PartySystem;
using Server.Factions;
@ -57,7 +58,7 @@ namespace Server.Spells.Necromancy
new Point3D(295, 712, 55)
};
public ExorcismSpell(Mobile caster, Item scroll) : base(caster, scroll, m_Info)
public ExorcismSpell(Mobile caster, Item scroll = null) : base(caster, scroll, m_Info)
{
}
@ -98,17 +99,11 @@ namespace Server.Spells.Necromancy
if (map != null)
{
List<Mobile> targets = new List<Mobile>();
IEnumerable<Mobile> targets = r.ChampionSpawn.GetMobilesInRange(Range).Where(IsValidTarget);
foreach (Mobile m in r.ChampionSpawn.GetMobilesInRange(Range))
if (IsValidTarget(m))
targets.Add(m);
for (int i = 0; i < targets.Count; ++i)
foreach (Mobile m in targets)
{
Mobile m = targets[i];
//Suprisingly, no sparkle type effects
//Surprisingly, no sparkle type effects
m.Location = GetNearestShrine(m);
}
@ -126,7 +121,7 @@ namespace Server.Spells.Necromancy
Corpse c = m.Corpse as Corpse;
Map map = m.Map;
if (c != null && !c.Deleted && map != null && c.Map == map)
if (c?.Deleted == false && map != null && c.Map == map)
{
if (SpellHelper.IsAnyT2A(map, c.Location) && SpellHelper.IsAnyT2A(map, m.Location))
return false; //Same Map, both in T2A, ie, same 'sub server'.
@ -134,12 +129,10 @@ namespace Server.Spells.Necromancy
if (m.Region.IsPartOf<DungeonRegion>() == Region.Find(c.Location, map).IsPartOf<DungeonRegion>())
return false; //Same Map, both in Dungeon region OR They're both NOT in a dungeon region.
//Just an approximation cause RunUO doens't divide up the world the same way OSI does ;p
//Just an approximation cause RunUO doesn't divide up the world the same way OSI does ;p
}
Party p = Party.Get(m);
if (p != null && p.Contains(Caster))
if (Party.Get(m)?.Contains(Caster) == true)
return false;
if (m.Guild != null && Caster.Guild != null)
@ -156,10 +149,7 @@ namespace Server.Spells.Necromancy
Faction f = Faction.Find(m);
if (Faction.Facet == m.Map && f != null && f == Faction.Find(Caster))
return false;
return true;
return Faction.Facet != m.Map || f == null || f != Faction.Find(Caster);
}
private static Point3D GetNearestShrine(Mobile m)
@ -198,4 +188,4 @@ namespace Server.Spells.Necromancy
return closest;
}
}
}
}

View file

@ -12,7 +12,7 @@ namespace Server.Spells.Necromancy
Reagent.DaemonBlood
);
public HorrificBeastSpell(Mobile caster, Item scroll) : base(caster, scroll, m_Info)
public HorrificBeastSpell(Mobile caster, Item scroll = null) : base(caster, scroll, m_Info)
{
}
@ -37,4 +37,4 @@ namespace Server.Spells.Necromancy
m.Delta(MobileDelta.WeaponDamage);
}
}
}
}

View file

@ -13,7 +13,7 @@ namespace Server.Spells.Necromancy
Reagent.NoxCrystal
);
public LichFormSpell(Mobile caster, Item scroll) : base(caster, scroll, m_Info)
public LichFormSpell(Mobile caster, Item scroll = null) : base(caster, scroll, m_Info)
{
}
@ -41,4 +41,4 @@ namespace Server.Spells.Necromancy
--m.Hits;
}
}
}
}

View file

@ -1,5 +1,4 @@
using System;
using System.Collections;
using System.Collections.Generic;
using Server.Targeting;
@ -18,7 +17,7 @@ namespace Server.Spells.Necromancy
private static Dictionary<Mobile, MRBucket> m_Table = new Dictionary<Mobile, MRBucket>();
public MindRotSpell(Mobile caster, Item scroll) : base(caster, scroll, m_Info)
public MindRotSpell(Mobile caster, Item scroll = null) : base(caster, scroll, m_Info)
{
}

View file

@ -1,5 +1,4 @@
using System;
using System.Collections;
using System.Collections.Generic;
using Server.Misc;
using Server.Targeting;
@ -18,7 +17,7 @@ namespace Server.Spells.Necromancy
private static Dictionary<Mobile, InternalTimer> m_Table = new Dictionary<Mobile, InternalTimer>();
public PainSpikeSpell(Mobile caster, Item scroll) : base(caster, scroll, m_Info)
public PainSpikeSpell(Mobile caster, Item scroll = null) : base(caster, scroll, m_Info)
{
}

View file

@ -1,5 +1,6 @@
using System;
using System.Collections.Generic;
using System.Linq;
using Server.Items;
using Server.Mobiles;
using Server.Targeting;
@ -15,7 +16,7 @@ namespace Server.Spells.Necromancy
Reagent.NoxCrystal
);
public PoisonStrikeSpell(Mobile caster, Item scroll)
public PoisonStrikeSpell(Mobile caster, Item scroll = null)
: base(caster, scroll, m_Info)
{
}
@ -67,11 +68,8 @@ namespace Server.Spells.Necromancy
if (Caster.CanBeHarmful(m, false))
targets.Add(m);
foreach (Mobile targ in m.GetMobilesInRange(2))
if (!(Caster is BaseCreature && targ is BaseCreature))
if (targ != Caster && m != targ && SpellHelper.ValidIndirectTarget(Caster, targ) &&
Caster.CanBeHarmful(targ, false))
targets.Add(targ);
targets.AddRange(m.GetMobilesInRange(2)
.Where(targ => !(Caster is BaseCreature && targ is BaseCreature && targ != Caster && m != targ && SpellHelper.ValidIndirectTarget(Caster, targ) && Caster.CanBeHarmful(targ, false))));
for (int i = 0; i < targets.Count; ++i)
{
@ -117,4 +115,4 @@ namespace Server.Spells.Necromancy
}
}
}
}
}

View file

@ -1,5 +1,4 @@
using System;
using System.Collections;
using System.Collections.Generic;
using Server.Targeting;
@ -17,7 +16,7 @@ namespace Server.Spells.Necromancy
private static Dictionary<Mobile, InternalTimer> m_Table = new Dictionary<Mobile, InternalTimer>();
public StrangleSpell(Mobile caster, Item scroll) : base(caster, scroll, m_Info)
public StrangleSpell(Mobile caster, Item scroll = null) : base(caster, scroll, m_Info)
{
}

View file

@ -1,5 +1,4 @@
using System;
using System.Collections;
using System.Collections.Generic;
using Server.Gumps;
using Server.Mobiles;
@ -18,7 +17,7 @@ namespace Server.Spells.Necromancy
Reagent.DaemonBlood
);
public SummonFamiliarSpell(Mobile caster, Item scroll) : base(caster, scroll, m_Info)
public SummonFamiliarSpell(Mobile caster, Item scroll = null) : base(caster, scroll, m_Info)
{
}
@ -111,7 +110,7 @@ namespace Server.Spells.Necromancy
AddItem(8, 15, 6882);
AddItem(2, 168, 6880);
AddHtmlLocalized(30, 26, 200, 20, 1060147, EnabledColor16, false, false); // Chose thy familiar...
AddHtmlLocalized(30, 26, 200, 20, 1060147, EnabledColor16); // Chose thy familiar...
double necro = from.Skills.Necromancy.Value;
double spirit = from.Skills.SpiritSpeak.Value;
@ -122,15 +121,13 @@ namespace Server.Spells.Necromancy
bool enabled = necro >= entries[i].ReqNecromancy && spirit >= entries[i].ReqSpiritSpeak;
AddButton(27, 53 + i * 21, 9702, 9703, i + 1, GumpButtonType.Reply, 0);
AddButton(27, 53 + i * 21, 9702, 9703, i + 1);
if (name is int intName)
AddHtmlLocalized(50, 51 + i * 21, 150, 20, intName, enabled ? EnabledColor16 : DisabledColor16, false,
false);
AddHtmlLocalized(50, 51 + i * 21, 150, 20, intName, enabled ? EnabledColor16 : DisabledColor16);
else if (name is string strName)
AddHtml(50, 51 + i * 21, 150, 20,
$"<BASEFONT COLOR=#{(enabled ? EnabledColor32 : DisabledColor32):X6}>{strName}</BASEFONT>", false,
false);
$"<BASEFONT COLOR=#{(enabled ? EnabledColor32 : DisabledColor32):X6}>{strName}</BASEFONT>");
}
}

View file

@ -14,7 +14,7 @@ namespace Server.Spells.Necromancy
Reagent.PigIron
);
public VampiricEmbraceSpell(Mobile caster, Item scroll) : base(caster, scroll, m_Info)
public VampiricEmbraceSpell(Mobile caster, Item scroll = null) : base(caster, scroll, m_Info)
{
}
@ -50,4 +50,4 @@ namespace Server.Spells.Necromancy
Effects.PlaySound(m.Location, m.Map, 0x4B1);
}
}
}
}

View file

@ -15,7 +15,7 @@ namespace Server.Spells.Necromancy
Reagent.PigIron
);
public VengefulSpiritSpell(Mobile caster, Item scroll) : base(caster, scroll, m_Info)
public VengefulSpiritSpell(Mobile caster, Item scroll = null) : base(caster, scroll, m_Info)
{
}
@ -92,4 +92,4 @@ namespace Server.Spells.Necromancy
}
}
}
}
}

View file

@ -16,7 +16,7 @@ namespace Server.Spells.Necromancy
Reagent.PigIron
);
public WitherSpell(Mobile caster, Item scroll)
public WitherSpell(Mobile caster, Item scroll = null)
: base(caster, scroll, m_Info)
{
}
@ -44,7 +44,7 @@ namespace Server.Spells.Necromancy
List<Mobile> targets = new List<Mobile>();
BaseCreature cbc = Caster as BaseCreature;
bool isMonster = cbc != null && !cbc.Controlled && !cbc.Summoned;
bool isMonster = cbc?.Controlled == false && !cbc.Summoned;
foreach (Mobile m in Caster.GetMobilesInRange(Core.ML ? 4 : 5))
if (Caster != m && Caster.InLOS(m) && (isMonster || SpellHelper.ValidIndirectTarget(Caster, m)) &&
@ -104,4 +104,4 @@ namespace Server.Spells.Necromancy
FinishSequence();
}
}
}
}

View file

@ -13,7 +13,7 @@ namespace Server.Spells.Necromancy
Reagent.PigIron
);
public WraithFormSpell(Mobile caster, Item scroll) : base(caster, scroll, m_Info)
public WraithFormSpell(Mobile caster, Item scroll = null) : base(caster, scroll, m_Info)
{
}
@ -46,4 +46,4 @@ namespace Server.Spells.Necromancy
mobile.IgnoreMobiles = false;
}
}
}
}

View file

@ -1,5 +1,4 @@
using System;
using System.Collections;
using System.Collections.Generic;
using Server.Gumps;
using Server.Items;
@ -45,26 +44,22 @@ namespace Server.Spells.Ninjitsu
public static AnimalFormEntry[] Entries{ get; } =
{
new AnimalFormEntry(typeof(Kirin), 1029632, 9632, 0, 1070811, 100.0, 0x84, 0, 0, false, true, false),
new AnimalFormEntry(typeof(Unicorn), 1018214, 9678, 0, 1070812, 100.0, 0x7A, 0, 0, false, true, false),
new AnimalFormEntry(typeof(BakeKitsune), 1030083, 10083, 0, 1070810, 82.5, 0xF6, 0, 0, false, true, false),
new AnimalFormEntry(typeof(GreyWolf), 1028482, 9681, 2309, 1070810, 82.5, 0x19, 0x8FD, 0x90E, false, true,
false),
new AnimalFormEntry(typeof(Llama), 1028438, 8438, 0, 1070809, 70.0, 0xDC, 0, 0, false, true, false),
new AnimalFormEntry(typeof(ForestOstard), 1018273, 8503, 2212, 1070809, 70.0, 0xDB, 0x899, 0x8B0, false, true,
false),
new AnimalFormEntry(typeof(BullFrog), 1028496, 8496, 2003, 1070807, 50.0, 0x51, 0x7D1, 0x7D6, false, false,
false),
new AnimalFormEntry(typeof(GiantSerpent), 1018114, 9663, 2009, 1070808, 50.0, 0x15, 0x7D1, 0x7E2, false, false,
false),
new AnimalFormEntry(typeof(Dog), 1018280, 8476, 2309, 1070806, 40.0, 0xD9, 0x8FD, 0x90E, false, false, false),
new AnimalFormEntry(typeof(Cat), 1018264, 8475, 2309, 1070806, 40.0, 0xC9, 0x8FD, 0x90E, false, false, false),
new AnimalFormEntry(typeof(Rat), 1018294, 8483, 2309, 1070805, 20.0, 0xEE, 0x8FD, 0x90E, true, false, false),
new AnimalFormEntry(typeof(Rabbit), 1028485, 8485, 2309, 1070805, 20.0, 0xCD, 0x8FD, 0x90E, true, false, false),
new AnimalFormEntry(typeof(Squirrel), 1031671, 11671, 0, 0, 20.0, 0x116, 0, 0, false, false, false),
new AnimalFormEntry(typeof(Kirin), 1029632, 9632, 0, 1070811, 100.0, 0x84, 0, 0),
new AnimalFormEntry(typeof(Unicorn), 1018214, 9678, 0, 1070812, 100.0, 0x7A, 0, 0),
new AnimalFormEntry(typeof(BakeKitsune), 1030083, 10083, 0, 1070810, 82.5, 0xF6, 0, 0),
new AnimalFormEntry(typeof(GreyWolf), 1028482, 9681, 2309, 1070810, 82.5, 0x19, 0x8FD, 0x90E),
new AnimalFormEntry(typeof(Llama), 1028438, 8438, 0, 1070809, 70.0, 0xDC, 0, 0),
new AnimalFormEntry(typeof(ForestOstard), 1018273, 8503, 2212, 1070809, 70.0, 0xDB, 0x899, 0x8B0),
new AnimalFormEntry(typeof(BullFrog), 1028496, 8496, 2003, 1070807, 50.0, 0x51, 0x7D1, 0x7D6, false, false),
new AnimalFormEntry(typeof(GiantSerpent), 1018114, 9663, 2009, 1070808, 50.0, 0x15, 0x7D1, 0x7E2, false, false),
new AnimalFormEntry(typeof(Dog), 1018280, 8476, 2309, 1070806, 40.0, 0xD9, 0x8FD, 0x90E, false, false),
new AnimalFormEntry(typeof(Cat), 1018264, 8475, 2309, 1070806, 40.0, 0xC9, 0x8FD, 0x90E, false, false),
new AnimalFormEntry(typeof(Rat), 1018294, 8483, 2309, 1070805, 20.0, 0xEE, 0x8FD, 0x90E, true, false),
new AnimalFormEntry(typeof(Rabbit), 1028485, 8485, 2309, 1070805, 20.0, 0xCD, 0x8FD, 0x90E, true, false),
new AnimalFormEntry(typeof(Squirrel), 1031671, 11671, 0, 0, 20.0, 0x116, 0, 0, false, false),
new AnimalFormEntry(typeof(Ferret), 1031672, 11672, 0, 1075220, 40.0, 0x117, 0, 0, false, false, true),
new AnimalFormEntry(typeof(CuSidhe), 1031670, 11670, 0, 1075221, 60.0, 0x115, 0, 0, false, false, false),
new AnimalFormEntry(typeof(Reptalon), 1075202, 11669, 0, 1075222, 90.0, 0x114, 0, 0, false, false, false)
new AnimalFormEntry(typeof(CuSidhe), 1031670, 11670, 0, 1075221, 60.0, 0x115, 0, 0, false, false),
new AnimalFormEntry(typeof(Reptalon), 1075202, 11669, 0, 1075222, 90.0, 0x114, 0, 0, false, false)
};
public static void Initialize()
@ -74,9 +69,7 @@ namespace Server.Spells.Ninjitsu
public static void OnLogin(LoginEventArgs e)
{
AnimalFormContext context = GetContext(e.Mobile);
if (context != null && context.SpeedBoost)
if (GetContext(e.Mobile)?.SpeedBoost == true)
e.Mobile.Send(SpeedControl.MountSpeed);
}
@ -350,7 +343,7 @@ namespace Server.Spells.Ninjitsu
*/
public AnimalFormEntry(Type type, TextDefinition name, int itemID, int hue, int tooltip, double reqSkill,
int bodyMod, int hueModMin, int hueModMax, bool stealthBonus, bool speedBoost, bool stealingBonus)
int bodyMod, int hueModMin, int hueModMax, bool stealthBonus = false, bool speedBoost = true, bool stealingBonus = false)
{
Type = type;
Name = name;
@ -390,7 +383,7 @@ namespace Server.Spells.Ninjitsu
public class AnimalFormGump : Gump
{
//TODO: Convert this for ML to the BaseImageTileButtonsgump
//TODO: Convert this for ML to the BaseImageTileButtonsGump
private Mobile m_Caster;
private AnimalForm m_Spell;
@ -408,11 +401,10 @@ namespace Server.Spells.Ninjitsu
AddImageTiled(10, 374, 500, 20, 0xA40);
AddAlphaRegion(10, 10, 500, 384);
AddHtmlLocalized(14, 12, 500, 20, 1063394, 0x7FFF, false,
false); // <center>Polymorph Selection Menu</center>
AddHtmlLocalized(14, 12, 500, 20, 1063394, 0x7FFF); // <center>Polymorph Selection Menu</center>
AddButton(10, 374, 0xFB1, 0xFB2, 0, GumpButtonType.Reply, 0);
AddHtmlLocalized(45, 376, 450, 20, 1011012, 0x7FFF, false, false); // CANCEL
AddButton(10, 374, 0xFB1, 0xFB2, 0);
AddHtmlLocalized(45, 376, 450, 20, 1011012, 0x7FFF); // CANCEL
double ninjitsu = caster.Skills.Ninjitsu.Value;
@ -430,7 +422,7 @@ namespace Server.Spells.Ninjitsu
if (page > 1)
{
AddButton(400, 374, 0xFA5, 0xFA7, 0, GumpButtonType.Page, page);
AddHtmlLocalized(440, 376, 60, 20, 1043353, 0x7FFF, false, false); // Next
AddHtmlLocalized(440, 376, 60, 20, 1043353, 0x7FFF); // Next
}
AddPage(page);
@ -438,7 +430,7 @@ namespace Server.Spells.Ninjitsu
if (page > 1)
{
AddButton(300, 374, 0xFAE, 0xFB0, 0, GumpButtonType.Page, 1);
AddHtmlLocalized(340, 376, 60, 20, 1011393, 0x7FFF, false, false); // Back
AddHtmlLocalized(340, 376, 60, 20, 1011393, 0x7FFF); // Back
}
}
@ -452,7 +444,7 @@ namespace Server.Spells.Ninjitsu
AddImageTiledButton(x, y, 0x918, 0x919, i + 1, GumpButtonType.Reply, 0, entries[i].ItemID,
entries[i].Hue, 40 - b.Width / 2 - b.X, 30 - b.Height / 2 - b.Y, entries[i].Tooltip);
AddHtmlLocalized(x + 84, y, 250, 60, entries[i].Name, 0x7FFF, false, false);
AddHtmlLocalized(x + 84, y, 250, 60, entries[i].Name, 0x7FFF);
current++;
}
@ -579,7 +571,7 @@ namespace Server.Spells.Ninjitsu
m_LastTarget = m_Mobile.Combatant;
}
if (m_Mobile.Warmode && m_LastTarget != null && m_LastTarget.Alive && !m_LastTarget.Deleted &&
if (m_Mobile.Warmode && m_LastTarget?.Alive == true && m_LastTarget?.Deleted != true &&
m_Counter-- <= 0)
{
if (m_Mobile.CanBeHarmful(m_LastTarget) && m_LastTarget.Map == m_Mobile.Map &&

View file

@ -1,5 +1,4 @@
using System;
using System.Collections;
using System.Collections.Generic;
using Server.Items;
using Server.SkillHandlers;
@ -31,11 +30,9 @@ namespace Server.Spells.Ninjitsu
double ninjitsu = attacker.Skills.Ninjitsu.Value;
double chance;
bool
isRanged = false; // should be defined onHit method, what if the player hit and remove the weapon before process? ;)
if (attacker.Weapon is BaseRanged)
isRanged = true;
// TODO: should be defined onHit method, what if the player hit and remove the weapon before process? ;)
bool isRanged = attacker.Weapon is BaseRanged;
if (ninjitsu < 100) //This formula is an approximation from OSI data. TODO: find correct formula
chance = 30 + (ninjitsu - 85) * 2.2;

View file

@ -1,5 +1,4 @@
using System;
using System.Collections;
using System.Collections.Generic;
using Server.Items;

View file

@ -251,7 +251,7 @@ namespace Server.Mobiles
// Clones only follow their owners
Mobile master = m_Mobile.SummonMaster;
if (master != null && master.Map == m_Mobile.Map && master.InRange(m_Mobile, m_Mobile.RangePerception))
if (master?.Map == m_Mobile.Map && master?.InRange(m_Mobile, m_Mobile.RangePerception) == true)
{
int iCurrDist = (int)m_Mobile.GetDistanceToSqrt(master);
bool bRun = iCurrDist > 5;

View file

@ -26,13 +26,7 @@ namespace Server.Spells.Ninjitsu
public static bool CheckExpansion(Mobile from)
{
if (!(from is PlayerMobile))
return true;
if (from.NetState == null)
return false;
return from.NetState.SupportsExpansion(Expansion.SE);
return (from as PlayerMobile)?.NetState?.SupportsExpansion(Expansion.SE) == true;
}
public override bool CheckCast()
@ -103,4 +97,4 @@ namespace Server.Spells.Ninjitsu
return 0;
}
}
}
}

View file

@ -1,5 +1,4 @@
using System;
using System.Collections;
using System.Collections.Generic;
using Server.SkillHandlers;

View file

@ -14,7 +14,7 @@ namespace Server.Spells.Second
Reagent.MandrakeRoot
);
public AgilitySpell(Mobile caster, Item scroll) : base(caster, scroll, m_Info)
public AgilitySpell(Mobile caster, Item scroll = null) : base(caster, scroll, m_Info)
{
}
@ -81,4 +81,4 @@ namespace Server.Spells.Second
}
}
}
}
}

View file

@ -14,7 +14,7 @@ namespace Server.Spells.Second
Reagent.Nightshade
);
public CunningSpell(Mobile caster, Item scroll) : base(caster, scroll, m_Info)
public CunningSpell(Mobile caster, Item scroll = null) : base(caster, scroll, m_Info)
{
}
@ -81,4 +81,4 @@ namespace Server.Spells.Second
}
}
}
}
}

View file

@ -13,7 +13,7 @@ namespace Server.Spells.Second
Reagent.Ginseng
);
public CureSpell(Mobile caster, Item scroll) : base(caster, scroll, m_Info)
public CureSpell(Mobile caster, Item scroll = null) : base(caster, scroll, m_Info)
{
}
@ -97,4 +97,4 @@ namespace Server.Spells.Second
}
}
}
}
}

View file

@ -12,7 +12,7 @@ namespace Server.Spells.Second
Reagent.SpidersSilk
);
public HarmSpell(Mobile caster, Item scroll) : base(caster, scroll, m_Info)
public HarmSpell(Mobile caster, Item scroll = null) : base(caster, scroll, m_Info)
{
}
@ -105,4 +105,4 @@ namespace Server.Spells.Second
}
}
}
}
}

View file

@ -14,7 +14,7 @@ namespace Server.Spells.Second
Reagent.SulfurousAsh
);
public MagicTrapSpell(Mobile caster, Item scroll) : base(caster, scroll, m_Info)
public MagicTrapSpell(Mobile caster, Item scroll = null) : base(caster, scroll, m_Info)
{
}
@ -90,4 +90,4 @@ namespace Server.Spells.Second
}
}
}
}
}

View file

@ -1,5 +1,4 @@
using System;
using System.Collections;
using System.Collections.Generic;
namespace Server.Spells.Second
@ -17,7 +16,7 @@ namespace Server.Spells.Second
private static Dictionary<Mobile, Tuple<ResistanceMod, DefaultSkillMod>> m_Table = new Dictionary<Mobile, Tuple<ResistanceMod, DefaultSkillMod>>();
public ProtectionSpell(Mobile caster, Item scroll) : base(caster, scroll, m_Info)
public ProtectionSpell(Mobile caster, Item scroll = null) : base(caster, scroll, m_Info)
{
}

View file

@ -13,7 +13,7 @@ namespace Server.Spells.Second
Reagent.SulfurousAsh
);
public RemoveTrapSpell(Mobile caster, Item scroll) : base(caster, scroll, m_Info)
public RemoveTrapSpell(Mobile caster, Item scroll = null) : base(caster, scroll, m_Info)
{
}
@ -76,4 +76,4 @@ namespace Server.Spells.Second
}
}
}
}
}

View file

@ -14,7 +14,7 @@ namespace Server.Spells.Second
Reagent.Nightshade
);
public StrengthSpell(Mobile caster, Item scroll) : base(caster, scroll, m_Info)
public StrengthSpell(Mobile caster, Item scroll = null) : base(caster, scroll, m_Info)
{
}
@ -81,4 +81,4 @@ namespace Server.Spells.Second
}
}
}
}
}

View file

@ -1,4 +1,5 @@
using System.Collections.Generic;
using System.Linq;
using Server.Targeting;
namespace Server.Spells.Seventh
@ -16,7 +17,7 @@ namespace Server.Spells.Seventh
Reagent.SulfurousAsh
);
public ChainLightningSpell(Mobile caster, Item scroll) : base(caster, scroll, m_Info)
public ChainLightningSpell(Mobile caster, Item scroll = null) : base(caster, scroll, m_Info)
{
}
@ -52,32 +53,25 @@ namespace Server.Spells.Seventh
{
IPooledEnumerable<Mobile> eable = map.GetMobilesInRange(new Point3D(p), 2);
foreach (Mobile m in eable)
targets.AddRange(eable.Where(m =>
{
if (Core.AOS && m == Caster)
continue;
if (Core.AOS && (m == Caster || !Caster.InLOS(m)) || !SpellHelper.ValidIndirectTarget(Caster, m) ||
!Caster.CanBeHarmful(m, false))
return false;
if (SpellHelper.ValidIndirectTarget(Caster, m) && Caster.CanBeHarmful(m, false))
{
if (Core.AOS && !Caster.InLOS(m))
continue;
if (m.Player)
playerVsPlayer = true;
targets.Add(m);
if (m.Player)
playerVsPlayer = true;
}
}
return true;
}).ToList());
eable.Free();
}
double damage;
if (Core.AOS)
damage = GetNewAosDamage(51, 1, 5, playerVsPlayer);
else
damage = Utility.Random(27, 22);
damage = Core.AOS ? GetNewAosDamage(51, 1, 5, playerVsPlayer)
: Utility.Random(27, 22);
if (targets.Count > 0)
{
@ -135,4 +129,4 @@ namespace Server.Spells.Seventh
}
}
}
}
}

View file

@ -19,7 +19,7 @@ namespace Server.Spells.Seventh
Reagent.SulfurousAsh
);
public EnergyFieldSpell(Mobile caster, Item scroll) : base(caster, scroll, m_Info)
public EnergyFieldSpell(Mobile caster, Item scroll = null) : base(caster, scroll, m_Info)
{
}
@ -198,4 +198,4 @@ namespace Server.Spells.Seventh
}
}
}
}
}

View file

@ -12,7 +12,7 @@ namespace Server.Spells.Seventh
Reagent.SulfurousAsh
);
public FlameStrikeSpell(Mobile caster, Item scroll) : base(caster, scroll, m_Info)
public FlameStrikeSpell(Mobile caster, Item scroll = null) : base(caster, scroll, m_Info)
{
}
@ -87,4 +87,4 @@ namespace Server.Spells.Seventh
}
}
}
}
}

View file

@ -22,11 +22,7 @@ namespace Server.Spells.Seventh
private 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)
public GateTravelSpell(Mobile caster, RunebookEntry entry = null, Item scroll = null) : base(caster, scroll, m_Info)
{
m_Entry = entry;
}
@ -246,4 +242,4 @@ namespace Server.Spells.Seventh
}
}
}
}
}

View file

@ -14,7 +14,7 @@ namespace Server.Spells.Seventh
Reagent.SpidersSilk
);
public ManaVampireSpell(Mobile caster, Item scroll) : base(caster, scroll, m_Info)
public ManaVampireSpell(Mobile caster, Item scroll = null) : base(caster, scroll, m_Info)
{
}
@ -113,4 +113,4 @@ namespace Server.Spells.Seventh
}
}
}
}
}

View file

@ -1,4 +1,5 @@
using System.Collections.Generic;
using System.Linq;
using Server.Items;
using Server.Mobiles;
using Server.Targeting;
@ -17,7 +18,7 @@ namespace Server.Spells.Seventh
Reagent.SulfurousAsh
);
public MassDispelSpell(Mobile caster, Item scroll) : base(caster, scroll, m_Info)
public MassDispelSpell(Mobile caster, Item scroll = null) : base(caster, scroll, m_Info)
{
}
@ -40,46 +41,38 @@ namespace Server.Spells.Seventh
SpellHelper.GetSurfaceTop(ref p);
List<Mobile> targets = new List<Mobile>();
Map map = Caster.Map;
if (map != null)
{
IPooledEnumerable<BaseCreature> eable = map.GetMobilesInRange<BaseCreature>(new Point3D(p), 8);
foreach (BaseCreature m in eable)
if (m.IsDispellable && Caster.CanBeHarmful(m, false))
targets.Add(m);
foreach (BaseCreature bc in eable)
{
if (!(bc.IsDispellable && Caster.CanBeHarmful(bc, false)))
continue;
double dispelChance =
(50.0 + 100 * (Caster.Skills.Magery.Value - bc.DispelDifficulty) / (bc.DispelFocus * 2)) / 100;
if (dispelChance > Utility.RandomDouble())
{
Effects.SendLocationParticles(EffectItem.Create(bc.Location, bc.Map, EffectItem.DefaultDuration),
0x3728, 8, 20, 5042);
Effects.PlaySound(bc, bc.Map, 0x201);
bc.Delete();
}
else
{
Caster.DoHarmful(bc);
bc.FixedEffect(0x3779, 10, 20);
}
}
eable.Free();
}
for (int i = 0; i < targets.Count; ++i)
{
Mobile m = targets[i];
if (!(m is BaseCreature bc))
continue;
double dispelChance =
(50.0 + 100 * (Caster.Skills.Magery.Value - bc.DispelDifficulty) / (bc.DispelFocus * 2)) / 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
{
Caster.DoHarmful(m);
m.FixedEffect(0x3779, 10, 20);
}
}
}
FinishSequence();
@ -106,4 +99,4 @@ namespace Server.Spells.Seventh
}
}
}
}
}

View file

@ -1,4 +1,5 @@
using System.Collections.Generic;
using System.Linq;
using Server.Targeting;
namespace Server.Spells.Seventh
@ -16,7 +17,7 @@ namespace Server.Spells.Seventh
Reagent.SpidersSilk
);
public MeteorSwarmSpell(Mobile caster, Item scroll) : base(caster, scroll, m_Info)
public MeteorSwarmSpell(Mobile caster, Item scroll = null) : base(caster, scroll, m_Info)
{
}
@ -42,7 +43,7 @@ namespace Server.Spells.Seventh
if (p is Item item)
p = item.GetWorldLocation();
List<Mobile> targets = new List<Mobile>();
List<Mobile> targets;
Map map = Caster.Map;
@ -52,27 +53,29 @@ namespace Server.Spells.Seventh
{
IPooledEnumerable<Mobile> eable = map.GetMobilesInRange(new Point3D(p), 2);
foreach (Mobile m in eable)
if (Caster != m && SpellHelper.ValidIndirectTarget(Caster, m) && Caster.CanBeHarmful(m, false))
{
if (Core.AOS && !Caster.InLOS(m))
continue;
targets = eable.Where(m =>
{
if (Caster == m || !SpellHelper.ValidIndirectTarget(Caster, m) || !Caster.CanBeHarmful(m, false) ||
Core.AOS && !Caster.InLOS(m))
return false;
targets.Add(m);
if (m.Player)
playerVsPlayer = true;
if (m.Player)
playerVsPlayer = true;
}
return true;
}).ToList();
eable.Free();
}
else
{
targets = new List<Mobile>();
}
double damage;
if (Core.AOS)
damage = GetNewAosDamage(51, 1, 5, playerVsPlayer);
else
damage = Utility.Random(27, 22);
damage = Core.AOS ? GetNewAosDamage(51, 1, 5, playerVsPlayer)
: Utility.Random(27, 22);
if (targets.Count > 0)
{
@ -83,12 +86,11 @@ namespace Server.Spells.Seventh
else if (!Core.AOS)
damage /= targets.Count;
double toDeal;
for (int i = 0; i < targets.Count; ++i)
{
Mobile m = targets[i];
toDeal = damage;
double toDeal = damage;
if (!Core.AOS && CheckResisted(m))
{
@ -130,4 +132,4 @@ namespace Server.Spells.Seventh
}
}
}
}
}

View file

@ -1,5 +1,4 @@
using System;
using System.Collections;
using System.Collections.Generic;
using Server.Factions;
using Server.Gumps;

View file

@ -15,7 +15,7 @@ namespace Server.Spells.Sixth
Reagent.SulfurousAsh
);
public DispelSpell(Mobile caster, Item scroll) : base(caster, scroll, m_Info)
public DispelSpell(Mobile caster, Item scroll = null) : base(caster, scroll, m_Info)
{
}
@ -79,4 +79,4 @@ namespace Server.Spells.Sixth
}
}
}
}
}

View file

@ -12,7 +12,7 @@ namespace Server.Spells.Sixth
Reagent.Nightshade
);
public EnergyBoltSpell(Mobile caster, Item scroll) : base(caster, scroll, m_Info)
public EnergyBoltSpell(Mobile caster, Item scroll = null) : base(caster, scroll, m_Info)
{
}
@ -92,4 +92,4 @@ namespace Server.Spells.Sixth
}
}
}
}
}

View file

@ -13,7 +13,7 @@ namespace Server.Spells.Sixth
Reagent.MandrakeRoot
);
public ExplosionSpell(Mobile caster, Item scroll)
public ExplosionSpell(Mobile caster, Item scroll = null)
: base(caster, scroll, m_Info)
{
}
@ -125,4 +125,4 @@ namespace Server.Spells.Sixth
}
}
}
}
}

Some files were not shown because too many files have changed in this diff Show more