Modernization Fixes & Updates to Default Values (#3)

This commit is contained in:
Kamron Batman 2018-10-28 00:33:16 -07:00 committed by GitHub
parent 445eddff68
commit dcf64091b1
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
768 changed files with 10507 additions and 14196 deletions

View file

@ -55,10 +55,10 @@ namespace Server.Spells
int maxSkill = (1 + (int)Circle) * 10;
maxSkill += (1 + (int)Circle / 6) * 25;
if (m.Skills[SkillName.MagicResist].Value < maxSkill)
m.CheckSkill(SkillName.MagicResist, 0.0, m.Skills[SkillName.MagicResist].Cap);
if (m.Skills.MagicResist.Value < maxSkill)
m.CheckSkill(SkillName.MagicResist, 0.0, m.Skills.MagicResist.Cap);
return m.Skills[SkillName.MagicResist].Value;
return m.Skills.MagicResist.Value;
}
public virtual bool CheckResisted(Mobile target)
@ -76,16 +76,16 @@ namespace Server.Spells
int maxSkill = (1 + (int)Circle) * 10;
maxSkill += (1 + (int)Circle / 6) * 25;
if (target.Skills[SkillName.MagicResist].Value < maxSkill)
target.CheckSkill(SkillName.MagicResist, 0.0, target.Skills[SkillName.MagicResist].Cap);
if (target.Skills.MagicResist.Value < maxSkill)
target.CheckSkill(SkillName.MagicResist, 0.0, target.Skills.MagicResist.Cap);
return n >= Utility.RandomDouble();
}
public virtual double GetResistPercentForCircle(Mobile target, SpellCircle circle)
{
double firstPercent = target.Skills[SkillName.MagicResist].Value / 5.0;
double secondPercent = target.Skills[SkillName.MagicResist].Value -
double firstPercent = target.Skills.MagicResist.Value / 5.0;
double secondPercent = target.Skills.MagicResist.Value -
((Caster.Skills[CastSkill].Value - 20.0) / 5.0 + (1 + (int)circle) * 5.0);
return (firstPercent > secondPercent ? firstPercent : secondPercent) /

View file

@ -89,9 +89,9 @@ namespace Server.Spells
if (IsCasting)
{
object o = ProtectionSpell.Registry[Caster];
double d = ProtectionSpell.Registry[Caster];
if (!(o is double d) || d <= Utility.RandomDouble() * 100.0)
if (d <= Utility.RandomDouble() * 100.0)
Disturb(DisturbType.Hurt, false, true);
}
}
@ -242,7 +242,7 @@ namespace Server.Spells
// There is no chance to gain
// m.CheckSkill( SkillName.Inscribe, 0.0, 120.0 );
return m.Skills[SkillName.Inscribe].Value;
return m.Skills.Inscribe.Value;
}
public virtual int GetInscribeFixed(Mobile m)
@ -250,7 +250,7 @@ namespace Server.Spells
// There is no chance to gain
// m.CheckSkill( SkillName.Inscribe, 0.0, 120.0 );
return m.Skills[SkillName.Inscribe].Fixed;
return m.Skills.Inscribe.Fixed;
}
public virtual int GetDamageFixed(Mobile m)
@ -269,7 +269,7 @@ namespace Server.Spells
public virtual double GetResistSkill(Mobile m)
{
return m.Skills[SkillName.MagicResist].Value;
return m.Skills.MagicResist.Value;
}
public virtual double GetDamageScalar(Mobile target)
@ -279,7 +279,7 @@ namespace Server.Spells
if (!Core.AOS) //EvalInt stuff for AoS is handled elsewhere
{
double casterEI = Caster.Skills[DamageSkill].Value;
double targetRS = target.Skills[SkillName.MagicResist].Value;
double targetRS = target.Skills.MagicResist.Value;
/*
if ( Core.AOS )
@ -645,7 +645,7 @@ namespace Server.Spells
int fcMax = 4;
if (CastSkill == SkillName.Magery || CastSkill == SkillName.Necromancy ||
CastSkill == SkillName.Chivalry && Caster.Skills[SkillName.Magery].Value >= 70.0)
CastSkill == SkillName.Chivalry && Caster.Skills.Magery.Value >= 70.0)
fcMax = 2;
int fc = AosAttributes.GetValue(Caster, AosAttribute.CastSpeed);
@ -653,7 +653,7 @@ namespace Server.Spells
if (fc > fcMax)
fc = fcMax;
if (ProtectionSpell.Registry.Contains(Caster))
if (ProtectionSpell.Registry.ContainsKey(Caster))
fc -= 2;
if (EssenceOfWindSpell.IsDebuffed(Caster))
@ -911,4 +911,4 @@ namespace Server.Spells
}
}
}
}
}

View file

@ -22,7 +22,7 @@ namespace Server
{
public static void Nullify(Mobile from)
{
if (!from.CanBeginAction(typeof(DefensiveSpell)))
if (!from.CanBeginAction<DefensiveSpell>())
new InternalTimer(from).Start();
}
@ -40,7 +40,7 @@ namespace Server
protected override void OnTick()
{
m_Mobile.EndAction(typeof(DefensiveSpell));
m_Mobile.EndAction<DefensiveSpell>();
}
}
}
@ -333,7 +333,7 @@ namespace Server.Spells
if (Core.AOS)
return TimeSpan.FromSeconds(6 * caster.Skills.EvalInt.Fixed / 50 + 1);
return TimeSpan.FromSeconds(caster.Skills[SkillName.Magery].Value * 1.2);
return TimeSpan.FromSeconds(caster.Skills.Magery.Value * 1.2);
}
public static double GetOffsetScalar(Mobile caster, Mobile target, bool curse)
@ -378,7 +378,7 @@ namespace Server.Spells
}
}
return 1 + (int)(caster.Skills[SkillName.Magery].Value * 0.1);
return 1 + (int)(caster.Skills.Magery.Value * 0.1);
}
public static Guild GetGuildFor(Mobile m)
@ -484,7 +484,7 @@ namespace Server.Spells
if (map == null)
return;
double scale = 1.0 + (caster.Skills[SkillName.Magery].Value - 100.0) / 200.0;
double scale = 1.0 + (caster.Skills.Magery.Value - 100.0) / 200.0;
if (scaleDuration)
duration = TimeSpan.FromSeconds(duration.TotalSeconds * scale);
@ -617,7 +617,7 @@ namespace Server.Spells
return false;
}
if (caster != null && caster.AccessLevel == AccessLevel.Player && caster.Region.IsPartOf(typeof(Jail)))
if (caster != null && caster.AccessLevel == AccessLevel.Player && caster.Region.IsPartOf<Jail>())
{
caster.SendLocalizedMessage(1114345); // You'll need a better jailbreak plan than that!
return false;
@ -698,7 +698,7 @@ namespace Server.Spells
public static bool IsFeluccaDungeon(Map map, Point3D loc)
{
Region region = Region.Find(loc, map);
return region.IsPartOf(typeof(DungeonRegion)) && region.Map == Map.Felucca;
return region.IsPartOf<DungeonRegion>() && region.Map == Map.Felucca;
}
public static bool IsKhaldun(Map map, Point3D loc)
@ -723,13 +723,11 @@ namespace Server.Spells
{
#region Duels
if (Region.Find(loc, map).IsPartOf(typeof(SafeZone)))
if (Region.Find(loc, map).IsPartOf<SafeZone>())
{
if (m_TravelType == TravelCheckType.TeleportTo || m_TravelType == TravelCheckType.TeleportFrom)
{
PlayerMobile pm = m_TravelCaster as PlayerMobile;
if (pm?.DuelPlayer != null && !pm.DuelPlayer.Eliminated)
if (m_TravelCaster is PlayerMobile pm && pm.DuelPlayer != null && !pm.DuelPlayer.Eliminated)
return true;
}
@ -750,12 +748,12 @@ namespace Server.Spells
return false;
}*/
return Region.Find(loc, map).IsPartOf(typeof(StrongholdRegion));
return Region.Find(loc, map).IsPartOf<StrongholdRegion>();
}
public static bool IsChampionSpawn(Map map, Point3D loc)
{
return Region.Find(loc, map).IsPartOf(typeof(ChampionSpawnRegion));
return Region.Find(loc, map).IsPartOf<ChampionSpawnRegion>();
}
public static bool IsDoomFerry(Map map, Point3D loc)
@ -858,11 +856,11 @@ namespace Server.Spells
#region Dueling
SafeZone sz = (SafeZone)Region.Find(loc, map).GetRegion(typeof(SafeZone));
SafeZone sz = Region.Find(loc, map).GetRegion<SafeZone>();
if (sz != null)
{
PlayerMobile pm = (PlayerMobile)caster;
PlayerMobile pm = caster as PlayerMobile;
if (pm?.DuelContext == null || !pm.DuelContext.Started || pm.DuelPlayer == null || pm.DuelPlayer.Eliminated)
return true;
@ -870,7 +868,7 @@ namespace Server.Spells
#endregion
GuardedRegion reg = (GuardedRegion)Region.Find(loc, map).GetRegion(typeof(GuardedRegion));
GuardedRegion reg = Region.Find(loc, map).GetRegion<GuardedRegion>();
return reg != null && !reg.IsDisabled();
}
@ -1176,7 +1174,7 @@ namespace Server.Spells
return false;
}
if (!caster.CanBeginAction(typeof(PolymorphSpell)))
if (!caster.CanBeginAction<PolymorphSpell>())
{
caster.SendLocalizedMessage(1061628); // You can't do that while polymorphed.
return false;
@ -1200,7 +1198,7 @@ namespace Server.Spells
{
caster.SendLocalizedMessage(1061632); // You can't do that while carrying the sigil.
}
else if (!caster.CanBeginAction(typeof(PolymorphSpell)))
else if (!caster.CanBeginAction<PolymorphSpell>())
{
caster.SendLocalizedMessage(1061628); // You can't do that while polymorphed.
}
@ -1213,7 +1211,7 @@ namespace Server.Spells
{
caster.SendLocalizedMessage(1061091); // You cannot cast that spell in this form.
}
else if (!caster.CanBeginAction(typeof(IncognitoSpell)) || caster.IsBodyMod && GetContext(caster) == null)
else if (!caster.CanBeginAction<IncognitoSpell>() || caster.IsBodyMod && GetContext(caster) == null)
{
spell.DoFizzle();
}

View file

@ -1,5 +1,6 @@
using System;
using System.Collections;
using System.Collections.Generic;
namespace Server.Spells.Bushido
{
@ -11,9 +12,8 @@ namespace Server.Spells.Bushido
9002
);
private static Hashtable m_Table = new Hashtable();
private static Hashtable m_RegenTable = new Hashtable();
private static Dictionary<Mobile, Timer> m_Table = new Dictionary<Mobile, Timer>();
private static Dictionary<Mobile, Timer> m_RegenTable = new Dictionary<Mobile, Timer>();
public Confidence(Mobile caster, Item scroll) : base(caster, scroll, m_Info)
{
@ -51,27 +51,22 @@ namespace Server.Spells.Bushido
public static bool IsConfident(Mobile m)
{
return m_Table.Contains(m);
return m_Table.ContainsKey(m);
}
public static void BeginConfidence(Mobile m)
{
Timer t = (Timer)m_Table[m];
Timer timer = m_Table[m];
timer?.Stop();
m_Table[m] = timer = new InternalTimer(m);
t?.Stop();
t = new InternalTimer(m);
m_Table[m] = t;
t.Start();
timer.Start();
}
public static void EndConfidence(Mobile m)
{
Timer t = (Timer)m_Table[m];
t?.Stop();
Timer timer = m_Table[m];
timer?.Stop();
m_Table.Remove(m);
@ -80,27 +75,23 @@ namespace Server.Spells.Bushido
public static bool IsRegenerating(Mobile m)
{
return m_RegenTable.Contains(m);
return m_RegenTable.ContainsKey(m);
}
public static void BeginRegenerating(Mobile m)
{
Timer t = (Timer)m_RegenTable[m];
Timer timer = m_RegenTable[m];
timer?.Stop();
t?.Stop();
m_RegenTable[m] = timer = new RegenTimer(m);
t = new RegenTimer(m);
m_RegenTable[m] = t;
t.Start();
timer.Start();
}
public static void StopRegenerating(Mobile m)
{
Timer t = (Timer)m_RegenTable[m];
t?.Stop();
Timer timer = m_RegenTable[m];
timer?.Stop();
m_RegenTable.Remove(m);
}
@ -149,4 +140,4 @@ namespace Server.Spells.Bushido
}
}
}
}
}

View file

@ -1,5 +1,6 @@
using System;
using System.Collections;
using System.Collections.Generic;
using Server.Items;
namespace Server.Spells.Bushido
@ -12,7 +13,7 @@ namespace Server.Spells.Bushido
9002
);
private static Hashtable m_Table = new Hashtable();
private static Dictionary<Mobile, Timer> m_Table = new Dictionary<Mobile, Timer>();
public CounterAttack(Mobile caster, Item scroll) : base(caster, scroll, m_Info)
{
@ -28,13 +29,13 @@ namespace Server.Spells.Bushido
if (!base.CheckCast())
return false;
if (Caster.FindItemOnLayer(Layer.TwoHanded) as BaseShield != null)
if (Caster.FindItemOnLayer(Layer.TwoHanded) is BaseShield)
return true;
if (Caster.FindItemOnLayer(Layer.OneHanded) as BaseWeapon != null)
if (Caster.FindItemOnLayer(Layer.OneHanded) is BaseWeapon)
return true;
if (Caster.FindItemOnLayer(Layer.TwoHanded) as BaseWeapon != null)
if (Caster.FindItemOnLayer(Layer.TwoHanded) is BaseWeapon)
return true;
Caster.SendLocalizedMessage(1062944); // You must have a weapon or a shield equipped to use this ability!
@ -64,27 +65,23 @@ namespace Server.Spells.Bushido
public static bool IsCountering(Mobile m)
{
return m_Table.Contains(m);
return m_Table.ContainsKey(m);
}
public static void StartCountering(Mobile m)
{
Timer t = (Timer)m_Table[m];
Timer timer = m_Table[m];
timer?.Stop();
t?.Stop();
m_Table[m] = timer = new InternalTimer(m);
t = new InternalTimer(m);
m_Table[m] = t;
t.Start();
timer.Start();
}
public static void StopCountering(Mobile m)
{
Timer t = (Timer)m_Table[m];
t?.Stop();
Timer timer = m_Table[m];
timer?.Stop();
m_Table.Remove(m);
@ -108,4 +105,4 @@ namespace Server.Spells.Bushido
}
}
}
}
}

