mirror of
https://github.com/kwsch/PKHeX
synced 2024-11-10 14:44:24 +00:00
Invert some "!is" to "is not"
This commit is contained in:
parent
e8c23f6644
commit
de840f40d4
26 changed files with 34 additions and 34 deletions
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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();
|
||||
|
|
|
@ -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));
|
||||
|
|
|
@ -76,7 +76,7 @@ namespace PKHeX.Core
|
|||
private static IEnumerable<IEncounterable> 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);
|
||||
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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<int> 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<int>();
|
||||
|
||||
return enc switch
|
||||
|
|
|
@ -36,7 +36,7 @@ namespace PKHeX.Core
|
|||
|
||||
private static List<EvoCriteria>[] GetChainAll(PKM pkm, IEncounterable enc, IReadOnlyList<EvoCriteria> 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<EvoCriteria>(CompleteEvoChain);
|
||||
|
|
|
@ -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.
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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:
|
||||
|
|
|
@ -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.
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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))
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -30,7 +30,7 @@ namespace PKHeX.WinForms
|
|||
GetLangStrings();
|
||||
LoadFields();
|
||||
|
||||
if (!(pkm is IGeoTrack))
|
||||
if (pkm is not IGeoTrack)
|
||||
tabControl1.TabPages.Remove(Tab_Residence);
|
||||
}
|
||||
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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<PKM>(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);
|
||||
|
|
|
@ -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<MysteryGift>(db);
|
||||
foreach (var mg in RawDB)
|
||||
|
|
Loading…
Reference in a new issue