diff --git a/PKHeX.Core/PKM/Shared/IFormArgument.cs b/PKHeX.Core/PKM/Shared/IFormArgument.cs index d1496c317..002211c0e 100644 --- a/PKHeX.Core/PKM/Shared/IFormArgument.cs +++ b/PKHeX.Core/PKM/Shared/IFormArgument.cs @@ -1,4 +1,5 @@ using System; +using static PKHeX.Core.Species; namespace PKHeX.Core { @@ -38,7 +39,7 @@ public interface IFormArgument /// /// Logic for mutating an object. /// - public static class FormArgumentExtensions + public static class FormArgumentUtil { /// /// Sets the suggested Form Argument to the . @@ -47,12 +48,12 @@ public static void SetSuggestedFormArgument(this PKM pkm) { if (pkm is not IFormArgument) return; - if (!FormConverter.IsFormArgumentTypeDatePair(pkm.Species, pkm.Form)) + if (!IsFormArgumentTypeDatePair(pkm.Species, pkm.Form)) { pkm.ChangeFormArgument(0); return; } - var max = FormConverter.GetFormArgumentMax(pkm.Species, pkm.Form, pkm.Format); + var max = GetFormArgumentMax(pkm.Species, pkm.Form, pkm.Format); pkm.ChangeFormArgument(max); } @@ -76,13 +77,13 @@ public static void ChangeFormArgument(this PKM pkm, uint value) /// Value to apply public static void ChangeFormArgument(this IFormArgument f, int species, int form, int generation, uint value) { - if (!FormConverter.IsFormArgumentTypeDatePair(species, form)) + if (!IsFormArgumentTypeDatePair(species, form)) { f.FormArgument = value; return; } - var max = FormConverter.GetFormArgumentMax(species, form, generation); + var max = GetFormArgumentMax(species, form, generation); f.FormArgumentRemain = (byte)value; if (value == max) { @@ -95,5 +96,32 @@ public static void ChangeFormArgument(this IFormArgument f, int species, int for if (species == (int)Species.Furfrou) f.FormArgumentMaximum = Math.Max(f.FormArgumentMaximum, elapsed); } + + + public static uint GetFormArgumentMax(int species, int form, int generation) + { + if (generation <= 5) + return 0; + + return species switch + { + (int)Furfrou when form != 0 => 5, + (int)Hoopa when form == 1 => 3, + (int)Yamask when form == 1 => 9999, + (int)Runerigus when form == 0 => 9999, + (int)Alcremie => (uint)AlcremieDecoration.Ribbon, + _ => 0, + }; + } + + public static bool IsFormArgumentTypeDatePair(int species, int form) + { + return species switch + { + (int)Furfrou when form != 0 => true, + (int)Hoopa when form == 1 => true, + _ => false, + }; + } } } diff --git a/PKHeX.Core/PKM/Util/FormConverter.cs b/PKHeX.Core/PKM/Util/FormConverter.cs index 715154634..720273ab3 100644 --- a/PKHeX.Core/PKM/Util/FormConverter.cs +++ b/PKHeX.Core/PKM/Util/FormConverter.cs @@ -732,32 +732,6 @@ public static string[] GetAlcremieFormList(IReadOnlyList forms) return result; } - public static uint GetFormArgumentMax(int species, int form, int generation) - { - if (generation <= 5) - return 0; - - return species switch - { - (int)Furfrou when form != 0 => 5, - (int)Hoopa when form == 1 => 3, - (int)Yamask when form == 1 => 9999, - (int)Runerigus when form == 0 => 9999, - (int)Alcremie => (uint)AlcremieDecoration.Ribbon, - _ => 0, - }; - } - - public static bool IsFormArgumentTypeDatePair(int species, int form) - { - return species switch - { - (int)Furfrou when form != 0 => true, - (int)Hoopa when form == 1 => true, - _ => false, - }; - } - public static bool GetFormArgumentIsNamedIndex(int species) => species == (int)Alcremie; public static string[] GetFormArgumentStrings(int species) => species switch diff --git a/PKHeX.Core/Saves/SAV8.cs b/PKHeX.Core/Saves/SAV8.cs index 13c4f3081..717222c9a 100644 --- a/PKHeX.Core/Saves/SAV8.cs +++ b/PKHeX.Core/Saves/SAV8.cs @@ -107,7 +107,7 @@ protected override void SetPKM(PKM pkm, bool isParty = false) DateTime Date = DateTime.Now; pk.Trade(this, Date.Day, Date.Month, Date.Year); - if (FormConverter.IsFormArgumentTypeDatePair(pk.Species, pk.Form)) + if (FormArgumentUtil.IsFormArgumentTypeDatePair(pk.Species, pk.Form)) { pk.FormArgumentElapsed = pk.FormArgumentMaximum = 0; pk.FormArgumentRemain = (byte)GetFormArgument(pkm); diff --git a/PKHeX.WinForms/Controls/PKM Editor/FormArgument.cs b/PKHeX.WinForms/Controls/PKM Editor/FormArgument.cs index 19dbae5c5..a7f2772cc 100644 --- a/PKHeX.WinForms/Controls/PKM Editor/FormArgument.cs +++ b/PKHeX.WinForms/Controls/PKM Editor/FormArgument.cs @@ -17,7 +17,7 @@ public partial class FormArgument : UserControl public void LoadArgument(IFormArgument f, int species, int form, int generation) { FieldsLoaded = false; - var max = FormConverter.GetFormArgumentMax(species, form, generation); + var max = FormArgumentUtil.GetFormArgumentMax(species, form, generation); if (max == 0) { CurrentSpecies = species; @@ -60,7 +60,7 @@ public void LoadArgument(IFormArgument f, int species, int form, int generation) CurrentForm = form; CurrentGeneration = generation; - if (FormConverter.IsFormArgumentTypeDatePair(species, form)) + if (FormArgumentUtil.IsFormArgumentTypeDatePair(species, form)) CurrentValue = f.FormArgumentRemain; else CurrentValue = f.FormArgument;