mirror of
https://github.com/kwsch/PKHeX.git
synced 2026-09-30 19:27:45 -05:00
Minor tweaks
Pass evo chain to memory learning machine move Pass minimum level for GB encounters if present, rather than enc min level
This commit is contained in:
@@ -173,12 +173,13 @@ private static CheckMoveResult[] ParseMovesGenGB(PKM pkm, IReadOnlyList<int> cur
|
||||
{
|
||||
var res = new CheckMoveResult[4];
|
||||
var enc = info.EncounterMatch;
|
||||
var level = pkm.HasOriginalMetLocation ? pkm.Met_Level : enc.LevelMin;
|
||||
var InitialMoves = Array.Empty<int>();
|
||||
var SpecialMoves = GetSpecialMoves(enc);
|
||||
var games = enc.Generation == 1 ? GBRestrictions.GetGen1Versions(enc) : GBRestrictions.GetGen2Versions(enc, pkm.Korean);
|
||||
foreach (var ver in games)
|
||||
{
|
||||
var VerInitialMoves = MoveLevelUp.GetEncounterMoves(enc.Species, 0, enc.LevelMin, ver);
|
||||
var VerInitialMoves = MoveLevelUp.GetEncounterMoves(enc.Species, 0, level, ver);
|
||||
if (VerInitialMoves.Intersect(InitialMoves).Count() == VerInitialMoves.Length)
|
||||
return res;
|
||||
|
||||
@@ -727,24 +728,24 @@ private static void VerifyNoEmptyDuplicates(IReadOnlyList<int> moves, CheckMoveR
|
||||
}
|
||||
}
|
||||
|
||||
private static void FlagDuplicateMovesAfterIndex(IReadOnlyList<int> moves, CheckMoveResult[] res, int i, int move)
|
||||
private static void FlagDuplicateMovesAfterIndex(IReadOnlyList<int> moves, CheckMoveResult[] res, int index, int move)
|
||||
{
|
||||
for (int j = i + 1; j < 4; j++)
|
||||
for (int i = index + 1; i < 4; i++)
|
||||
{
|
||||
if (moves[j] != move)
|
||||
if (moves[i] != move)
|
||||
continue;
|
||||
res[i] = new CheckMoveResult(res[i], Invalid, LMoveSourceDuplicate);
|
||||
res[index] = new CheckMoveResult(res[index], Invalid, LMoveSourceDuplicate);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
private static void FlagEmptySlotsBeforeIndex(IReadOnlyList<int> moves, CheckMoveResult[] res, int i)
|
||||
private static void FlagEmptySlotsBeforeIndex(IReadOnlyList<int> moves, CheckMoveResult[] res, int index)
|
||||
{
|
||||
for (int k = i - 1; k >= 0; k--)
|
||||
for (int i = index - 1; i >= 0; i--)
|
||||
{
|
||||
if (moves[k] != 0)
|
||||
if (moves[i] != 0)
|
||||
return;
|
||||
res[k] = new CheckMoveResult(res[k], Invalid, LMoveSourceEmpty);
|
||||
res[i] = new CheckMoveResult(res[i], Invalid, LMoveSourceEmpty);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -96,6 +96,11 @@ private static bool CanBuyItem8(int item, GameVersion version)
|
||||
public static bool GetCanLearnMachineMove(PKM pkm, int move, int generation, GameVersion version = GameVersion.Any)
|
||||
{
|
||||
var evos = EvolutionChain.GetValidPreEvolutions(pkm);
|
||||
return GetCanLearnMachineMove(pkm, evos, move, generation, version);
|
||||
}
|
||||
|
||||
public static bool GetCanLearnMachineMove(PKM pkm, IReadOnlyList<EvoCriteria> evos, int move, int generation, GameVersion version = GameVersion.Any)
|
||||
{
|
||||
return MoveList.GetValidMoves(pkm, version, evos, generation, types: MoveSourceType.AllMachines).Contains(move);
|
||||
}
|
||||
|
||||
|
||||
@@ -27,14 +27,14 @@ private CheckResult VerifyCommonMemory(PKM pkm, int handler, int gen, LegalInfo
|
||||
if (matchingMoveMemory != -1)
|
||||
{
|
||||
// Gen8 has no HMs, so this memory can never exist.
|
||||
if (gen != 6 || (pkm.Species != (int)Species.Smeargle && !GetCanLearnMachineMove(pkm, Memories.MoveSpecificMemories[1][matchingMoveMemory], 6)))
|
||||
if (gen != 6 || (pkm.Species != (int)Species.Smeargle && !GetCanLearnMachineMove(pkm, info.EvoChainsAllGens[gen], Memories.MoveSpecificMemories[1][matchingMoveMemory], 6)))
|
||||
return GetInvalid(string.Format(LMemoryArgBadMove, memory.Handler));
|
||||
}
|
||||
|
||||
switch (memory.MemoryID)
|
||||
{
|
||||
// {0} saw {2} carrying {1} on its back. {4} that {3}.
|
||||
case 21 when gen != 6 || !GetCanLearnMachineMove(new PK6 {Species = memory.Variable, EXP = Experience.GetEXP(100, PersonalTable.XY.GetFormIndex(memory.Variable, 0))}, 19, 6):
|
||||
case 21 when gen != 6 || !GetCanLearnMachineMove(new PK6 {Species = memory.Variable, EXP = Experience.GetEXP(100, PersonalTable.XY.GetFormIndex(memory.Variable, 0))}, (int)Move.Fly, 6):
|
||||
return GetInvalid(string.Format(LMemoryArgBadMove, memory.Handler));
|
||||
|
||||
case 16 or 48 when !CanKnowMove(pkm, memory, gen, info, memory.MemoryID == 16):
|
||||
|
||||
Reference in New Issue
Block a user