Play with living dex gen a little

generate altforms too, store in a list
This commit is contained in:
Kurt 2020-01-25 22:54:25 -08:00
parent c301ce88ab
commit f0fb6a2371

View file

@ -10,25 +10,43 @@ namespace PKHeX.Core
{
public static IList<PKM> GetLivingDex(SaveFile sav)
{
var bd = sav.BoxData;
var tr = sav;
for (int i = 1; i <= sav.MaxSpeciesID; i++) // should really get a list of valid species IDs
var speciesToGenerate = Enumerable.Range(1, sav.MaxSpeciesID);
return GetLivingDex(sav, speciesToGenerate, sav.BlankPKM);
}
public static List<PKM> GetLivingDex(ITrainerInfo tr, IEnumerable<int> speciesToGenerate, PKM blank)
{
var result = new List<PKM>();
var destType = blank.GetType();
foreach (var s in speciesToGenerate)
{
var pk = sav.BlankPKM;
pk.Species = i;
var pk = blank.Clone();
pk.Species = s;
pk.Gender = pk.GetSaneGender();
if (i == (int)Species.Meowstic)
pk.AltForm = pk.Gender;
var f = EncounterMovesetGenerator.GeneratePKMs(pk, tr).FirstOrDefault();
if (f == null)
continue;
var pi = pk.PersonalInfo;
for (int i = 0; i < pi.FormeCount; i++)
{
pk.AltForm = i;
if (s == (int) Species.Indeedee || s == (int) Species.Meowstic)
pk.Gender = i;
var converted = PKMConverter.ConvertToType(f, sav.PKMType, out _);
if (converted != null)
bd[i] = converted;
var f = EncounterMovesetGenerator.GeneratePKMs(pk, tr).FirstOrDefault();
if (f == null)
continue;
var converted = PKMConverter.ConvertToType(f, destType, out _);
if (converted == null)
continue;
converted.CurrentLevel = 100;
converted.Species = s;
converted.AltForm = i;
result.Add(converted);
}
}
return bd;
return result;
}
}
}