diff --git a/PKHeX.Core/Legality/Core.cs b/PKHeX.Core/Legality/Core.cs index 29964e451..444403160 100644 --- a/PKHeX.Core/Legality/Core.cs +++ b/PKHeX.Core/Legality/Core.cs @@ -1106,6 +1106,26 @@ internal static IEnumerable GetFutureGenEvolutions(int generation) default: return Enumerable.Empty(); } } + internal static int GetDebutGeneration(int species) + { + if (species <= 0) + return 0; + if (species <= MaxSpeciesID_1) + return 1; + if (species <= MaxSpeciesID_2) + return 2; + if (species <= MaxSpeciesID_3) + return 3; + if (species <= MaxSpeciesID_4) + return 4; + if (species <= MaxSpeciesID_5) + return 5; + if (species <= MaxSpeciesID_6) + return 6; + if (species <= MaxSpeciesID_7_USUM) + return 7; + return -1; + } internal static int GetMaxLanguageID(int generation) { diff --git a/PKHeX.Core/PKM/PKM.cs b/PKHeX.Core/PKM/PKM.cs index cea9896bc..99935ecf4 100644 --- a/PKHeX.Core/PKM/PKM.cs +++ b/PKHeX.Core/PKM/PKM.cs @@ -321,8 +321,9 @@ public int GenNumber if (VC1) return 1; if (VC2) return 2; return -1; - } + } } + public int DebutGeneration => Legal.GetDebutGeneration(Species); public bool PKRS_Infected => PKRS_Strain > 0; public bool PKRS_Cured => PKRS_Days == 0 && PKRS_Strain > 0; public virtual bool ChecksumValid => Checksum == CalculateChecksum();