mirror of
https://github.com/kwsch/PKHeX
synced 2024-12-27 12:53:14 +00:00
46640d48a3
un-nest classes, move some logic to core, update some get-only properties that return arrays to methods
34 lines
1 KiB
C#
34 lines
1 KiB
C#
using System.Collections.Generic;
|
|
using System.Linq;
|
|
|
|
namespace PKHeX.Core
|
|
{
|
|
/// <summary>
|
|
/// Logic for generating a large amount of <see cref="PKM"/> data.
|
|
/// </summary>
|
|
public static class BulkGenerator
|
|
{
|
|
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 pk = sav.BlankPKM;
|
|
pk.Species = i;
|
|
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 converted = PKMConverter.ConvertToType(f, sav.PKMType, out _);
|
|
if (converted != null)
|
|
bd[i] = converted;
|
|
}
|
|
return bd;
|
|
}
|
|
}
|
|
}
|