From c52b49de086a42073a35cde18585de50eb2ff7e9 Mon Sep 17 00:00:00 2001 From: Kurt Date: Fri, 7 Jul 2023 20:57:01 -0700 Subject: [PATCH] Update BallVerifier.cs --- .../Legality/Verifiers/Ball/BallVerifier.cs | 40 +++++++++++++++---- 1 file changed, 33 insertions(+), 7 deletions(-) diff --git a/PKHeX.Core/Legality/Verifiers/Ball/BallVerifier.cs b/PKHeX.Core/Legality/Verifiers/Ball/BallVerifier.cs index 8f2440c92..62662d3f5 100644 --- a/PKHeX.Core/Legality/Verifiers/Ball/BallVerifier.cs +++ b/PKHeX.Core/Legality/Verifiers/Ball/BallVerifier.cs @@ -300,6 +300,11 @@ private CheckResult VerifyBallEggGen8BDSP(LegalityAnalysis data) if (IsBallPermitted(BallUseLegality.WildPokeballs8, (int)ball)) return GetValid(LBallSpeciesPass); } + if (IsPaldeaCatchAndBreed(species)) + { + if (IsBallPermitted(BallUseLegality.WildPokeballs9, (int)ball)) + return GetValid(LBallSpeciesPass); + } if (ball == Safari) { @@ -366,16 +371,18 @@ private CheckResult VerifyBallEggGen8(LegalityAnalysis data) return GetValid(LBallEnc); // Poké Ball var species = data.EncounterMatch.Species; - if (species is >= (int)Species.Grookey and <= (int)Species.Inteleon) // G8 Starters - return VerifyBallEquals(data, (int)Poke); - if (IsGalarCatchAndBreed(species)) { if (IsBallPermitted(BallUseLegality.WildPokeballs8, pk.Ball)) return GetValid(LBallSpeciesPass); - if (species >= (int)Species.Grookey) - return GetInvalid(LBallSpecies); } + if (IsPaldeaCatchAndBreed(species)) + { + if (IsBallPermitted(BallUseLegality.WildPokeballs9, pk.Ball)) + return GetValid(LBallSpeciesPass); + } + if (species is >= (int)Species.Grookey and <= (int)Species.Inteleon) // G8 Starters + return VerifyBallEquals(data, (int)Poke); Ball ball = (Ball)pk.Ball; @@ -452,9 +459,13 @@ private CheckResult VerifyBallEggGen9(LegalityAnalysis data) return VerifyBallEquals(data, (int)Poke); var pk = data.Entity; - if (IsBallPermitted(BallUseLegality.WildPokeballs9, pk.Ball)) + if (IsPaldeaCatchAndBreed(species) && IsBallPermitted(BallUseLegality.WildPokeballs9, pk.Ball)) return GetValid(LBallSpeciesPass); - return NONE; + + if (species > Legal.MaxSpeciesID_8) + return VerifyBallEquals(data, BallUseLegality.WildPokeballs9); + + return VerifyBallEggGen8(data); } private static bool IsHiddenAndNotPossible(PKM pk) @@ -485,6 +496,21 @@ private static bool IsGalarCatchAndBreed(ushort species) return false; } + private static bool IsPaldeaCatchAndBreed(ushort species) + { + if (species is >= (int)Species.Sprigatito and <= (int)Species.Quaquaval) // starter + return false; + var pt = PersonalTable.SV; + var pi = pt.GetFormEntry(species, 0); + if (pi.IsInDex) + return true; + + if (pi.IsPresentInGame) + return species != (int)Species.Grookey; // not available yet + + return false; + } + private CheckResult VerifyBallEquals(LegalityAnalysis data, int ball) => GetResult(ball == data.Entity.Ball); private CheckResult VerifyBallEquals(LegalityAnalysis data, ulong permit) => GetResult(IsBallPermitted(permit, data.Entity.Ball));