From 110d25d50ed16cd78efca3f8769bd40f7c7c02ee Mon Sep 17 00:00:00 2001 From: Kurt Date: Fri, 27 Nov 2020 13:05:36 -0800 Subject: [PATCH] Add placeholder duplicate relearn move check --- .../Verifiers/VerifyRelearnMoves.cs | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/PKHeX.Core/Legality/Encounters/Verifiers/VerifyRelearnMoves.cs b/PKHeX.Core/Legality/Encounters/Verifiers/VerifyRelearnMoves.cs index 024d058d3..eead22cf9 100644 --- a/PKHeX.Core/Legality/Encounters/Verifiers/VerifyRelearnMoves.cs +++ b/PKHeX.Core/Legality/Encounters/Verifiers/VerifyRelearnMoves.cs @@ -126,6 +126,9 @@ namespace PKHeX.Core if (splitInvalid && e is EncounterEggSplit x) FlagSplitbreedMoves(result, reqBase, x); + var dupe = IsAnyRelearnMoveDuplicate(pkm); + if (dupe > 0) + result[dupe] = new CheckResult(Severity.Invalid, LMoveSourceDuplicate, CheckIdentifier.RelearnMove); return result; } @@ -197,5 +200,21 @@ namespace PKHeX.Core reqBase = Math.Min(4, unique); return reqBase; } + + private static int IsAnyRelearnMoveDuplicate(PKM pk) + { + int m1 = pk.RelearnMove1; + int m2 = pk.RelearnMove2; + + if (m1 != 0 && m1 == m2) + return 1; + int m3 = pk.RelearnMove3; + if (m3 != 0 && (m1 == m3 || m2 == m3)) + return 2; + int m4 = pk.RelearnMove4; + if (m4 != 0 && (m1 == m4 || m2 == m4 || m3 == m4)) + return 3; + return -1; + } } }