diff --git a/PKHeX.Core/Editing/ShowdownSet.cs b/PKHeX.Core/Editing/ShowdownSet.cs index 998d3699d..55d690549 100644 --- a/PKHeX.Core/Editing/ShowdownSet.cs +++ b/PKHeX.Core/Editing/ShowdownSet.cs @@ -189,6 +189,8 @@ private void ParseLines(IEnumerable lines) int move = StringUtil.FindIndexIgnoreCase(Strings.movelist, moveString); if (move < 0) InvalidLines.Add($"Unknown Move: {moveString}"); + else if (Moves.Contains(move)) + InvalidLines.Add($"Duplicate Move: {moveString}"); else Moves[movectr++] = move; diff --git a/Tests/PKHeX.Core.Tests/Simulator/ShowdownSetTests.cs b/Tests/PKHeX.Core.Tests/Simulator/ShowdownSetTests.cs index e610fcf0c..a6d88bea1 100644 --- a/Tests/PKHeX.Core.Tests/Simulator/ShowdownSetTests.cs +++ b/Tests/PKHeX.Core.Tests/Simulator/ShowdownSetTests.cs @@ -1,5 +1,6 @@ using System; using System.Linq; +using FluentAssertions; using PKHeX.Core; using Xunit; @@ -157,6 +158,26 @@ public void SimulatorParseMultiple() Assert.True(!sets.Any()); } + [Theory] + [InlineData(SetDuplicateMoves, 3)] + public void SimulatorParseDuplicate(string text, int moveCount) + { + var set = new ShowdownSet(text); + var actual = set.Moves.Count(z => z != 0); + actual.Should().Be(moveCount); + } + + private const string SetDuplicateMoves = +@"Kingler-Gmax @ Master Ball +Ability: Sheer Force +Shiny: Yes +EVs: 252 Atk / 4 SpD / 252 Spe +Jolly Nature +- Crabhammer +- Rock Slide +- Rock Slide +- X-Scissor"; + private const string SetROCKSMetang = @"Metang IVs: 20 HP / 3 Atk / 26 Def / 1 SpA / 6 SpD / 8 Spe