From d25f388bf529bed6de6c16f7f2f89f6b1c6dade8 Mon Sep 17 00:00:00 2001 From: Kurt Date: Fri, 22 Nov 2019 19:59:34 -0800 Subject: [PATCH] Fix dexnav relearn checks Closes #2491 Thanks @NinFanBoyFTW ! --- .../Generator/EncounterSlotGenerator.cs | 14 -------------- .../Encounters/Verifiers/VerifyRelearnMoves.cs | 6 +++--- .../035 - Clefairy - 2A2C8A94FA80 dexnav.pk6 | Bin 0 -> 260 bytes .../087 - Dewgong - B33438369BC5 dexnav.pk6 | Bin 0 -> 260 bytes .../097 - Hypno - F845514A2D54 dexnav.pk6 | Bin 0 -> 260 bytes .../295 - Exploud - 24A2112B6A94 dexnav.pk6 | Bin 0 -> 260 bytes 6 files changed, 3 insertions(+), 17 deletions(-) create mode 100644 Tests/PKHeX.Core.Tests/Legality/Legal/Generation 6/035 - Clefairy - 2A2C8A94FA80 dexnav.pk6 create mode 100644 Tests/PKHeX.Core.Tests/Legality/Legal/Generation 6/087 - Dewgong - B33438369BC5 dexnav.pk6 create mode 100644 Tests/PKHeX.Core.Tests/Legality/Legal/Generation 6/097 - Hypno - F845514A2D54 dexnav.pk6 create mode 100644 Tests/PKHeX.Core.Tests/Legality/Legal/Generation 6/295 - Exploud - 24A2112B6A94 dexnav.pk6 diff --git a/PKHeX.Core/Legality/Encounters/Generator/EncounterSlotGenerator.cs b/PKHeX.Core/Legality/Encounters/Generator/EncounterSlotGenerator.cs index 7e82d3090..80fd7832f 100644 --- a/PKHeX.Core/Legality/Encounters/Generator/EncounterSlotGenerator.cs +++ b/PKHeX.Core/Legality/Encounters/Generator/EncounterSlotGenerator.cs @@ -164,20 +164,6 @@ private static bool IsHiddenAbilitySlot(this EncounterSlot slot) return slot.Permissions.DexNav || slot.Type == SlotType.FriendSafari || slot.Type == SlotType.Horde || slot.Type == SlotType.SOS; } - internal static bool IsDexNavValid(PKM pkm) - { - if (!pkm.AO || !pkm.InhabitedGeneration(6)) - return false; - - var vs = EvolutionChain.GetValidPreEvolutions(pkm); - var table = pkm.Version == (int) GameVersion.AS ? SlotsA : SlotsO; - int loc = pkm.Met_Location; - var areas = table.Where(l => l.Location == loc); - var minlvl = GetMinLevelEncounter(pkm); - var d_areas = areas.Select(area => GetValidEncounterSlots(pkm, area, vs, minlvl)); - return d_areas.Any(slots => slots.Any(slot => slot.Permissions.AllowDexNav && slot.Permissions.DexNav)); - } - internal static EncounterArea GetCaptureLocation(PKM pkm) { var vs = EvolutionChain.GetValidPreEvolutions(pkm); diff --git a/PKHeX.Core/Legality/Encounters/Verifiers/VerifyRelearnMoves.cs b/PKHeX.Core/Legality/Encounters/Verifiers/VerifyRelearnMoves.cs index 17a1c512f..a6d94a4d7 100644 --- a/PKHeX.Core/Legality/Encounters/Verifiers/VerifyRelearnMoves.cs +++ b/PKHeX.Core/Legality/Encounters/Verifiers/VerifyRelearnMoves.cs @@ -23,7 +23,7 @@ public static CheckResult[] VerifyRelearn(PKM pkm, LegalInfo info) MysteryGift g => VerifyRelearnSpecifiedMoveset(pkm, info, g.RelearnMoves), IRelearn s when s.Relearn.Length > 0 => VerifyRelearnSpecifiedMoveset(pkm, info, s.Relearn), EncounterEgg e => VerifyRelearnEggBase(pkm, info, e), - EncounterSlot z when pkm.RelearnMove1 != 0 && z.Permissions.DexNav && EncounterSlotGenerator.IsDexNavValid(pkm) => VerifyRelearnDexNav(pkm, info), + EncounterSlot z when pkm.RelearnMove1 != 0 && z.Permissions.DexNav => VerifyRelearnDexNav(pkm, info), _ => VerifyRelearnNone(pkm, info) }; } @@ -50,8 +50,8 @@ private static CheckResult[] VerifyRelearnDexNav(PKM pkm, LegalInfo info) int[] RelearnMoves = pkm.RelearnMoves; // DexNav Pokémon can have 1 random egg move as a relearn move. - var enc = info.EncounterMatch; - result[0] = !Legal.GetValidRelearn(pkm, enc.Species, enc.Form, true).Contains(RelearnMoves[0]) + var baseSpec = Legal.GetBaseSpecies(pkm); + result[0] = !Legal.GetValidRelearn(pkm, baseSpec.Species, baseSpec.Form, true).Contains(RelearnMoves[0]) ? new CheckResult(Severity.Invalid, LMoveRelearnDexNav, CheckIdentifier.RelearnMove) : new CheckResult(CheckIdentifier.RelearnMove); diff --git a/Tests/PKHeX.Core.Tests/Legality/Legal/Generation 6/035 - Clefairy - 2A2C8A94FA80 dexnav.pk6 b/Tests/PKHeX.Core.Tests/Legality/Legal/Generation 6/035 - Clefairy - 2A2C8A94FA80 dexnav.pk6 new file mode 100644 index 0000000000000000000000000000000000000000..69afc0d58d7931fa3cbc4520b5bb52aac4c8cc9a GIT binary patch literal 260 zcmZqpHKmJzK}SoOfq}tt*Q98M6ATP3EDQ{$i?}%0nSg=>fHOl5Ln=cWLn1>aLlHwI zlIqpTN(@{ga{M6S-Eg^A2iUFP91)+suN2!DMqd0|SHQu1V1yGZ`5485tOEtz=uk4-_K=To_Ur${Erb@)`1gBr@=2 zJj$5G=*cJ}#K{B__XU~?0sp_BH-fQArF|I^8A^Z<6ZkMNGHNhz0wn}F#DSy^Ba;$? Ow4n+k*mg|y2oV4tw-b>7 literal 0 HcmV?d00001 diff --git a/Tests/PKHeX.Core.Tests/Legality/Legal/Generation 6/097 - Hypno - F845514A2D54 dexnav.pk6 b/Tests/PKHeX.Core.Tests/Legality/Legal/Generation 6/097 - Hypno - F845514A2D54 dexnav.pk6 new file mode 100644 index 0000000000000000000000000000000000000000..5198eea90b24e9c949abc6a99abb5981858d504b GIT binary patch literal 260 zcmWI1^$KKQaQ%_Uz`$U+Yf^MYCIbUMBLjm`>@|CSCZHez;K5MIP{5GKkdL8Gh_Ra? zfx(7BL|t73Bq;5EHmDFftl4Fasq7ImChF7X~Id25CbT IMuNTo00~zSi~s-t literal 0 HcmV?d00001 diff --git a/Tests/PKHeX.Core.Tests/Legality/Legal/Generation 6/295 - Exploud - 24A2112B6A94 dexnav.pk6 b/Tests/PKHeX.Core.Tests/Legality/Legal/Generation 6/295 - Exploud - 24A2112B6A94 dexnav.pk6 new file mode 100644 index 0000000000000000000000000000000000000000..2ef5c33c12e0bcd78af9077b751ac5745b392287 GIT binary patch literal 260 zcmbP|r7g(7ut-Ink%3{&7GZ;sy9^B4Kz8Mt$y#De3eeLn%WFit2R6 zzYL!k<}h$^@pFMB(t)NzKu!N-eP4z|h7use0vJ^ckwx7Y7+IJYIH5wg^?5TeF`6?l X1Jwy~hyY0~Mt*e$DMJ-Tg1!I%DGe04 literal 0 HcmV?d00001