Upgrades code style - First batch (#22)

This commit is contained in:
Kamron Batman 2018-08-14 06:16:50 +08:00 committed by GitHub
parent 8ee42c8ea2
commit 632e8b4757
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
1834 changed files with 10245 additions and 10437 deletions

View file

@ -204,7 +204,7 @@ namespace Server.Spells
}
}
public virtual bool ValidatesDuringHit{ get { return true; } }
public virtual bool ValidatesDuringHit => true;
public static SpecialMove GetCurrentMove( Mobile m )
{
@ -217,8 +217,7 @@ namespace Server.Spells
return null;
}
SpecialMove move = null;
m_Table.TryGetValue( m, out move );
m_Table.TryGetValue( m, out SpecialMove move );
if ( move != null && move.ValidatesDuringHit && !move.Validate( m ) )
{
@ -271,8 +270,7 @@ namespace Server.Spells
public static void ClearCurrentMove( Mobile m )
{
SpecialMove move = null;
m_Table.TryGetValue( m, out move );
m_Table.TryGetValue( m, out SpecialMove move );
if ( move != null )
{
@ -318,8 +316,7 @@ namespace Server.Spells
public static bool GetContext( Mobile m, Type type )
{
SpecialMoveContext context = null;
m_PlayersTable.TryGetValue( m, out context );
m_PlayersTable.TryGetValue( m, out SpecialMoveContext context );
if ( context == null )
return false;
@ -359,4 +356,4 @@ namespace Server.Spells
}
}
}
}
}

View file

@ -27,7 +27,7 @@ namespace Server.Spells
public string Mantra{ get{ return m_Info.Mantra; } }
public Type[] Reagents{ get{ return m_Info.Reagents; } }
public Item Scroll{ get{ return m_Scroll; } }
public long StartCastTime { get { return m_StartCastTime; } }
public long StartCastTime => m_StartCastTime;
private static TimeSpan NextSpellDelay = TimeSpan.FromSeconds( 0.75 );
private static TimeSpan AnimateDelay = TimeSpan.FromSeconds( 1.5 );
@ -41,9 +41,9 @@ namespace Server.Spells
public virtual bool DelayedDamage{ get{ return false; } }
public virtual bool DelayedDamageStacking { get { return true; } }
//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
public virtual bool DelayedDamageStacking => true;
//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.
@ -55,8 +55,7 @@ namespace Server.Spells
public void Add( Mobile m, Timer t )
{
Timer oldTimer;
if( m_Contexts.TryGetValue( m, out oldTimer ) )
if (m_Contexts.TryGetValue( m, out Timer oldTimer ))
{
oldTimer.Stop();
m_Contexts.Remove( m );
@ -76,9 +75,7 @@ namespace Server.Spells
if( DelayedDamageStacking )
return; //Sanity
DelayedDamageContextWrapper contexts;
if( !m_ContextTable.TryGetValue( GetType(), out contexts ) )
if (!m_ContextTable.TryGetValue( GetType(), out DelayedDamageContextWrapper contexts ))
{
contexts = new DelayedDamageContextWrapper();
m_ContextTable.Add( GetType(), contexts );
@ -89,9 +86,7 @@ namespace Server.Spells
public void RemoveDelayedDamageContext( Mobile m )
{
DelayedDamageContextWrapper contexts;
if( !m_ContextTable.TryGetValue( GetType(), out contexts ) )
if (!m_ContextTable.TryGetValue( GetType(), out DelayedDamageContextWrapper contexts ))
return;
contexts.Remove( m );
@ -140,7 +135,7 @@ namespace Server.Spells
damageBonus += intBonus;
int sdiBonus = AosAttributes.GetValue( m_Caster, AosAttribute.SpellDamage );
// PvP spell damage increase cap of 15% from an items magic property
// PvP spell damage increase cap of 15% from an item<EFBFBD>s magic property
if ( playerVsPlayer && sdiBonus > 15 )
sdiBonus = 15;
@ -667,8 +662,8 @@ namespace Server.Spells
public abstract TimeSpan CastDelayBase { get; }
public virtual double CastDelayFastScalar { get { return 1; } }
public virtual double CastDelaySecondsPerTick { get { return 0.25; } }
public virtual double CastDelayFastScalar => 1;
public virtual double CastDelaySecondsPerTick => 0.25;
public virtual TimeSpan CastDelayMinimum { get { return TimeSpan.FromSeconds( 0.25 ); } }
//public virtual int CastDelayBase{ get{ return 3; } }
@ -681,10 +676,10 @@ namespace Server.Spells
if ( m_Scroll is BaseWand )
return Core.ML ? CastDelayBase : TimeSpan.Zero; // TODO: Should FC apply to wands?
// Faster casting cap of 2 (if not using the protection spell)
// Faster casting cap of 0 (if using the protection spell)
// Paladin spells are subject to a faster casting cap of 4
// Paladins with magery of 70.0 or above are subject to a faster casting cap of 2
// Faster casting cap of 2 (if not using the protection spell)
// Faster casting cap of 0 (if using the protection spell)
// Paladin spells are subject to a faster casting cap of 4
// Paladins with magery of 70.0 or above are subject to a faster casting cap of 2
int fcMax = 4;
if ( CastSkill == SkillName.Magery || CastSkill == SkillName.Necromancy || ( CastSkill == SkillName.Chivalry && m_Caster.Skills[SkillName.Magery].Value >= 70.0 ) )
@ -931,4 +926,4 @@ namespace Server.Spells
}
}
}
}
}

