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

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

View file

@ -54,7 +54,7 @@ namespace Server
public static int Damage(Mobile m, Mobile from, int damage, bool ignoreArmor, int phys, int fire, int cold, int pois,
int nrgy, int chaos = 0, int direct = 0, bool keepAlive = false, bool archer = false, bool deathStrike = false)
{
if (m == null || m.Deleted || !m.Alive || damage <= 0)
if (m?.Deleted != false || !m.Alive || damage <= 0)
return 0;
if (phys == 0 && fire == 100 && cold == 0 && pois == 0 && nrgy == 0)
@ -149,7 +149,7 @@ namespace Server
#region Dragon Barding
if ((from == null || !from.Player) && m.Player && m.Mount is SwampDragon pet)
if ((from?.Player != true) && m.Player && m.Mount is SwampDragon pet)
if (pet.HasBarding)
{
int percent = pet.BardingExceptional ? 20 : 10;
@ -172,14 +172,14 @@ namespace Server
if (keepAlive && totalDamage > m.Hits)
totalDamage = m.Hits;
if (from != null && !from.Deleted && from.Alive)
if (from?.Deleted == false && from.Alive)
{
int reflectPhys = AosAttributes.GetValue(m, AosAttribute.ReflectPhysical);
if (reflectPhys != 0)
{
if (from is ExodusMinion minion && minion.FieldActive ||
from is ExodusOverseer overseer && overseer.FieldActive)
if ((from as ExodusMinion)?.FieldActive == true ||
(from as ExodusOverseer)?.FieldActive == true)
{
from.FixedParticles(0x376A, 20, 10, 0x2530, EffectLayer.Waist);
from.PlaySound(0x2F4);
@ -1019,13 +1019,10 @@ namespace Server
public void GetProperties(ObjectPropertyList list)
{
SkillName skill;
for (int i = 0; i < 5; ++i)
{
if (!GetValues(i, out skill, out double bonus))
continue;
list.Add(1060451 + i, "#{0}\t{1}", GetLabel(skill), bonus);
if (GetValues(i, out SkillName skill, out double bonus))
list.Add(1060451 + i, "#{0}\t{1}", GetLabel(skill), bonus);
}
}
@ -1495,4 +1492,4 @@ namespace Server
return index;
}
}
}
}