chore: Cleans up pattern checks. (#892)

This commit is contained in:
Kamron Batman 2021-12-24 15:53:59 -08:00 • committed by GitHub
parent 171df32257
commit 63e1b02d93
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
283 changed files with 587 additions and 702 deletions

View file

@ -623,7 +623,7 @@ namespace Server.Spells
public static void SendInvalidMessage(Mobile caster, TravelCheckType type)
{
if (type == TravelCheckType.RecallTo || type == TravelCheckType.GateTo)
if (type is TravelCheckType.RecallTo or TravelCheckType.GateTo)
{
caster.SendLocalizedMessage(1019004); // You are not allowed to travel there.
}
@ -754,7 +754,7 @@ namespace Server.Spells
public static bool IsSafeZone(Map map, Point3D loc) =>
Region.Find(loc, map).IsPartOf<SafeZone>() &&
(m_TravelType == TravelCheckType.TeleportTo || m_TravelType == TravelCheckType.TeleportFrom)
m_TravelType is TravelCheckType.TeleportTo or TravelCheckType.TeleportFrom
&& (m_TravelCaster as PlayerMobile)?.DuelPlayer?.Eliminated == false;
public static bool IsFactionStronghold(Map map, Point3D loc) => Region.Find(loc, map).IsPartOf<StrongholdRegion>();

View file

@ -20,14 +20,14 @@ namespace Server.Spells.Ninjitsu
Item handOne = from.FindItemOnLayer(Layer.OneHanded) as BaseWeapon;
if (handOne != null && !(handOne is BaseRanged))
if (handOne != null && handOne is not BaseRanged)
{
return base.Validate(from);
}
Item handTwo = from.FindItemOnLayer(Layer.TwoHanded) as BaseWeapon;
if (handTwo != null && !(handTwo is BaseRanged))
if (handTwo != null && handTwo is not BaseRanged)
{
return base.Validate(from);
}

View file

@ -129,7 +129,7 @@ namespace Server.Spells.Seventh
foreach (var item in eable)
{
if (item is Moongate || item is PublicMoongate)
if (item is Moongate or PublicMoongate)
{
return true;
}

View file

@ -118,9 +118,7 @@ namespace Server.Spells.Spellweaving
}
public static bool IsValidTile(int itemID) =>
itemID == 0xFEA || itemID == 0x1216 || itemID == 0x307F || itemID == 0x1D10 || itemID == 0x1D0F ||
itemID == 0x1D1F ||
itemID == 0x1D12;
itemID is 0xFEA or 0x1216 or 0x307F or 0x1D10 or 0x1D0F or 0x1D1F or 0x1D12;
private List<Mobile> GetArcanists()
{

View file

@ -34,7 +34,7 @@ namespace Server.Spells.Spellweaving
from.Holding as ArcaneFocus ?? from.Backpack?.FindItemByType<ArcaneFocus>();
public static bool CheckExpansion(Mobile from) =>
!(from is PlayerMobile) || from.NetState?.SupportsExpansion(Expansion.ML) == true;
@from is not PlayerMobile || from.NetState?.SupportsExpansion(Expansion.ML) == true;
public override bool CheckCast()
{

View file

@ -26,7 +26,7 @@ namespace Server.Spells.Spellweaving
public override bool CheckCast()
{
if (!(Caster.Weapon is BaseWeapon weapon) || weapon is Fists || weapon is BaseRanged)
if (Caster.Weapon is not BaseWeapon weapon || weapon is Fists or BaseRanged)
{
Caster.SendLocalizedMessage(1060179); // You must be wielding a weapon to use this ability!
return false;
@ -37,7 +37,7 @@ namespace Server.Spells.Spellweaving
public override void OnCast()
{
if (!(Caster.Weapon is BaseWeapon weapon) || weapon is Fists || weapon is BaseRanged)
if (Caster.Weapon is not BaseWeapon weapon || weapon is Fists or BaseRanged)
{
Caster.SendLocalizedMessage(1060179); // You must be wielding a weapon to use this ability!
}