From 20dcb8d407c00fef10b3938eed8c7823bf9c5b81 Mon Sep 17 00:00:00 2001 From: Kurt Date: Tue, 6 Sep 2022 21:04:40 -0700 Subject: [PATCH] Remove old showdown set aliases Don't need to support sets that don't follow the current standard. --- PKHeX.Core/Editing/Showdown/ShowdownSet.cs | 31 ++++++++-------------- 1 file changed, 11 insertions(+), 20 deletions(-) diff --git a/PKHeX.Core/Editing/Showdown/ShowdownSet.cs b/PKHeX.Core/Editing/Showdown/ShowdownSet.cs index 942fd3642..b81102f6a 100644 --- a/PKHeX.Core/Editing/Showdown/ShowdownSet.cs +++ b/PKHeX.Core/Editing/Showdown/ShowdownSet.cs @@ -202,15 +202,15 @@ public sealed class ShowdownSet : IBattleTemplate private bool ParseEntry(string identifier, string value) => identifier switch { - "Ability" or "Trait" => (Ability = StringUtil.FindIndexIgnoreCase(Strings.abilitylist, value)) >= 0, - "Nature" => (Nature = StringUtil.FindIndexIgnoreCase(Strings.natures , value)) >= 0, - "Shiny" => Shiny = StringUtil.IsMatchIgnoreCase("Yes", value), - "Gigantamax" => CanGigantamax = StringUtil.IsMatchIgnoreCase("Yes", value), - "Friendship" or "Happiness" => ParseFriendship(value), - "EV" or "EVs" => ParseLineEVs(value), - "IV" or "IVs" => ParseLineIVs(value), - "Level" => ParseLevel(value), - "Dynamax Level" => ParseDynamax(value), + "Ability" => (Ability = StringUtil.FindIndexIgnoreCase(Strings.abilitylist, value)) >= 0, + "Nature" => (Nature = StringUtil.FindIndexIgnoreCase(Strings.natures , value)) >= 0, + "Shiny" => Shiny = StringUtil.IsMatchIgnoreCase("Yes", value), + "Gigantamax" => CanGigantamax = StringUtil.IsMatchIgnoreCase("Yes", value), + "Friendship" => ParseFriendship(value), + "EVs" => ParseLineEVs(value), + "IVs" => ParseLineIVs(value), + "Level" => ParseLevel(value), + "Dynamax Level" => ParseDynamax(value), _ => false, }; @@ -636,7 +636,7 @@ public sealed class ShowdownSet : IBattleTemplate private bool ParseLineEVs(string line) { - var list = SplitLineStats(line); + var list = line.Split(StatSplitters, StringSplitOptions.None); if ((list.Length & 1) == 1) InvalidLines.Add("Unknown EV input."); for (int i = 0; i < list.Length / 2; i++) @@ -656,7 +656,7 @@ public sealed class ShowdownSet : IBattleTemplate private bool ParseLineIVs(string line) { - var list = SplitLineStats(line); + var list = line.Split(StatSplitters, StringSplitOptions.None); if ((list.Length & 1) == 1) InvalidLines.Add("Unknown IV input."); for (int i = 0; i < list.Length / 2; i++) @@ -687,13 +687,4 @@ public sealed class ShowdownSet : IBattleTemplate return original; return new string(result[..ctr].ToArray()); } - - private static string[] SplitLineStats(string line) - { - // Because people think they can type sets out... - return line - .Replace("SAtk", "SpA").Replace("Sp Atk", "SpA") - .Replace("SDef", "SpD").Replace("Sp Def", "SpD") - .Replace("Spd", "Spe").Replace("Speed", "Spe").Split(StatSplitters, StringSplitOptions.None); - } }