From 18469a78aafa8ada8f41ebbc1f8c74fc78bbab5d Mon Sep 17 00:00:00 2001 From: Kurt Date: Thu, 9 Dec 2021 18:39:03 -0800 Subject: [PATCH] Set legal default ball for bdsp bred egg templates --- .../Encounters/EncounterMisc/EncounterEgg.cs | 2 +- .../Verifiers/Ball/BallBreedLegality.cs | 18 ++++++++++++++++++ 2 files changed, 19 insertions(+), 1 deletion(-) diff --git a/PKHeX.Core/Legality/Encounters/EncounterMisc/EncounterEgg.cs b/PKHeX.Core/Legality/Encounters/EncounterMisc/EncounterEgg.cs index 6a3d7165f..8914e53e0 100644 --- a/PKHeX.Core/Legality/Encounters/EncounterMisc/EncounterEgg.cs +++ b/PKHeX.Core/Legality/Encounters/EncounterMisc/EncounterEgg.cs @@ -34,7 +34,7 @@ public PKM ConvertToPKM(ITrainerInfo sav, EncounterCriteria criteria) pk.Nickname = SpeciesName.GetSpeciesNameGeneration(Species, lang, gen); pk.CurrentLevel = Level; pk.Version = (int)version; - pk.Ball = (int)Ball.Poke; + pk.Ball = (int)BallBreedLegality.GetDefaultBall(Version, Species); pk.OT_Friendship = pk.PersonalInfo.BaseFriendship; SetEncounterMoves(pk, version); diff --git a/PKHeX.Core/Legality/Verifiers/Ball/BallBreedLegality.cs b/PKHeX.Core/Legality/Verifiers/Ball/BallBreedLegality.cs index cb350288c..4b4766848 100644 --- a/PKHeX.Core/Legality/Verifiers/Ball/BallBreedLegality.cs +++ b/PKHeX.Core/Legality/Verifiers/Ball/BallBreedLegality.cs @@ -1037,5 +1037,23 @@ internal static class BallBreedLegality (int)Phione, }; + + /// + /// Gets a legal value for a bred egg encounter. + /// + /// Version the egg was created on. + /// Species the egg contained. + /// Valid ball to hatch with. + /// Not all things can hatch with a Poké Ball! + public static Ball GetDefaultBall(GameVersion version, int species) + { + if (GameVersion.BDSP.Contains(version)) + { + if (BanInheritedExceptSafari_BDSP.Contains(species)) + return Ball.Safari; + } + + return Ball.Poke; + } } }