View file

@ -1,5 +1,6 @@
using System;
using System.Collections;
using System.Collections.Generic;
using Server.Items;
namespace Server.Spells.Bushido
@ -12,7 +13,7 @@ namespace Server.Spells.Bushido
9002
);
private static Hashtable m_Table = new Hashtable();
private static Dictionary<Mobile, Timer> m_Table = new Dictionary<Mobile, Timer>();
public Evasion(Mobile caster, Item scroll)
: base(caster, scroll, m_Info)
@ -57,7 +58,7 @@ namespace Server.Spells.Bushido
return false;
}
if (!Caster.CanBeginAction(typeof(Evasion)))
if (!Caster.CanBeginAction<Evasion>())
{
if (messages) Caster.SendLocalizedMessage(501789); // You must wait before trying again.
return false;
@ -114,8 +115,8 @@ namespace Server.Spells.Bushido
BeginEvasion(Caster);
Caster.BeginAction(typeof(Evasion));
Timer.DelayCall(TimeSpan.FromSeconds(20.0), delegate { Caster.EndAction(typeof(Evasion)); });
Caster.BeginAction<Evasion>();
Timer.DelayCall(TimeSpan.FromSeconds(20.0), delegate { Caster.EndAction<Evasion>(); });
}
FinishSequence();
@ -123,7 +124,7 @@ namespace Server.Spells.Bushido
public static bool IsEvading(Mobile m)
{
return m_Table.Contains(m);
return m_Table.ContainsKey(m);
}
public static TimeSpan GetEvadeDuration(Mobile m)
@ -179,22 +180,17 @@ namespace Server.Spells.Bushido
public static void BeginEvasion(Mobile m)
{
Timer t = (Timer)m_Table[m];
Timer timer = m_Table[m];
timer?.Stop();
t?.Stop();
t = new InternalTimer(m, GetEvadeDuration(m));
m_Table[m] = t;
t.Start();
m_Table[m] = timer = new InternalTimer(m, GetEvadeDuration(m));
timer.Start();
}
public static void EndEvasion(Mobile m)
{
Timer t = (Timer)m_Table[m];
t?.Stop();
Timer timer = m_Table[m];
timer?.Stop();
m_Table.Remove(m);
@ -219,4 +215,4 @@ namespace Server.Spells.Bushido
}
}
}
}
}

View file

@ -1,11 +1,12 @@
using System;
using System.Collections;
using System.Collections.Generic;
namespace Server.Spells.Bushido
{
public class HonorableExecution : SamuraiMove
{
private static Hashtable m_Table = new Hashtable();
private static Dictionary<Mobile, HonorableExecutionInfo> m_Table = new Dictionary<Mobile, HonorableExecutionInfo>();
public override int BaseMana => 0;
public override double RequiredSkill => 25.0;
@ -15,7 +16,7 @@ namespace Server.Spells.Bushido
public override double GetDamageScalar(Mobile attacker, Mobile defender)
{
double bushido = attacker.Skills[SkillName.Bushido].Value;
double bushido = attacker.Skills.Bushido.Value;
// TODO: 20 -> Perfection
return 1.0 + bushido * 20 / 10000;
@ -28,10 +29,11 @@ namespace Server.Spells.Bushido
ClearCurrentMove(attacker);
if (m_Table[attacker] is HonorableExecutionInfo info)
HonorableExecutionInfo info = m_Table[attacker];
if (info != null)
{
info.Clear();
info.m_Timer?.Stop();
}
@ -39,20 +41,20 @@ namespace Server.Spells.Bushido
{
attacker.FixedParticles(0x373A, 1, 17, 0x7E2, EffectLayer.Waist);
double bushido = attacker.Skills[SkillName.Bushido].Value;
double bushido = attacker.Skills.Bushido.Value;
attacker.Hits += 20 + (int)(bushido * bushido / 480.0);
int swingBonus = Math.Max(1, (int)(bushido * bushido / 720.0));
info = new HonorableExecutionInfo(attacker, swingBonus);
info.m_Timer = Timer.DelayCall(TimeSpan.FromSeconds(20.0), new TimerStateCallback(EndEffect), info);
info.m_Timer = Timer.DelayCall(TimeSpan.FromSeconds(20.0), RemovePenalty, info.m_Mobile);
m_Table[attacker] = info;
}
else
{
ArrayList mods = new ArrayList
List<object> mods = new List<object>
{
new ResistanceMod(ResistanceType.Physical, -40),
new ResistanceMod(ResistanceType.Fire, -40),
@ -60,14 +62,14 @@ namespace Server.Spells.Bushido
new ResistanceMod(ResistanceType.Poison, -40),
new ResistanceMod(ResistanceType.Energy, -40)
};
double resSpells = attacker.Skills[SkillName.MagicResist].Value;
double resSpells = attacker.Skills.MagicResist.Value;
if (resSpells > 0.0)
mods.Add(new DefaultSkillMod(SkillName.MagicResist, true, -resSpells));
info = new HonorableExecutionInfo(attacker, mods);
info.m_Timer = Timer.DelayCall(TimeSpan.FromSeconds(7.0), new TimerStateCallback(EndEffect), info);
info.m_Timer = Timer.DelayCall(TimeSpan.FromSeconds(7.0), RemovePenalty, info.m_Mobile);
m_Table[attacker] = info;
}
@ -103,24 +105,19 @@ namespace Server.Spells.Bushido
m_Table.Remove(target);
}
public void EndEffect(object state)
{
RemovePenalty(((HonorableExecutionInfo)state).m_Mobile);
}
private class HonorableExecutionInfo
{
public Mobile m_Mobile;
public ArrayList m_Mods;
public List<object> m_Mods;
public bool m_Penalty;
public int m_SwingBonus;
public Timer m_Timer;
public HonorableExecutionInfo(Mobile from, ArrayList mods) : this(from, 0, mods, true)
public HonorableExecutionInfo(Mobile from, List<object> mods) : this(from, 0, mods, true)
{
}
public HonorableExecutionInfo(Mobile from, int swingBonus, ArrayList mods = null, bool penalty = false)
public HonorableExecutionInfo(Mobile from, int swingBonus, List<object> mods = null, bool penalty = false)
{
m_Mobile = from;
m_SwingBonus = swingBonus;
@ -163,4 +160,4 @@ namespace Server.Spells.Bushido
}
}
}
}
}

View file

@ -32,7 +32,7 @@ namespace Server.Spells.Bushido
public override bool IgnoreArmor(Mobile attacker)
{
double bushido = attacker.Skills[SkillName.Bushido].Value;
double bushido = attacker.Skills.Bushido.Value;
double criticalChance = bushido * bushido / 72000.0;
return criticalChance >= Utility.RandomDouble();
}

View file

@ -40,7 +40,7 @@ namespace Server.Spells.Bushido
Mobile target = targets[Utility.Random(targets.Count)];
double damageBonus = attacker.Skills[SkillName.Bushido].Value / 100.0;
double damageBonus = attacker.Skills.Bushido.Value / 100.0;
if (!defender.Alive)
damageBonus *= 1.5;

View file

@ -58,7 +58,7 @@ namespace Server.Spells.Chivalry
if (p != null)
{
// Cleanse by fire is now difficulty based
int chanceToCure = 10000 + (int)(Caster.Skills[SkillName.Chivalry].Value * 75) - (p.Level + 1) * 2000;
int chanceToCure = 10000 + (int)(Caster.Skills.Chivalry.Value * 75) - (p.Level + 1) * 2000;
chanceToCure /= 100;
if (chanceToCure > Utility.Random(100))

View file

@ -1,5 +1,6 @@
using System;
using System.Collections;
using System.Collections.Generic;
using Server.Items;
namespace Server.Spells.Chivalry
@ -12,7 +13,7 @@ namespace Server.Spells.Chivalry
9002
);
private static Hashtable m_Table = new Hashtable();
private static Dictionary<BaseWeapon, ExpireTimer> m_Table = new Dictionary<BaseWeapon, ExpireTimer>();
public ConsecrateWeaponSpell(Mobile caster, Item scroll) : base(caster, scroll, m_Info)
{
@ -77,15 +78,14 @@ namespace Server.Spells.Chivalry
TimeSpan duration = TimeSpan.FromSeconds(seconds);
Timer t = (Timer)m_Table[weapon];
t?.Stop();
ExpireTimer timer = m_Table[weapon];
timer?.Stop();
weapon.Consecrated = true;
m_Table[weapon] = t = new ExpireTimer(weapon, duration);
m_Table[weapon] = timer = new ExpireTimer(weapon, duration);
t.Start();
timer.Start();
}
FinishSequence();
@ -105,8 +105,8 @@ namespace Server.Spells.Chivalry
{
m_Weapon.Consecrated = false;
Effects.PlaySound(m_Weapon.GetWorldLocation(), m_Weapon.Map, 0x1F8);
m_Table.Remove(this);
m_Table.Remove(m_Weapon);
}
}
}
}
}

View file

@ -1,5 +1,6 @@
using System;
using System.Collections;
using System.Collections.Generic;
namespace Server.Spells.Chivalry
{
@ -11,7 +12,7 @@ namespace Server.Spells.Chivalry
9002
);
private static Hashtable m_Table = new Hashtable();
private static Dictionary<Mobile, Timer> m_Table = new Dictionary<Mobile, Timer>();
public DivineFurySpell(Mobile caster, Item scroll) : base(caster, scroll, m_Info)
{
@ -36,9 +37,8 @@ namespace Server.Spells.Chivalry
Caster.Stam = Caster.StamMax;
Timer t = (Timer)m_Table[Caster];
t?.Stop();
Timer timer = m_Table[Caster];
timer?.Stop();
int delay = ComputePowerValue(10);
@ -48,8 +48,7 @@ namespace Server.Spells.Chivalry
else if (delay > 24)
delay = 24;
m_Table[Caster] = t = Timer.DelayCall(TimeSpan.FromSeconds(delay), new TimerStateCallback(Expire_Callback),
Caster);
m_Table[Caster] = Timer.DelayCall(TimeSpan.FromSeconds(delay), Expire_Callback, Caster);
Caster.Delta(MobileDelta.WeaponDamage);
BuffInfo.AddBuff(Caster,
@ -61,17 +60,15 @@ namespace Server.Spells.Chivalry
public static bool UnderEffect(Mobile m)
{
return m_Table.Contains(m);
return m_Table.ContainsKey(m);
}
private static void Expire_Callback(object state)
private static void Expire_Callback(Mobile m)
{
Mobile m = (Mobile)state;
m_Table.Remove(m);
m.Delta(MobileDelta.WeaponDamage);
m.PlaySound(0xF8);
}
}
}
}

View file

@ -1,5 +1,6 @@
using System;
using System.Collections;
using System.Collections.Generic;
using Server.Mobiles;
namespace Server.Spells.Chivalry
@ -12,7 +13,7 @@ namespace Server.Spells.Chivalry
9002
);
private static Hashtable m_Table = new Hashtable();
private static Dictionary<Mobile, Timer> m_Table = new Dictionary<Mobile, Timer>();
public EnemyOfOneSpell(Mobile caster, Item scroll) : base(caster, scroll, m_Info)
{
@ -35,9 +36,8 @@ namespace Server.Spells.Chivalry
Caster.FixedParticles(0x375A, 1, 30, 9966, 33, 2, EffectLayer.Head);
Caster.FixedParticles(0x37B9, 1, 30, 9502, 43, 3, EffectLayer.Head);
Timer t = (Timer)m_Table[Caster];
t?.Stop();
Timer timer = m_Table[Caster];
timer?.Stop();
double delay = (double)ComputePowerValue(1) / 60;
@ -47,8 +47,7 @@ namespace Server.Spells.Chivalry
else if (delay > 3.5)
delay = 3.5;
m_Table[Caster] = Timer.DelayCall(TimeSpan.FromMinutes(delay), new TimerStateCallback(Expire_Callback),
Caster);
m_Table[Caster] = Timer.DelayCall(TimeSpan.FromMinutes(delay), Expire_Callback, Caster);
if (Caster is PlayerMobile mobile)
{
@ -63,10 +62,8 @@ namespace Server.Spells.Chivalry
FinishSequence();
}
private static void Expire_Callback(object state)
private static void Expire_Callback(Mobile m)
{
Mobile m = (Mobile)state;
m_Table.Remove(m);
m.PlaySound(0x1F8);
@ -78,4 +75,4 @@ namespace Server.Spells.Chivalry
}
}
}
}
}

View file

@ -62,7 +62,7 @@ namespace Server.Spells.Chivalry
if (!m.Alive)
{
if (m.Region != null && m.Region.IsPartOf("Khaldun"))
if (m.Region?.IsPartOf("Khaldun") == true)
{
Caster.SendLocalizedMessage(
1010395); // The veil of death in this area is too strong and resists thy efforts to restore life.
@ -70,7 +70,7 @@ namespace Server.Spells.Chivalry
else if (resChance > Utility.RandomDouble())
{
m.FixedParticles(0x375A, 1, 15, 5005, 5, 3, EffectLayer.Head);
m.CloseGump(typeof(ResurrectGump));
m.CloseGump<ResurrectGump>();
m.SendGump(new ResurrectGump(m, Caster));
sacrifice = true;
}

View file

@ -33,7 +33,7 @@ namespace Server.Spells.Eighth
Map map = Caster.Map;
if (map != null)
foreach (Mobile m in Caster.GetMobilesInRange(1 + (int)(Caster.Skills[SkillName.Magery].Value / 15.0)))
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);

View file

@ -68,7 +68,7 @@ namespace Server.Spells.Eighth
Caster.SendLocalizedMessage(501042); // Target can not be resurrected at that location.
m.SendLocalizedMessage(502391); // Thou can not be resurrected there!
}
else if (m.Region != null && m.Region.IsPartOf("Khaldun"))
else if (m.Region?.IsPartOf("Khaldun") == true)
{
Caster.SendLocalizedMessage(
1010395); // The veil of death in this area is too strong and resists thy efforts to restore life.
@ -80,7 +80,7 @@ namespace Server.Spells.Eighth
m.PlaySound(0x214);
m.FixedEffect(0x376A, 10, 16);
m.CloseGump(typeof(ResurrectGump));
m.CloseGump<ResurrectGump>();
m.SendGump(new ResurrectGump(m, Caster));
}

View file

