mirror of
https://github.com/kwsch/PKHeX
synced 2025-01-30 21:23:30 +00:00
Handle self-form pointer
Logic is much more clear now.
This commit is contained in:
parent
b15211ce1b
commit
528d927a85
1 changed files with 7 additions and 2 deletions
|
@ -137,14 +137,19 @@ internal static class EggMovesExtensions
|
|||
if (species > baseIndex)
|
||||
return [];
|
||||
|
||||
if (form == 0)
|
||||
if (form == 0 || baseIndex == species) // no form data if pointing to self
|
||||
return entry.Moves;
|
||||
|
||||
// Jump to the associated form's entry within the table.
|
||||
return table.GetFormEntry(form, baseIndex);
|
||||
}
|
||||
|
||||
private static ReadOnlySpan<ushort> GetFormEntry(this EggMoves7[] table, byte form, ushort baseIndex)
|
||||
{
|
||||
var index = form - 1u + baseIndex;
|
||||
if (index >= table.Length)
|
||||
return [];
|
||||
entry = table[index];
|
||||
var entry = table[index];
|
||||
|
||||
// Double-check that the entry is still associated to the species.
|
||||
if (entry.FormTableIndex != baseIndex)
|
||||
|
|
Loading…
Reference in a new issue