Add g-kanto formes

Probably will refactor things when shiny/ball legality is detailed
This commit is contained in:
Kurt 2020-11-11 13:27:08 -08:00
parent 532cee11f7
commit 915727ed67
2 changed files with 23 additions and 8 deletions

View file

@ -33,11 +33,12 @@ namespace PKHeX.Core
// Gen8: GO transfers to HOME can send Mew. Iterate from here.
// However, Mew transfers with LGPE base moves. Because everything <= 151 uses LGPE level-up table. Handle manually!
yield return GetSlot(area, (int)Species.Mew, 0, GameVersion.GG);
const int start = (int)Species.Mew + 1;
const int start = 1;
var speciesList = Enumerable.Range(start, maxSpecies - start + 1).Concat(extras);
var pt7 = PersonalTable.USUM;
var pt8 = PersonalTable.SWSH;
var ptGG = PersonalTable.GG;
foreach (var species in speciesList)
{
if (banlist.Contains(species))
@ -48,16 +49,20 @@ namespace PKHeX.Core
{
for (int f = 0; f < pi8.FormeCount; f++)
{
if ((species <= 151 || species == 808 || species == 809) && ptGG[species].HasForme(f))
continue; // Already yielded by LGP/E table
if (IsDisallowedDuplicateForm(species, f))
continue;
yield return GetSlot(area, species, f, GameVersion.SWSH);
}
}
else if (species <= Legal.MaxAbilityID_7_USUM)
else if (species <= Legal.MaxSpeciesID_7_USUM)
{
var pi7 = pt7[species];
for (int f = 0; f < pi7.FormeCount; f++)
{
if (species <= 151 && ptGG[species].HasForme(f))
continue; // Already yielded by LGP/E table
if (IsDisallowedDuplicateForm(species, f))
continue;
yield return GetSlot(area, species, f, GameVersion.USUM);

View file

@ -250,16 +250,26 @@ namespace PKHeX.Core
/// <returns>Index the <see cref="PKM.AltForm"/> exists as in the <see cref="PersonalTable"/>.</returns>
public int FormeIndex(int species, int forme)
{
if (forme <= 0) // no forme requested
if (!HasForme(forme))
return species;
if (FormStatsIndex <= 0) // no formes present
return species;
if (forme >= FormeCount) // beyond range of species' formes
return species;
return FormStatsIndex + forme - 1;
}
/// <summary>
/// Checks if the <see cref="PersonalInfo"/> has the requested <see cref="PKM.AltForm"/> entry index available.
/// </summary>
/// <param name="forme"><see cref="PKM.AltForm"/> to retrieve for</param>
public bool HasForme(int forme)
{
if (forme <= 0) // no forme requested
return false;
if (FormStatsIndex <= 0) // no formes present
return false;
if (forme >= FormeCount) // beyond range of species' formes
return false;
return true;
}
/// <summary>
/// Gets a random valid gender for the entry.
/// </summary>