@ -1,5 +1,6 @@
using System;
using System.Collections;
using System.Collections.Generic;
using Server.Factions;
using Server.Items;
using Server.Mobiles;
@ -18,22 +19,7 @@ namespace Server.Spells.Fifth
Reagent.Nightshade
);
private static Hashtable m_Timers = new Hashtable();
private static int[] m_HairIDs =
{
0x2044, 0x2045, 0x2046,
0x203C, 0x203B, 0x203D,
0x2047, 0x2048, 0x2049,
0x204A, 0x0000
};
private static int[] m_BeardIDs =
{
0x203E, 0x203F, 0x2040,
0x2041, 0x204B, 0x204C,
0x204D, 0x0000
};
private static Dictionary<Mobile, InternalTimer> m_Timers = new Dictionary<Mobile, InternalTimer>();
public IncognitoSpell(Mobile caster, Item scroll) : base(caster, scroll, m_Info)
{
@ -49,7 +35,7 @@ namespace Server.Spells.Fifth
return false;
}
if (!Caster.CanBeginAction(typeof(IncognitoSpell)))
if (!Caster.CanBeginAction<IncognitoSpell>())
{
Caster.SendLocalizedMessage(1005559); // This spell is already in effect.
return false;
@ -70,7 +56,7 @@ namespace Server.Spells.Fifth
{
Caster.SendLocalizedMessage(1010445); // You cannot incognito if you have a sigil
}
else if (!Caster.CanBeginAction(typeof(IncognitoSpell)))
else if (!Caster.CanBeginAction<IncognitoSpell>())
{
Caster.SendLocalizedMessage(1005559); // This spell is already in effect.
}
@ -82,13 +68,13 @@ namespace Server.Spells.Fifth
{
Caster.SendLocalizedMessage(1061631); // You can't do that while disguised.
}
else if (!Caster.CanBeginAction(typeof(PolymorphSpell)) || Caster.IsBodyMod)
else if (!Caster.CanBeginAction<PolymorphSpell>() || Caster.IsBodyMod)
{
DoFizzle();
}
else if (CheckSequence())
{
if (Caster.BeginAction(typeof(IncognitoSpell)))
if (Caster.BeginAction<IncognitoSpell>())
{
DisguiseTimers.StopTimer(Caster);
@ -121,8 +107,7 @@ namespace Server.Spells.Fifth
TimeSpan length = TimeSpan.FromSeconds(timeVal);
Timer t = new InternalTimer(Caster, length);
InternalTimer t = new InternalTimer(Caster, length);
m_Timers[Caster] = t;
t.Start();
@ -138,18 +123,16 @@ namespace Server.Spells.Fifth
FinishSequence();
}
public static bool StopTimer(Mobile m)
public static void StopTimer(Mobile m)
{
Timer t = (Timer)m_Timers[m];
Timer t = m_Timers[m];
if (t != null)
{
t.Stop();
m_Timers.Remove(m);
BuffInfo.RemoveBuff(m, BuffIcon.Incognito);
}
if (t == null)
return;
return t != null;
t.Stop();
m_Timers.Remove(m);
BuffInfo.RemoveBuff(m, BuffIcon.Incognito);
}
private class InternalTimer : Timer
@ -173,14 +156,14 @@ namespace Server.Spells.Fifth
protected override void OnTick()
{
if (!m_Owner.CanBeginAction(typeof(IncognitoSpell)))
if (!m_Owner.CanBeginAction<IncognitoSpell>())
{
(m_Owner as PlayerMobile)?.SetHairMods(-1, -1);
m_Owner.BodyMod = 0;
m_Owner.HueMod = -1;
m_Owner.NameMod = null;
m_Owner.EndAction(typeof(IncognitoSpell));
m_Owner.EndAction<IncognitoSpell>();
BaseArmor.ValidateMobile(m_Owner);
BaseClothing.ValidateMobile(m_Owner);
@ -188,4 +171,4 @@ namespace Server.Spells.Fifth
}
}
}
}
}

View file

@ -1,4 +1,5 @@
using System.Collections;
using System.Collections.Generic;
namespace Server.Spells.Fifth
{
@ -13,7 +14,7 @@ namespace Server.Spells.Fifth
Reagent.SpidersSilk
);
private static Hashtable m_Table = new Hashtable();
private static Dictionary<Mobile, ResistanceMod[]> m_Table = new Dictionary<Mobile, ResistanceMod[]>();
public MagicReflectSpell(Mobile caster, Item scroll) : base(caster, scroll, m_Info)
{
@ -32,7 +33,7 @@ namespace Server.Spells.Fifth
return false;
}
if (!Caster.CanBeginAction(typeof(DefensiveSpell)))
if (!Caster.CanBeginAction<DefensiveSpell>())
{
Caster.SendLocalizedMessage(1005385); // The spell will not adhere to you at this time.
return false;
@ -56,17 +57,17 @@ namespace Server.Spells.Fifth
{
Mobile targ = Caster;
ResistanceMod[] mods = (ResistanceMod[])m_Table[targ];
ResistanceMod[] mods = m_Table[targ];
if (mods == null)
{
targ.PlaySound(0x1E9);
targ.FixedParticles(0x375A, 10, 15, 5037, EffectLayer.Waist);
int physiMod = -25 + (int)(targ.Skills[SkillName.Inscribe].Value / 20);
int physiMod = -25 + (int)(targ.Skills.Inscribe.Value / 20);
int otherMod = 10;
mods = new ResistanceMod[5]
mods = new[]
{
new ResistanceMod(ResistanceType.Physical, physiMod),
new ResistanceMod(ResistanceType.Fire, otherMod),
@ -106,15 +107,15 @@ namespace Server.Spells.Fifth
{
Caster.SendLocalizedMessage(1005559); // This spell is already in effect.
}
else if (!Caster.CanBeginAction(typeof(DefensiveSpell)))
else if (!Caster.CanBeginAction<DefensiveSpell>())
{
Caster.SendLocalizedMessage(1005385); // The spell will not adhere to you at this time.
}
else if (CheckSequence())
{
if (Caster.BeginAction(typeof(DefensiveSpell)))
if (Caster.BeginAction<DefensiveSpell>())
{
int value = (int)(Caster.Skills[SkillName.Magery].Value + Caster.Skills[SkillName.Inscribe].Value);
int value = (int)(Caster.Skills.Magery.Value + Caster.Skills.Inscribe.Value);
value = (int)(8 + value / 200 * 7.0); //absorb from 8 to 15 "circles"
Caster.MagicDamageAbsorb = value;
@ -134,17 +135,16 @@ namespace Server.Spells.Fifth
public static void EndReflect(Mobile m)
{
if (m_Table.Contains(m))
{
ResistanceMod[] mods = (ResistanceMod[])m_Table[m];
ResistanceMod[] mods = m_Table[m];
if (mods != null)
for (int i = 0; i < mods.Length; ++i)
m.RemoveResistanceMod(mods[i]);
if (mods != null)
{
for (int i = 0; i < mods.Length; ++i)
m.RemoveResistanceMod(mods[i]);
m_Table.Remove(m);
BuffInfo.RemoveBuff(m, BuffIcon.MagicReflection);
}
}
}
}
}

View file

@ -30,14 +30,8 @@ namespace Server.Spells.Fifth
Caster.Target = new InternalTarget(this);
}
private void AosDelay_Callback(object state)
private void AosDelay_Callback(Mobile caster, Mobile target, Mobile defender, int damage)
{
object[] states = (object[])state;
Mobile caster = (Mobile)states[0];
Mobile target = (Mobile)states[1];
Mobile defender = (Mobile)states[2];
int damage = (int)states[3];
if (caster.HarmfulCheck(defender))
{
SpellHelper.Damage(this, target, Utility.RandomMinMax(damage, damage + 4), 0, 0, 100, 0, 0);
@ -63,14 +57,13 @@ namespace Server.Spells.Fifth
SpellHelper.CheckReflect((int)Circle, ref from, ref target);
int damage = (int)((Caster.Skills[SkillName.Magery].Value + Caster.Int) / 5);
int damage = (int)((Caster.Skills.Magery.Value + Caster.Int) / 5);
if (damage > 60)
damage = 60;
Timer.DelayCall(TimeSpan.FromSeconds(1.0),
new TimerStateCallback(AosDelay_Callback),
new object[] { Caster, target, m, damage });
() => AosDelay_Callback(Caster, target, m, damage));
}
}
else if (CheckHSequence(m))

View file

@ -65,7 +65,7 @@ namespace Server.Spells.Fifth
{
// Algorithm: ((20% of magery) + 7) seconds [- 50% if resisted]
duration = 7.0 + Caster.Skills[SkillName.Magery].Value * 0.2;
duration = 7.0 + Caster.Skills.Magery.Value * 0.2;
if (CheckResisted(m))
duration *= 0.75;

View file

@ -72,7 +72,7 @@ namespace Server.Spells.Fifth
if (Core.AOS)
duration = TimeSpan.FromSeconds(2 * Caster.Skills.Magery.Fixed / 5);
else
duration = TimeSpan.FromSeconds(4.0 * Caster.Skills[SkillName.Magery].Value);
duration = TimeSpan.FromSeconds(4.0 * Caster.Skills.Magery.Value);
SpellHelper.Summon(creature, Caster, 0x215, duration, false, false);
}

View file

@ -77,7 +77,7 @@ namespace Server.Spells.First
}
else
{
toHeal = (int)(Caster.Skills[SkillName.Magery].Value * 0.1);
toHeal = (int)(Caster.Skills.Magery.Value * 0.1);
toHeal += Utility.Random(1, 5);
}

View file

@ -38,13 +38,13 @@ namespace Server.Spells.First
{
SpellHelper.Turn(m_Spell.Caster, targ);
if (targ.BeginAction(typeof(LightCycle)))
if (targ.BeginAction<LightCycle>())
{
new LightCycle.NightSightTimer(targ).Start();
int level = (int)(LightCycle.DungeonLevel *
((Core.AOS
? targ.Skills[SkillName.Magery].Value
: from.Skills[SkillName.Magery].Value) / 100));
? targ.Skills.Magery.Value
: from.Skills.Magery.Value) / 100));
if (level < 0)
level = 0;

View file

