Adds style cop (#109)
This commit is contained in:
parent
3e715bcb60
commit
556a17aba8
1725 changed files with 33831 additions and 38046 deletions
|
|
@ -7,14 +7,14 @@ namespace Server.Spells
|
|||
{
|
||||
private const double ChanceOffset = 20.0, ChanceLength = 100.0 / 7.0;
|
||||
|
||||
private static int[] m_ManaTable = { 4, 6, 9, 11, 14, 20, 40, 50 };
|
||||
private static readonly int[] m_ManaTable = { 4, 6, 9, 11, 14, 20, 40, 50 };
|
||||
|
||||
public MagerySpell(Mobile caster, Item scroll, SpellInfo info)
|
||||
: base(caster, scroll, info)
|
||||
{
|
||||
}
|
||||
|
||||
public abstract SpellCircle Circle{ get; }
|
||||
public abstract SpellCircle Circle { get; }
|
||||
|
||||
public override TimeSpan CastDelayBase => TimeSpan.FromSeconds((3 + (int)Circle) * CastDelaySecondsPerTick);
|
||||
|
||||
|
|
|
|||
|
|
@ -11,7 +11,7 @@ namespace Server.Spells
|
|||
{
|
||||
public abstract class SpecialMove
|
||||
{
|
||||
private static Dictionary<Mobile, SpecialMoveContext> m_PlayersTable = new Dictionary<Mobile, SpecialMoveContext>();
|
||||
private static readonly Dictionary<Mobile, SpecialMoveContext> m_PlayersTable = new Dictionary<Mobile, SpecialMoveContext>();
|
||||
|
||||
public virtual int BaseMana => 0;
|
||||
|
||||
|
|
@ -23,7 +23,7 @@ namespace Server.Spells
|
|||
public virtual bool BlockedByAnimalForm => true;
|
||||
public virtual bool DelayedContext => false;
|
||||
|
||||
public static Dictionary<Mobile, SpecialMove> Table{ get; } = new Dictionary<Mobile, SpecialMove>();
|
||||
public static Dictionary<Mobile, SpecialMove> Table { get; } = new Dictionary<Mobile, SpecialMove>();
|
||||
|
||||
public virtual bool ValidatesDuringHit => true;
|
||||
|
||||
|
|
@ -145,8 +145,6 @@ namespace Server.Spells
|
|||
return false;
|
||||
}
|
||||
|
||||
#region Dueling
|
||||
|
||||
string option = null;
|
||||
|
||||
if (this is Backstab)
|
||||
|
|
@ -169,8 +167,6 @@ namespace Server.Spells
|
|||
if (option != null && !DuelContext.AllowSpecialMove(from, option, this))
|
||||
return false;
|
||||
|
||||
#endregion
|
||||
|
||||
return CheckSkills(from) && CheckMana(from, false);
|
||||
}
|
||||
|
||||
|
|
@ -286,7 +282,7 @@ namespace Server.Spells
|
|||
|
||||
private class SpecialMoveTimer : Timer
|
||||
{
|
||||
private Mobile m_Mobile;
|
||||
private readonly Mobile m_Mobile;
|
||||
|
||||
public SpecialMoveTimer(Mobile from) : base(TimeSpan.FromSeconds(3.0))
|
||||
{
|
||||
|
|
@ -309,9 +305,9 @@ namespace Server.Spells
|
|||
Type = type;
|
||||
}
|
||||
|
||||
public Timer Timer{ get; }
|
||||
public Timer Timer { get; }
|
||||
|
||||
public Type Type{ get; }
|
||||
public Type Type { get; }
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -16,15 +16,15 @@ namespace Server.Spells
|
|||
{
|
||||
public abstract class Spell : ISpell
|
||||
{
|
||||
private static TimeSpan NextSpellDelay = TimeSpan.FromSeconds(0.75);
|
||||
private static readonly TimeSpan NextSpellDelay = TimeSpan.FromSeconds(0.75);
|
||||
|
||||
private static TimeSpan AnimateDelay = TimeSpan.FromSeconds(1.5);
|
||||
//In reality, it's ANY delayed Damage spell Post-AoS that can't stack, but, only
|
||||
//Expo & Magic Arrow have enough delay and a short enough cast time to bring up
|
||||
//the possibility of stacking 'em. Note that a MA & an Explosion will stack, but
|
||||
//of course, two MA's won't.
|
||||
private static readonly TimeSpan AnimateDelay = TimeSpan.FromSeconds(1.5);
|
||||
// In reality, it's ANY delayed Damage spell Post-AoS that can't stack, but, only
|
||||
// Expo & Magic Arrow have enough delay and a short enough cast time to bring up
|
||||
// the possibility of stacking 'em. Note that a MA & an Explosion will stack, but
|
||||
// of course, two MA's won't.
|
||||
|
||||
private static Dictionary<Type, DelayedDamageContextWrapper> m_ContextTable =
|
||||
private static readonly Dictionary<Type, DelayedDamageContextWrapper> m_ContextTable =
|
||||
new Dictionary<Type, DelayedDamageContextWrapper>();
|
||||
|
||||
private AnimTimer m_AnimTimer;
|
||||
|
|
@ -38,18 +38,18 @@ namespace Server.Spells
|
|||
Info = info;
|
||||
}
|
||||
|
||||
public SpellState State{ get; set; }
|
||||
public SpellState State { get; set; }
|
||||
|
||||
public Mobile Caster{ get; }
|
||||
public Mobile Caster { get; }
|
||||
|
||||
public SpellInfo Info{ get; }
|
||||
public SpellInfo Info { get; }
|
||||
|
||||
public string Name => Info.Name;
|
||||
public string Mantra => Info.Mantra;
|
||||
public Type[] Reagents => Info.Reagents;
|
||||
public Item Scroll{ get; }
|
||||
public Item Scroll { get; }
|
||||
|
||||
public long StartCastTime{ get; private set; }
|
||||
public long StartCastTime { get; private set; }
|
||||
|
||||
public virtual SkillName CastSkill => SkillName.Magery;
|
||||
public virtual SkillName DamageSkill => SkillName.EvalInt;
|
||||
|
|
@ -73,7 +73,7 @@ namespace Server.Spells
|
|||
public virtual int CastRecoveryPerSecond => 4;
|
||||
public virtual int CastRecoveryMinimum => 0;
|
||||
|
||||
public abstract TimeSpan CastDelayBase{ get; }
|
||||
public abstract TimeSpan CastDelayBase { get; }
|
||||
|
||||
public virtual double CastDelayFastScalar => 1;
|
||||
public virtual double CastDelaySecondsPerTick => 0.25;
|
||||
|
|
@ -83,7 +83,7 @@ namespace Server.Spells
|
|||
|
||||
public virtual void OnCasterHurt()
|
||||
{
|
||||
//Confirm: Monsters and pets cannot be disturbed.
|
||||
// Confirm: Monsters and pets cannot be disturbed.
|
||||
if (Caster.Player && IsCasting && ProtectionSpell.Registry.TryGetValue(Caster, out double d) &&
|
||||
d <= Utility.RandomDouble() * 100.0)
|
||||
Disturb(DisturbType.Hurt, false, true);
|
||||
|
|
@ -131,7 +131,7 @@ namespace Server.Spells
|
|||
public void StartDelayedDamageContext(Mobile m, Timer t)
|
||||
{
|
||||
if (DelayedDamageStacking)
|
||||
return; //Sanity
|
||||
return; // Sanity
|
||||
|
||||
if (!m_ContextTable.TryGetValue(GetType(), out DelayedDamageContextWrapper contexts))
|
||||
m_ContextTable[GetType()] = contexts = new DelayedDamageContextWrapper();
|
||||
|
|
@ -233,17 +233,17 @@ namespace Server.Spells
|
|||
{
|
||||
double scalar = 1.0;
|
||||
|
||||
if (!Core.AOS) //EvalInt stuff for AoS is handled elsewhere
|
||||
if (!Core.AOS) // EvalInt stuff for AoS is handled elsewhere
|
||||
{
|
||||
double casterEI = Caster.Skills[DamageSkill].Value;
|
||||
double targetRS = target.Skills.MagicResist.Value;
|
||||
|
||||
/*
|
||||
if ( Core.AOS )
|
||||
if (Core.AOS)
|
||||
targetRS = 0;
|
||||
*/
|
||||
|
||||
//m_Caster.CheckSkill( DamageSkill, 0.0, 120.0 );
|
||||
// m_Caster.CheckSkill( DamageSkill, 0.0, 120.0 );
|
||||
|
||||
if (casterEI > targetRS)
|
||||
scalar = 1.0 + (casterEI - targetRS) / 500.0;
|
||||
|
|
@ -266,7 +266,7 @@ namespace Server.Spells
|
|||
|
||||
target.Region.SpellDamageScalar(Caster, target, ref scalar);
|
||||
|
||||
if (Evasion.CheckSpellEvasion(target)) //Only single target spells an be evaded
|
||||
if (Evasion.CheckSpellEvasion(target)) // Only single target spells an be evaded
|
||||
scalar = 0;
|
||||
|
||||
return scalar;
|
||||
|
|
@ -284,7 +284,7 @@ namespace Server.Spells
|
|||
|
||||
if (atkSlayer?.Slays(defender) == true || atkSlayer2?.Slays(defender) == true)
|
||||
{
|
||||
defender.FixedEffect(0x37B9, 10, 5); //TODO: Confirm this displays on OSIs
|
||||
defender.FixedEffect(0x37B9, 10, 5); // TODO: Confirm this displays on OSIs
|
||||
scalar = 2.0;
|
||||
}
|
||||
|
||||
|
|
@ -411,9 +411,9 @@ namespace Server.Spells
|
|||
{
|
||||
Caster.SendLocalizedMessage(502642); // You are already casting a spell.
|
||||
}
|
||||
else if (BlockedByHorrificBeast &&
|
||||
TransformationSpellHelper.UnderTransformation(Caster, typeof(HorrificBeastSpell)) ||
|
||||
BlockedByAnimalForm && AnimalForm.UnderTransformation(Caster))
|
||||
else if ((BlockedByHorrificBeast &&
|
||||
TransformationSpellHelper.UnderTransformation(Caster, typeof(HorrificBeastSpell))) ||
|
||||
(BlockedByAnimalForm && AnimalForm.UnderTransformation(Caster)))
|
||||
{
|
||||
Caster.SendLocalizedMessage(1061091); // You cannot cast that spell in this form.
|
||||
}
|
||||
|
|
@ -429,15 +429,9 @@ namespace Server.Spells
|
|||
{
|
||||
mobile.SendLocalizedMessage(1072060); // You cannot cast a spell while calmed.
|
||||
}
|
||||
|
||||
#region Dueling
|
||||
|
||||
else if ((Caster as PlayerMobile)?.DuelContext?.AllowSpellCast(Caster, this) == false)
|
||||
{
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
else if (Caster.Mana >= ScaleMana(GetMana()))
|
||||
{
|
||||
if (Caster.Spell == null && Caster.CheckSpellCast(this) && CheckCast() &&
|
||||
|
|
@ -453,7 +447,7 @@ namespace Server.Spells
|
|||
|
||||
TimeSpan castDelay = GetCastDelay();
|
||||
|
||||
if (ShowHandMovement && (Caster.Body.IsHuman || Caster.Player && Caster.Body.IsMonster))
|
||||
if (ShowHandMovement && (Caster.Body.IsHuman || (Caster.Player && Caster.Body.IsMonster)))
|
||||
{
|
||||
int count = (int)Math.Ceiling(castDelay.TotalSeconds / AnimateDelay.TotalSeconds);
|
||||
|
||||
|
|
@ -477,7 +471,7 @@ namespace Server.Spells
|
|||
WeaponAbility.ClearCurrentAbility(Caster);
|
||||
|
||||
m_CastTimer = new CastTimer(this, castDelay);
|
||||
//m_CastTimer.Start();
|
||||
// m_CastTimer.Start();
|
||||
|
||||
OnBeginCast();
|
||||
|
||||
|
|
@ -507,7 +501,7 @@ namespace Server.Spells
|
|||
|
||||
public virtual void GetCastSkills(out double min, out double max)
|
||||
{
|
||||
min = max = 0; //Intended but not required for overriding.
|
||||
min = max = 0; // Intended but not required for overriding.
|
||||
}
|
||||
|
||||
public virtual bool CheckFizzle()
|
||||
|
|
@ -574,10 +568,10 @@ namespace Server.Spells
|
|||
return TimeSpan.FromSeconds((double)delay / CastRecoveryPerSecond);
|
||||
}
|
||||
|
||||
//public virtual int CastDelayBase{ get{ return 3; } }
|
||||
//public virtual int CastDelayFastScalar{ get{ return 1; } }
|
||||
//public virtual int CastDelayPerSecond{ get{ return 4; } }
|
||||
//public virtual int CastDelayMinimum{ get{ return 1; } }
|
||||
// public virtual int CastDelayBase{ get{ return 3; } }
|
||||
// public virtual int CastDelayFastScalar{ get{ return 1; } }
|
||||
// public virtual int CastDelayPerSecond{ get{ return 4; } }
|
||||
// public virtual int CastDelayMinimum{ get{ return 1; } }
|
||||
|
||||
public virtual TimeSpan GetCastDelay()
|
||||
{
|
||||
|
|
@ -591,7 +585,7 @@ namespace Server.Spells
|
|||
int fcMax = 4;
|
||||
|
||||
if (CastSkill == SkillName.Magery || CastSkill == SkillName.Necromancy ||
|
||||
CastSkill == SkillName.Chivalry && Caster.Skills.Magery.Value >= 70.0)
|
||||
(CastSkill == SkillName.Chivalry && Caster.Skills.Magery.Value >= 70.0))
|
||||
fcMax = 2;
|
||||
|
||||
int fc = AosAttributes.GetValue(Caster, AosAttribute.CastSpeed);
|
||||
|
|
@ -609,13 +603,13 @@ namespace Server.Spells
|
|||
|
||||
TimeSpan fcDelay = TimeSpan.FromSeconds(-(CastDelayFastScalar * fc * CastDelaySecondsPerTick));
|
||||
|
||||
//int delay = CastDelayBase + circleDelay + fcDelay;
|
||||
// int delay = CastDelayBase + circleDelay + fcDelay;
|
||||
TimeSpan delay = baseDelay + fcDelay;
|
||||
|
||||
if (delay < CastDelayMinimum)
|
||||
delay = CastDelayMinimum;
|
||||
|
||||
//return TimeSpan.FromSeconds( (double)delay / CastDelayPerSecond );
|
||||
// return TimeSpan.FromSeconds( (double)delay / CastDelayPerSecond );
|
||||
return delay;
|
||||
}
|
||||
|
||||
|
|
@ -638,8 +632,8 @@ namespace Server.Spells
|
|||
DoFizzle();
|
||||
}
|
||||
else if (Scroll != null && !(Scroll is Runebook) &&
|
||||
(Scroll.Amount <= 0 || Scroll.Deleted || Scroll.RootParent != Caster || Scroll is BaseWand baseWand &&
|
||||
(baseWand.Charges <= 0 || baseWand.Parent != Caster)))
|
||||
(Scroll.Amount <= 0 || Scroll.Deleted || Scroll.RootParent != Caster || (Scroll is BaseWand baseWand &&
|
||||
(baseWand.Charges <= 0 || baseWand.Parent != Caster))))
|
||||
{
|
||||
DoFizzle();
|
||||
}
|
||||
|
|
@ -759,7 +753,7 @@ namespace Server.Spells
|
|||
|
||||
private class DelayedDamageContextWrapper
|
||||
{
|
||||
private Dictionary<Mobile, Timer> m_Contexts = new Dictionary<Mobile, Timer>();
|
||||
private readonly Dictionary<Mobile, Timer> m_Contexts = new Dictionary<Mobile, Timer>();
|
||||
|
||||
public void Add(Mobile m, Timer t)
|
||||
{
|
||||
|
|
@ -780,7 +774,7 @@ namespace Server.Spells
|
|||
|
||||
private class AnimTimer : Timer
|
||||
{
|
||||
private Spell m_Spell;
|
||||
private readonly Spell m_Spell;
|
||||
|
||||
public AnimTimer(Spell spell, int count) : base(TimeSpan.Zero, AnimateDelay, count)
|
||||
{
|
||||
|
|
@ -812,7 +806,7 @@ namespace Server.Spells
|
|||
|
||||
private class CastTimer : Timer
|
||||
{
|
||||
private Spell m_Spell;
|
||||
private readonly Spell m_Spell;
|
||||
|
||||
public CastTimer(Spell spell, TimeSpan castDelay) : base(castDelay)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -28,7 +28,7 @@ namespace Server
|
|||
|
||||
private class InternalTimer : Timer
|
||||
{
|
||||
private Mobile m_Mobile;
|
||||
private readonly Mobile m_Mobile;
|
||||
|
||||
public InternalTimer(Mobile m)
|
||||
: base(TimeSpan.FromMinutes(1.0))
|
||||
|
|
@ -61,13 +61,13 @@ namespace Server.Spells
|
|||
|
||||
public class SpellHelper
|
||||
{
|
||||
private static TimeSpan AosDamageDelay = TimeSpan.FromSeconds(1.0);
|
||||
private static TimeSpan OldDamageDelay = TimeSpan.FromSeconds(0.5);
|
||||
private static readonly TimeSpan AosDamageDelay = TimeSpan.FromSeconds(1.0);
|
||||
private static readonly TimeSpan OldDamageDelay = TimeSpan.FromSeconds(0.5);
|
||||
|
||||
private static TimeSpan CombatHeatDelay = TimeSpan.FromSeconds(30.0);
|
||||
private static bool RestrictTravelCombat = true;
|
||||
private static readonly TimeSpan CombatHeatDelay = TimeSpan.FromSeconds(30.0);
|
||||
private static readonly bool RestrictTravelCombat = true;
|
||||
|
||||
private static int[] m_Offsets =
|
||||
private static readonly int[] m_Offsets =
|
||||
{
|
||||
-1, -1,
|
||||
-1, 0,
|
||||
|
|
@ -79,7 +79,7 @@ namespace Server.Spells
|
|||
1, 1
|
||||
};
|
||||
|
||||
private static TravelValidator[] m_Validators =
|
||||
private static readonly TravelValidator[] m_Validators =
|
||||
{
|
||||
IsFeluccaT2A,
|
||||
IsKhaldun,
|
||||
|
|
@ -102,10 +102,10 @@ namespace Server.Spells
|
|||
IsMLDungeon
|
||||
};
|
||||
|
||||
// TODO: Find a better way
|
||||
private static bool[,] m_Rules =
|
||||
// TODO: Move to configuration
|
||||
private static readonly bool[,] m_Rules =
|
||||
{
|
||||
/*T2A(Fel), Khaldun, Ilshenar, Wind(Tram), Wind(Fel), Dungeons(Fel), Solen(Tram), Solen(Fel), CrystalCave(Malas), Gauntlet(Malas), Gauntlet(Ferry), SafeZone, Stronghold, ChampionSpawn, Dungeons(Tokuno[Malas]), LampRoom(Doom), GuardianRoom(Doom), Heartwood, MLDungeons */
|
||||
/* T2A(Fel), Khaldun, Ilshenar, Wind(Tram), Wind(Fel), Dungeons(Fel), Solen(Tram), Solen(Fel), CrystalCave(Malas), Gauntlet(Malas), Gauntlet(Ferry), SafeZone, Stronghold, ChampionSpawn, Dungeons(Tokuno[Malas]), LampRoom(Doom), GuardianRoom(Doom), Heartwood, MLDungeons */
|
||||
/* Recall From */
|
||||
{
|
||||
false, false, true, true, false, false, true, false, false, false, false, true, true, false, true, false,
|
||||
|
|
@ -146,7 +146,7 @@ namespace Server.Spells
|
|||
private static Mobile m_TravelCaster;
|
||||
private static TravelCheckType m_TravelType;
|
||||
|
||||
public static bool DisableSkillCheck{ get; set; }
|
||||
public static bool DisableSkillCheck { get; set; }
|
||||
|
||||
public static TimeSpan GetDamageDelayForSpell(Spell sp)
|
||||
{
|
||||
|
|
@ -169,7 +169,7 @@ namespace Server.Spells
|
|||
|
||||
if (multi is BaseHouse bh)
|
||||
{
|
||||
if (houses && bh.IsInside(p, 16) || housingrange > 0 && bh.InRange(p, housingrange))
|
||||
if ((houses && bh.IsInside(p, 16)) || (housingrange > 0 && bh.InRange(p, housingrange)))
|
||||
return true;
|
||||
}
|
||||
else if (multi.Contains(p))
|
||||
|
|
@ -405,8 +405,6 @@ namespace Server.Spells
|
|||
BaseCreature bcFrom = from as BaseCreature;
|
||||
BaseCreature bcTarg = to as BaseCreature;
|
||||
|
||||
#region Dueling
|
||||
|
||||
PlayerMobile pmFrom;
|
||||
PlayerMobile pmTarg;
|
||||
|
||||
|
|
@ -424,8 +422,6 @@ namespace Server.Spells
|
|||
pmFrom.DuelPlayer != null && pmTarg?.DuelPlayer != null)
|
||||
return pmFrom.DuelPlayer.Participant != pmTarg.DuelPlayer.Participant;
|
||||
|
||||
#endregion
|
||||
|
||||
Guild fromGuild = GetGuildFor(from);
|
||||
Guild toGuild = GetGuildFor(to);
|
||||
|
||||
|
|
@ -457,7 +453,7 @@ namespace Server.Spells
|
|||
return false;
|
||||
}
|
||||
|
||||
return bcTarg?.Controlled == false && bcTarg.InitialInnocent ||
|
||||
return (bcTarg?.Controlled == false && bcTarg.InitialInnocent) ||
|
||||
Notoriety.Compute(from, to) != Notoriety.Innocent || from.Kills >= 5;
|
||||
}
|
||||
|
||||
|
|
@ -494,7 +490,6 @@ namespace Server.Spells
|
|||
return;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
int offset = Utility.Random( 8 ) * 2;
|
||||
|
||||
|
|
@ -503,7 +498,7 @@ namespace Server.Spells
|
|||
int x = caster.X + m_Offsets[(offset + i) % m_Offsets.Length];
|
||||
int y = caster.Y + m_Offsets[(offset + i + 1) % m_Offsets.Length];
|
||||
|
||||
if ( map.CanSpawnMobile( x, y, caster.Z ) )
|
||||
if (map.CanSpawnMobile( x, y, caster.Z ))
|
||||
{
|
||||
BaseCreature.Summon( creature, caster, new Point3D( x, y, caster.Z ), sound, duration );
|
||||
return;
|
||||
|
|
@ -512,7 +507,7 @@ namespace Server.Spells
|
|||
{
|
||||
int z = map.GetAverageZ( x, y );
|
||||
|
||||
if ( map.CanSpawnMobile( x, y, z ) )
|
||||
if (map.CanSpawnMobile( x, y, z ))
|
||||
{
|
||||
BaseCreature.Summon( creature, caster, new Point3D( x, y, z ), sound, duration );
|
||||
return;
|
||||
|
|
@ -527,12 +522,12 @@ namespace Server.Spells
|
|||
|
||||
public static bool FindValidSpawnLocation(Map map, ref Point3D p, bool surroundingsOnly)
|
||||
{
|
||||
if (map == null) //sanity
|
||||
if (map == null) // sanity
|
||||
return false;
|
||||
|
||||
if (!surroundingsOnly)
|
||||
{
|
||||
if (map.CanSpawnMobile(p)) //p's fine.
|
||||
if (map.CanSpawnMobile(p)) // p's fine.
|
||||
{
|
||||
p = new Point3D(p);
|
||||
return true;
|
||||
|
|
@ -674,22 +669,19 @@ namespace Server.Spells
|
|||
|
||||
int x = loc.X, y = loc.Y;
|
||||
|
||||
return x >= 1182 && y >= 437 && x < 1211 && y < 470
|
||||
|| x >= 1156 && y >= 470 && x < 1211 && y < 503
|
||||
|| x >= 1176 && y >= 503 && x < 1208 && y < 509
|
||||
|| x >= 1188 && y >= 509 && x < 1201 && y < 513;
|
||||
return (x >= 1182 && y >= 437 && x < 1211 && y < 470)
|
||||
|| (x >= 1156 && y >= 470 && x < 1211 && y < 503)
|
||||
|| (x >= 1176 && y >= 503 && x < 1208 && y < 509)
|
||||
|| (x >= 1188 && y >= 509 && x < 1201 && y < 513);
|
||||
}
|
||||
|
||||
public static bool IsSafeZone(Map map, Point3D loc)
|
||||
{
|
||||
#region Duels
|
||||
if (Region.Find(loc, map).IsPartOf<SafeZone>() &&
|
||||
(m_TravelType == TravelCheckType.TeleportTo || m_TravelType == TravelCheckType.TeleportFrom)
|
||||
&& (m_TravelCaster as PlayerMobile)?.DuelPlayer?.Eliminated == false)
|
||||
return true;
|
||||
|
||||
#endregion
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
@ -715,7 +707,7 @@ namespace Server.Spells
|
|||
|
||||
public static bool IsTokunoDungeon(Map map, Point3D loc)
|
||||
{
|
||||
//The tokuno dungeons are really inside malas
|
||||
// The tokuno dungeons are really inside malas
|
||||
if (map != Map.Malas)
|
||||
return false;
|
||||
|
||||
|
|
@ -776,7 +768,7 @@ namespace Server.Spells
|
|||
return x < 0 || y < 0 || x >= map.Width || y >= map.Height;
|
||||
}
|
||||
|
||||
//towns
|
||||
// towns
|
||||
public static bool IsTown(IPoint3D ip, Mobile caster)
|
||||
{
|
||||
if (ip is Item item)
|
||||
|
|
@ -792,13 +784,10 @@ namespace Server.Spells
|
|||
if (map == null)
|
||||
return false;
|
||||
|
||||
#region Dueling
|
||||
if (Region.Find(loc, map).GetRegion<SafeZone>() != null)
|
||||
if (caster is PlayerMobile pm && (pm.DuelContext?.Started != true || pm.DuelPlayer?.Eliminated != false))
|
||||
return true;
|
||||
|
||||
#endregion
|
||||
|
||||
GuardedRegion reg = Region.Find(loc, map).GetRegion<GuardedRegion>();
|
||||
|
||||
return reg?.IsDisabled() == false;
|
||||
|
|
@ -823,7 +812,7 @@ namespace Server.Spells
|
|||
return true;
|
||||
}
|
||||
|
||||
//magic reflection
|
||||
// magic reflection
|
||||
public static void CheckReflect(int circle, Mobile caster, ref Mobile target)
|
||||
{
|
||||
CheckReflect(circle, ref caster, ref target);
|
||||
|
|
@ -994,7 +983,7 @@ namespace Server.Spells
|
|||
|
||||
public static void Heal(int amount, Mobile target, Mobile from, bool message = true)
|
||||
{
|
||||
//TODO: All Healing *spells* go through ArcaneEmpowerment
|
||||
// TODO: All Healing *spells* go through ArcaneEmpowerment
|
||||
target.Heal(amount, from, message);
|
||||
}
|
||||
|
||||
|
|
@ -1003,8 +992,9 @@ namespace Server.Spells
|
|||
private class SpellDamageTimer : Timer
|
||||
{
|
||||
private int m_Damage;
|
||||
private Spell m_Spell;
|
||||
private Mobile m_Target, m_From;
|
||||
private readonly Spell m_Spell;
|
||||
private readonly Mobile m_Target;
|
||||
private readonly Mobile m_From;
|
||||
|
||||
public SpellDamageTimer(Spell s, Mobile target, Mobile from, int damage, TimeSpan delay)
|
||||
: base(delay)
|
||||
|
|
@ -1034,10 +1024,16 @@ namespace Server.Spells
|
|||
private class SpellDamageTimerAOS : Timer
|
||||
{
|
||||
private int m_Damage;
|
||||
private DFAlgorithm m_DFA;
|
||||
private int m_Phys, m_Fire, m_Cold, m_Pois, m_Nrgy, m_Chaos;
|
||||
private Spell m_Spell;
|
||||
private Mobile m_Target, m_From;
|
||||
private readonly DFAlgorithm m_DFA;
|
||||
private readonly int m_Phys;
|
||||
private readonly int m_Fire;
|
||||
private readonly int m_Cold;
|
||||
private readonly int m_Pois;
|
||||
private readonly int m_Nrgy;
|
||||
private readonly int m_Chaos;
|
||||
private readonly Spell m_Spell;
|
||||
private readonly Mobile m_Target;
|
||||
private readonly Mobile m_From;
|
||||
|
||||
public SpellDamageTimerAOS(Spell s, TimeSpan delay, Mobile target, Mobile from, int damage, int phys, int fire, int cold,
|
||||
int pois, int nrgy, int chaos, DFAlgorithm dfa)
|
||||
|
|
@ -1138,7 +1134,7 @@ namespace Server.Spells
|
|||
{
|
||||
caster.SendLocalizedMessage(1061091); // You cannot cast that spell in this form.
|
||||
}
|
||||
else if (!caster.CanBeginAction<IncognitoSpell>() || caster.IsBodyMod && GetContext(caster) == null)
|
||||
else if (!caster.CanBeginAction<IncognitoSpell>() || (caster.IsBodyMod && GetContext(caster) == null))
|
||||
{
|
||||
spell.DoFizzle();
|
||||
}
|
||||
|
|
@ -1207,9 +1203,7 @@ namespace Server.Spells
|
|||
return false;
|
||||
}
|
||||
|
||||
#region Context Stuff
|
||||
|
||||
private static Dictionary<Mobile, TransformContext> m_Table = new Dictionary<Mobile, TransformContext>();
|
||||
private static readonly Dictionary<Mobile, TransformContext> m_Table = new Dictionary<Mobile, TransformContext>();
|
||||
|
||||
public static void AddContext(Mobile m, TransformContext context)
|
||||
{
|
||||
|
|
@ -1256,29 +1250,26 @@ namespace Server.Spells
|
|||
public static bool UnderTransformation(Mobile m) => GetContext(m) != null;
|
||||
|
||||
public static bool UnderTransformation(Mobile m, Type type) => GetContext(m)?.Type == type;
|
||||
|
||||
#endregion
|
||||
}
|
||||
|
||||
public interface ITransformationSpell
|
||||
{
|
||||
int Body{ get; }
|
||||
int Hue{ get; }
|
||||
int Body { get; }
|
||||
int Hue { get; }
|
||||
|
||||
int PhysResistOffset{ get; }
|
||||
int FireResistOffset{ get; }
|
||||
int ColdResistOffset{ get; }
|
||||
int PoisResistOffset{ get; }
|
||||
int NrgyResistOffset{ get; }
|
||||
int PhysResistOffset { get; }
|
||||
int FireResistOffset { get; }
|
||||
int ColdResistOffset { get; }
|
||||
int PoisResistOffset { get; }
|
||||
int NrgyResistOffset { get; }
|
||||
|
||||
double TickRate{ get; }
|
||||
double TickRate { get; }
|
||||
void OnTick(Mobile m);
|
||||
|
||||
void DoEffect(Mobile m);
|
||||
void RemoveEffect(Mobile m);
|
||||
}
|
||||
|
||||
|
||||
public class TransformContext
|
||||
{
|
||||
public TransformContext(Timer timer, List<ResistanceMod> mods, Type type, ITransformationSpell spell)
|
||||
|
|
@ -1289,19 +1280,19 @@ namespace Server.Spells
|
|||
Spell = spell;
|
||||
}
|
||||
|
||||
public Timer Timer{ get; }
|
||||
public Timer Timer { get; }
|
||||
|
||||
public List<ResistanceMod> Mods{ get; }
|
||||
public List<ResistanceMod> Mods { get; }
|
||||
|
||||
public Type Type{ get; }
|
||||
public Type Type { get; }
|
||||
|
||||
public ITransformationSpell Spell{ get; }
|
||||
public ITransformationSpell Spell { get; }
|
||||
}
|
||||
|
||||
public class TransformTimer : Timer
|
||||
{
|
||||
private Mobile m_Mobile;
|
||||
private ITransformationSpell m_Spell;
|
||||
private readonly Mobile m_Mobile;
|
||||
private readonly ITransformationSpell m_Spell;
|
||||
|
||||
public TransformTimer(Mobile from, ITransformationSpell spell)
|
||||
: base(TimeSpan.FromSeconds(spell.TickRate), TimeSpan.FromSeconds(spell.TickRate))
|
||||
|
|
|
|||
|
|
@ -51,20 +51,20 @@ namespace Server.Spells
|
|||
Amounts[i] = 1;
|
||||
}
|
||||
|
||||
public int Action{ get; set; }
|
||||
public int Action { get; set; }
|
||||
|
||||
public bool AllowTown{ get; set; }
|
||||
public bool AllowTown { get; set; }
|
||||
|
||||
public int[] Amounts{ get; set; }
|
||||
public int[] Amounts { get; set; }
|
||||
|
||||
public string Mantra{ get; set; }
|
||||
public string Mantra { get; set; }
|
||||
|
||||
public string Name{ get; set; }
|
||||
public string Name { get; set; }
|
||||
|
||||
public Type[] Reagents{ get; set; }
|
||||
public Type[] Reagents { get; set; }
|
||||
|
||||
public int LeftHandEffect{ get; set; }
|
||||
public int LeftHandEffect { get; set; }
|
||||
|
||||
public int RightHandEffect{ get; set; }
|
||||
public int RightHandEffect { get; set; }
|
||||
}
|
||||
}
|
||||
|
|
@ -1,19 +1,19 @@
|
|||
using Server.Utilities;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using Server.Utilities;
|
||||
|
||||
namespace Server.Spells
|
||||
{
|
||||
public class SpellRegistry
|
||||
{
|
||||
private static Type[] m_Types = new Type[700];
|
||||
private static readonly Type[] m_Types = new Type[700];
|
||||
private static int m_Count;
|
||||
|
||||
private static Dictionary<Type, int> m_IDsFromTypes = new Dictionary<Type, int>(m_Types.Length);
|
||||
private static readonly Dictionary<Type, int> m_IDsFromTypes = new Dictionary<Type, int>(m_Types.Length);
|
||||
|
||||
private static object[] m_Params = new object[2];
|
||||
private static readonly object[] m_Params = new object[2];
|
||||
|
||||
private static string[] m_CircleNames =
|
||||
private static readonly string[] m_CircleNames =
|
||||
{
|
||||
"First",
|
||||
"Second",
|
||||
|
|
@ -39,7 +39,7 @@ namespace Server.Spells
|
|||
}
|
||||
}
|
||||
|
||||
//What IS this used for anyways.
|
||||
// What IS this used for anyways.
|
||||
public static int Count
|
||||
{
|
||||
get
|
||||
|
|
@ -57,7 +57,7 @@ namespace Server.Spells
|
|||
}
|
||||
}
|
||||
|
||||
public static Dictionary<int, SpecialMove> SpecialMoves{ get; } = new Dictionary<int, SpecialMove>();
|
||||
public static Dictionary<int, SpecialMove> SpecialMoves { get; } = new Dictionary<int, SpecialMove>();
|
||||
|
||||
public static int GetRegistryNumber(ISpell s) => GetRegistryNumber(s.GetType());
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue