diff --git a/PKHeX.Core/PKM/Shared/AlcremieDecoration.cs b/PKHeX.Core/PKM/Shared/AlcremieDecoration.cs new file mode 100644 index 000000000..bd9ca2df8 --- /dev/null +++ b/PKHeX.Core/PKM/Shared/AlcremieDecoration.cs @@ -0,0 +1,13 @@ +namespace PKHeX.Core +{ + public enum AlcremieDecoration + { + Strawberry = 0, + Berry = 1, + Love = 2, + Star = 3, + Clover = 4, + Flower = 5, + Ribbon = 6, + } +} diff --git a/PKHeX.Core/PKM/Util/FormConverter.cs b/PKHeX.Core/PKM/Util/FormConverter.cs index a3591ffd7..f6bf1ed86 100644 --- a/PKHeX.Core/PKM/Util/FormConverter.cs +++ b/PKHeX.Core/PKM/Util/FormConverter.cs @@ -934,5 +934,32 @@ private static string[] GetSingleGigantamax(IReadOnlyList types, IReadOn forms[Gigantamax], // Gigantamax }; } + + public static string[] GetAlcremieFormList(IReadOnlyList forms) + { + var result = new string[63]; + result[0 * 7] = forms[(int) Alcremie]; // Vanilla Cream + result[1 * 7] = forms[RubyCream]; + result[2 * 7] = forms[MatchaCream]; + result[3 * 7] = forms[MintCream]; + result[4 * 7] = forms[LemonCream]; + result[5 * 7] = forms[SaltedCream]; + result[6 * 7] = forms[RubySwirl]; + result[7 * 7] = forms[CaramelSwirl]; + result[8 * 7] = forms[RainbowSwirl]; + + const int deco = 7; + const int fc = 9; + for (int f = 0; f < fc; f++) + { + int start = f * deco; + for (int i = deco - 1; i >= 0; i--) + { + result[start + i] = result[start] + $" ({((AlcremieDecoration) i).ToString()})"; + } + } + + return result; + } } } diff --git a/PKHeX.Core/Saves/SAV8SWSH.cs b/PKHeX.Core/Saves/SAV8SWSH.cs index 22b2653db..65ea51ec0 100644 --- a/PKHeX.Core/Saves/SAV8SWSH.cs +++ b/PKHeX.Core/Saves/SAV8SWSH.cs @@ -83,11 +83,14 @@ private void Initialize() protected override void SetPartyValues(PKM pkm, bool isParty) { base.SetPartyValues(pkm, isParty); - ((PK8)pkm).FormDuration = GetFormDuration(pkm, isParty); + ((PK8)pkm).FormDuration = GetFormDuration((PK8)pkm, isParty); } - private static uint GetFormDuration(PKM pkm, bool isParty) + private static uint GetFormDuration(PK8 pkm, bool isParty) { + if (pkm.Species == (int) Species.Alcremie) + return pkm.FormDuration & 7; + if (!isParty || pkm.AltForm == 0) return 0; diff --git a/PKHeX.Core/Saves/Substructures/PokeDex/Zukan8.cs b/PKHeX.Core/Saves/Substructures/PokeDex/Zukan8.cs index a7a831b73..30c0ed36a 100644 --- a/PKHeX.Core/Saves/Substructures/PokeDex/Zukan8.cs +++ b/PKHeX.Core/Saves/Substructures/PokeDex/Zukan8.cs @@ -271,7 +271,7 @@ public override void SetDex(PKM pkm) if (species == (int)Species.Alcremie) { form *= 7; - form += 0; // alteration byte? + form += (int)((PK8)pkm).FormDuration; // alteration byte } else if (species == (int) Species.Eternatus && pkm.AltForm == 1) { @@ -415,7 +415,9 @@ private void SetAllSeen(int species, bool value = true, bool shinyToo = false) if (species == (int) Species.Alcremie) { // Alcremie forms - for (int i = 0; i < 7 * 8; i++) + const int deco = 7; + const int forms = 9; + for (int i = 0; i < deco * forms; i++) // 0-62 SeenAll(species, i, value, pi, shinyToo); } diff --git a/PKHeX.WinForms/Subforms/Save Editors/Gen8/SAV_PokedexSWSH.cs b/PKHeX.WinForms/Subforms/Save Editors/Gen8/SAV_PokedexSWSH.cs index 879d585eb..8588b84fb 100644 --- a/PKHeX.WinForms/Subforms/Save Editors/Gen8/SAV_PokedexSWSH.cs +++ b/PKHeX.WinForms/Subforms/Save Editors/Gen8/SAV_PokedexSWSH.cs @@ -86,9 +86,7 @@ private void GetEntry() if (s <= 0) return; - var forms = FormConverter - .GetFormList(s, GameInfo.Strings.Types, GameInfo.Strings.forms, GameInfo.GenderSymbolASCII, 8) - .ToArray(); + var forms = GetFormList(s); if (forms[0].Length == 0) forms[0] = GameInfo.Strings.Types[0]; @@ -118,6 +116,14 @@ private void GetEntry() NUD_Battled.Value = Dex.GetBattledCount(s); } + private static string[] GetFormList(in int species) + { + var s = GameInfo.Strings; + if (species == (int)Species.Alcremie) + return FormConverter.GetAlcremieFormList(s.forms); + return FormConverter.GetFormList(species, s.Types, s.forms, GameInfo.GenderSymbolASCII, 8).ToArray(); + } + private void SetEntry() { if (!CanSave || Loading)