mirror of
https://github.com/kwsch/PKHeX.git
synced 2026-08-24 15:54:14 -05:00
Simplify shared egg move array get
This commit is contained in:
@@ -180,10 +180,7 @@ private static IEnumerable<int> GetMovesForGeneration(PKM pk, IReadOnlyList<EvoC
|
||||
{
|
||||
// Shared Egg Moves via daycare
|
||||
// Any egg move can be obtained
|
||||
var evo = chain[chain.Count - 1];
|
||||
var shared = MoveEgg.GetEggMoves(8, evo.Species, evo.Form, GameVersion.SW);
|
||||
if (shared.Length != 0)
|
||||
moves = moves.Concat(shared);
|
||||
moves = moves.Concat(MoveEgg.GetSharedEggMoves(pk, generation));
|
||||
|
||||
// TR moves -- default logic checks the TR flags, so we need to add all possible ones here.
|
||||
moves = moves.Concat(MoveTechnicalMachine.GetAllPossibleRecords(pk.Species, pk.Form));
|
||||
|
||||
@@ -69,12 +69,19 @@ public static bool GetIsSharedEggMove(PKM pkm, int gen, int move)
|
||||
{
|
||||
if (gen < 8 || pkm.IsEgg)
|
||||
return false;
|
||||
var egg = GetSharedEggMoves(pkm, gen);
|
||||
return Array.IndexOf(egg, move) >= 0;
|
||||
}
|
||||
|
||||
public static int[] GetSharedEggMoves(PKM pkm, int gen)
|
||||
{
|
||||
if (gen < 8 || pkm.IsEgg)
|
||||
return Array.Empty<int>();
|
||||
var table = PersonalTable.SWSH;
|
||||
var entry = (PersonalInfoSWSH)table.GetFormEntry(pkm.Species, pkm.Form);
|
||||
var baseSpecies = entry.HatchSpecies;
|
||||
var baseForm = entry.HatchFormIndexEverstone;
|
||||
var egg = GetEggMoves(8, baseSpecies, baseForm, SW);
|
||||
return Array.Exists(egg, z => z == move);
|
||||
return GetEggMoves(8, baseSpecies, baseForm, SW);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user