@ -1,4 +1,5 @@
using System.Collections;
using System.Collections.Generic;
namespace Server.Spells.First
{
@ -13,7 +14,7 @@ namespace Server.Spells.First
Reagent.SulfurousAsh
);
private static Hashtable m_Table = new Hashtable();
private static Dictionary<Mobile, ResistanceMod[]> m_Table = new Dictionary<Mobile, ResistanceMod[]>();
public ReactiveArmorSpell(Mobile caster, Item scroll) : base(caster, scroll, m_Info)
{
@ -32,7 +33,7 @@ namespace Server.Spells.First
return false;
}
if (!Caster.CanBeginAction(typeof(DefensiveSpell)))
if (!Caster.CanBeginAction<DefensiveSpell>())
{
Caster.SendLocalizedMessage(1005385); // The spell will not adhere to you at this time.
return false;
@ -57,17 +58,17 @@ namespace Server.Spells.First
{
Mobile targ = Caster;
ResistanceMod[] mods = (ResistanceMod[])m_Table[targ];
ResistanceMod[] mods = m_Table[targ];
if (mods == null)
{
targ.PlaySound(0x1E9);
targ.FixedParticles(0x376A, 9, 32, 5008, EffectLayer.Waist);
mods = new ResistanceMod[5]
mods = new []
{
new ResistanceMod(ResistanceType.Physical,
15 + (int)(targ.Skills[SkillName.Inscribe].Value / 20)),
15 + (int)(targ.Skills.Inscribe.Value / 20)),
new ResistanceMod(ResistanceType.Fire, -5),
new ResistanceMod(ResistanceType.Cold, -5),
new ResistanceMod(ResistanceType.Poison, -5),
@ -79,7 +80,7 @@ namespace Server.Spells.First
for (int i = 0; i < mods.Length; ++i)
targ.AddResistanceMod(mods[i]);
int physresist = 15 + (int)(targ.Skills[SkillName.Inscribe].Value / 20);
int physresist = 15 + (int)(targ.Skills.Inscribe.Value / 20);
string args = $"{physresist}\t{5}\t{5}\t{5}\t{5}";
BuffInfo.AddBuff(Caster, new BuffInfo(BuffIcon.ReactiveArmor, 1075812, 1075813, args));
@ -106,16 +107,16 @@ namespace Server.Spells.First
{
Caster.SendLocalizedMessage(1005559); // This spell is already in effect.
}
else if (!Caster.CanBeginAction(typeof(DefensiveSpell)))
else if (!Caster.CanBeginAction<DefensiveSpell>())
{
Caster.SendLocalizedMessage(1005385); // The spell will not adhere to you at this time.
}
else if (CheckSequence())
{
if (Caster.BeginAction(typeof(DefensiveSpell)))
if (Caster.BeginAction<DefensiveSpell>())
{
int value = (int)(Caster.Skills[SkillName.Magery].Value + Caster.Skills[SkillName.Meditation].Value +
Caster.Skills[SkillName.Inscribe].Value);
int value = (int)(Caster.Skills.Magery.Value + Caster.Skills.Meditation.Value +
Caster.Skills.Inscribe.Value);
value /= 3;
if (value < 0)
@ -140,17 +141,16 @@ namespace Server.Spells.First
public static void EndArmor(Mobile m)
{
if (m_Table.Contains(m))
{
ResistanceMod[] mods = (ResistanceMod[])m_Table[m];
ResistanceMod[] mods = m_Table[m];
if (mods != null)
for (int i = 0; i < mods.Length; ++i)
m.RemoveResistanceMod(mods[i]);
if (mods != null)
{
for (int i = 0; i < mods.Length; ++i)
m.RemoveResistanceMod(mods[i]);
m_Table.Remove(m);
BuffInfo.RemoveBuff(m, BuffIcon.ReactiveArmor);
}
}
}
}
}

View file

@ -85,7 +85,7 @@ namespace Server.Spells.Fourth
if (poison != null)
{
int chanceToCure = 10000 + (int)(Caster.Skills[SkillName.Magery].Value * 75) -
int chanceToCure = 10000 + (int)(Caster.Skills.Magery.Value * 75) -
(poison.Level + 1) * 1750;
chanceToCure /= 100;
chanceToCure -= 1;

View file

@ -77,14 +77,14 @@ namespace Server.Spells.Fourth
{
Effects.PlaySound(p, Caster.Map, 0x299);
int val = (int)(Caster.Skills[SkillName.Magery].Value / 10.0 + 1);
int val = (int)(Caster.Skills.Magery.Value / 10.0 + 1);
if (targets.Count > 0)
for (int i = 0; i < targets.Count; ++i)
{
Mobile m = targets[i];
if (m.BeginAction(typeof(ArchProtectionSpell)))
if (m.BeginAction<ArchProtectionSpell>())
{
Caster.DoBeneficial(m);
m.VirtualArmorMod += val;
@ -113,7 +113,7 @@ namespace Server.Spells.Fourth
{
int v = _Table[m];
_Table.Remove(m);
m.EndAction(typeof(ArchProtectionSpell));
m.EndAction<ArchProtectionSpell>();
m.VirtualArmorMod -= v;
if (m.VirtualArmorMod < 0)
m.VirtualArmorMod = 0;
@ -126,7 +126,7 @@ namespace Server.Spells.Fourth
public InternalTimer(Mobile target, Mobile caster) : base(TimeSpan.FromSeconds(0))
{
double time = caster.Skills[SkillName.Magery].Value * 1.2;
double time = caster.Skills.Magery.Value * 1.2;
if (time > 144)
time = 144;
Delay = TimeSpan.FromSeconds(time);

View file

@ -1,5 +1,6 @@
using System;
using System.Collections;
using System.Collections.Generic;
using Server.Targeting;
namespace Server.Spells.Fourth
@ -15,7 +16,7 @@ namespace Server.Spells.Fourth
Reagent.SulfurousAsh
);
private static Hashtable m_UnderEffect = new Hashtable();
private static Dictionary<Mobile, Timer> m_UnderEffect = new Dictionary<Mobile, Timer>();
public CurseSpell(Mobile caster, Item scroll) : base(caster, scroll, m_Info)
{
@ -28,10 +29,8 @@ namespace Server.Spells.Fourth
Caster.Target = new InternalTarget(this);
}
public static void RemoveEffect(object state)
public static void RemoveEffect(Mobile m)
{
Mobile m = (Mobile)state;
m_UnderEffect.Remove(m);
m.UpdateResistances();
@ -39,7 +38,7 @@ namespace Server.Spells.Fourth
public static bool UnderEffect(Mobile m)
{
return m_UnderEffect.Contains(m);
return m_UnderEffect.ContainsKey(m);
}
public void Target(Mobile m)
@ -60,13 +59,13 @@ namespace Server.Spells.Fourth
SpellHelper.AddStatCurse(Caster, m, StatType.Int);
SpellHelper.DisableSkillCheck = false;
Timer t = (Timer)m_UnderEffect[m];
Timer t = m_UnderEffect[m];
if (Caster.Player && m.Player /*&& Caster != m */ && t == null
) //On OSI you CAN curse yourself and get this effect.
{
TimeSpan duration = SpellHelper.GetDuration(Caster, m);
m_UnderEffect[m] = Timer.DelayCall(duration, new TimerStateCallback(RemoveEffect), m);
m_UnderEffect[m] = Timer.DelayCall(duration, RemoveEffect, m);
m.UpdateResistances();
}
@ -111,4 +110,4 @@ namespace Server.Spells.Fourth
}
}
}
}
}

View file

@ -67,7 +67,7 @@ namespace Server.Spells.Fourth
if (Core.AOS)
duration = TimeSpan.FromSeconds((15 + Caster.Skills.Magery.Fixed / 5) / 4);
else
duration = TimeSpan.FromSeconds(4.0 + Caster.Skills[SkillName.Magery].Value * 0.5);
duration = TimeSpan.FromSeconds(4.0 + Caster.Skills.Magery.Value * 0.5);
for (int i = -2; i <= 2; ++i)
{

View file

@ -68,7 +68,7 @@ namespace Server.Spells.Fourth
// Algorithm: (40% of magery) + (1-10)
int toHeal = (int)(Caster.Skills[SkillName.Magery].Value * 0.4);
int toHeal = (int)(Caster.Skills.Magery.Value * 0.4);
toHeal += Utility.Random(1, 10);
//m.Heal( toHeal, Caster );

View file

@ -28,13 +28,8 @@ namespace Server.Spells.Fourth
Caster.Target = new InternalTarget(this);
}
private void AosDelay_Callback(object state)
private void AosDelay_Callback(Mobile m, int mana)
{
object[] states = (object[])state;
Mobile m = (Mobile)states[0];
int mana = (int)states[1];
if (m.Alive && !m.IsDeadBondedPet)
{
m.Mana += mana;
@ -81,8 +76,7 @@ namespace Server.Spells.Fourth
{
m.Mana -= toDrain;
m_Table[m] = Timer.DelayCall(TimeSpan.FromSeconds(5.0), new TimerStateCallback(AosDelay_Callback),
new object[] { m, toDrain });
m_Table[m] = Timer.DelayCall(TimeSpan.FromSeconds(5.0), () => AosDelay_Callback(m, toDrain));
}
}
else

View file

@ -43,7 +43,7 @@ namespace Server.Spells
public void Stop()
{
m_Stop = true;
Disturb(DisturbType.Hurt, false, false);
Disturb(DisturbType.Hurt, false);
}
public override bool CheckDisturb(DisturbType type, bool checkFirst, bool resistable)

View file

@ -22,12 +22,12 @@ namespace Server.Spells.Mysticism
*/
public override double GetDamageSkill(Mobile m)
{
return Math.Max(m.Skills[SkillName.Imbuing].Value, m.Skills[SkillName.Focus].Value);
return Math.Max(m.Skills.Imbuing.Value, m.Skills.Focus.Value);
}
public override int GetDamageFixed(Mobile m)
{
return Math.Max(m.Skills[SkillName.Imbuing].Fixed, m.Skills[SkillName.Focus].Fixed);
return Math.Max(m.Skills.Imbuing.Fixed, m.Skills.Focus.Fixed);
}
public override void GetCastSkills(out double min, out double max)
@ -82,12 +82,12 @@ namespace Server.Spells.Mysticism
public static double GetBaseSkill(Mobile m)
{
return m.Skills[SkillName.Mysticism].Value;
return m.Skills.Mysticism.Value;
}
public static double GetBoostSkill(Mobile m)
{
return Math.Max(m.Skills[SkillName.Imbuing].Value, m.Skills[SkillName.Focus].Value);
return Math.Max(m.Skills.Imbuing.Value, m.Skills.Focus.Value);
}
}
}

View file

@ -85,7 +85,7 @@ namespace Server.Spells.Mysticism
Caster.DoHarmful(m);
SpellHelper.Damage(this, m, damage, 0, 0, 0, 0, 0, 100);
double resistedReduction = reduction - m.Skills[SkillName.MagicResist].Value / 800.0;
double resistedReduction = reduction - m.Skills.MagicResist.Value / 800.0;
m.Stam -= (int)(m.StamMax * resistedReduction);
m.Mana -= (int)(m.ManaMax * resistedReduction);

View file

@ -158,7 +158,7 @@ namespace Server.Spells.Mysticism
{
int exploChance = 90 - m_Explosions * 30;
double resist = m_Target.Skills[SkillName.MagicResist].Value;
double resist = m_Target.Skills.MagicResist.Value;
if (resist >= 70)
exploChance -= (int)((resist - 70.0) * 3.0 / 10.0);

View file

@ -20,7 +20,7 @@ namespace Server.Spells.Mysticism
Reagent.Garlic
);
private static Hashtable m_Table = new Hashtable();
private static Dictionary<Mobile, ResistanceMod[]> m_Table = new Dictionary<Mobile, ResistanceMod[]>();
public StoneFormSpell(Mobile caster, Item scroll)
: base(caster, scroll, m_Info)
@ -39,7 +39,7 @@ namespace Server.Spells.Mysticism
public static bool UnderEffect(Mobile m)
{
return m_Table.Contains(m);
return m_Table.ContainsKey(m);
}
public override bool CheckCast()
@ -50,7 +50,7 @@ namespace Server.Spells.Mysticism
return false;
}
if (!Caster.CanBeginAction(typeof(PolymorphSpell)))
if (!Caster.CanBeginAction<PolymorphSpell>())
{
Caster.SendLocalizedMessage(1061628); // You can't do that while polymorphed.
return false;
@ -77,11 +77,11 @@ namespace Server.Spells.Mysticism
{
Caster.SendLocalizedMessage(1061632); // You can't do that while carrying the sigil.
}
else if (!Caster.CanBeginAction(typeof(PolymorphSpell)))
else if (!Caster.CanBeginAction<PolymorphSpell>())
{
Caster.SendLocalizedMessage(1061628); // You can't do that while polymorphed.
}
else if (!Caster.CanBeginAction(typeof(IncognitoSpell)) || Caster.IsBodyMod && !UnderEffect(Caster))
else if (!Caster.CanBeginAction<IncognitoSpell>() || Caster.IsBodyMod && !UnderEffect(Caster))
{
Caster.SendLocalizedMessage(1063218); // You cannot use that ability in this form.
}
@ -106,8 +106,7 @@ namespace Server.Spells.Mysticism
int offset = (int)((GetBaseSkill(Caster) + GetBoostSkill(Caster)) / 24.0);
List<ResistanceMod> mods = new List<ResistanceMod>
{
ResistanceMod[] mods = {
new ResistanceMod(ResistanceType.Physical, offset),
new ResistanceMod(ResistanceType.Fire, offset),
new ResistanceMod(ResistanceType.Cold, offset),
@ -115,8 +114,8 @@ namespace Server.Spells.Mysticism
new ResistanceMod(ResistanceType.Energy, offset)
};
foreach (ResistanceMod mod in mods)
Caster.AddResistanceMod(mod);
for (int i = 0; i < mods.Length; ++i)
Caster.AddResistanceMod(mods[i]);
m_Table[Caster] = mods;
@ -143,10 +142,10 @@ namespace Server.Spells.Mysticism
public static void RemoveEffects(Mobile m)
{
List<ResistanceMod> mods = (List<ResistanceMod>)m_Table[m];
ResistanceMod[] mods = m_Table[m];
foreach (ResistanceMod mod in mods)
m.RemoveResistanceMod(mod);
for (int i = 0; i < mods.Length; ++i)
m.RemoveResistanceMod(mods[i]);
m.BodyMod = 0;
m.HueMod = -1;
@ -164,4 +163,4 @@ namespace Server.Spells.Mysticism
RemoveEffects(m);
}
}
}
}

View file

@ -140,7 +140,7 @@ namespace Server.Spells.Necromancy
if (qs is DarkTidesQuest)
{
QuestObjective objective = qs.FindObjective(typeof(AnimateMaabusCorpseObjective));
QuestObjective objective = qs.FindObjective<AnimateMaabusCorpseObjective>();
if (objective != null && !objective.Completed)
{
@ -189,8 +189,8 @@ namespace Server.Spells.Necromancy
Effects.SendLocationParticles(EffectItem.Create(p, map, EffectItem.DefaultDuration), 0x3789,
1, 40, 0x3F, 3, 9907, 0);
Timer.DelayCall(TimeSpan.FromSeconds(2.0), new TimerStateCallback(SummonDelay_Callback),
new object[] { Caster, c, p, map, group });
Timer.DelayCall(TimeSpan.FromSeconds(2.0),
() => SummonDelay_Callback(Caster, c, p, map, group));
}
}
}
@ -242,30 +242,19 @@ namespace Server.Spells.Necromancy
if (list.Count > 3)
Timer.DelayCall(TimeSpan.Zero, list[0].Kill);
Timer.DelayCall(TimeSpan.FromSeconds(2.0), TimeSpan.FromSeconds(2.0), new TimerStateCallback(Summoned_Damage),
summoned);
Timer.DelayCall(TimeSpan.FromSeconds(2.0), TimeSpan.FromSeconds(2.0), Summoned_Damage, summoned);
}
private static void Summoned_Damage(object state)
private static void Summoned_Damage(Mobile mob)
{
Mobile mob = (Mobile)state;
if (mob.Hits > 0)
--mob.Hits;
else
mob.Kill();
}
private static void SummonDelay_Callback(object state)
private static void SummonDelay_Callback(Mobile caster, Corpse corpse, Point3D loc, Map map, CreatureGroup group)
{
object[] states = (object[])state;
Mobile caster = (Mobile)states[0];
Corpse corpse = (Corpse)states[1];
Point3D loc = (Point3D)states[2];
Map map = (Map)states[3];
CreatureGroup group = (CreatureGroup)states[4];
if (corpse.Animated)
return;
@ -274,8 +263,8 @@ namespace Server.Spells.Necromancy
if (owner == null)
return;
double necromancy = caster.Skills[SkillName.Necromancy].Value;
double spiritSpeak = caster.Skills[SkillName.SpiritSpeak].Value;
double necromancy = caster.Skills.Necromancy.Value;
double spiritSpeak = caster.Skills.SpiritSpeak.Value;
int casterAbility = 0;

View file

@ -1,5 +1,6 @@
using System;
using System.Collections;
using System.Collections.Generic;
using Server.Mobiles;
using Server.Targeting;
@ -14,8 +15,8 @@ namespace Server.Spells.Necromancy
Reagent.DaemonBlood
);
private static Hashtable m_OathTable = new Hashtable();
private static Hashtable m_Table = new Hashtable();
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)
{
@ -38,11 +39,11 @@ namespace Server.Spells.Necromancy
{
Caster.SendLocalizedMessage(1060508); // You can't curse that.
}
else if (m_OathTable.Contains(Caster))
else if (m_OathTable.ContainsKey(Caster))
{
Caster.SendLocalizedMessage(1061607); // You are already bonded in a Blood Oath.
}
else if (m_OathTable.Contains(m))
else if (m_OathTable.ContainsKey(m))
{
if (m.Player)
Caster.SendLocalizedMessage(1061608); // That player is already bonded in a Blood Oath.
@ -61,7 +62,7 @@ namespace Server.Spells.Necromancy
* ((ss-rm)/8)+8
*/
ExpireTimer timer = (ExpireTimer)m_Table[m];
ExpireTimer timer = m_Table[m];
timer?.DoExpire();
m_OathTable[Caster] = Caster;
@ -93,15 +94,10 @@ namespace Server.Spells.Necromancy
FinishSequence();
}
public static bool RemoveCurse(Mobile m)
public static void RemoveCurse(Mobile m)
{
ExpireTimer t = (ExpireTimer)m_Table[m];
if (t == null)
return false;
t.DoExpire();
return true;
ExpireTimer t = m_Table[m];
t?.DoExpire();
}
public static Mobile GetBloodOath(Mobile m)
@ -109,12 +105,8 @@ namespace Server.Spells.Necromancy
if (m == null)
return null;
Mobile oath = (Mobile)m_OathTable[m];
if (oath == m)
oath = null;
return oath;
Mobile oath = m_OathTable[m];
return oath == m ? null : oath;
}
private class ExpireTimer : Timer
@ -141,13 +133,13 @@ namespace Server.Spells.Necromancy
public void DoExpire()
{
if (m_OathTable.Contains(m_Caster))
if (m_OathTable.ContainsKey(m_Caster))
{
m_Caster.SendLocalizedMessage(1061620); // Your Blood Oath has been broken.
m_OathTable.Remove(m_Caster);
}
if (m_OathTable.Contains(m_Target))
if (m_OathTable.ContainsKey(m_Target))
{
m_Target.SendLocalizedMessage(1061620); // Your Blood Oath has been broken.
m_OathTable.Remove(m_Target);
@ -185,4 +177,4 @@ namespace Server.Spells.Necromancy
}
}
}
}
}