View file

@ -75,12 +75,12 @@ namespace Server.Spells
{
return CheckMulti( p, map, true, 0);
}
public static bool CheckMulti(Point3D p, Map map, bool houses)
{
return CheckMulti(p, map, houses, 0);
}
public static bool CheckMulti( Point3D p, Map map, bool houses, int housingrange )
{
if( map == null || map == Map.Internal )
@ -182,11 +182,11 @@ namespace Server.Spells
if ( m is BaseCreature )
{
BaseCreature c = (BaseCreature)m;
if ( !c.Controlled )
return true;
}
return false;
}
@ -1246,9 +1246,7 @@ namespace Server.Spells
public static TransformContext GetContext( Mobile m )
{
TransformContext context = null;
m_Table.TryGetValue( m, out context );
m_Table.TryGetValue( m, out TransformContext context );
return context;
}
@ -1407,10 +1405,10 @@ namespace Server.Spells
private Type m_Type;
private ITransformationSpell m_Spell;
public Timer Timer { get { return m_Timer; } }
public List<ResistanceMod> Mods { get { return m_Mods; } }
public Type Type { get { return m_Type; } }
public ITransformationSpell Spell { get { return m_Spell; } }
public Timer Timer => m_Timer;
public List<ResistanceMod> Mods => m_Mods;
public Type Type => m_Type;
public ITransformationSpell Spell => m_Spell;
public TransformContext( Timer timer, List<ResistanceMod> mods, Type type, ITransformationSpell spell )
{

View file

@ -22,7 +22,7 @@ namespace Server.Spells
return m_Types;
}
}
//What IS this used for anyways.
public static int Count
{
@ -42,9 +42,9 @@ namespace Server.Spells
}
private static Dictionary<Type, Int32> m_IDsFromTypes = new Dictionary<Type, Int32>( m_Types.Length );
private static Dictionary<Int32, SpecialMove> m_SpecialMoves = new Dictionary<Int32, SpecialMove>();
public static Dictionary<Int32, SpecialMove> SpecialMoves { get { return m_SpecialMoves; } }
public static Dictionary<Int32, SpecialMove> SpecialMoves => m_SpecialMoves;
public static int GetRegistryNumber( ISpell s )
{
@ -174,4 +174,4 @@ namespace Server.Spells
return null;
}
}
}
}