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

@ -1,4 +1,5 @@
using System;
using System.Linq;
using Server.Multis;
using Server.Network;
using Server.Targeting;
@ -28,23 +29,17 @@ namespace Server.SkillHandlers
BaseHouse house = BaseHouse.FindHouseAt(m);
if (house != null && house.IsFriend(m))
if (house?.IsFriend(m) == true)
{
bonus = 100.0;
}
else if (!Core.AOS)
{
if (house == null)
house = BaseHouse.FindHouseAt(new Point3D(m.X - 1, m.Y, 127), m.Map, 16);
if (house == null)
house = BaseHouse.FindHouseAt(new Point3D(m.X + 1, m.Y, 127), m.Map, 16);
if (house == null)
house = BaseHouse.FindHouseAt(new Point3D(m.X, m.Y - 1, 127), m.Map, 16);
if (house == null)
house = BaseHouse.FindHouseAt(new Point3D(m.X, m.Y + 1, 127), m.Map, 16);
house = BaseHouse.FindHouseAt(new Point3D(m.X - 1, m.Y, 127), m.Map, 16) ??
BaseHouse.FindHouseAt(new Point3D(m.X + 1, m.Y, 127), m.Map, 16) ??
BaseHouse.FindHouseAt(new Point3D(m.X, m.Y - 1, 127), m.Map, 16) ??
BaseHouse.FindHouseAt(new Point3D(m.X, m.Y + 1, 127), m.Map, 16);
if (house != null)
bonus = 50.0;
@ -61,13 +56,10 @@ namespace Server.SkillHandlers
if (ok)
{
if (!CombatOverride)
foreach (Mobile check in m.GetMobilesInRange(range))
if (check.InLOS(m) && check.Combatant == m)
{
badCombat = true;
ok = false;
break;
}
if (m.GetMobilesInRange(range).Any(check => check.InLOS(m) && check.Combatant == m))
{
badCombat = true;
}
ok = !badCombat && m.CheckSkill(SkillName.Hiding, 0.0 - bonus, 100.0 - bonus);
}
@ -97,4 +89,4 @@ namespace Server.SkillHandlers
return TimeSpan.FromSeconds(10.0);
}
}
}
}