View file

@ -1,5 +1,6 @@
using System;
using System.Collections;
using System.Collections.Generic;
using Server.Targeting;
namespace Server.Spells.Necromancy
@ -14,7 +15,7 @@ namespace Server.Spells.Necromancy
Reagent.GraveDust
);
private static Hashtable m_Table = new Hashtable();
private static Dictionary<Mobile, ExpireTimer> m_Table = new Dictionary<Mobile, ExpireTimer>();
public CorpseSkinSpell(Mobile caster, Item scroll) : base(caster, scroll, m_Info)
{
@ -48,7 +49,7 @@ namespace Server.Spells.Necromancy
* NOTE: Resistance is not checked if targeting yourself
*/
ExpireTimer timer = (ExpireTimer)m_Table[m];
ExpireTimer timer = m_Table[m];
if (timer != null)
timer.DoExpire();
@ -66,8 +67,7 @@ namespace Server.Spells.Necromancy
TimeSpan duration = TimeSpan.FromSeconds((ss - mr) / 2.5 + 40.0);
ResistanceMod[] mods = new ResistanceMod[4]
{
ResistanceMod[] mods = {
new ResistanceMod(ResistanceType.Fire, -15),
new ResistanceMod(ResistanceType.Poison, -15),
new ResistanceMod(ResistanceType.Cold, +10),
@ -92,7 +92,7 @@ namespace Server.Spells.Necromancy
public static bool RemoveCurse(Mobile m)
{
ExpireTimer t = (ExpireTimer)m_Table[m];
ExpireTimer t = m_Table[m];
if (t == null)
return false;
@ -151,4 +151,4 @@ namespace Server.Spells.Necromancy
}
}
}
}
}

View file

@ -1,5 +1,6 @@
using System;
using System.Collections;
using System.Collections.Generic;
using Server.Items;
namespace Server.Spells.Necromancy
@ -13,7 +14,7 @@ namespace Server.Spells.Necromancy
Reagent.PigIron
);
private static Hashtable m_Table = new Hashtable();
private static Dictionary<BaseWeapon, ExpireTimer> m_Table = new Dictionary<BaseWeapon, ExpireTimer>();
public CurseWeaponSpell(Mobile caster, Item scroll) : base(caster, scroll, m_Info)
{
@ -47,18 +48,17 @@ namespace Server.Spells.Necromancy
Caster.FixedParticles(0x37B9, 1, 14, 9502, 32, 5, (EffectLayer)255);
new SoundEffectTimer(Caster).Start();
TimeSpan duration = TimeSpan.FromSeconds(Caster.Skills[SkillName.SpiritSpeak].Value / 3.4 + 1.0);
TimeSpan duration = TimeSpan.FromSeconds(Caster.Skills.SpiritSpeak.Value / 3.4 + 1.0);
Timer t = (Timer)m_Table[weapon];
t?.Stop();
ExpireTimer timer = m_Table[weapon];
timer?.Stop();
weapon.Cursed = true;
m_Table[weapon] = t = new ExpireTimer(weapon, duration);
m_Table[weapon] = timer = new ExpireTimer(weapon, duration);
t.Start();
timer.Start();
}
FinishSequence();
@ -78,7 +78,7 @@ namespace Server.Spells.Necromancy
{
m_Weapon.Cursed = false;
Effects.PlaySound(m_Weapon.GetWorldLocation(), m_Weapon.Map, 0xFA);
m_Table.Remove(this);
m_Table.Remove(m_Weapon);
}
}
@ -98,4 +98,4 @@ namespace Server.Spells.Necromancy
}
}
}
}
}

View file

