mirror of
https://github.com/kwsch/PKHeX
synced 2024-11-10 14:44:24 +00:00
Filter out duplicate moves
This commit is contained in:
parent
5a89c6af4c
commit
7919beaddc
2 changed files with 23 additions and 0 deletions
|
@ -189,6 +189,8 @@ namespace PKHeX.Core
|
|||
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;
|
||||
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
using System;
|
||||
using System.Linq;
|
||||
using FluentAssertions;
|
||||
using PKHeX.Core;
|
||||
using Xunit;
|
||||
|
||||
|
@ -157,6 +158,26 @@ namespace PKHeX.Tests.Simulator
|
|||
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
|
||||
|
|
Loading…
Reference in a new issue