mirror of
https://github.com/kwsch/PKHeX
synced 2024-11-10 06:34:19 +00:00
Merge type check with usage in if statements
if x is y with z property true, then :D
This commit is contained in:
parent
4890e0e952
commit
514b60b447
29 changed files with 60 additions and 60 deletions
|
@ -24,7 +24,7 @@
|
|||
{
|
||||
case EncounterTrade1 c:
|
||||
return c.GetInitialCatchRate();
|
||||
case EncounterStatic s when s.Version == GameVersion.Stadium && s.Species == (int)Species.Psyduck:
|
||||
case EncounterStatic1E { Version: GameVersion.Stadium, Species: (int)Species.Psyduck}:
|
||||
return pk1.Japanese ? 167 : 168; // Amnesia Psyduck has different catch rates depending on language
|
||||
default:
|
||||
{
|
||||
|
|
|
@ -415,7 +415,7 @@ namespace PKHeX.Core
|
|||
/// <param name="la">Precomputed optional</param>
|
||||
public static void SetDefaultNickname(this PKM pk, LegalityAnalysis la)
|
||||
{
|
||||
if (la.Parsed && la.EncounterOriginal is EncounterTrade t && t.HasNickname)
|
||||
if (la.Parsed && la.EncounterOriginal is EncounterTrade {HasNickname: true} t)
|
||||
pk.SetNickname(t.GetNickname(pk.Language));
|
||||
else
|
||||
pk.ClearNickname();
|
||||
|
|
|
@ -28,7 +28,7 @@ namespace PKHeX.Core
|
|||
new BoxManipSort(BoxManipType.SortLevelReverse, PKMSorting.OrderByDescendingLevel),
|
||||
new BoxManipSort(BoxManipType.SortDate, PKMSorting.OrderByDateObtained, s => s.Generation >= 4),
|
||||
new BoxManipSort(BoxManipType.SortName, list => list.OrderBySpeciesName(GameInfo.Strings.Species)),
|
||||
new BoxManipSort(BoxManipType.SortFavorite, list => list.OrderByCustom(pk => pk is PB7 pb7 && pb7.Favorite), s => s is SAV7b),
|
||||
new BoxManipSort(BoxManipType.SortFavorite, list => list.OrderByCustom(pk => pk is PB7 {Favorite: true}), s => s is SAV7b),
|
||||
new BoxManipSortComplex(BoxManipType.SortParty, (list, sav) => list.OrderByCustom(pk => ((SAV7b)sav).Blocks.Storage.GetPartyIndex(pk.Box - 1, pk.Slot - 1)), s => s is SAV7b),
|
||||
new BoxManipSort(BoxManipType.SortShiny, list => list.OrderByCustom(pk => !pk.IsShiny)),
|
||||
new BoxManipSort(BoxManipType.SortRandom, list => list.OrderByCustom(_ => Util.Rand32())),
|
||||
|
|
|
@ -174,7 +174,7 @@ namespace PKHeX.Core
|
|||
new(dc.Data, 0, Daycare8.GetDaycareSlotOffset(1, 1)) {Type = StorageSlotType.Daycare},
|
||||
};
|
||||
|
||||
if (sav is SAV8SWSH s8 && s8.SaveRevision >= 2)
|
||||
if (sav is SAV8SWSH {SaveRevision: >= 2} s8)
|
||||
{
|
||||
var block = s8.Blocks.GetBlockSafe(SaveBlockAccessor8SWSH.KFusedCalyrex);
|
||||
var c = new SlotInfoMisc(block.Data, 3, 0, true) {Type = StorageSlotType.Fused};
|
||||
|
|
|
@ -115,9 +115,7 @@ namespace PKHeX.Core
|
|||
{
|
||||
var dupes = AllAnalysis.Where(z =>
|
||||
z.Info.Generation >= 3
|
||||
&& z.EncounterOriginal is MysteryGift g
|
||||
&& g.EggEncounter
|
||||
&& !z.pkm.WasTradedEgg)
|
||||
&& z.EncounterOriginal is MysteryGift {EggEncounter: true} && !z.pkm.WasTradedEgg)
|
||||
.GroupBy(z => ((MysteryGift)z.EncounterOriginal).CardTitle);
|
||||
|
||||
foreach (var dupe in dupes)
|
||||
|
@ -268,9 +266,9 @@ namespace PKHeX.Core
|
|||
|
||||
private bool VerifyIDReuse(PKM pp, LegalityAnalysis pa, PKM cp, LegalityAnalysis ca)
|
||||
{
|
||||
if (pa.EncounterMatch is MysteryGift g1 && !g1.EggEncounter)
|
||||
if (pa.EncounterMatch is MysteryGift {EggEncounter: false})
|
||||
return false;
|
||||
if (ca.EncounterMatch is MysteryGift g2 && !g2.EggEncounter)
|
||||
if (ca.EncounterMatch is MysteryGift {EggEncounter: false})
|
||||
return false;
|
||||
|
||||
const CheckIdentifier ident = CheckIdentifier.Trainer;
|
||||
|
|
|
@ -180,7 +180,7 @@ namespace PKHeX.Core
|
|||
return e.Language == EncounterGBLanguage.Japanese ? 1 : 2;
|
||||
|
||||
// E-Reader was only available to Japanese games.
|
||||
case EncounterStaticShadow s when s.EReader:
|
||||
case EncounterStaticShadow {EReader: true}:
|
||||
// Old Sea Map was only distributed to Japanese games.
|
||||
case EncounterStatic3 _ when Species == (int)Core.Species.Mew:
|
||||
pk.OT_Name = "ゲーフリ";
|
||||
|
@ -200,7 +200,7 @@ namespace PKHeX.Core
|
|||
{
|
||||
switch (Generation)
|
||||
{
|
||||
case 3 when this is EncounterStatic3 s3 && s3.Roaming && Version != GameVersion.E: // Roamer IV glitch was fixed in Emerald
|
||||
case 3 when this is EncounterStatic3 {Roaming: true} && Version != 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;
|
||||
|
|
|
@ -241,7 +241,7 @@ namespace PKHeX.Core
|
|||
var gifts = MysteryGiftGenerator.GetPossible(pk, chain);
|
||||
foreach (var gift in gifts)
|
||||
{
|
||||
if (gift is WC3 wc3 && wc3.NotDistributed)
|
||||
if (gift is WC3 {NotDistributed: true})
|
||||
continue;
|
||||
if (needs.Count == 0)
|
||||
{
|
||||
|
|
|
@ -117,7 +117,7 @@ namespace PKHeX.Core
|
|||
|
||||
private static bool IsHiddenAbilitySlot(this EncounterSlot slot)
|
||||
{
|
||||
return (slot is EncounterSlot6AO ao && ao.CanDexNav) || slot.Area.Type == SlotType.FriendSafari || slot.Area.Type == SlotType.Horde || slot.Area.Type == SlotType.SOS;
|
||||
return slot is EncounterSlot6AO {CanDexNav: true} || slot.Area.Type == SlotType.FriendSafari || slot.Area.Type == SlotType.Horde || slot.Area.Type == SlotType.SOS;
|
||||
}
|
||||
|
||||
internal static EncounterSlot? GetCaptureLocation(PKM pkm)
|
||||
|
|
|
@ -263,7 +263,7 @@ namespace PKHeX.Core
|
|||
switch (s.Generation)
|
||||
{
|
||||
case 3:
|
||||
if (s is EncounterStaticShadow w && w.EReader && pkm.Language != (int)LanguageID.Japanese) // Non-JP E-reader Pokemon
|
||||
if (s is EncounterStaticShadow {EReader: true} && pkm.Language != (int)LanguageID.Japanese) // Non-JP E-reader Pokemon
|
||||
return new CheckResult(Severity.Invalid, LG3EReader, CheckIdentifier.Encounter);
|
||||
|
||||
if (pkm.Species == (int)Species.Mew && s.Location == 201 && pkm.Language != (int)LanguageID.Japanese) // Non-JP Mew (Old Sea Map)
|
||||
|
@ -282,7 +282,7 @@ namespace PKHeX.Core
|
|||
case (int)Species.Arceus when s.Location == 086: // Azure Flute Arceus
|
||||
return new CheckResult(Severity.Invalid, LEncUnreleasedHoOArceus, CheckIdentifier.Encounter);
|
||||
}
|
||||
if (pkm.Met_Location == 193 && s is EncounterStaticTyped t && t.TypeEncounter == EncounterType.Surfing_Fishing) // Roaming pokemon surfing in Johto Route 45
|
||||
if (pkm.Met_Location == 193 && s is EncounterStaticTyped {TypeEncounter: EncounterType.Surfing_Fishing}) // Roaming pokemon surfing in Johto Route 45
|
||||
return new CheckResult(Severity.Invalid, LG4InvalidTileR45Surf, CheckIdentifier.Encounter);
|
||||
break;
|
||||
case 7:
|
||||
|
|
|
@ -166,11 +166,11 @@ namespace PKHeX.Core
|
|||
{
|
||||
// Gigantamax Pikachu, Meowth-0, and Eevee are prevented from evolving.
|
||||
// Raichu cannot be evolved to the Alolan variant at this time.
|
||||
BanEvo((int)Species.Raichu, 0, pkm => pkm is IGigantamax g && g.CanGigantamax);
|
||||
BanEvo((int)Species.Raichu, 1, pkm => (pkm is IGigantamax g && g.CanGigantamax) || pkm.Version >= (int)GP || pkm.Version == (int)GO);
|
||||
BanEvo((int)Species.Persian, 0, pkm => pkm is IGigantamax g && g.CanGigantamax);
|
||||
BanEvo((int)Species.Persian, 1, pkm => pkm is IGigantamax g && g.CanGigantamax);
|
||||
BanEvo((int)Species.Perrserker, 0, pkm => pkm is IGigantamax g && g.CanGigantamax);
|
||||
BanEvo((int)Species.Raichu, 0, pkm => pkm is IGigantamax {CanGigantamax: true});
|
||||
BanEvo((int)Species.Raichu, 1, pkm => (pkm is IGigantamax {CanGigantamax: true}) || pkm.Version >= (int)GP || pkm.Version == (int)GO);
|
||||
BanEvo((int)Species.Persian, 0, pkm => pkm is IGigantamax {CanGigantamax: true});
|
||||
BanEvo((int)Species.Persian, 1, pkm => pkm is IGigantamax {CanGigantamax: true});
|
||||
BanEvo((int)Species.Perrserker, 0, pkm => pkm is IGigantamax {CanGigantamax: true});
|
||||
|
||||
BanEvo((int)Species.Exeggutor, 1, pkm => pkm.Version >= (int)GP || pkm.Version == (int)GO);
|
||||
BanEvo((int)Species.Marowak, 1, pkm => pkm.Version >= (int)GP || pkm.Version == (int)GO);
|
||||
|
@ -178,7 +178,7 @@ namespace PKHeX.Core
|
|||
BanEvo((int)Species.MrMime, 0, pkm => pkm.Version >= (int)SW);
|
||||
|
||||
foreach (var s in GetEvolutions((int)Species.Eevee, 0)) // Eeveelutions
|
||||
BanEvo(s, 0, pkm => pkm is IGigantamax g && g.CanGigantamax);
|
||||
BanEvo(s, 0, pkm => pkm is IGigantamax {CanGigantamax: true});
|
||||
}
|
||||
|
||||
private void BanEvo(int species, int form, Func<PKM, bool> func)
|
||||
|
|
|
@ -221,7 +221,7 @@ namespace PKHeX.Core
|
|||
if (pkm.Version == (int)GameVersion.CXD)
|
||||
CXD.Verify(this);
|
||||
|
||||
if (Info.EncounterMatch is WC3 z && z.NotDistributed)
|
||||
if (Info.EncounterMatch is WC3 {NotDistributed: true})
|
||||
AddLine(Severity.Invalid, LEncUnreleased, CheckIdentifier.Encounter);
|
||||
|
||||
if (pkm.Format >= 8)
|
||||
|
|
|
@ -68,7 +68,7 @@ namespace PKHeX.Core
|
|||
}
|
||||
|
||||
var enc = data.EncounterMatch;
|
||||
if (enc is MysteryGift g && g.Generation >= 4)
|
||||
if (enc is MysteryGift {Generation: >= 4} g)
|
||||
return VerifyAbilityMG(data, g, abilities);
|
||||
|
||||
if (format < 6)
|
||||
|
@ -298,7 +298,7 @@ namespace PKHeX.Core
|
|||
// hidden abilities
|
||||
if (enc is EncounterSlot slot)
|
||||
{
|
||||
bool valid = (slot is EncounterSlot6AO ao && ao.CanDexNav) || slot.Area.Type == SlotType.FriendSafari || slot.Area.Type == SlotType.Horde;
|
||||
bool valid = slot is EncounterSlot6AO {CanDexNav: true} || slot.Area.Type == SlotType.FriendSafari || slot.Area.Type == SlotType.Horde;
|
||||
if (!valid)
|
||||
return GetInvalid(LAbilityMismatchHordeSafari);
|
||||
}
|
||||
|
|
|
@ -32,7 +32,7 @@ namespace PKHeX.Core
|
|||
return VerifyBallMysteryGift(data, g);
|
||||
case EncounterTrade t:
|
||||
return VerifyBallEquals(data, t.Ball);
|
||||
case EncounterStatic s when s.Gift:
|
||||
case EncounterStatic {Gift: true} s:
|
||||
return VerifyBallEquals(data, s.Ball);
|
||||
case EncounterSlot8GO _: // Already a strict match
|
||||
return GetResult(true);
|
||||
|
|
|
@ -26,7 +26,7 @@ namespace PKHeX.Core
|
|||
if (data.pkm is IGeoTrack t)
|
||||
VerifyGeoLocationData(data, t, data.pkm);
|
||||
|
||||
if (pkm.VC && pkm is PK7 g && g.Geo1_Country == 0) // VC transfers set Geo1 Country
|
||||
if (pkm.VC && pkm is PK7 {Geo1_Country: 0}) // VC transfers set Geo1 Country
|
||||
data.AddLine(GetInvalid(LegalityCheckStrings.LGeoMemoryMissing));
|
||||
|
||||
if (!pkm.IsUntraded)
|
||||
|
|
|
@ -23,7 +23,7 @@ namespace PKHeX.Core
|
|||
break;
|
||||
case WC7 wc7 when wc7.MetLevel == pkm.Met_Level:
|
||||
break;
|
||||
case PGT pgt when pgt.IsManaphyEgg && pkm.Met_Level == 0:
|
||||
case PGT {IsManaphyEgg: true} when pkm.Met_Level == 0:
|
||||
break;
|
||||
default:
|
||||
data.AddLine(GetInvalid(LLevelMetGift));
|
||||
|
@ -46,7 +46,7 @@ namespace PKHeX.Core
|
|||
return;
|
||||
}
|
||||
|
||||
var reqEXP = EncounterMatch is EncounterStatic s && s.Version == GameVersion.C
|
||||
var reqEXP = EncounterMatch is EncounterStatic {Version: GameVersion.C}
|
||||
? 125 // Gen2 Dizzy Punch gifts always have 125 EXP, even if it's more than the Lv5 exp required.
|
||||
: Experience.GetEXP(elvl, pkm.PersonalInfo.EXPGrowth);
|
||||
if (reqEXP != pkm.EXP)
|
||||
|
|
|
@ -143,13 +143,13 @@ namespace PKHeX.Core
|
|||
|
||||
switch (data.EncounterMatch)
|
||||
{
|
||||
case WC6 g when !g.IsEgg && g.OTGender != 3:
|
||||
case WC6 {IsEgg: false} g when g.OTGender != 3:
|
||||
VerifyOTMemoryIs(data, g.OT_Memory, g.OT_Intensity, g.OT_TextVar, g.OT_Feeling);
|
||||
return;
|
||||
case WC7 g when !g.IsEgg && g.OTGender != 3:
|
||||
case WC7 {IsEgg: false} g when g.OTGender != 3:
|
||||
VerifyOTMemoryIs(data, g.OT_Memory, g.OT_Intensity, g.OT_TextVar, g.OT_Feeling);
|
||||
return;
|
||||
case WC8 g when !g.IsEgg && g.OTGender != 3:
|
||||
case WC8 {IsEgg: false} g when g.OTGender != 3:
|
||||
VerifyOTMemoryIs(data, g.OT_Memory, g.OT_Intensity, g.OT_TextVar, g.OT_Feeling);
|
||||
return;
|
||||
|
||||
|
|
|
@ -49,7 +49,7 @@ namespace PKHeX.Core
|
|||
|
||||
switch (pkm)
|
||||
{
|
||||
case PK7 pk7 when pk7.ResortEventStatus >= 20:
|
||||
case PK7 {ResortEventStatus: >= 20}:
|
||||
data.AddLine(GetInvalid(LTransferBad));
|
||||
break;
|
||||
case PB7 pb7:
|
||||
|
@ -137,7 +137,7 @@ namespace PKHeX.Core
|
|||
|
||||
CheckResult GetWasNotTradeback()
|
||||
{
|
||||
if ((e is EncounterStatic1 s && s.Version == GameVersion.Stadium) || e is EncounterTrade1)
|
||||
if (e is EncounterStatic1E {Version: GameVersion.Stadium} || e is EncounterTrade1)
|
||||
return GetValid(LG1CatchRateMatchPrevious); // Encounters detected by the catch rate, cant be invalid if match this encounters
|
||||
|
||||
int species = pk1.Species;
|
||||
|
@ -164,7 +164,7 @@ namespace PKHeX.Core
|
|||
var EncounterMatch = data.EncounterMatch;
|
||||
switch (EncounterMatch)
|
||||
{
|
||||
case WC3 w when w.Fateful:
|
||||
case WC3 {Fateful: true} w:
|
||||
if (w.IsEgg)
|
||||
{
|
||||
// Eggs hatched in RS clear the obedience flag!
|
||||
|
@ -187,7 +187,7 @@ namespace PKHeX.Core
|
|||
VerifyReceivability(data, g);
|
||||
VerifyFatefulMysteryGift(data, g);
|
||||
return;
|
||||
case EncounterStatic s when s.Fateful: // ingame fateful
|
||||
case EncounterStatic {Fateful: true}: // ingame fateful
|
||||
case EncounterSlot3PokeSpot _: // ingame pokespot
|
||||
case EncounterTrade4Ranch _: // ranch varied PID
|
||||
VerifyFatefulIngameActive(data);
|
||||
|
@ -244,7 +244,7 @@ namespace PKHeX.Core
|
|||
private static void VerifyFatefulMysteryGift(LegalityAnalysis data, MysteryGift g)
|
||||
{
|
||||
var pkm = data.pkm;
|
||||
if (g is PGF p && p.IsShiny)
|
||||
if (g is PGF {IsShiny: true})
|
||||
{
|
||||
var Info = data.Info;
|
||||
Info.PIDIV = MethodFinder.Analyze(pkm);
|
||||
|
@ -397,7 +397,7 @@ namespace PKHeX.Core
|
|||
}
|
||||
|
||||
var enc = data.EncounterMatch;
|
||||
bool originGMax = enc is IGigantamax g && g.CanGigantamax;
|
||||
bool originGMax = enc is IGigantamax {CanGigantamax: true};
|
||||
if (originGMax != pk8.CanGigantamax)
|
||||
{
|
||||
bool ok = !pk8.IsEgg && pk8.CanToggleGigantamax(pk8.Species, pk8.Form, enc.Species, enc.Form);
|
||||
|
|
|
@ -33,7 +33,7 @@ namespace PKHeX.Core
|
|||
{
|
||||
if (pkm.VC)
|
||||
VerifyG1NicknameWithinBounds(data, pkm.Nickname);
|
||||
else if (EncounterMatch is MysteryGift m && !m.IsEgg)
|
||||
else if (EncounterMatch is MysteryGift {IsEgg: false})
|
||||
data.AddLine(Get(LEncGiftNicknamed, ParseSettings.NicknamedMysteryGift));
|
||||
}
|
||||
|
||||
|
|
|
@ -37,7 +37,7 @@ namespace PKHeX.Core
|
|||
if (!s.Shiny.IsValid(pkm))
|
||||
data.AddLine(GetInvalid(LEncStaticPIDShiny, CheckIdentifier.Shiny));
|
||||
|
||||
if (s is EncounterStatic8U u && u.Shiny == Shiny.Random)
|
||||
if (s is EncounterStatic8U {Shiny: Shiny.Random})
|
||||
{
|
||||
// Underground Raids are originally anti-shiny on encounter.
|
||||
// When selecting a prize at the end, the game rolls and force-shiny is applied to be XOR=1.
|
||||
|
@ -119,7 +119,7 @@ namespace PKHeX.Core
|
|||
|
||||
if (pkm.EncryptionConstant == 0)
|
||||
{
|
||||
if (Info.EncounterMatch is WC8 wc8 && wc8.PID == 0 && wc8.EncryptionConstant == 0)
|
||||
if (Info.EncounterMatch is WC8 {PID: 0, EncryptionConstant: 0})
|
||||
return; // HOME Gifts
|
||||
data.AddLine(Get(LPIDEncryptZero, Severity.Fishy, CheckIdentifier.EC));
|
||||
}
|
||||
|
|
|
@ -367,7 +367,8 @@ namespace PKHeX.Core
|
|||
{
|
||||
const int memChampion = 27;
|
||||
{
|
||||
bool hasChampMemory = (pkm.Format == 8 && pkm is IMemoryHT h && h.HT_Memory == memChampion) || (pkm.Gen8 && pkm is IMemoryOT o && o.OT_Memory == memChampion);
|
||||
bool hasChampMemory = (pkm.Format == 8 && pkm is IMemoryHT {HT_Memory: memChampion}) ||
|
||||
(pkm.Gen8 && pkm is IMemoryOT {OT_Memory: memChampion});
|
||||
if (hasChampMemory && !s8.RibbonChampionGalar)
|
||||
yield return new RibbonResult(nameof(s8.RibbonChampionGalar));
|
||||
}
|
||||
|
@ -387,9 +388,9 @@ namespace PKHeX.Core
|
|||
// If the Tower Master ribbon is not present but a memory hint implies it should...
|
||||
// This memory can also be applied in Gen6/7 via defeating the Chatelaines, where legends are disallowed.
|
||||
const int strongest = 30;
|
||||
if ((pkm is IMemoryOT o && o.OT_Memory == strongest) || (pkm is IMemoryHT h && h.HT_Memory == strongest))
|
||||
if (pkm is IMemoryOT {OT_Memory: strongest} || pkm is IMemoryHT {HT_Memory: strongest})
|
||||
{
|
||||
if (pkm.Gen8 || !IsAllowedBattleFrontier(pkm.Species) || (pkm is IRibbonSetCommon6 s6 && !s6.RibbonBattlerSkillful))
|
||||
if (pkm.Gen8 || !IsAllowedBattleFrontier(pkm.Species) || pkm is IRibbonSetCommon6 {RibbonBattlerSkillful: false})
|
||||
yield return new RibbonResult(nameof(s8.RibbonTowerMaster));
|
||||
}
|
||||
}
|
||||
|
@ -398,7 +399,7 @@ namespace PKHeX.Core
|
|||
|
||||
private static bool CanParticipateInRankedSWSH(PKM pkm)
|
||||
{
|
||||
if (!pkm.SWSH && pkm is IBattleVersion v && v.BattleVersion == 0)
|
||||
if (!pkm.SWSH && pkm is IBattleVersion {BattleVersion: 0})
|
||||
return false;
|
||||
|
||||
// Clamp to permitted species
|
||||
|
@ -446,7 +447,7 @@ namespace PKHeX.Core
|
|||
var sb = set2.RibbonBits();
|
||||
var eb = enc is IRibbonSetEvent4 e4 ? e4.RibbonBits() : new bool[sb.Length];
|
||||
|
||||
if (enc is EncounterStatic7 s && s.Species == (int)Species.Magearna)
|
||||
if (enc is EncounterStatic7 {Species: (int)Species.Magearna})
|
||||
eb[1] = true; // require Wishing Ribbon
|
||||
|
||||
for (int i = 0; i < sb.Length; i++)
|
||||
|
|
|
@ -22,7 +22,7 @@ namespace PKHeX.Core
|
|||
switch (data.EncounterMatch)
|
||||
{
|
||||
case EncounterTrade _:
|
||||
case MysteryGift g when !g.IsEgg:
|
||||
case MysteryGift {IsEgg: false}:
|
||||
case EncounterStatic5N _:
|
||||
return; // already verified
|
||||
}
|
||||
|
@ -107,7 +107,7 @@ namespace PKHeX.Core
|
|||
|
||||
if (tr.Length == 0)
|
||||
{
|
||||
if (pkm is SK2 sk2 && sk2.TID == 0 && sk2.IsRental)
|
||||
if (pkm is SK2 {TID: 0, IsRental: true})
|
||||
{
|
||||
data.AddLine(Get(LOTShort, Severity.Fishy));
|
||||
}
|
||||
|
|
|
@ -130,7 +130,7 @@ namespace PKHeX.Core
|
|||
}
|
||||
|
||||
var enc = data.EncounterMatch;
|
||||
if (enc.Version == GameVersion.GO || (enc is WC8 wc && wc.IsHOMEGift))
|
||||
if (enc.Version == GameVersion.GO || enc is WC8 {IsHOMEGift: true})
|
||||
{
|
||||
VerifyHOMETracker(data, pkm);
|
||||
}
|
||||
|
@ -166,7 +166,7 @@ namespace PKHeX.Core
|
|||
{
|
||||
// Tracker value is set via Transfer across HOME.
|
||||
// Can't validate the actual values (we aren't the server), so we can only check against zero.
|
||||
if (pkm is IHomeTrack home && home.Tracker == 0)
|
||||
if (pkm is IHomeTrack {Tracker: 0})
|
||||
{
|
||||
data.AddLine(Get(LTransferTrackerMissing, ParseSettings.Gen8TransferTrackerNotPresent));
|
||||
// To the reader: It seems like the best course of action for setting a tracker is:
|
||||
|
@ -183,7 +183,7 @@ namespace PKHeX.Core
|
|||
yield return GetInvalid(LEggLocationNone);
|
||||
|
||||
// Flag Moves that cannot be transferred
|
||||
if (encounter is EncounterStatic s && s.Version == GameVersion.C && s.EggLocation == 256) // Dizzy Punch Gifts
|
||||
if (encounter is EncounterStatic2Odd {Version: GameVersion.C, EggLocation: 256}) // Dizzy Punch Gifts
|
||||
FlagIncompatibleTransferMove(pkm, Moves, 146, 2); // can't have Dizzy Punch at all
|
||||
|
||||
bool checkShiny = pkm.VC2 || (pkm.TradebackStatus == TradebackType.WasTradeback && pkm.VC1);
|
||||
|
|
|
@ -131,7 +131,7 @@ namespace PKHeX.Core
|
|||
var flags = ExportFlags.None;
|
||||
if (ext == ".dsv")
|
||||
flags |= ExportFlags.IncludeFooter;
|
||||
if (ext == ".gci" || (SAV is IGCSaveFile gc && !gc.IsMemoryCardSave))
|
||||
if (ext == ".gci" || SAV is IGCSaveFile {IsMemoryCardSave: false})
|
||||
flags |= ExportFlags.IncludeHeader;
|
||||
return flags;
|
||||
}
|
||||
|
|
|
@ -189,7 +189,7 @@ namespace PKHeX.Core
|
|||
case PKM pk:
|
||||
yield return pk;
|
||||
break;
|
||||
case MysteryGift g when g.IsPokémon:
|
||||
case MysteryGift {IsPokémon: true} g:
|
||||
yield return g.ConvertToPKM(sav);
|
||||
break;
|
||||
case GP1 g when g.Species != 0:
|
||||
|
|
|
@ -94,7 +94,7 @@ namespace PKHeX.Drawing
|
|||
var formarg = pk is IFormArgument f ? f.FormArgument : 0;
|
||||
bool alt = pk.Format >= 8 && (pk.ShinyXor == 0 || pk.FatefulEncounter || pk.Version == (int)GameVersion.GO);
|
||||
var img = GetSprite(pk.Species, pk.Form, pk.Gender, formarg, pk.SpriteItem, pk.IsEgg, pk.IsShiny, pk.Format, isBoxBGRed, alt);
|
||||
if (pk is IShadowPKM s && s.IsShadow)
|
||||
if (pk is IShadowPKM {IsShadow: true})
|
||||
{
|
||||
const int Lugia = 249;
|
||||
if (pk.Species == Lugia) // show XD shadow sprite
|
||||
|
@ -103,7 +103,7 @@ namespace PKHeX.Drawing
|
|||
var glowImg = ImageUtil.GetBitmap(pixels, baseSprite.Width, baseSprite.Height, baseSprite.PixelFormat);
|
||||
return ImageUtil.LayerImage(glowImg, img, 0, 0);
|
||||
}
|
||||
if (pk is IGigantamax g && g.CanGigantamax)
|
||||
if (pk is IGigantamax {CanGigantamax: true})
|
||||
{
|
||||
var gm = Resources.dyna;
|
||||
return ImageUtil.LayerImage(img, gm, (img.Width - gm.Width) / 2, 0);
|
||||
|
|
|
@ -494,7 +494,7 @@ namespace PKHeX.WinForms.Controls
|
|||
PB_MarkShiny.Image = GetMarkSprite(PB_MarkShiny, !BTN_Shinytize.Enabled);
|
||||
PB_MarkCured.Image = GetMarkSprite(PB_MarkCured, CHK_Cured.Checked);
|
||||
|
||||
PB_Favorite.Image = GetMarkSprite(PB_Favorite, Entity is IFavorite f && f.Favorite);
|
||||
PB_Favorite.Image = GetMarkSprite(PB_Favorite, Entity is IFavorite {Favorite: true});
|
||||
PB_Origin.Image = GetOriginSprite(Entity);
|
||||
|
||||
// Colored Markings
|
||||
|
|
|
@ -1081,13 +1081,13 @@ namespace PKHeX.WinForms.Controls
|
|||
B_Roamer.Enabled = sav is SAV3;
|
||||
|
||||
B_OpenHoneyTreeEditor.Enabled = B_OpenUGSEditor.Enabled = sav is SAV4Sinnoh;
|
||||
B_OpenApricorn.Enabled = sav is SAV4 s4 && s4.HGSS;
|
||||
B_OpenApricorn.Enabled = sav is SAV4HGSS;
|
||||
B_OpenRTCEditor.Enabled = sav.Generation == 2 || (sav is SAV3 s3 && (s3.RS || s3.E));
|
||||
B_MailBox.Enabled = sav is SAV2 || sav is SAV3 || sav is SAV4 || sav is SAV5;
|
||||
|
||||
B_Raids.Enabled = sav is SAV8SWSH;
|
||||
B_RaidArmor.Enabled = sav is SAV8SWSH ss1 && ss1.SaveRevision >= 1;
|
||||
B_RaidCrown.Enabled = sav is SAV8SWSH ss2 && ss2.SaveRevision >= 2;
|
||||
B_RaidArmor.Enabled = sav is SAV8SWSH {SaveRevision: >= 1};
|
||||
B_RaidCrown.Enabled = sav is SAV8SWSH {SaveRevision: >= 2};
|
||||
B_Blocks.Enabled = true;
|
||||
|
||||
SL_Extra.SAV = sav;
|
||||
|
|
|
@ -589,7 +589,8 @@ namespace PKHeX.WinForms
|
|||
{
|
||||
if (editing)
|
||||
return;
|
||||
if (sender is RadioButton radioButton && !radioButton.Checked) return;
|
||||
if (sender is RadioButton {Checked: false})
|
||||
return;
|
||||
StatAddrControl(SetValToSav: -2, SetSavToVal: true);
|
||||
if (GB_Hall.Visible)
|
||||
{
|
||||
|
|
|
@ -175,7 +175,7 @@ namespace PKHeX.Tests.Simulator
|
|||
var set = new ShowdownSet(text);
|
||||
var pk7 = new PK7 { Species = set.Species, Form = set.Form, Moves = set.Moves, CurrentLevel = set.Level };
|
||||
var encs = EncounterMovesetGenerator.GenerateEncounters(pk7, set.Moves);
|
||||
var tr3 = encs.First(z => z is EncounterTrade t && t.Generation == 3);
|
||||
var tr3 = encs.First(z => z is EncounterTrade3);
|
||||
var pk3 = tr3.ConvertToPKM(new SAV3());
|
||||
|
||||
var la = new LegalityAnalysis(pk3);
|
||||
|
|
Loading…
Reference in a new issue