@ -1,5 +1,6 @@
using System;
using System.Collections;
using System.Collections.Generic;
using Server.Mobiles;
using Server.Targeting;
@ -15,7 +16,7 @@ namespace Server.Spells.Necromancy
Reagent.NoxCrystal
);
private static Hashtable m_Table = new Hashtable();
private static Dictionary<Mobile, DefaultSkillMod> m_Table = new Dictionary<Mobile, DefaultSkillMod>();
public EvilOmenSpell(Mobile caster, Item scroll)
: base(caster, scroll, m_Info)
@ -56,19 +57,19 @@ namespace Server.Spells.Necromancy
m.FixedParticles(0x3728, 1, 13, 9912, 1150, 7, EffectLayer.Head);
m.FixedParticles(0x3779, 1, 15, 9502, 67, 7, EffectLayer.Head);
if (!m_Table.Contains(m))
if (!m_Table.ContainsKey(m))
{
SkillMod mod = new DefaultSkillMod(SkillName.MagicResist, false, 50.0);
DefaultSkillMod mod = new DefaultSkillMod(SkillName.MagicResist, false, 50.0);
if (m.Skills[SkillName.MagicResist].Base > 50.0)
if (m.Skills.MagicResist.Base > 50.0)
m.AddSkillMod(mod);
m_Table[m] = mod;
}
TimeSpan duration = TimeSpan.FromSeconds(Caster.Skills[SkillName.SpiritSpeak].Value / 12 + 1.0);
TimeSpan duration = TimeSpan.FromSeconds(Caster.Skills.SpiritSpeak.Value / 12 + 1.0);
Timer.DelayCall(duration, new TimerStateCallback(EffectExpire_Callback), m);
Timer.DelayCall(duration, () => TryEndEffect(m));
HarmfulSpell(m);
@ -78,14 +79,9 @@ namespace Server.Spells.Necromancy
FinishSequence();
}
private static void EffectExpire_Callback(object state)
{
TryEndEffect((Mobile)state);
}
/*
* The naming here was confusing. Its a 1-off effect spell.
* So, we dont actually "checkeffect"; we endeffect with bool
* So, we don't actually "checkeffect"; we endeffect with bool
* return to determine external behaviors.
*
* -refactored.
@ -93,7 +89,7 @@ namespace Server.Spells.Necromancy
public static bool TryEndEffect(Mobile m)
{
SkillMod mod = (SkillMod)m_Table[m];
DefaultSkillMod mod = m_Table[m];
if (mod == null)
return false;
@ -128,4 +124,4 @@ namespace Server.Spells.Necromancy
}
}
}
}
}

View file

@ -87,7 +87,8 @@ namespace Server.Spells.Necromancy
public override void OnCast()
{
if (!(Caster.Region.GetRegion(typeof(ChampionSpawnRegion)) is ChampionSpawnRegion r) || !Caster.InRange(r.ChampionSpawn, Range))
ChampionSpawnRegion r = Caster.Region.GetRegion<ChampionSpawnRegion>();
if (r == null || !Caster.InRange(r.ChampionSpawn, Range))
{
Caster.SendLocalizedMessage(1072111); // You are not in a valid exorcism region.
}
@ -130,7 +131,7 @@ namespace Server.Spells.Necromancy
if (SpellHelper.IsAnyT2A(map, c.Location) && SpellHelper.IsAnyT2A(map, m.Location))
return false; //Same Map, both in T2A, ie, same 'sub server'.
if (m.Region.IsPartOf(typeof(DungeonRegion)) == Region.Find(c.Location, map).IsPartOf(typeof(DungeonRegion)))
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

View file

@ -1,5 +1,6 @@
using System;
using System.Collections;
using System.Collections.Generic;
using Server.Targeting;
namespace Server.Spells.Necromancy
@ -15,7 +16,7 @@ namespace Server.Spells.Necromancy
Reagent.DaemonBlood
);
private static Hashtable m_Table = new Hashtable();
private static Dictionary<Mobile, MRBucket> m_Table = new Dictionary<Mobile, MRBucket>();
public MindRotSpell(Mobile caster, Item scroll) : base(caster, scroll, m_Info)
{
@ -70,13 +71,13 @@ namespace Server.Spells.Necromancy
public static void ClearMindRotScalar(Mobile m)
{
if (!m_Table.ContainsKey(m))
MRBucket tmpB = m_Table[m];
if (tmpB == null)
return;
BuffInfo.RemoveBuff(m, BuffIcon.Mindrot);
MRBucket tmpB = (MRBucket)m_Table[m];
MRExpireTimer tmpT = tmpB.m_MRExpireTimer;
tmpT.Stop();
tmpB.m_MRExpireTimer.Stop();
m_Table.Remove(m);
m.SendLocalizedMessage(1060872); // Your mind feels normal again.
}
@ -88,10 +89,11 @@ namespace Server.Spells.Necromancy
public static bool GetMindRotScalar(Mobile m, ref double scalar)
{
if (!m_Table.ContainsKey(m))
MRBucket tmpB = m_Table[m];
if (tmpB == null)
return false;
MRBucket tmpB = (MRBucket)m_Table[m];
scalar = tmpB.m_Scalar;
return true;
}
@ -100,11 +102,10 @@ namespace Server.Spells.Necromancy
{
if (!m_Table.ContainsKey(target))
{
m_Table.Add(target, new MRBucket(scalar, new MRExpireTimer(caster, target, duration)));
MRBucket tmpB = new MRBucket(scalar, new MRExpireTimer(caster, target, duration));
m_Table.Add(target, tmpB);
BuffInfo.AddBuff(target, new BuffInfo(BuffIcon.Mindrot, 1075665, duration, target));
MRBucket tmpB = (MRBucket)m_Table[target];
MRExpireTimer tmpT = tmpB.m_MRExpireTimer;
tmpT.Start();
tmpB.m_MRExpireTimer.Start();
target.SendLocalizedMessage(1074384);
}
}
@ -146,16 +147,6 @@ namespace Server.Spells.Necromancy
Priority = TimerPriority.TwoFiftyMS;
}
public void RenewDelay(TimeSpan delay)
{
m_End = DateTime.UtcNow + delay;
}
public void Halt()
{
Stop();
}
protected override void OnTick()
{
if (m_Target.Deleted || !m_Target.Alive || DateTime.UtcNow >= m_End)
@ -178,4 +169,4 @@ namespace Server.Spells.Necromancy
m_MRExpireTimer = theTimer;
}
}
}
}

View file

@ -1,5 +1,6 @@
using System;
using System.Collections;
using System.Collections.Generic;
using Server.Misc;
using Server.Targeting;
@ -15,7 +16,7 @@ namespace Server.Spells.Necromancy
Reagent.PigIron
);
private static Hashtable m_Table = new Hashtable();
private static Dictionary<Mobile, InternalTimer> m_Table = new Dictionary<Mobile, InternalTimer>();
public PainSpikeSpell(Mobile caster, Item scroll) : base(caster, scroll, m_Info)
{
@ -58,20 +59,18 @@ namespace Server.Spells.Necromancy
TimeSpan buffTime = TimeSpan.FromSeconds(10.0);
if (m_Table.Contains(m))
InternalTimer timer = m_Table[m];
if (timer == null)
{
damage = Utility.RandomMinMax(3, 7);
if (m_Table[m] is Timer t)
{
t.Delay += TimeSpan.FromSeconds(2.0);
buffTime = t.Next - DateTime.UtcNow;
}
m_Table[m] = timer = new InternalTimer(m, damage);
timer.Start();
}
else
{
new InternalTimer(m, damage).Start();
damage = Utility.RandomMinMax(3, 7);
timer.Delay += TimeSpan.FromSeconds(2.0);
buffTime = timer.Next - DateTime.UtcNow;
}
BuffInfo.AddBuff(m, new BuffInfo(BuffIcon.PainSpike, 1075667, buffTime, m, Convert.ToString((int)damage)));
@ -100,8 +99,6 @@ namespace Server.Spells.Necromancy
m_Mobile = m;
m_ToRestore = (int)toRestore;
m_Table[m] = this;
}
protected override void OnTick()
@ -136,4 +133,4 @@ namespace Server.Spells.Necromancy
}
}
}
}
}

View file

@ -1,5 +1,6 @@
using System;
using System.Collections;
using System.Collections.Generic;
using Server.Targeting;
namespace Server.Spells.Necromancy
@ -14,7 +15,7 @@ namespace Server.Spells.Necromancy
Reagent.NoxCrystal
);
private static Hashtable m_Table = new Hashtable();
private static Dictionary<Mobile, InternalTimer> m_Table = new Dictionary<Mobile, InternalTimer>();
public StrangleSpell(Mobile caster, Item scroll) : base(caster, scroll, m_Info)
{
@ -58,19 +59,19 @@ namespace Server.Spells.Necromancy
m.FixedParticles(0x36CB, 1, 9, 9911, 67, 5, EffectLayer.Head);
m.FixedParticles(0x374A, 1, 17, 9502, 1108, 4, (EffectLayer)255);
if (!m_Table.Contains(m))
{
Timer t = new InternalTimer(m, Caster);
t.Start();
InternalTimer timer = m_Table[m];
m_Table[m] = t;
if (timer == null)
{
m_Table[m] = timer = new InternalTimer(m, Caster);
timer.Start();
}
HarmfulSpell(m);
}
//Calculations for the buff bar
double spiritlevel = Caster.Skills[SkillName.SpiritSpeak].Value / 10;
double spiritlevel = Caster.Skills.SpiritSpeak.Value / 10;
if (spiritlevel < 4)
spiritlevel = 4;
int d_MinDamage = 4;
@ -95,10 +96,7 @@ namespace Server.Spells.Necromancy
{
int delay = (int)Math.Ceiling((1.0 + 5 * i_Count) / i_MaxCount);
if (delay <= 5)
i_HitDelay = delay;
else
i_HitDelay = 5;
i_HitDelay = delay <= 5 ? delay : 5;
}
}
@ -113,12 +111,12 @@ namespace Server.Spells.Necromancy
public static bool RemoveCurse(Mobile m)
{
Timer t = (Timer)m_Table[m];
Timer timer = m_Table[m];
if (t == null)
if (timer == null)
return false;
t.Stop();
timer.Stop();
m.SendLocalizedMessage(1061687); // You can breath normally again.
m_Table.Remove(m);
@ -141,7 +139,7 @@ namespace Server.Spells.Necromancy
m_Target = target;
m_From = from;
double spiritLevel = from.Skills[SkillName.SpiritSpeak].Value / 10;
double spiritLevel = from.Skills.SpiritSpeak.Value / 10;
m_MinBaseDamage = spiritLevel - 2;
m_MaxBaseDamage = spiritLevel + 1;
@ -237,4 +235,4 @@ namespace Server.Spells.Necromancy
}
}
}
}
}

View file

@ -1,5 +1,6 @@
using System;
using System.Collections;
using System.Collections.Generic;
using Server.Gumps;
using Server.Mobiles;
using Server.Network;
@ -26,7 +27,7 @@ namespace Server.Spells.Necromancy
public override double RequiredSkill => 30.0;
public override int RequiredMana => 17;
public static Hashtable Table{ get; } = new Hashtable();
public static Dictionary<Mobile, BaseCreature> Table{ get; } = new Dictionary<Mobile, BaseCreature>();
public static SummonFamiliarEntry[] Entries{ get; } =
{
@ -39,9 +40,9 @@ namespace Server.Spells.Necromancy
public override bool CheckCast()
{
BaseCreature check = (BaseCreature)Table[Caster];
BaseCreature check = Table[Caster];
if (check != null && !check.Deleted)
if (check?.Deleted == false)
{
Caster.SendLocalizedMessage(1061605); // You already have a familiar.
return false;
@ -54,7 +55,7 @@ namespace Server.Spells.Necromancy
{
if (CheckSequence())
{
Caster.CloseGump(typeof(SummonFamiliarGump));
Caster.CloseGump<SummonFamiliarGump>();
Caster.SendGump(new SummonFamiliarGump(Caster, Entries, this));
}
@ -89,7 +90,6 @@ namespace Server.Spells.Necromancy
private const int EnabledColor32 = 0x18CD00;
private const int DisabledColor32 = 0x4A8B52;
private static Hashtable m_Table = new Hashtable();
private SummonFamiliarEntry[] m_Entries;
private Mobile m_From;
@ -117,8 +117,8 @@ namespace Server.Spells.Necromancy
AddHtmlLocalized(30, 26, 200, 20, 1060147, EnabledColor16, false, false); // Chose thy familiar...
double necro = from.Skills[SkillName.Necromancy].Value;
double spirit = from.Skills[SkillName.SpiritSpeak].Value;
double necro = from.Skills.Necromancy.Value;
double spirit = from.Skills.SpiritSpeak.Value;
for (int i = 0; i < entries.Length; ++i)
{
@ -146,10 +146,10 @@ namespace Server.Spells.Necromancy
{
SummonFamiliarEntry entry = m_Entries[index];
double necro = m_From.Skills[SkillName.Necromancy].Value;
double spirit = m_From.Skills[SkillName.SpiritSpeak].Value;
double necro = m_From.Skills.Necromancy.Value;
double spirit = m_From.Skills.SpiritSpeak.Value;
BaseCreature check = (BaseCreature)SummonFamiliarSpell.Table[m_From];
BaseCreature check = SummonFamiliarSpell.Table[m_From];
#region Dueling
@ -160,7 +160,7 @@ namespace Server.Spells.Necromancy
#endregion
else if (check != null && !check.Deleted)
else if (check?.Deleted == false)
{
m_From.SendLocalizedMessage(1061605); // You already have a familiar.
}
@ -169,14 +169,14 @@ namespace Server.Spells.Necromancy
// That familiar requires ~1_NECROMANCY~ Necromancy and ~2_SPIRIT~ Spirit Speak.
m_From.SendLocalizedMessage(1061606, $"{entry.ReqNecromancy:F1}\t{entry.ReqSpiritSpeak:F1}");
m_From.CloseGump(typeof(SummonFamiliarGump));
m_From.CloseGump<SummonFamiliarGump>();
m_From.SendGump(new SummonFamiliarGump(m_From, SummonFamiliarSpell.Entries, m_Spell));
}
else if (entry.Type == null)
{
m_From.SendMessage("That familiar has not yet been defined.");
m_From.CloseGump(typeof(SummonFamiliarGump));
m_From.CloseGump<SummonFamiliarGump>();
m_From.SendGump(new SummonFamiliarGump(m_From, SummonFamiliarSpell.Entries, m_Spell));
}
else
@ -185,7 +185,8 @@ namespace Server.Spells.Necromancy
{
BaseCreature bc = (BaseCreature)Activator.CreateInstance(entry.Type);
bc.Skills.MagicResist = m_From.Skills.MagicResist;
// TODO: Is this right?
bc.Skills.MagicResist.Base = m_From.Skills.MagicResist.Base;
if (BaseCreature.Summon(bc, m_From, m_From.Location, -1, TimeSpan.FromDays(1.0)))
{
@ -196,6 +197,7 @@ namespace Server.Spells.Necromancy
}
catch
{
// ignored
}
}
}
@ -205,4 +207,4 @@ namespace Server.Spells.Necromancy
}
}
}
}
}

View file

@ -1,5 +1,6 @@
using System;
using System.Collections;
using System.Collections.Generic;
using Server.Gumps;
using Server.Items;
using Server.Mobiles;
@ -24,9 +25,8 @@ namespace Server.Spells.Ninjitsu
9002
);
private static Hashtable m_LastAnimalForms = new Hashtable();
private static Hashtable m_Table = new Hashtable();
private static Dictionary<Mobile, int> m_LastAnimalForms = new Dictionary<Mobile, int>();
private static Dictionary<Mobile, AnimalFormContext> m_Table = new Dictionary<Mobile, AnimalFormContext>();
private bool m_WasMoving;
@ -82,7 +82,7 @@ namespace Server.Spells.Ninjitsu
public override bool CheckCast()
{
if (!Caster.CanBeginAction(typeof(PolymorphSpell)))
if (!Caster.CanBeginAction<PolymorphSpell>())
{
Caster.SendLocalizedMessage(1061628); // You can't do that while polymorphed.
return false;
@ -129,7 +129,7 @@ namespace Server.Spells.Ninjitsu
public override void OnCast()
{
if (!Caster.CanBeginAction(typeof(PolymorphSpell)))
if (!Caster.CanBeginAction<PolymorphSpell>())
{
Caster.SendLocalizedMessage(1061628); // You can't do that while polymorphed.
}
@ -137,7 +137,7 @@ namespace Server.Spells.Ninjitsu
{
Caster.SendLocalizedMessage(1063219); // You cannot mimic an animal while in that form.
}
else if (!Caster.CanBeginAction(typeof(IncognitoSpell)) || Caster.IsBodyMod && GetContext(Caster) == null)
else if (!Caster.CanBeginAction<IncognitoSpell>() || Caster.IsBodyMod && GetContext(Caster) == null)
{
DoFizzle();
}
@ -162,7 +162,7 @@ namespace Server.Spells.Ninjitsu
if (GetLastAnimalForm(Caster) == -1 || !skipGump)
{
Caster.CloseGump(typeof(AnimalFormGump));
Caster.CloseGump<AnimalFormGump>();
Caster.SendGump(new AnimalFormGump(Caster, Entries, this));
}
else
@ -197,8 +197,8 @@ namespace Server.Spells.Ninjitsu
public int GetLastAnimalForm(Mobile m)
{
if (m_LastAnimalForms.Contains(m))
return (int)m_LastAnimalForms[m];
if (m_LastAnimalForms.ContainsKey(m))
return m_LastAnimalForms[m];
return -1;
}
@ -214,7 +214,7 @@ namespace Server.Spells.Ninjitsu
if (m.Skills.Ninjitsu.Value < entry.ReqSkill)
{
string args = $"{entry.ReqSkill.ToString("F1")}\t{SkillName.Ninjitsu}\t ";
string args = $"{entry.ReqSkill:F1}\t{SkillName.Ninjitsu}\t ";
m.SendLocalizedMessage(1063013,
args); // You need at least ~1_SKILL_REQUIREMENT~ ~2_SKILL_NAME~ skill to use that ability.
return MorphResult.NoSkill;
@ -257,8 +257,7 @@ namespace Server.Spells.Ninjitsu
if (entry.StealthBonus)
{
mod = new DefaultSkillMod(SkillName.Stealth, true, 20.0);
mod.ObeyCap = true;
mod = new DefaultSkillMod(SkillName.Stealth, true, 20.0) { ObeyCap = true };
m.AddSkillMod(mod);
}
@ -266,8 +265,7 @@ namespace Server.Spells.Ninjitsu
if (entry.StealingBonus)
{
stealingMod = new DefaultSkillMod(SkillName.Stealing, true, 10.0);
stealingMod.ObeyCap = true;
stealingMod = new DefaultSkillMod(SkillName.Stealing, true, 10.0) { ObeyCap = true };
m.AddSkillMod(stealingMod);
}
@ -325,19 +323,17 @@ namespace Server.Spells.Ninjitsu
public static AnimalFormContext GetContext(Mobile m)
{
return m_Table[m] as AnimalFormContext;
return m_Table[m];
}
public static bool UnderTransformation(Mobile m)
{
return GetContext(m) != null;
return m_Table.ContainsKey(m);
}
public static bool UnderTransformation(Mobile m, Type type)
{
AnimalFormContext context = GetContext(m);
return context != null && context.Type == type;
return GetContext(m)?.Type == type;
}
/*
@ -400,14 +396,12 @@ namespace Server.Spells.Ninjitsu
//TODO: Convert this for ML to the BaseImageTileButtonsgump
private Mobile m_Caster;
private AnimalForm m_Spell;
private Item m_Talisman;
public AnimalFormGump(Mobile caster, AnimalFormEntry[] entries, AnimalForm spell)
: base(50, 50)
{
m_Caster = caster;
m_Spell = spell;
m_Talisman = caster.Talisman;
AddPage(0);
@ -615,7 +609,7 @@ namespace Server.Spells.Ninjitsu
{
m_Mobile.RevealingAction();
m_Mobile.PlaySound(0x227);
Effects.SendMovingEffect(m_Mobile, target, 0x36D4, 5, 0, false, false, 0, 0);
Effects.SendMovingEffect(m_Mobile, target, 0x36D4, 5, 0, false, false);
DelayCall(TimeSpan.FromSeconds(1), BreathDamage_Callback, target);
}
@ -631,4 +625,4 @@ namespace Server.Spells.Ninjitsu
}
}
}
}
}

View file

@ -15,7 +15,7 @@ namespace Server.Spells.Ninjitsu
public override double GetDamageScalar(Mobile attacker, Mobile defender)
{
double ninjitsu = attacker.Skills[SkillName.Ninjitsu].Value;
double ninjitsu = attacker.Skills.Ninjitsu.Value;
return 1.0 + ninjitsu / 360 + Tracking.GetStalkingBonus(attacker, defender) / 100;
}
@ -37,8 +37,8 @@ namespace Server.Spells.Ninjitsu
if (valid)
{
attacker.BeginAction(typeof(Stealth));
Timer.DelayCall(TimeSpan.FromSeconds(5.0), delegate { attacker.EndAction(typeof(Stealth)); });
attacker.BeginAction<Stealth>();
Timer.DelayCall(TimeSpan.FromSeconds(5.0), delegate { attacker.EndAction<Stealth>(); });
}
return valid;

View file

@ -1,5 +1,6 @@
using System;
using System.Collections;
using System.Collections.Generic;
using Server.Items;
using Server.SkillHandlers;
@ -7,7 +8,7 @@ namespace Server.Spells.Ninjitsu
{
public class DeathStrike : NinjaMove
{
private static Hashtable m_Table = new Hashtable();
private static Dictionary<Mobile, DeathStrikeInfo> m_Table = new Dictionary<Mobile, DeathStrikeInfo>();
public override int BaseMana => 30;
public override double RequiredSkill => 85.0;
@ -27,7 +28,7 @@ namespace Server.Spells.Ninjitsu
ClearCurrentMove(attacker);
double ninjitsu = attacker.Skills[SkillName.Ninjitsu].Value;
double ninjitsu = attacker.Skills.Ninjitsu.Value;
double chance;
bool
@ -48,18 +49,16 @@ namespace Server.Spells.Ninjitsu
}
DeathStrikeInfo info;
DeathStrikeInfo info = m_Table[defender];
int damageBonus = 0;
if (m_Table.Contains(defender))
if (info != null)
{
defender.SendLocalizedMessage(1063092); // Your opponent lands another Death Strike!
info = (DeathStrikeInfo)m_Table[defender];
if (info.m_Steps > 0)
damageBonus = attacker.Skills[SkillName.Ninjitsu].Fixed / 150;
damageBonus = attacker.Skills.Ninjitsu.Fixed / 150;
info.m_Timer?.Stop();
@ -75,8 +74,10 @@ namespace Server.Spells.Ninjitsu
defender.FixedParticles(0x374A, 1, 17, 0x26BC, EffectLayer.Waist);
attacker.PlaySound(attacker.Female ? 0x50D : 0x50E);
info = new DeathStrikeInfo(defender, attacker, damageBonus, isRanged);
info.m_Timer = Timer.DelayCall(TimeSpan.FromSeconds(5.0), new TimerStateCallback(ProcessDeathStrike), defender);
info = new DeathStrikeInfo(defender, attacker, damageBonus, isRanged)
{
m_Timer = Timer.DelayCall(TimeSpan.FromSeconds(5.0), ProcessDeathStrike, defender)
};
m_Table[defender] = info;
@ -85,29 +86,29 @@ namespace Server.Spells.Ninjitsu
public static void AddStep(Mobile m)
{
if (!(m_Table[m] is DeathStrikeInfo info))
DeathStrikeInfo info = m_Table[m];
if (info == null)
return;
if (++info.m_Steps >= 5)
ProcessDeathStrike(m);
}
private static void ProcessDeathStrike(object state)
private static void ProcessDeathStrike(Mobile defender)
{
Mobile defender = (Mobile)state;
if (!(m_Table[defender] is DeathStrikeInfo info)) //sanity
DeathStrikeInfo info = m_Table[defender];
if (info == null)
return;
int damage;
double ninjitsu = info.m_Attacker.Skills[SkillName.Ninjitsu].Value;
double ninjitsu = info.m_Attacker.Skills.Ninjitsu.Value;
double stalkingBonus = Tracking.GetStalkingBonus(info.m_Attacker, info.m_Target);
if (Core.ML)
{
double scalar = (info.m_Attacker.Skills[SkillName.Hiding].Value +
info.m_Attacker.Skills[SkillName.Stealth].Value) / 220;
double scalar = (info.m_Attacker.Skills.Hiding.Value +
info.m_Attacker.Skills.Stealth.Value) / 220;
if (scalar > 1)
scalar = 1;
@ -159,4 +160,4 @@ namespace Server.Spells.Ninjitsu
}
}
}
}
}

View file

@ -34,14 +34,14 @@ namespace Server.Spells.Ninjitsu
public override double GetDamageScalar(Mobile attacker, Mobile defender)
{
double ninjitsu = attacker.Skills[SkillName.Ninjitsu].Value;
double ninjitsu = attacker.Skills.Ninjitsu.Value;
return 1.0 + ninjitsu * ninjitsu / 43636;
}
public override double GetPropertyBonus(Mobile attacker)
{
double ninjitsu = attacker.Skills[SkillName.Ninjitsu].Value;
double ninjitsu = attacker.Skills.Ninjitsu.Value;
double bonus = ninjitsu * ninjitsu / 43636;

View file

@ -1,12 +1,13 @@
using System;
using System.Collections;
using System.Collections.Generic;
using Server.Items;
namespace Server.Spells.Ninjitsu
{
public class KiAttack : NinjaMove
{
private static Hashtable m_Table = new Hashtable();
private static Dictionary<Mobile, KiAttackInfo> m_Table = new Dictionary<Mobile, KiAttackInfo>();
public override int BaseMana => 25;
public override double RequiredSkill => 80.0;
@ -20,7 +21,7 @@ namespace Server.Spells.Ninjitsu
return;
KiAttackInfo info = new KiAttackInfo(from);
info.m_Timer = Timer.DelayCall(TimeSpan.FromSeconds(2.0), new TimerStateCallback(EndKiAttack), info);
info.m_Timer = Timer.DelayCall(TimeSpan.FromSeconds(2.0), EndKiAttack, info);
m_Table[from] = info;
}
@ -33,12 +34,12 @@ namespace Server.Spells.Ninjitsu
return false;
}
if (Core.ML && @from.Weapon is BaseRanged)
if (Core.ML && from.Weapon is BaseRanged)
{
from.SendLocalizedMessage(1075858); // You can only use this with melee attacks.
return false;
}
return base.Validate(from);
}
@ -80,18 +81,21 @@ namespace Server.Spells.Ninjitsu
public override void OnClearMove(Mobile from)
{
if (m_Table[@from] is KiAttackInfo info)
{
info.m_Timer?.Stop();
KiAttackInfo info = m_Table[from];
m_Table.Remove(info.m_Mobile);
}
if (info == null)
return;
info.m_Timer?.Stop();
m_Table.Remove(info.m_Mobile);
}
public static double GetBonus(Mobile from)
{
if (!(m_Table[@from] is KiAttackInfo info))
return 0.0;
KiAttackInfo info = m_Table[from];
if (info == null)
return 0;
int xDelta = info.m_Location.X - from.X;
int yDelta = info.m_Location.Y - from.Y;
@ -104,10 +108,8 @@ namespace Server.Spells.Ninjitsu
return bonus;
}
private static void EndKiAttack(object state)
private static void EndKiAttack(KiAttackInfo info)
{
KiAttackInfo info = (KiAttackInfo)state;
info.m_Timer?.Stop();
ClearCurrentMove(info.m_Mobile);
@ -129,4 +131,4 @@ namespace Server.Spells.Ninjitsu
}
}
}
}
}

View file

@ -87,7 +87,7 @@ namespace Server.Spells.Ninjitsu
{
Caster.SendLocalizedMessage(502831); // Cannot teleport to that spot.
}
else if (Region.Find(to, map).GetRegion(typeof(HouseRegion)) != null)
else if (Region.Find(to, map).IsPartOf<HouseRegion>())
{
Caster.SendLocalizedMessage(502829); // Cannot teleport to that spot.
}

View file

@ -1,12 +1,13 @@
using System;
using System.Collections;
using System.Collections.Generic;
using Server.SkillHandlers;
namespace Server.Spells.Ninjitsu
{
public class SurpriseAttack : NinjaMove
{
private static Hashtable m_Table = new Hashtable();
private static Dictionary<Mobile, SurpriseAttackInfo> m_Table = new Dictionary<Mobile, SurpriseAttackInfo>();
public override int BaseMana => 20;
public override double RequiredSkill => Core.ML ? 60.0 : 30.0;
@ -32,8 +33,8 @@ namespace Server.Spells.Ninjitsu
if (valid)
{
attacker.BeginAction(typeof(Stealth));
Timer.DelayCall(TimeSpan.FromSeconds(5.0), delegate { attacker.EndAction(typeof(Stealth)); });
attacker.BeginAction<Stealth>();
Timer.DelayCall(TimeSpan.FromSeconds(5.0), delegate { attacker.EndAction<Stealth>(); });
}
return valid;
@ -52,23 +53,21 @@ namespace Server.Spells.Ninjitsu
attacker.RevealingAction();
SurpriseAttackInfo info;
SurpriseAttackInfo info = m_Table[defender];
if (m_Table.Contains(defender))
if (info != null)
{
info = (SurpriseAttackInfo)m_Table[defender];
info.m_Timer?.Stop();
m_Table.Remove(defender);
}
int ninjitsu = attacker.Skills[SkillName.Ninjitsu].Fixed;
int ninjitsu = attacker.Skills.Ninjitsu.Fixed;
int malus = ninjitsu / 60 + (int)Tracking.GetStalkingBonus(attacker, defender);
info = new SurpriseAttackInfo(defender, malus);
info.m_Timer = Timer.DelayCall(TimeSpan.FromSeconds(8.0), new TimerStateCallback(EndSurprise), info);
info.m_Timer = Timer.DelayCall(TimeSpan.FromSeconds(8.0), EndSurprise, info);
m_Table[defender] = info;
@ -86,19 +85,18 @@ namespace Server.Spells.Ninjitsu
public static bool GetMalus(Mobile target, ref int malus)
{
if (!(m_Table[target] is SurpriseAttackInfo info))
SurpriseAttackInfo info = m_Table[target];
if (info == null)
return false;
malus = info.m_Malus;
return true;
}
private static void EndSurprise(object state)
private static void EndSurprise(SurpriseAttackInfo info)
{
SurpriseAttackInfo info = (SurpriseAttackInfo)state;
info.m_Timer?.Stop();
info.m_Target.SendLocalizedMessage(1063131); // Your defenses have returned to normal.
m_Table.Remove(info.m_Target);
@ -117,4 +115,4 @@ namespace Server.Spells.Ninjitsu
}
}
}
}
}

View file

@ -49,7 +49,7 @@ namespace Server.Spells.Second
if (p != null)
{
int chanceToCure = 10000 + (int)(Caster.Skills[SkillName.Magery].Value * 75) -
int chanceToCure = 10000 + (int)(Caster.Skills.Magery.Value * 75) -
(p.Level + 1) * (Core.AOS ? p.Level < 4 ? 3300 : 3100 : 1750);
chanceToCure /= 100;

View file

@ -1,5 +1,6 @@
using System;
using System.Collections;
using System.Collections.Generic;
namespace Server.Spells.Second
{
@ -14,13 +15,13 @@ namespace Server.Spells.Second
Reagent.SulfurousAsh
);
private static Hashtable m_Table = new Hashtable();
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 static Hashtable Registry{ get; } = new Hashtable();
public static Dictionary<Mobile, double> Registry{ get; } = new Dictionary<Mobile, double>();
public override SpellCircle Circle => SpellCircle.Second;
@ -35,7 +36,7 @@ namespace Server.Spells.Second
return false;
}
if (!Caster.CanBeginAction(typeof(DefensiveSpell)))
if (!Caster.CanBeginAction<DefensiveSpell>())
{
Caster.SendLocalizedMessage(1005385); // The spell will not adhere to you at this time.
return false;
@ -55,29 +56,28 @@ namespace Server.Spells.Second
* even after dying<EFBFBD>until you <EFBFBD>turn them off<EFBFBD> by casting them again.
*/
object[] mods = (object[])m_Table[target];
Tuple<ResistanceMod, DefaultSkillMod> mods = m_Table[target];
if (mods == null)
{
target.PlaySound(0x1E9);
target.FixedParticles(0x375A, 9, 20, 5016, EffectLayer.Waist);
mods = new object[2]
{
mods = new Tuple<ResistanceMod, DefaultSkillMod>(
new ResistanceMod(ResistanceType.Physical,
-15 + Math.Min((int)(caster.Skills[SkillName.Inscribe].Value / 20), 15)),
-15 + Math.Min((int)(caster.Skills.Inscribe.Value / 20), 15)),
new DefaultSkillMod(SkillName.MagicResist, true,
-35 + Math.Min((int)(caster.Skills[SkillName.Inscribe].Value / 20), 35))
};
-35 + Math.Min((int)(caster.Skills.Inscribe.Value / 20), 35))
);
m_Table[target] = mods;
Registry[target] = 100.0;
target.AddResistanceMod((ResistanceMod)mods[0]);
target.AddSkillMod((SkillMod)mods[1]);
target.AddResistanceMod(mods.Item1);
target.AddSkillMod(mods.Item2);
int physloss = -15 + (int)(caster.Skills[SkillName.Inscribe].Value / 20);
int resistloss = -35 + (int)(caster.Skills[SkillName.Inscribe].Value / 20);
int physloss = -15 + (int)(caster.Skills.Inscribe.Value / 20);
int resistloss = -35 + (int)(caster.Skills.Inscribe.Value / 20);
string args = $"{physloss}\t{resistloss}";
BuffInfo.AddBuff(target, new BuffInfo(BuffIcon.Protection, 1075814, 1075815, args));
}
@ -89,8 +89,8 @@ namespace Server.Spells.Second
m_Table.Remove(target);
Registry.Remove(target);
target.RemoveResistanceMod((ResistanceMod)mods[0]);
target.RemoveSkillMod((SkillMod)mods[1]);
target.RemoveResistanceMod(mods.Item1);
target.RemoveSkillMod(mods.Item2);
BuffInfo.RemoveBuff(target, BuffIcon.Protection);
}
@ -98,18 +98,18 @@ namespace Server.Spells.Second
public static void EndProtection(Mobile m)
{
if (m_Table.Contains(m))
{
object[] mods = (object[])m_Table[m];
Tuple<ResistanceMod, DefaultSkillMod> mods = m_Table[m];
m_Table.Remove(m);
Registry.Remove(m);
if (mods == null)
return;
m.RemoveResistanceMod((ResistanceMod)mods[0]);
m.RemoveSkillMod((SkillMod)mods[1]);
m_Table.Remove(m);
Registry.Remove(m);
BuffInfo.RemoveBuff(m, BuffIcon.Protection);
}
m.RemoveResistanceMod(mods.Item1);
m.RemoveSkillMod(mods.Item2);
BuffInfo.RemoveBuff(m, BuffIcon.Protection);
}
public override void OnCast()
@ -127,17 +127,17 @@ namespace Server.Spells.Second
{
Caster.SendLocalizedMessage(1005559); // This spell is already in effect.
}
else if (!Caster.CanBeginAction(typeof(DefensiveSpell)))
else if (!Caster.CanBeginAction<DefensiveSpell>())
{
Caster.SendLocalizedMessage(1005385); // The spell will not adhere to you at this time.
}
else if (CheckSequence())
{
if (Caster.BeginAction(typeof(DefensiveSpell)))
if (Caster.BeginAction<DefensiveSpell>())
{
double value = (int)(Caster.Skills[SkillName.EvalInt].Value +
Caster.Skills[SkillName.Meditation].Value +
Caster.Skills[SkillName.Inscribe].Value);
double value = (int)(Caster.Skills.EvalInt.Value +
Caster.Skills.Meditation.Value +
Caster.Skills.Inscribe.Value);
value /= 4;
if (value < 0)
@ -167,7 +167,7 @@ namespace Server.Spells.Second
public InternalTimer(Mobile caster) : base(TimeSpan.FromSeconds(0))
{
double val = caster.Skills[SkillName.Magery].Value * 2.0;
double val = caster.Skills.Magery.Value * 2.0;
if (val < 15)
val = 15;
else if (val > 240)
@ -185,4 +185,4 @@ namespace Server.Spells.Second
}
}
}
}
}

