mirror of
https://github.com/kwsch/PKHeX.git
synced 2026-09-14 22:45:20 -05:00
Minor clean
This commit is contained in:
@@ -1320,7 +1320,6 @@ internal static class Encounters8Nest
|
||||
new EncounterStatic8N(Nest91,0,1,1) { Species = 588, Ability = A3 }, // Karrablast
|
||||
new EncounterStatic8N(Nest91,1,2,2) { Species = 616, Ability = A3 }, // Shelmet
|
||||
new EncounterStatic8N(Nest91,4,4,4) { Species = 589, Ability = A4 }, // Escavalier
|
||||
|
||||
};
|
||||
|
||||
internal static readonly EncounterStatic8N[] Nest_SH =
|
||||
|
||||
@@ -25,7 +25,7 @@ public void Insert(EvolutionMethod entry)
|
||||
Chain.Insert(0, new List<EvolutionMethod> {entry});
|
||||
}
|
||||
|
||||
public List<EvoCriteria> GetExplicitLineage(PKM pkm, int maxLevel, bool skipChecks, int maxSpeciesTree, int maxSpeciesOrigin, int minLevel)
|
||||
public List<EvoCriteria> GetExplicitLineage(PKM pkm, int maxLevel, bool skipChecks, int maxSpeciesOrigin, int minLevel)
|
||||
{
|
||||
int lvl = maxLevel;
|
||||
var first = new EvoCriteria {Species = pkm.Species, Level = lvl, Form = pkm.AltForm};
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using static PKHeX.Core.GameVersion;
|
||||
|
||||
namespace PKHeX.Core
|
||||
{
|
||||
@@ -27,15 +28,15 @@ static EvolutionTree()
|
||||
static byte[] get(string resource) => Util.GetBinaryResource($"evos_{resource}.pkl");
|
||||
static byte[][] unpack(string resource) => Data.UnpackMini(get(resource), resource);
|
||||
|
||||
Evolves1 = new EvolutionTree(new[] { get("rby") }, GameVersion.Gen1, PersonalTable.Y, Legal.MaxSpeciesID_1);
|
||||
Evolves2 = new EvolutionTree(new[] { get("gsc") }, GameVersion.Gen2, PersonalTable.C, Legal.MaxSpeciesID_2);
|
||||
Evolves3 = new EvolutionTree(new[] { get("g3") }, GameVersion.Gen3, PersonalTable.RS, Legal.MaxSpeciesID_3);
|
||||
Evolves4 = new EvolutionTree(new[] { get("g4") }, GameVersion.Gen4, PersonalTable.DP, Legal.MaxSpeciesID_4);
|
||||
Evolves5 = new EvolutionTree(new[] { get("g5") }, GameVersion.Gen5, PersonalTable.BW, Legal.MaxSpeciesID_5);
|
||||
Evolves6 = new EvolutionTree(unpack("ao"), GameVersion.Gen6, PersonalTable.AO, Legal.MaxSpeciesID_6);
|
||||
Evolves7 = new EvolutionTree(unpack("uu"), GameVersion.Gen7, PersonalTable.USUM, Legal.MaxSpeciesID_7_USUM);
|
||||
Evolves7b = new EvolutionTree(unpack("gg"), GameVersion.Gen7, PersonalTable.GG, Legal.MaxSpeciesID_7b);
|
||||
Evolves8 = new EvolutionTree(unpack("ss"), GameVersion.Gen8, PersonalTable.SWSH, Legal.MaxSpeciesID_8);
|
||||
Evolves1 = new EvolutionTree(new[] { get("rby") }, Gen1, PersonalTable.Y, Legal.MaxSpeciesID_1);
|
||||
Evolves2 = new EvolutionTree(new[] { get("gsc") }, Gen2, PersonalTable.C, Legal.MaxSpeciesID_2);
|
||||
Evolves3 = new EvolutionTree(new[] { get("g3") }, Gen3, PersonalTable.RS, Legal.MaxSpeciesID_3);
|
||||
Evolves4 = new EvolutionTree(new[] { get("g4") }, Gen4, PersonalTable.DP, Legal.MaxSpeciesID_4);
|
||||
Evolves5 = new EvolutionTree(new[] { get("g5") }, Gen5, PersonalTable.BW, Legal.MaxSpeciesID_5);
|
||||
Evolves6 = new EvolutionTree(unpack("ao"), Gen6, PersonalTable.AO, Legal.MaxSpeciesID_6);
|
||||
Evolves7 = new EvolutionTree(unpack("uu"), Gen7, PersonalTable.USUM, Legal.MaxSpeciesID_7_USUM);
|
||||
Evolves7b = new EvolutionTree(unpack("gg"), Gen7, PersonalTable.GG, Legal.MaxSpeciesID_7b);
|
||||
Evolves8 = new EvolutionTree(unpack("ss"), Gen8, PersonalTable.SWSH, Legal.MaxSpeciesID_8);
|
||||
|
||||
// There's always oddballs.
|
||||
Evolves7.FixEvoTreeSM();
|
||||
@@ -91,14 +92,14 @@ private IReadOnlyList<EvolutionMethod[]> GetEntries(IReadOnlyList<byte[]> data)
|
||||
{
|
||||
return Game switch
|
||||
{
|
||||
GameVersion.Gen1 => EvolutionSet1.GetArray(data[0], MaxSpeciesTree),
|
||||
GameVersion.Gen2 => EvolutionSet1.GetArray(data[0], MaxSpeciesTree),
|
||||
GameVersion.Gen3 => EvolutionSet3.GetArray(data[0]),
|
||||
GameVersion.Gen4 => EvolutionSet4.GetArray(data[0]),
|
||||
GameVersion.Gen5 => EvolutionSet5.GetArray(data[0]),
|
||||
GameVersion.Gen6 => EvolutionSet6.GetArray(data),
|
||||
GameVersion.Gen7 => EvolutionSet7.GetArray(data),
|
||||
GameVersion.Gen8 => EvolutionSet7.GetArray(data),
|
||||
Gen1 => EvolutionSet1.GetArray(data[0], MaxSpeciesTree),
|
||||
Gen2 => EvolutionSet1.GetArray(data[0], MaxSpeciesTree),
|
||||
Gen3 => EvolutionSet3.GetArray(data[0]),
|
||||
Gen4 => EvolutionSet4.GetArray(data[0]),
|
||||
Gen5 => EvolutionSet5.GetArray(data[0]),
|
||||
Gen6 => EvolutionSet6.GetArray(data),
|
||||
Gen7 => EvolutionSet7.GetArray(data),
|
||||
Gen8 => EvolutionSet7.GetArray(data),
|
||||
_ => throw new Exception()
|
||||
};
|
||||
}
|
||||
@@ -108,7 +109,7 @@ private EvolutionLineage[] CreateTree()
|
||||
var lineage = new EvolutionLineage[Entries.Count];
|
||||
for (int i = 0; i < Entries.Count; i++)
|
||||
lineage[i] = new EvolutionLineage();
|
||||
if (Game == GameVersion.Gen6)
|
||||
if (Game == Gen6)
|
||||
Array.Resize(ref lineage, MaxSpeciesTree + 1);
|
||||
|
||||
if (Game.GetGeneration() <= 6)
|
||||
@@ -119,13 +120,13 @@ private EvolutionLineage[] CreateTree()
|
||||
return lineage;
|
||||
}
|
||||
|
||||
private void GenerateEntriesSpeciesOnly(EvolutionLineage[] lineage)
|
||||
private void GenerateEntriesSpeciesOnly(IReadOnlyList<EvolutionLineage> lineage)
|
||||
{
|
||||
for (int species = 1; species < lineage.Length; species++)
|
||||
for (int species = 1; species < lineage.Count; species++)
|
||||
CreateBranch(lineage, species, 0, species);
|
||||
}
|
||||
|
||||
private void GenerateEntriesSpeciesForm(EvolutionLineage[] lineage)
|
||||
private void GenerateEntriesSpeciesForm(IReadOnlyList<EvolutionLineage> lineage)
|
||||
{
|
||||
for (int species = 1; species <= MaxSpeciesTree; species++)
|
||||
{
|
||||
@@ -264,9 +265,15 @@ public List<EvoCriteria> GetValidPreEvolutions(PKM pkm, int maxLevel, int maxSpe
|
||||
int index = GetIndex(pkm);
|
||||
if (maxSpeciesOrigin <= 0)
|
||||
maxSpeciesOrigin = Legal.GetMaxSpeciesOrigin(pkm);
|
||||
return Lineage[index].GetExplicitLineage(pkm, maxLevel, skipChecks, MaxSpeciesTree, maxSpeciesOrigin, minLevel);
|
||||
return Lineage[index].GetExplicitLineage(pkm, maxLevel, skipChecks, maxSpeciesOrigin, minLevel);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets all species the <see cref="species"/>-<see cref="form"/> can evolve to & from.
|
||||
/// </summary>
|
||||
/// <param name="species">Species ID</param>
|
||||
/// <param name="form">Form ID</param>
|
||||
/// <returns>Enumerable of species IDs.</returns>
|
||||
public IEnumerable<int> GetEvolutionsAndPreEvolutions(int species, int form)
|
||||
{
|
||||
foreach (var s in GetPreEvolutions(species, form))
|
||||
|
||||
@@ -98,12 +98,12 @@ private static Image GetSprite(PKM pk, bool isBoxBGRed = false)
|
||||
img = Spriter.GetSprite(Resources._249x, Lugia, pk.HeldItem, pk.IsEgg, pk.IsShiny, pk.Format, isBoxBGRed);
|
||||
GetSpriteGlow(pk, 75, 0, 130, out var pixels, out var baseSprite, true);
|
||||
var glowImg = ImageUtil.GetBitmap(pixels, baseSprite.Width, baseSprite.Height, baseSprite.PixelFormat);
|
||||
img = ImageUtil.LayerImage(glowImg, img, 0, 0);
|
||||
return ImageUtil.LayerImage(glowImg, img, 0, 0);
|
||||
}
|
||||
else if (pk is IGigantamax g && g.CanGigantamax)
|
||||
if (pk is IGigantamax g && g.CanGigantamax)
|
||||
{
|
||||
var gm = Resources.dyna;
|
||||
img = ImageUtil.LayerImage(img, gm, (img.Width - gm.Width) / 2, 0);
|
||||
return ImageUtil.LayerImage(img, gm, (img.Width - gm.Width) / 2, 0);
|
||||
}
|
||||
return img;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user