mirror of
https://github.com/kwsch/PKHeX
synced 2024-11-27 06:20:25 +00:00
More pattern matching expressions
Shapes are fancy; nested pattern checks
This commit is contained in:
parent
9dfa1077ee
commit
25565e6f07
5 changed files with 9 additions and 8 deletions
|
@ -95,7 +95,7 @@ namespace PKHeX.Core
|
||||||
}
|
}
|
||||||
|
|
||||||
var encounter = EncounterSuggestion.GetSuggestedMetInfo(legal.pkm);
|
var encounter = EncounterSuggestion.GetSuggestedMetInfo(legal.pkm);
|
||||||
if (encounter is IRelearn r && r.Relearn.Count > 0)
|
if (encounter is IRelearn {Relearn: {Count: > 0}} r)
|
||||||
return r.Relearn;
|
return r.Relearn;
|
||||||
|
|
||||||
return m;
|
return m;
|
||||||
|
|
|
@ -76,12 +76,12 @@ namespace PKHeX.Core
|
||||||
var pi8 = (PersonalInfoSWSH)pt8[species];
|
var pi8 = (PersonalInfoSWSH)pt8[species];
|
||||||
if (pi8.IsPresentInGame)
|
if (pi8.IsPresentInGame)
|
||||||
{
|
{
|
||||||
bool lgpe = (species <= 151 || species is 808 or 809) && (form == 0 || ptGG[species].HasForm(form));
|
bool lgpe = (species is (<= 151 or 808 or 809)) && (form == 0 || ptGG[species].HasForm(form));
|
||||||
return lgpe ? GameVersion.GG : GameVersion.SWSH;
|
return lgpe ? GameVersion.GG : GameVersion.SWSH;
|
||||||
}
|
}
|
||||||
if (species <= Legal.MaxSpeciesID_7_USUM)
|
if (species <= Legal.MaxSpeciesID_7_USUM)
|
||||||
{
|
{
|
||||||
bool lgpe = species <= 151 && (form == 0 || ptGG[species].HasForm(form));
|
bool lgpe = species is <= 151 && (form == 0 || ptGG[species].HasForm(form));
|
||||||
return lgpe ? GameVersion.GG : GameVersion.USUM;
|
return lgpe ? GameVersion.GG : GameVersion.USUM;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -470,7 +470,7 @@ namespace PKHeX
|
||||||
|
|
||||||
internal static bool IsTradedKadabraG1(PKM pkm)
|
internal static bool IsTradedKadabraG1(PKM pkm)
|
||||||
{
|
{
|
||||||
if (pkm is not PK1 pk1 || pk1.Species != (int)Kadabra)
|
if (pkm is not PK1 {Species: (int)Kadabra} pk1)
|
||||||
return false;
|
return false;
|
||||||
if (pk1.TradebackStatus == TradebackType.WasTradeback)
|
if (pk1.TradebackStatus == TradebackType.WasTradeback)
|
||||||
return true;
|
return true;
|
||||||
|
|
|
@ -440,9 +440,10 @@ namespace PKHeX.Core
|
||||||
if (pkm.Version == 15 && enc is EncounterStaticShadow s)
|
if (pkm.Version == 15 && enc is EncounterStaticShadow s)
|
||||||
{
|
{
|
||||||
// only require national ribbon if no longer on origin game
|
// only require national ribbon if no longer on origin game
|
||||||
eb[1] = s.Version == GameVersion.XD
|
bool untraded = s.Version == GameVersion.XD
|
||||||
? pkm is not XK3 x || x.RibbonNational
|
? pkm is XK3 {RibbonNational: false}
|
||||||
: pkm is not CK3 c || c.RibbonNational;
|
: pkm is CK3 {RibbonNational: false};
|
||||||
|
eb[1] = !untraded;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -444,7 +444,7 @@ namespace PKHeX.Core
|
||||||
}
|
}
|
||||||
for (int i = 8; i < 11; i++) // 3 PCD
|
for (int i = 8; i < 11; i++) // 3 PCD
|
||||||
{
|
{
|
||||||
if (value[i] is PCD d && d.Gift.CardType != 0)
|
if (value[i] is PCD {Gift: {CardType: not 0}})
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
|
|
Loading…
Reference in a new issue