mirror of
https://github.com/kwsch/PKHeX.git
synced 2026-09-30 04:49:09 -05:00
Fix handling for get evolutions method
only used for Zukan7b, but add in handling so that it works for <=gen6 games, and supports form alterations too! update style to match GetPreEvolutions could probably update this to yield tuples (species, form) but LGPE/SWSH only needs species. If there's the need for tuples later, should be ez tweak.
This commit is contained in:
@@ -91,7 +91,7 @@ private EvolutionTree(IReadOnlyList<byte[]> data, GameVersion game, PersonalTabl
|
||||
Entries = GetEntries(data);
|
||||
|
||||
// Starting in Generation 7, forms have separate evolution data.
|
||||
int format = Game.GetGeneration();
|
||||
int format = Game - Gen1 + 1;
|
||||
var oldStyle = format < 7;
|
||||
var connections = oldStyle ? CreateTreeOld() : CreateTree();
|
||||
|
||||
@@ -214,7 +214,7 @@ public List<EvoCriteria> GetValidPreEvolutions(PKM pkm, int maxLevel, int maxSpe
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets all species the <see cref="species"/>-<see cref="form"/> can evolve to & from.
|
||||
/// Gets all species the <see cref="species"/>-<see cref="form"/> can evolve to & from, yielded in order of increasing evolution stage.
|
||||
/// </summary>
|
||||
/// <param name="species">Species ID</param>
|
||||
/// <param name="form">Form ID</param>
|
||||
@@ -235,6 +235,8 @@ private IEnumerable<int> GetPreEvolutions(int species, int form)
|
||||
foreach (var method in node)
|
||||
{
|
||||
var s = method.Species;
|
||||
if (s == 0)
|
||||
continue;
|
||||
var f = method.Form;
|
||||
yield return s;
|
||||
var preEvolutions = GetPreEvolutions(s, f);
|
||||
@@ -245,13 +247,18 @@ private IEnumerable<int> GetPreEvolutions(int species, int form)
|
||||
|
||||
private IEnumerable<int> GetEvolutions(int species, int form)
|
||||
{
|
||||
int index = GetLookupKey(species, form);
|
||||
var node = Lineage[index];
|
||||
foreach (var method in node)
|
||||
int format = Game - Gen1 + 1;
|
||||
int index = format < 7 ? species : Personal.GetFormeIndex(species, form);
|
||||
var evos = Entries[index];
|
||||
foreach (var method in evos)
|
||||
{
|
||||
var s = method.Species;
|
||||
if (s == 0)
|
||||
continue;
|
||||
var f = method.GetDestinationForm(form);
|
||||
yield return s;
|
||||
foreach (var next in GetEvolutions(s, form))
|
||||
var nextEvolutions = GetEvolutions(s, f);
|
||||
foreach (var next in nextEvolutions)
|
||||
yield return next;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user