Permit all generations prior to requested generation for know move check

This commit is contained in:
Kurt 2021-01-04 15:38:30 -08:00
parent cbc57dc794
commit acf811f5c1
2 changed files with 11 additions and 3 deletions

View File

@ -132,7 +132,7 @@ internal static bool GetCanRelearnMove(PKM pkm, int move, int generation, IReadO
return MoveList.GetValidMoves(pkm, version, evos, generation, types: MoveSourceType.Reminder).Contains(move);
}
internal static bool GetCanKnowMove(PKM pkm, int move, int generation, IReadOnlyList<EvoCriteria> evos, GameVersion version = GameVersion.Any)
internal static bool GetCanKnowMove(PKM pkm, int move, int generation, IReadOnlyList<IReadOnlyList<EvoCriteria>> evos, GameVersion version = GameVersion.Any)
{
if (pkm.Species == (int)Species.Smeargle)
return !InvalidSketch.Contains(move);
@ -140,7 +140,15 @@ internal static bool GetCanKnowMove(PKM pkm, int move, int generation, IReadOnly
if (generation >= 8 && MoveEgg.GetIsSharedEggMove(pkm, generation, move))
return true;
return MoveList.GetValidMoves(pkm, version, evos, generation, types: MoveSourceType.All).Contains(move);
if (evos.Count <= generation)
return false;
for (int i = 1; i <= generation; i++)
{
var moves = MoveList.GetValidMoves(pkm, version, evos[i], i, types: MoveSourceType.All);
if (moves.Contains(move))
return true;
}
return false;
}
internal static bool IsCatchRateHeldItem(int rate) => ParseSettings.AllowGen1Tradeback && HeldItems_GSC.Contains((ushort) rate);

View File

@ -94,7 +94,7 @@ private static bool CanKnowMove(PKM pkm, MemoryVariableSet memory, int gen, Lega
if (pkm.HasMove(move))
return true;
if (Legal.GetCanKnowMove(pkm, memory.Variable, gen, info.EvoChainsAllGens[gen]))
if (Legal.GetCanKnowMove(pkm, memory.Variable, gen, info.EvoChainsAllGens))
return true;
var enc = info.EncounterMatch;