Add DebutGeneration get

https://projectpokemon.org/home/forums/topic/43378-generation-search-in-pkmdb-andor-batch-editor/

(less than) < and (greater than) > not currently supported (no plan to
add, would need to rewrite value eval logic)
This commit is contained in:
Kurt 2018-01-10 15:40:33 -08:00
parent 4f489a720f
commit c751c987a9
2 changed files with 22 additions and 1 deletions

View File

@ -1106,6 +1106,26 @@ internal static IEnumerable<int> GetFutureGenEvolutions(int generation)
default: return Enumerable.Empty<int>();
}
}
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)
{

View File

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