mirror of
https://github.com/kwsch/PKHeX.git
synced 2026-10-23 13:12:59 -05:00
Fix pattern matching comparison
Wish I had an analyzer to catch this (missing parens) similar to boolean logic #3271 - resolves the traded egg recognition issue
This commit is contained in:
@@ -473,7 +473,7 @@ public enum AreaSlotType8 : byte
|
||||
|
||||
public static class AreaSlotType8Extensions
|
||||
{
|
||||
public static bool CanCrossover(this AreaSlotType8 type) => type is not HiddenMain or HiddenMain2 or OnlyFishing;
|
||||
public static bool CanCrossover(this AreaSlotType8 type) => type is not (HiddenMain or HiddenMain2 or OnlyFishing);
|
||||
public static bool CanEncounterViaFishing(this AreaSlotType8 type, AreaWeather8 weather) => type is OnlyFishing || weather.HasFlag(Fishing);
|
||||
public static bool CanEncounterViaCurry(this AreaSlotType8 type) => type is HiddenMain or HiddenMain2;
|
||||
}
|
||||
|
||||
@@ -54,7 +54,7 @@ protected override bool IsMatchEggLocation(PKM pkm)
|
||||
// Unhatched:
|
||||
if (eggloc != EggLocation)
|
||||
return false;
|
||||
if (pk4.Met_Location is not 0 or Locations.LinkTrade4)
|
||||
if (pk4.Met_Location is not (0 or Locations.LinkTrade4))
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -40,7 +40,7 @@ protected override bool IsMatchEggLocation(PKM pkm)
|
||||
// Unhatched:
|
||||
if (eggloc != EggLocation)
|
||||
return false;
|
||||
if (pkm.Met_Location is not 0 or Locations.LinkTrade5)
|
||||
if (pkm.Met_Location is not (0 or Locations.LinkTrade5))
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -42,7 +42,7 @@ protected override bool IsMatchEggLocation(PKM pkm)
|
||||
// Unhatched:
|
||||
if (eggloc != EggLocation)
|
||||
return false;
|
||||
if (pkm.Met_Location is not 0 or Locations.LinkTrade6)
|
||||
if (pkm.Met_Location is not (0 or Locations.LinkTrade6))
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -35,7 +35,7 @@ protected override bool IsMatchEggLocation(PKM pkm)
|
||||
// Unhatched:
|
||||
if (eggloc != EggLocation)
|
||||
return false;
|
||||
if (pkm.Met_Location is not 0 or Locations.LinkTrade6)
|
||||
if (pkm.Met_Location is not (0 or Locations.LinkTrade6))
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -556,6 +556,6 @@ public enum TimeCapsuleEvaluation
|
||||
|
||||
public static class TimeCapsuleEvlautationExtensions
|
||||
{
|
||||
public static bool WasTimeCapsuleTransferred(this TimeCapsuleEvaluation eval) => eval is not TimeCapsuleEvaluation.Indeterminate or TimeCapsuleEvaluation.NotTransferred or TimeCapsuleEvaluation.BadCatchRate;
|
||||
public static bool WasTimeCapsuleTransferred(this TimeCapsuleEvaluation eval) => eval is not (TimeCapsuleEvaluation.Indeterminate or TimeCapsuleEvaluation.NotTransferred or TimeCapsuleEvaluation.BadCatchRate);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -518,7 +518,7 @@ private static bool CanHaveRibbonWinning(PKM pkm, IEncounterTemplate enc, int ge
|
||||
if (enc.LevelMin <= 50)
|
||||
return true;
|
||||
|
||||
return enc is not EncounterStaticShadow or WC3;
|
||||
return enc is not (EncounterStaticShadow or WC3);
|
||||
}
|
||||
|
||||
private static bool CanHaveRibbonVictory(PKM pkm, int gen)
|
||||
|
||||
@@ -163,7 +163,7 @@ private bool SearchIntermediate(PKM pk)
|
||||
private bool SearchComplex(PKM pk)
|
||||
{
|
||||
if (SearchEgg != null && !FilterResultEgg(pk)) return false;
|
||||
if (Level is not null or 0 && !SearchUtil.SatisfiesFilterLevel(pk, SearchLevel, (int) Level)) return false;
|
||||
if (Level is not (null or 0) && !SearchUtil.SatisfiesFilterLevel(pk, SearchLevel, (int) Level)) return false;
|
||||
if (SearchLegal != null && new LegalityAnalysis(pk).Valid != SearchLegal) return false;
|
||||
if (BatchFilters.Length != 0 && !SearchUtil.SatisfiesFilterBatchInstruction(pk, BatchFilters)) return false;
|
||||
|
||||
|
||||
@@ -51,7 +51,7 @@ public SAV1(byte[] data, GameVersion versionOverride = GameVersion.Any) : base(d
|
||||
private void Initialize(GameVersion versionOverride)
|
||||
{
|
||||
// see if RBY can be differentiated
|
||||
if (Starter != 0 && versionOverride is not GameVersion.RB or GameVersion.YW)
|
||||
if (Starter != 0 && versionOverride is not (GameVersion.RB or GameVersion.YW))
|
||||
Version = Yellow ? GameVersion.YW : GameVersion.RB;
|
||||
|
||||
Box = Data.Length;
|
||||
|
||||
Reference in New Issue
Block a user