mirror of
https://github.com/kwsch/PKHeX.git
synced 2026-10-02 11:36:40 -05:00
Minor clean
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
using System.Collections.Generic;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
|
||||
namespace PKHeX.Core
|
||||
@@ -8,13 +9,18 @@ namespace PKHeX.Core
|
||||
/// </summary>
|
||||
public static class BulkGenerator
|
||||
{
|
||||
public static IList<PKM> GetLivingDex(SaveFile sav)
|
||||
public static List<PKM> GetLivingDex(this SaveFile sav)
|
||||
{
|
||||
var speciesToGenerate = Enumerable.Range(1, sav.MaxSpeciesID);
|
||||
return GetLivingDex(sav, speciesToGenerate, sav.BlankPKM);
|
||||
return GetLivingDex(sav, speciesToGenerate);
|
||||
}
|
||||
|
||||
public static List<PKM> GetLivingDex(ITrainerInfo tr, IEnumerable<int> speciesToGenerate, PKM blank)
|
||||
private static List<PKM> GetLivingDex(SaveFile sav, IEnumerable<int> speciesToGenerate)
|
||||
{
|
||||
return sav.GetLivingDex(speciesToGenerate, sav.BlankPKM);
|
||||
}
|
||||
|
||||
public static List<PKM> GetLivingDex(this ITrainerInfo tr, IEnumerable<int> speciesToGenerate, PKM blank)
|
||||
{
|
||||
var result = new List<PKM>();
|
||||
var destType = blank.GetType();
|
||||
@@ -25,28 +31,38 @@ public static List<PKM> GetLivingDex(ITrainerInfo tr, IEnumerable<int> speciesTo
|
||||
pk.Gender = pk.GetSaneGender();
|
||||
|
||||
var pi = pk.PersonalInfo;
|
||||
for (int i = 0; i < pi.FormeCount; i++)
|
||||
for (int f = 0; f < pi.FormeCount; f++)
|
||||
{
|
||||
pk.AltForm = i;
|
||||
if (s == (int) Species.Indeedee || s == (int) Species.Meowstic)
|
||||
pk.Gender = i;
|
||||
|
||||
var f = EncounterMovesetGenerator.GeneratePKMs(pk, tr).FirstOrDefault();
|
||||
if (f == null)
|
||||
var entry = tr.GetLivingEntry(pk, s, f, destType);
|
||||
if (entry == 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);
|
||||
result.Add(entry);
|
||||
}
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
public static PKM? GetLivingEntry(this ITrainerInfo tr, PKM template, int species, int form, Type destType)
|
||||
{
|
||||
template.Species = species;
|
||||
template.AltForm = form;
|
||||
template.Gender = template.GetSaneGender();
|
||||
|
||||
var f = EncounterMovesetGenerator.GeneratePKMs(template, tr).FirstOrDefault();
|
||||
if (f == null)
|
||||
return null;
|
||||
|
||||
var result = PKMConverter.ConvertToType(f, destType, out _);
|
||||
if (result == null)
|
||||
return null;
|
||||
|
||||
result.CurrentLevel = 100;
|
||||
result.Species = species;
|
||||
result.AltForm = form;
|
||||
|
||||
result.Heal();
|
||||
return result;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -11,6 +11,12 @@ public class EncounterSlot : IEncounterable, IGeneration, ILocation, IVersion
|
||||
public int Form { get; set; }
|
||||
public int LevelMin { get; set; }
|
||||
public int LevelMax { get; set; }
|
||||
public GameVersion Version { get; set; }
|
||||
public int Generation { get; set; } = -1;
|
||||
internal EncounterArea? Area { private get; set; }
|
||||
public int Location { get => Area?.Location ?? 0; set { } }
|
||||
public bool EggEncounter => false;
|
||||
public int EggLocation { get => 0; set { } }
|
||||
|
||||
/// <summary>
|
||||
/// Gets if the specified level inputs are within range of the <see cref="LevelMin"/> and <see cref="LevelMax"/>
|
||||
@@ -49,15 +55,8 @@ public class EncounterSlot : IEncounterable, IGeneration, ILocation, IVersion
|
||||
public SlotType Type { get; set; } = SlotType.Any;
|
||||
public EncounterType TypeEncounter { get; set; } = EncounterType.None;
|
||||
public int SlotNumber { get; set; }
|
||||
public int Generation { get; set; } = -1;
|
||||
private EncounterSlotPermissions? _perm;
|
||||
public EncounterSlotPermissions Permissions => _perm ??= new EncounterSlotPermissions();
|
||||
public GameVersion Version { get; set; }
|
||||
|
||||
internal EncounterArea? Area { private get; set; }
|
||||
public int Location { get => Area?.Location ?? 0; set { } }
|
||||
public bool EggEncounter => false;
|
||||
public int EggLocation { get => 0; set { } }
|
||||
|
||||
public EncounterSlot Clone()
|
||||
{
|
||||
|
||||
@@ -279,7 +279,7 @@ private static void VerifyFatefulIngameActive(LegalityAnalysis data)
|
||||
data.AddLine(result);
|
||||
}
|
||||
|
||||
public void VerifyVersionEvolution(LegalityAnalysis data)
|
||||
public static void VerifyVersionEvolution(LegalityAnalysis data)
|
||||
{
|
||||
var pkm = data.pkm;
|
||||
if (pkm.Format < 7 || data.EncounterMatch.Species == pkm.Species)
|
||||
|
||||
Reference in New Issue
Block a user