From de840f40d402344a060907ef10ddcc14dea63eff Mon Sep 17 00:00:00 2001 From: Kurt Date: Tue, 29 Dec 2020 00:58:08 -0800 Subject: [PATCH] Invert some "!is" to "is not" --- .../Legality/Encounters/EncounterStatic/EncounterStatic.cs | 2 +- .../Legality/Encounters/EncounterStatic/EncounterStatic2.cs | 4 ++-- .../Encounters/EncounterStatic/EncounterStatic8Nest.cs | 4 ++-- .../Legality/Encounters/EncounterTrade/EncounterTrade1.cs | 4 ++-- PKHeX.Core/Legality/Encounters/Generator/EncounterFinder.cs | 2 +- .../Legality/Encounters/Generator/EncounterGenerator12.cs | 2 +- .../Legality/Encounters/Verifiers/VerifyCurrentMoves.cs | 4 ++-- .../Legality/Encounters/Verifiers/VerifyRelearnMoves.cs | 4 ++-- PKHeX.Core/Legality/Evolutions/EvolutionChain.cs | 2 +- PKHeX.Core/Legality/Restrictions/GBRestrictions.cs | 2 +- PKHeX.Core/Legality/Verifiers/AbilityVerifier.cs | 2 +- PKHeX.Core/Legality/Verifiers/FormVerifier.cs | 6 +++--- PKHeX.Core/Legality/Verifiers/HistoryVerifier.cs | 2 +- PKHeX.Core/Legality/Verifiers/LevelVerifier.cs | 2 +- PKHeX.Core/Legality/Verifiers/MemoryVerifier.cs | 2 +- PKHeX.Core/Legality/Verifiers/MiscVerifier.cs | 2 +- PKHeX.Core/Legality/Verifiers/Ribbons/RibbonVerifier.cs | 2 +- PKHeX.Core/Legality/Verifiers/TrainerNameVerifier.cs | 2 +- PKHeX.Core/MysteryGifts/WC8.cs | 2 +- PKHeX.Core/PKM/PKM.cs | 2 +- PKHeX.WinForms/Controls/PKM Editor/ContestStat.cs | 2 +- PKHeX.WinForms/MainWindow/Main.cs | 2 +- PKHeX.WinForms/Subforms/PKM Editors/MemoryAmie.cs | 2 +- PKHeX.WinForms/Subforms/PKM Editors/SuperTrainingEditor.cs | 2 +- PKHeX.WinForms/Subforms/SAV_Database.cs | 4 ++-- PKHeX.WinForms/Subforms/SAV_MysteryGiftDB.cs | 2 +- 26 files changed, 34 insertions(+), 34 deletions(-) diff --git a/PKHeX.Core/Legality/Encounters/EncounterStatic/EncounterStatic.cs b/PKHeX.Core/Legality/Encounters/EncounterStatic/EncounterStatic.cs index 99580ce4a..32078ce3b 100644 --- a/PKHeX.Core/Legality/Encounters/EncounterStatic/EncounterStatic.cs +++ b/PKHeX.Core/Legality/Encounters/EncounterStatic/EncounterStatic.cs @@ -184,7 +184,7 @@ namespace PKHeX.Core { switch (Generation) { - case 3 when this is EncounterStatic3 {Roaming: true} && Version != GameVersion.E: // Roamer IV glitch was fixed in Emerald + case 3 when this is EncounterStatic3 {Roaming: true, Version: not GameVersion.E}: // Roamer IV glitch was fixed in Emerald return PIDType.Method_1_Roamer; case 4 when Shiny == Shiny.Always: // Lake of Rage Gyarados return PIDType.ChainShiny; diff --git a/PKHeX.Core/Legality/Encounters/EncounterStatic/EncounterStatic2.cs b/PKHeX.Core/Legality/Encounters/EncounterStatic/EncounterStatic2.cs index 335c5c0c3..57885d01a 100644 --- a/PKHeX.Core/Legality/Encounters/EncounterStatic/EncounterStatic2.cs +++ b/PKHeX.Core/Legality/Encounters/EncounterStatic/EncounterStatic2.cs @@ -63,7 +63,7 @@ namespace PKHeX.Core protected override bool IsMatchLevel(PKM pkm, DexLevel evo) { - if (pkm is ICaughtData2 pk2 && pk2.CaughtData != 0) + if (pkm is ICaughtData2 {CaughtData: not 0}) return pkm.Met_Level == (EggEncounter ? 1 : Level); return Level <= evo.Level; @@ -75,7 +75,7 @@ namespace PKHeX.Core return true; if (Location == 0) return true; - if (pkm is ICaughtData2 pk2 && pk2.CaughtData != 0) + if (pkm is ICaughtData2 {CaughtData: not 0}) return Location == pkm.Met_Location; return true; } diff --git a/PKHeX.Core/Legality/Encounters/EncounterStatic/EncounterStatic8Nest.cs b/PKHeX.Core/Legality/Encounters/EncounterStatic/EncounterStatic8Nest.cs index 0a94f241f..f8faf042c 100644 --- a/PKHeX.Core/Legality/Encounters/EncounterStatic/EncounterStatic8Nest.cs +++ b/PKHeX.Core/Legality/Encounters/EncounterStatic/EncounterStatic8Nest.cs @@ -41,9 +41,9 @@ namespace PKHeX.Core return true; if (pkm is IGigantamax g && g.CanGigantamax != CanGigantamax && !g.CanToggleGigantamax(pkm.Species, pkm.Form, Species, Form)) return true; - if (Species == (int)Core.Species.Alcremie && pkm is IFormArgument a && a.FormArgument != 0) + if (Species == (int)Core.Species.Alcremie && pkm is IFormArgument {FormArgument: not 0}) return true; - if (Species == (int)Core.Species.Runerigus && pkm is IFormArgument r && r.FormArgument != 0) + if (Species == (int)Core.Species.Runerigus && pkm is IFormArgument {FormArgument: not 0}) return true; if (Ability != -1) // Any diff --git a/PKHeX.Core/Legality/Encounters/EncounterTrade/EncounterTrade1.cs b/PKHeX.Core/Legality/Encounters/EncounterTrade/EncounterTrade1.cs index d573d0c22..3005b7dfe 100644 --- a/PKHeX.Core/Legality/Encounters/EncounterTrade/EncounterTrade1.cs +++ b/PKHeX.Core/Legality/Encounters/EncounterTrade/EncounterTrade1.cs @@ -95,7 +95,7 @@ namespace PKHeX.Core private bool IsMatchLevel(PKM pkm, int lvl) { - if (!(pkm is PK1)) + if (pkm is not PK1) return lvl >= LevelMinGSC; return lvl >= LevelMin; } @@ -115,7 +115,7 @@ namespace PKHeX.Core return false; } - if (pkm is not PK1 pk1 || !pkm.Gen1_NotTradeback) + if (pkm is not PK1 {Gen1_NotTradeback: true} pk1) return true; var req = GetInitialCatchRate(); diff --git a/PKHeX.Core/Legality/Encounters/Generator/EncounterFinder.cs b/PKHeX.Core/Legality/Encounters/Generator/EncounterFinder.cs index ab405c554..8115d253d 100644 --- a/PKHeX.Core/Legality/Encounters/Generator/EncounterFinder.cs +++ b/PKHeX.Core/Legality/Encounters/Generator/EncounterFinder.cs @@ -45,7 +45,7 @@ namespace PKHeX.Core break; // passes } - if (!info.FrameMatches && info.EncounterMatch is EncounterSlot && pkm.Version != (int)GameVersion.CXD) // if false, all valid RNG frame matches have already been consumed + if (!info.FrameMatches && info.EncounterMatch is EncounterSlot {Version: not GameVersion.CXD}) // if false, all valid RNG frame matches have already been consumed info.Parse.Add(new CheckResult(ParseSettings.RNGFrameNotFound, LEncConditionBadRNGFrame, CheckIdentifier.PID)); // todo for further confirmation if (!info.PIDIVMatches) // if false, all valid PIDIV matches have already been consumed info.Parse.Add(new CheckResult(Severity.Invalid, LPIDTypeMismatch, CheckIdentifier.PID)); diff --git a/PKHeX.Core/Legality/Encounters/Generator/EncounterGenerator12.cs b/PKHeX.Core/Legality/Encounters/Generator/EncounterGenerator12.cs index 0e464c5a8..22e00e6be 100644 --- a/PKHeX.Core/Legality/Encounters/Generator/EncounterGenerator12.cs +++ b/PKHeX.Core/Legality/Encounters/Generator/EncounterGenerator12.cs @@ -76,7 +76,7 @@ namespace PKHeX.Core private static IEnumerable GenerateFilteredEncounters12(PKM pkm) { // If the current data indicates that it must have originated from Crystal, only yield encounter data from Crystal. - bool crystal = (pkm is ICaughtData2 pk2 && pk2.CaughtData != 0) || (pkm.Format >= 7 && pkm.OT_Gender == 1); + bool crystal = (pkm is ICaughtData2 {CaughtData: not 0}) || (pkm.Format >= 7 && pkm.OT_Gender == 1); if (crystal) return GenerateRawEncounters12(pkm, GameVersion.C); diff --git a/PKHeX.Core/Legality/Encounters/Verifiers/VerifyCurrentMoves.cs b/PKHeX.Core/Legality/Encounters/Verifiers/VerifyCurrentMoves.cs index bfe12da60..5691edb64 100644 --- a/PKHeX.Core/Legality/Encounters/Verifiers/VerifyCurrentMoves.cs +++ b/PKHeX.Core/Legality/Encounters/Verifiers/VerifyCurrentMoves.cs @@ -247,7 +247,7 @@ namespace PKHeX.Core // Special considerations! int reset = 0; - if (pkm is IBattleVersion v && v.BattleVersion != 0) + if (pkm is IBattleVersion {BattleVersion: not 0} v) { reset = ((GameVersion) v.BattleVersion).GetGeneration(); source.ResetSources(); @@ -515,7 +515,7 @@ namespace PKHeX.Core res[m] = new CheckMoveResult(res[m], Invalid, LMoveEventEggLevelUp, Move); } } - else if (!(enc is EncounterEgg)) + else if (enc is not EncounterEgg) { // Event eggs cannot inherit moves from parents; they are not bred. foreach (int m in RegularEggMovesLearned) diff --git a/PKHeX.Core/Legality/Encounters/Verifiers/VerifyRelearnMoves.cs b/PKHeX.Core/Legality/Encounters/Verifiers/VerifyRelearnMoves.cs index b1b41ab7d..9bfbddede 100644 --- a/PKHeX.Core/Legality/Encounters/Verifiers/VerifyRelearnMoves.cs +++ b/PKHeX.Core/Legality/Encounters/Verifiers/VerifyRelearnMoves.cs @@ -13,7 +13,7 @@ namespace PKHeX.Core { public static CheckResult[] VerifyRelearn(PKM pkm, IEncounterable enc) { - if (enc.Generation < 6 || (pkm is IBattleVersion v && v.BattleVersion != 0)) + if (enc.Generation < 6 || (pkm is IBattleVersion {BattleVersion: not 0})) return VerifyRelearnNone(pkm); return enc switch @@ -27,7 +27,7 @@ namespace PKHeX.Core public static IReadOnlyList GetSuggestedRelearn(PKM pkm, IEncounterable enc, CheckResult[] relearn) { - if (enc.Generation < 6 || (pkm is IBattleVersion v && v.BattleVersion != 0)) + if (enc.Generation < 6 || (pkm is IBattleVersion {BattleVersion: not 0})) return Array.Empty(); return enc switch diff --git a/PKHeX.Core/Legality/Evolutions/EvolutionChain.cs b/PKHeX.Core/Legality/Evolutions/EvolutionChain.cs index 2fd62b236..cebe97180 100644 --- a/PKHeX.Core/Legality/Evolutions/EvolutionChain.cs +++ b/PKHeX.Core/Legality/Evolutions/EvolutionChain.cs @@ -36,7 +36,7 @@ namespace PKHeX.Core private static List[] GetChainAll(PKM pkm, IEncounterable enc, IReadOnlyList CompleteEvoChain) { - int maxgen = pkm is PK1 && !pkm.Gen1_NotTradeback ? 2 : pkm.Format; + int maxgen = pkm is PK1 {Gen1_NotTradeback: false} ? 2 : pkm.Format; var GensEvoChains = GetChainBase(maxgen); var queue = new Queue(CompleteEvoChain); diff --git a/PKHeX.Core/Legality/Restrictions/GBRestrictions.cs b/PKHeX.Core/Legality/Restrictions/GBRestrictions.cs index 8a4001501..d4def5bcf 100644 --- a/PKHeX.Core/Legality/Restrictions/GBRestrictions.cs +++ b/PKHeX.Core/Legality/Restrictions/GBRestrictions.cs @@ -374,7 +374,7 @@ namespace PKHeX // If you put a Pokemon in the N64 box, the met info is retained, even if you switch over to a Gen I game to teach it TMs // You can use rare candies from within the lab, so level-up moves from RBY context can be learned this way as well // Stadium 2 is GB Cart Era only (not 3DS Virtual Console). - if (pkm is ICaughtData2 pk2 && pk2.CaughtData != 0 && !ParseSettings.AllowGBCartEra) + if (pkm is ICaughtData2 {CaughtData: not 0} && !ParseSettings.AllowGBCartEra) return false; // Sanity check species, if it could have existed as a pre-evolution. diff --git a/PKHeX.Core/Legality/Verifiers/AbilityVerifier.cs b/PKHeX.Core/Legality/Verifiers/AbilityVerifier.cs index 6b1ac4867..0b229364a 100644 --- a/PKHeX.Core/Legality/Verifiers/AbilityVerifier.cs +++ b/PKHeX.Core/Legality/Verifiers/AbilityVerifier.cs @@ -358,7 +358,7 @@ namespace PKHeX.Core { // Must not have the Ability bit flag set. // Some shadow stuff with single-ability might have the flag set anyways? - if (abit && !(pkm is IShadowPKM s && s.ShadowID != 0)) + if (abit && !(pkm is IShadowPKM {ShadowID: not 0})) return GetInvalid(LAbilityMismatchFlag, CheckIdentifier.PID); } else diff --git a/PKHeX.Core/Legality/Verifiers/FormVerifier.cs b/PKHeX.Core/Legality/Verifiers/FormVerifier.cs index 714d6099e..c3c7c118d 100644 --- a/PKHeX.Core/Legality/Verifiers/FormVerifier.cs +++ b/PKHeX.Core/Legality/Verifiers/FormVerifier.cs @@ -109,7 +109,7 @@ namespace PKHeX.Core case (int)Species.Greninja: if (form > 1) // Ash Battle Bond active return GetInvalid(LFormBattle); - if (form != 0 && !(EncounterMatch is MysteryGift)) // Formes are not breedable, MysteryGift already checked + if (form != 0 && EncounterMatch is not MysteryGift) // Formes are not breedable, MysteryGift already checked return GetInvalid(string.Format(LFormInvalidRange, 0, form)); break; @@ -124,7 +124,7 @@ namespace PKHeX.Core case (int)Species.Vivillon: if (form > 17) // Fancy & Pokéball { - if (!(EncounterMatch is MysteryGift)) + if (EncounterMatch is not MysteryGift) return GetInvalid(LFormVivillonInvalid); return GetValid(LFormVivillon); } @@ -135,7 +135,7 @@ namespace PKHeX.Core break; case (int)Species.Floette when form == 5: // Floette Eternal Flower -- Never Released - if (!(EncounterMatch is MysteryGift)) + if (EncounterMatch is not MysteryGift) return GetInvalid(LFormEternalInvalid); return GetValid(LFormEternal); case (int)Species.Meowstic when form != pkm.Gender: diff --git a/PKHeX.Core/Legality/Verifiers/HistoryVerifier.cs b/PKHeX.Core/Legality/Verifiers/HistoryVerifier.cs index 255afe169..fa002ff22 100644 --- a/PKHeX.Core/Legality/Verifiers/HistoryVerifier.cs +++ b/PKHeX.Core/Legality/Verifiers/HistoryVerifier.cs @@ -40,7 +40,7 @@ namespace PKHeX.Core data.AddLine(GetInvalid(LegalityCheckStrings.LMemoryHTFlagInvalid)); else if (pkm.HT_Friendship != 0) data.AddLine(GetInvalid(LegalityCheckStrings.LMemoryStatFriendshipHT0)); - else if (pkm is IAffection a && a.HT_Affection != 0) + else if (pkm is IAffection {HT_Affection: not 0}) data.AddLine(GetInvalid(LegalityCheckStrings.LMemoryStatAffectionHT0)); // Don't check trade evolutions if Untraded. The Evolution Chain already checks for trade evolutions. diff --git a/PKHeX.Core/Legality/Verifiers/LevelVerifier.cs b/PKHeX.Core/Legality/Verifiers/LevelVerifier.cs index e69c696c7..3ad9ab2a4 100644 --- a/PKHeX.Core/Legality/Verifiers/LevelVerifier.cs +++ b/PKHeX.Core/Legality/Verifiers/LevelVerifier.cs @@ -83,7 +83,7 @@ namespace PKHeX.Core // There is no way to prevent a gen1 trade evolution as held items (everstone) did not exist. // Machoke, Graveler, Haunter and Kadabra captured in the second phase evolution, excluding in-game trades, are already checked - if (pkm.Format <= 2 && !(EncounterMatch is EncounterTrade) && EncounterMatch.Species == pkm.Species && GBRestrictions.Trade_Evolution1.Contains(EncounterMatch.Species)) + if (pkm.Format <= 2 && EncounterMatch is not EncounterTrade && EncounterMatch.Species == pkm.Species && GBRestrictions.Trade_Evolution1.Contains(EncounterMatch.Species)) VerifyG1TradeEvo(data); } diff --git a/PKHeX.Core/Legality/Verifiers/MemoryVerifier.cs b/PKHeX.Core/Legality/Verifiers/MemoryVerifier.cs index f662bbcde..6d526fd3d 100644 --- a/PKHeX.Core/Legality/Verifiers/MemoryVerifier.cs +++ b/PKHeX.Core/Legality/Verifiers/MemoryVerifier.cs @@ -160,7 +160,7 @@ namespace PKHeX.Core VerifyOTMemoryIs(data, g.OT_Memory, g.OT_Intensity, g.OT_TextVar, g.OT_Feeling); return; - case IMemoryOT t when !(t is MysteryGift): // Ignore Mystery Gift cases (covered above) + case IMemoryOT t when t is not MysteryGift: // Ignore Mystery Gift cases (covered above) VerifyOTMemoryIs(data, t.OT_Memory, t.OT_Intensity, t.OT_TextVar, t.OT_Feeling); return; } diff --git a/PKHeX.Core/Legality/Verifiers/MiscVerifier.cs b/PKHeX.Core/Legality/Verifiers/MiscVerifier.cs index c59bddcb1..639dd9b4a 100644 --- a/PKHeX.Core/Legality/Verifiers/MiscVerifier.cs +++ b/PKHeX.Core/Legality/Verifiers/MiscVerifier.cs @@ -39,7 +39,7 @@ namespace PKHeX.Core break; } - if (pkm is IHomeTrack home && home.Tracker != 0) + if (pkm is IHomeTrack {Tracker: not 0}) data.AddLine(GetInvalid(LTransferTrackerShouldBeZero)); } else diff --git a/PKHeX.Core/Legality/Verifiers/Ribbons/RibbonVerifier.cs b/PKHeX.Core/Legality/Verifiers/Ribbons/RibbonVerifier.cs index 85b28bc97..e2878a9c1 100644 --- a/PKHeX.Core/Legality/Verifiers/Ribbons/RibbonVerifier.cs +++ b/PKHeX.Core/Legality/Verifiers/Ribbons/RibbonVerifier.cs @@ -504,7 +504,7 @@ namespace PKHeX.Core if (enc.LevelMin <= 50) return true; - return !(enc is EncounterStaticShadow or WC3); + return enc is not EncounterStaticShadow or WC3; } private static bool CanHaveRibbonVictory(PKM pkm, int gen) diff --git a/PKHeX.Core/Legality/Verifiers/TrainerNameVerifier.cs b/PKHeX.Core/Legality/Verifiers/TrainerNameVerifier.cs index 705511e0f..3336ba6fe 100644 --- a/PKHeX.Core/Legality/Verifiers/TrainerNameVerifier.cs +++ b/PKHeX.Core/Legality/Verifiers/TrainerNameVerifier.cs @@ -128,7 +128,7 @@ namespace PKHeX.Core { if (StringConverter12.GetIsG1English(str)) { - if (str.Length > 7 && !(data.EncounterOriginal is EncounterTradeGB)) // OT already verified; GER shuckle has 8 chars + if (str.Length > 7 && data.EncounterOriginal is not EncounterTradeGB) // OT already verified; GER shuckle has 8 chars data.AddLine(GetInvalid(LOTLong)); } else if (StringConverter12.GetIsG1Japanese(str)) diff --git a/PKHeX.Core/MysteryGifts/WC8.cs b/PKHeX.Core/MysteryGifts/WC8.cs index d2f48067e..acaaa5d4e 100644 --- a/PKHeX.Core/MysteryGifts/WC8.cs +++ b/PKHeX.Core/MysteryGifts/WC8.cs @@ -590,7 +590,7 @@ namespace PKHeX.Core if (pkm is IGigantamax g && g.CanGigantamax != CanGigantamax && !g.CanToggleGigantamax(pkm.Species, pkm.Form, Species, Form)) return false; - if (!(pkm is IDynamaxLevel dl && dl.DynamaxLevel >= DynamaxLevel)) + if (pkm is not IDynamaxLevel dl || dl.DynamaxLevel < DynamaxLevel) return false; if (IsHOMEGift && pkm is IScaledSize s) diff --git a/PKHeX.Core/PKM/PKM.cs b/PKHeX.Core/PKM/PKM.cs index 4b8746e86..0caebbbf9 100644 --- a/PKHeX.Core/PKM/PKM.cs +++ b/PKHeX.Core/PKM/PKM.cs @@ -1053,7 +1053,7 @@ namespace PKHeX.Core { BatchEditing.TryGetHasProperty(this, property, out var src); var prop = src.GetValue(this); - if (prop != null && !(prop is byte[]) && BatchEditing.TryGetHasProperty(Destination, property, out var pi)) + if (prop is not byte[] && BatchEditing.TryGetHasProperty(Destination, property, out var pi)) ReflectUtil.SetValue(pi, Destination, prop); } } diff --git a/PKHeX.WinForms/Controls/PKM Editor/ContestStat.cs b/PKHeX.WinForms/Controls/PKM Editor/ContestStat.cs index 61e3ca5d6..de59715b1 100644 --- a/PKHeX.WinForms/Controls/PKM Editor/ContestStat.cs +++ b/PKHeX.WinForms/Controls/PKM Editor/ContestStat.cs @@ -56,7 +56,7 @@ namespace PKHeX.WinForms.Controls public void ToggleInterface(object o, int gen = PKX.Generation) { - if (!(o is IContestStats)) + if (o is not IContestStats) { Visible = false; return; diff --git a/PKHeX.WinForms/MainWindow/Main.cs b/PKHeX.WinForms/MainWindow/Main.cs index 4327f947f..a893e9060 100644 --- a/PKHeX.WinForms/MainWindow/Main.cs +++ b/PKHeX.WinForms/MainWindow/Main.cs @@ -927,7 +927,7 @@ namespace PKHeX.WinForms LocalizeUtil.InitializeStrings(CurrentLanguage, C_SAV.SAV, HaX); WinFormsUtil.TranslateInterface(this, CurrentLanguage); // Translate the UI to language. - if (!(C_SAV.SAV is FakeSaveFile)) + if (C_SAV.SAV is not FakeSaveFile) { var pk = PKME_Tabs.CurrentPKM.Clone(); var sav = C_SAV.SAV; diff --git a/PKHeX.WinForms/Subforms/PKM Editors/MemoryAmie.cs b/PKHeX.WinForms/Subforms/PKM Editors/MemoryAmie.cs index 350285b42..3457363b4 100644 --- a/PKHeX.WinForms/Subforms/PKM Editors/MemoryAmie.cs +++ b/PKHeX.WinForms/Subforms/PKM Editors/MemoryAmie.cs @@ -30,7 +30,7 @@ namespace PKHeX.WinForms GetLangStrings(); LoadFields(); - if (!(pkm is IGeoTrack)) + if (pkm is not IGeoTrack) tabControl1.TabPages.Remove(Tab_Residence); } diff --git a/PKHeX.WinForms/Subforms/PKM Editors/SuperTrainingEditor.cs b/PKHeX.WinForms/Subforms/PKM Editors/SuperTrainingEditor.cs index ed98956a5..11502ef99 100644 --- a/PKHeX.WinForms/Subforms/PKM Editors/SuperTrainingEditor.cs +++ b/PKHeX.WinForms/Subforms/PKM Editors/SuperTrainingEditor.cs @@ -173,7 +173,7 @@ namespace PKHeX.WinForms private void CHK_Secret_CheckedChanged(object sender, EventArgs e) { - if (!(pkm is PK6)) + if (pkm is not PK6) return; CHK_SecretComplete.Checked &= CHK_SecretUnlocked.Checked; CHK_SecretComplete.Enabled = CHK_SecretUnlocked.Checked; diff --git a/PKHeX.WinForms/Subforms/SAV_Database.cs b/PKHeX.WinForms/Subforms/SAV_Database.cs index 4d7fd0c2e..bf9c97bd3 100644 --- a/PKHeX.WinForms/Subforms/SAV_Database.cs +++ b/PKHeX.WinForms/Subforms/SAV_Database.cs @@ -356,7 +356,7 @@ namespace PKHeX.WinForms var db = bakpkm.Concat(savpkm).Where(pk => pk.ChecksumValid && pk.Sanity == 0); // when PK7->PK8 conversion is possible (and sprites in new size are available, remove this filter) - db = SAV is SAV8SWSH ? db.Where(z => z is PK8 || ((PersonalInfoSWSH)PersonalTable.SWSH.GetFormEntry(z.Species, z.Form)).IsPresentInGame) : db.Where(z => !(z is PK8)); + db = SAV is SAV8SWSH ? db.Where(z => z is PK8 || ((PersonalInfoSWSH)PersonalTable.SWSH.GetFormEntry(z.Species, z.Form)).IsPresentInGame) : db.Where(z => z is not PK8); // Finalize the Database return new List(db); @@ -371,7 +371,7 @@ namespace PKHeX.WinForms var data = File.ReadAllBytes(file); var prefer = PKX.GetPKMFormatFromExtension(fi.Extension, dest.Generation); var pk = PKMConverter.GetPKMfromBytes(data, prefer); - if (!(pk?.Species > 0)) + if (pk?.Species is not > 0) return; pk.Identifier = file; dbTemp.Add(pk); diff --git a/PKHeX.WinForms/Subforms/SAV_MysteryGiftDB.cs b/PKHeX.WinForms/Subforms/SAV_MysteryGiftDB.cs index a0b321aa7..479f7437e 100644 --- a/PKHeX.WinForms/Subforms/SAV_MysteryGiftDB.cs +++ b/PKHeX.WinForms/Subforms/SAV_MysteryGiftDB.cs @@ -200,7 +200,7 @@ namespace PKHeX.WinForms var db = EncounterEvent.GetAllEvents(); // when all sprites in new size are available, remove this filter - db = SAV is SAV8SWSH ? db.Where(z => ((PersonalInfoSWSH)PersonalTable.SWSH.GetFormEntry(z.Species, z.Form)).IsPresentInGame) : db.Where(z => !(z is WC8)); + db = SAV is SAV8SWSH ? db.Where(z => ((PersonalInfoSWSH)PersonalTable.SWSH.GetFormEntry(z.Species, z.Form)).IsPresentInGame) : db.Where(z => z is not WC8); RawDB = new List(db); foreach (var mg in RawDB)