View file

@ -65,7 +65,7 @@ namespace Server.Spells.Seventh
if (Core.AOS)
duration = TimeSpan.FromSeconds((15 + Caster.Skills.Magery.Fixed / 5) / 7);
else
duration = TimeSpan.FromSeconds(Caster.Skills[SkillName.Magery].Value * 0.28 +
duration = TimeSpan.FromSeconds(Caster.Skills.Magery.Value * 0.28 +
2.0); // (28% of magery) + 2.0 seconds
int itemID = eastToWest ? 0x3946 : 0x3956;

View file

@ -1,5 +1,6 @@
using System;
using System.Collections;
using System.Collections.Generic;
using Server.Factions;
using Server.Gumps;
using Server.Items;
@ -19,19 +20,15 @@ namespace Server.Spells.Seventh
Reagent.MandrakeRoot
);
private static Hashtable m_Timers = new Hashtable();
private static Dictionary<Mobile, InternalTimer> m_Timers = new Dictionary<Mobile, InternalTimer>();
private int m_NewBody;
public PolymorphSpell(Mobile caster, Item scroll, int body) : base(caster, scroll, m_Info)
public PolymorphSpell(Mobile caster, Item scroll, int body = 0) : base(caster, scroll, m_Info)
{
m_NewBody = body;
}
public PolymorphSpell(Mobile caster, Item scroll) : this(caster, scroll, 0)
{
}
public override SpellCircle Circle => SpellCircle.Seventh;
public override bool CheckCast()
@ -66,7 +63,7 @@ namespace Server.Spells.Seventh
return false;
}
if (!Caster.CanBeginAction(typeof(PolymorphSpell)))
if (!Caster.CanBeginAction<PolymorphSpell>())
{
if (Core.ML)
EndPolymorph(Caster);
@ -77,11 +74,7 @@ namespace Server.Spells.Seventh
if (m_NewBody == 0)
{
Gump gump;
if (Core.SE)
gump = new NewPolymorphGump(Caster, Scroll);
else
gump = new PolymorphGump(Caster, Scroll);
Gump gump = Core.SE ? (Gump)new NewPolymorphGump(Caster, Scroll) : new PolymorphGump(Caster, Scroll);
Caster.SendGump(gump);
return false;
@ -101,7 +94,7 @@ namespace Server.Spells.Seventh
{
Caster.SendLocalizedMessage(1010521); // You cannot polymorph while you have a Town Sigil
}
else if (!Caster.CanBeginAction(typeof(PolymorphSpell)))
else if (!Caster.CanBeginAction<PolymorphSpell>())
{
if (Core.ML)
EndPolymorph(Caster);
@ -120,13 +113,13 @@ namespace Server.Spells.Seventh
{
Caster.SendLocalizedMessage(1042512); // You cannot polymorph while wearing body paint
}
else if (!Caster.CanBeginAction(typeof(IncognitoSpell)) || Caster.IsBodyMod)
else if (!Caster.CanBeginAction<IncognitoSpell>() || Caster.IsBodyMod)
{
DoFizzle();
}
else if (CheckSequence())
{
if (Caster.BeginAction(typeof(PolymorphSpell)))
if (Caster.BeginAction<PolymorphSpell>())
{
if (m_NewBody != 0)
{
@ -141,7 +134,7 @@ namespace Server.Spells.Seventh
Caster.BodyMod = m_NewBody;
if (m_NewBody == 400 || m_NewBody == 401)
Caster.HueMod = Utility.RandomSkinHue();
Caster.HueMod = Caster.Race.RandomSkinHue();
else
Caster.HueMod = 0;
@ -152,11 +145,11 @@ namespace Server.Spells.Seventh
{
StopTimer(Caster);
Timer t = new InternalTimer(Caster);
InternalTimer timer = new InternalTimer(Caster);
m_Timers[Caster] = t;
m_Timers[Caster] = timer;
t.Start();
timer.Start();
}
}
}
@ -169,26 +162,23 @@ namespace Server.Spells.Seventh
FinishSequence();
}
public static bool StopTimer(Mobile m)
public static void StopTimer(Mobile m)
{
Timer t = (Timer)m_Timers[m];
InternalTimer timer = m_Timers[m];
if (timer == null)
return;
if (t != null)
{
t.Stop();
m_Timers.Remove(m);
}
return t != null;
timer.Stop();
m_Timers.Remove(m);
}
private static void EndPolymorph(Mobile m)
{
if (!m.CanBeginAction(typeof(PolymorphSpell)))
if (!m.CanBeginAction<PolymorphSpell>())
{
m.BodyMod = 0;
m.HueMod = -1;
m.EndAction(typeof(PolymorphSpell));
m.EndAction<PolymorphSpell>();
BaseArmor.ValidateMobile(m);
BaseClothing.ValidateMobile(m);
@ -203,7 +193,7 @@ namespace Server.Spells.Seventh
{
m_Owner = owner;
int val = (int)owner.Skills[SkillName.Magery].Value;
int val = (int)owner.Skills.Magery.Value;
if (val > 120)
val = 120;
@ -218,4 +208,4 @@ namespace Server.Spells.Seventh
}
}
}
}
}

View file

@ -61,7 +61,7 @@ namespace Server.Spells.Sixth
int itemID = eastToWest ? 0x3967 : 0x3979;
TimeSpan duration = TimeSpan.FromSeconds(3.0 + Caster.Skills[SkillName.Magery].Value / 3.0);
TimeSpan duration = TimeSpan.FromSeconds(3.0 + Caster.Skills.Magery.Value / 3.0);
for (int i = -2; i <= 2; ++i)
{
@ -171,8 +171,8 @@ namespace Server.Spells.Sixth
if (Core.AOS)
{
duration = 2.0 + ((int)(m_Caster.Skills[SkillName.EvalInt].Value / 10) -
(int)(m.Skills[SkillName.MagicResist].Value / 10));
duration = 2.0 + ((int)(m_Caster.Skills.EvalInt.Value / 10) -
(int)(m.Skills.MagicResist.Value / 10));
if (!m.Player)
duration *= 3.0;
@ -182,7 +182,7 @@ namespace Server.Spells.Sixth
}
else
{
duration = 7.0 + m_Caster.Skills[SkillName.Magery].Value * 0.2;
duration = 7.0 + m_Caster.Skills.Magery.Value * 0.2;
}
m.Paralyze(TimeSpan.FromSeconds(duration));

View file

@ -44,7 +44,7 @@ namespace Server.Spells.Sixth
if (map != null)
{
IPooledEnumerable<Mobile> eable = map.GetMobilesInRange(new Point3D(p),
1 + (int)(Caster.Skills[SkillName.Magery].Value / 20.0));
1 + (int)(Caster.Skills.Magery.Value / 20.0));
foreach (Mobile m in eable)
{
@ -80,11 +80,11 @@ namespace Server.Spells.Sixth
if (!Core.AOS || InvisibilitySpell.HasTimer(m))
return true;
int magery = from.Skills[SkillName.Magery].Fixed;
int detectHidden = from.Skills[SkillName.DetectHidden].Fixed;
int magery = from.Skills.Magery.Fixed;
int detectHidden = from.Skills.DetectHidden.Fixed;
int hiding = m.Skills[SkillName.Hiding].Fixed;
int stealth = m.Skills[SkillName.Stealth].Fixed;
int hiding = m.Skills.Hiding.Fixed;
int stealth = m.Skills.Stealth.Fixed;
int divisor = hiding + stealth;
int chance;

View file

@ -30,7 +30,7 @@ namespace Server.Spells.Spellweaving
return false;
}
if (!Caster.CanBeginAction(typeof(AttuneWeaponSpell)))
if (!Caster.CanBeginAction<AttuneWeaponSpell>())
{
Caster.SendLocalizedMessage(1075124); // You must wait before casting that spell again.
return false;
@ -47,7 +47,7 @@ namespace Server.Spells.Spellweaving
Caster.FixedParticles(0x3728, 1, 13, 0x26B8, 0x455, 7, EffectLayer.Waist);
Caster.FixedParticles(0x3779, 1, 15, 0x251E, 0x3F, 7, EffectLayer.Waist);
double skill = Caster.Skills[SkillName.Spellweaving].Value;
double skill = Caster.Skills.Spellweaving.Value;
int damageAbsorb = (int)(18 + (skill - 10) / 10 * 3 + FocusLevel * 6);
Caster.MeleeDamageAbsorb = damageAbsorb;
@ -59,7 +59,7 @@ namespace Server.Spells.Spellweaving
m_Table[Caster] = t;
Caster.BeginAction(typeof(AttuneWeaponSpell));
Caster.BeginAction<AttuneWeaponSpell>();
BuffInfo.AddBuff(Caster,
new BuffInfo(BuffIcon.AttuneWeapon, 1075798, duration, Caster, damageAbsorb.ToString()));
@ -124,7 +124,7 @@ namespace Server.Spells.Spellweaving
m_Table.Remove(m_Mobile);
DelayCall(TimeSpan.FromSeconds(120), delegate { m_Mobile.EndAction(typeof(AttuneWeaponSpell)); });
DelayCall(TimeSpan.FromSeconds(120), delegate { m_Mobile.EndAction<AttuneWeaponSpell>(); });
BuffInfo.RemoveBuff(m_Mobile, BuffIcon.AttuneWeapon);
}
}

View file

@ -27,7 +27,7 @@ namespace Server.Spells.Spellweaving
int range = 5 + FocusLevel;
int damage = 25 + FocusLevel;
double skill = Caster.Skills[SkillName.Spellweaving].Value;
double skill = Caster.Skills.Spellweaving.Value;
TimeSpan duration = TimeSpan.FromSeconds((int)(skill / 24) + FocusLevel);

View file

@ -35,7 +35,7 @@ namespace Server.Spells.Spellweaving
{
if (TransformationSpellHelper.UnderTransformation(Caster, typeof(EtherealVoyageSpell)))
Caster.SendLocalizedMessage(501775); // This spell is already in effect.
else if (!Caster.CanBeginAction(typeof(EtherealVoyageSpell)))
else if (!Caster.CanBeginAction<EtherealVoyageSpell>())
Caster.SendLocalizedMessage(1075124); // You must wait before casting that spell again.
else if (Caster.Combatant != null)
Caster.SendLocalizedMessage(1072586); // You cannot cast Ethereal Voyage while you are in combat.
@ -68,7 +68,7 @@ namespace Server.Spells.Spellweaving
TransformationSpellHelper.RemoveContext(m, true);
Timer.DelayCall(TimeSpan.FromMinutes(5), delegate { m.EndAction(typeof(EtherealVoyageSpell)); });
Timer.DelayCall(TimeSpan.FromMinutes(5), delegate { m.EndAction<EtherealVoyageSpell>(); });
BuffInfo.RemoveBuff(m, BuffIcon.EtherealVoyage);
}

View file

@ -72,7 +72,7 @@ namespace Server.Spells.Spellweaving
m.FixedParticles(0x3709, 1, 30, 0x26ED, 5, 2, EffectLayer.Waist);
m.FixedParticles(0x376A, 1, 30, 0x251E, 5, 3, EffectLayer.Waist);
double skill = Caster.Skills[SkillName.Spellweaving].Value;
double skill = Caster.Skills.Spellweaving.Value;
TimeSpan duration = TimeSpan.FromMinutes((int)(skill / 24) * 2 + FocusLevel);
@ -105,7 +105,7 @@ namespace Server.Spells.Spellweaving
if (master?.NetState != null && Utility.InUpdateRange(pet, master))
{
master.CloseGump(typeof(PetResurrectGump));
master.CloseGump<PetResurrectGump>();
master.SendGump(new PetResurrectGump(master, pet, hitsScalar));
}
else
@ -118,7 +118,7 @@ namespace Server.Spells.Spellweaving
if (friend.NetState != null && Utility.InUpdateRange(pet, friend))
{
friend.CloseGump(typeof(PetResurrectGump));
friend.CloseGump<PetResurrectGump>();
friend.SendGump(new PetResurrectGump(friend, pet));
break;
}
@ -127,7 +127,7 @@ namespace Server.Spells.Spellweaving
}
else
{
m.CloseGump(typeof(ResurrectGump));
m.CloseGump<ResurrectGump>();
m.SendGump(new ResurrectGump(m, hitsScalar));
}

