Add placeholder duplicate relearn move check

This commit is contained in:
Kurt 2020-11-27 13:05:36 -08:00
parent 26d6143325
commit 110d25d50e

View file

@ -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;
}
}
}