diff --git a/PKHeX.Core/Legality/Encounters/EncounterStatic8N.cs b/PKHeX.Core/Legality/Encounters/EncounterStatic8N.cs index 36e6a1fcd..34453bd54 100644 --- a/PKHeX.Core/Legality/Encounters/EncounterStatic8N.cs +++ b/PKHeX.Core/Legality/Encounters/EncounterStatic8N.cs @@ -29,7 +29,7 @@ public EncounterStatic8N(byte nestID, uint minRank, uint maxRank, byte val) FlawlessIVCount = val; } - private readonly int[] LevelCaps = + private static readonly int[] LevelCaps = { 15, 20, // 0 25, 30, // 1 @@ -38,6 +38,8 @@ public EncounterStatic8N(byte nestID, uint minRank, uint maxRank, byte val) 55, 60, // 4 }; + public static bool IsHighestLevelTier(int lvl) => ArrayUtil.WithinRange(lvl, 55, 60); + protected override int GetMinimalLevel() => LevelCaps[MinRank * 2]; protected override bool IsMatchLevel(PKM pkm, int lvl) diff --git a/PKHeX.Core/Legality/Encounters/Information/ValidEncounterMoves.cs b/PKHeX.Core/Legality/Encounters/Information/ValidEncounterMoves.cs index 582173f30..9fa6be0ff 100644 --- a/PKHeX.Core/Legality/Encounters/Information/ValidEncounterMoves.cs +++ b/PKHeX.Core/Legality/Encounters/Information/ValidEncounterMoves.cs @@ -17,13 +17,27 @@ public sealed class ValidEncounterMoves private const int EmptyCount = PKX.Generation + 1; // one for each generation index (and 0th) private static readonly List[] Empty = new int[EmptyCount].Select(_ => new List()).ToArray(); - public ValidEncounterMoves(PKM pkm, LevelUpRestriction restrict) + public ValidEncounterMoves(PKM pkm, LevelUpRestriction restrict, IEncounterable encounter) { - LevelUpMoves = Legal.GetValidMovesAllGens(pkm, restrict.EvolutionChains, minLvLG1: restrict.MinimumLevelGen1, minLvLG2: restrict.MinimumLevelGen2, Tutor: false, Machine: false, RemoveTransferHM: false); + var originalGeneration = encounter is IGeneration g ? g.Generation : pkm.GenNumber; + var level = Legal.GetValidMovesAllGens(pkm, restrict.EvolutionChains, minLvLG1: restrict.MinimumLevelGen1, minLvLG2: restrict.MinimumLevelGen2, Tutor: false, Machine: false, RemoveTransferHM: false); + AddEdgeCaseMoves(level[originalGeneration], encounter, pkm); + + LevelUpMoves = level; TMHMMoves = Legal.GetValidMovesAllGens(pkm, restrict.EvolutionChains, LVL: false, Tutor: false, MoveReminder: false, RemoveTransferHM: false); TutorMoves = Legal.GetValidMovesAllGens(pkm, restrict.EvolutionChains, LVL: false, Machine: false, MoveReminder: false, RemoveTransferHM: false); } + private static void AddEdgeCaseMoves(List moves, IEncounterable encounter, PKM pkm) + { + switch (encounter) + { + case EncounterStatic8N r when pkm.Met_Location == Encounters8Nest.SharedNest && !EncounterStatic8N.IsHighestLevelTier(pkm.Met_Level): + moves.AddRange(MoveLevelUp.GetMovesLevelUp(pkm, r.Species, -1, -1, 60, r.Form, GameVersion.SW, false, 8)); + break; + } + } + public ValidEncounterMoves(IReadOnlyList[] levelup) { LevelUpMoves = levelup; diff --git a/PKHeX.Core/Legality/Encounters/Verifiers/VerifyCurrentMoves.cs b/PKHeX.Core/Legality/Encounters/Verifiers/VerifyCurrentMoves.cs index 2ea0d5c6b..34a09a329 100644 --- a/PKHeX.Core/Legality/Encounters/Verifiers/VerifyCurrentMoves.cs +++ b/PKHeX.Core/Legality/Encounters/Verifiers/VerifyCurrentMoves.cs @@ -41,7 +41,7 @@ private static CheckMoveResult[] ParseMovesForEncounters(PKM pkm, LegalInfo info // gather valid moves for encounter species var restrict = new LevelUpRestriction(pkm, info); - info.EncounterMoves = new ValidEncounterMoves(pkm, restrict); + info.EncounterMoves = new ValidEncounterMoves(pkm, restrict, info.EncounterMatch); IReadOnlyList defaultG1LevelMoves = Array.Empty(); IReadOnlyList defaultG2LevelMoves = Array.Empty();