View file

@ -35,7 +35,7 @@ namespace Server.Spells.Spellweaving
{
Caster.SendLocalizedMessage(501775); // This spell is already in effect.
}
else if (!Caster.CanBeginAction(typeof(GiftOfRenewalSpell)))
else if (!Caster.CanBeginAction<GiftOfRenewalSpell>())
{
Caster.SendLocalizedMessage(501789); // You must wait before trying again.
}
@ -52,7 +52,7 @@ namespace Server.Spells.Spellweaving
}
else
{
double skill = Caster.Skills[SkillName.Spellweaving].Value;
double skill = Caster.Skills.Spellweaving.Value;
int hitsPerRound = 5 + (int)(skill / 24) + FocusLevel;
TimeSpan duration = TimeSpan.FromSeconds(30 + FocusLevel * 10);
@ -72,7 +72,7 @@ namespace Server.Spells.Spellweaving
m_Table[m] = info;
Caster.BeginAction(typeof(GiftOfRenewalSpell));
Caster.BeginAction<GiftOfRenewalSpell>();
BuffInfo.AddBuff(m,
new BuffInfo(BuffIcon.GiftOfRenewal, 1031602, 1075797, duration, m, hitsPerRound.ToString()));
@ -91,7 +91,7 @@ namespace Server.Spells.Spellweaving
info.m_Timer.Stop();
BuffInfo.RemoveBuff(m, BuffIcon.GiftOfRenewal);
Timer.DelayCall(TimeSpan.FromSeconds(60), delegate { info.m_Caster.EndAction(typeof(GiftOfRenewalSpell)); });
Timer.DelayCall(TimeSpan.FromSeconds(60), delegate { info.m_Caster.EndAction<GiftOfRenewalSpell>(); });
return true;
}

View file

@ -50,7 +50,7 @@ namespace Server.Spells.Spellweaving
if (map == null)
return;
HouseRegion r = Region.Find(p, map).GetRegion(typeof(HouseRegion)) as HouseRegion;
HouseRegion r = Region.Find(p, map).GetRegion<HouseRegion>();
if (r?.House != null && !r.House.IsFriend(Caster))
return;

View file

@ -28,7 +28,7 @@ namespace Server.Spells.Spellweaving
{
Caster.PlaySound(0x5CE);
double skill = Caster.Skills[SkillName.Spellweaving].Value;
double skill = Caster.Skills.Spellweaving.Value;
int damage = Math.Max(11, 10 + (int)(skill / 24)) + FocusLevel;

View file

@ -69,11 +69,11 @@ namespace Server.Spells.Third
}
else
{
//double total = Caster.Skills[SkillName.Magery].Value + Caster.Skills[SkillName.Poisoning].Value;
//double total = Caster.Skills.Magery.Value + Caster.Skills.Poisoning.Value;
#region Dueling
double total = Caster.Skills[SkillName.Magery].Value;
double total = Caster.Skills.Magery.Value;
if (Caster is PlayerMobile pm)
{
@ -83,12 +83,12 @@ namespace Server.Spells.Third
}
else
{
total += pm.Skills[SkillName.Poisoning].Value;
total += pm.Skills.Poisoning.Value;
}
}
else
{
total += Caster.Skills[SkillName.Poisoning].Value;
total += Caster.Skills.Poisoning.Value;
}
#endregion

View file

@ -79,7 +79,7 @@ namespace Server.Spells.Third
{
Caster.SendLocalizedMessage(502831); // Cannot teleport to that spot.
}
else if (Region.Find(to, map).GetRegion(typeof(HouseRegion)) != null)
else if (Region.Find(to, map).IsPartOf<HouseRegion>())
{
Caster.SendLocalizedMessage(502829); // Cannot teleport to that spot.
}

View file

@ -76,7 +76,7 @@ namespace Server.Spells.Third
}
else
{
int level = (int)(from.Skills[SkillName.Magery].Value * 0.8) - 4;
int level = (int)(from.Skills.Magery.Value * 0.8) - 4;
if (level >= cont.RequiredSkill &&
!(cont is TreasureMapChest chest && chest.Level > 2))