Set legal default ball for bdsp bred egg templates

This commit is contained in:
Kurt
2021-12-09 18:39:03 -08:00
parent 22cd12ee8d
commit 18469a78aa
2 changed files with 19 additions and 1 deletions

View File

@@ -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);

View File

@@ -1037,5 +1037,23 @@ internal static class BallBreedLegality
(int)Phione,
};
/// <summary>
/// Gets a legal <see cref="Ball"/> value for a bred egg encounter.
/// </summary>
/// <param name="version">Version the egg was created on.</param>
/// <param name="species">Species the egg contained.</param>
/// <returns>Valid ball to hatch with.</returns>
/// <remarks>Not all things can hatch with a Poké Ball!</remarks>
public static Ball GetDefaultBall(GameVersion version, int species)
{
if (GameVersion.BDSP.Contains(version))
{
if (BanInheritedExceptSafari_BDSP.Contains(species))
return Ball.Safari;
}
return Ball.Poke;
}
}
}