Add alcremie form display for dex edit

Nothing for the PKM Editor; not sure how I want to handle the reused
FormDuration work value.

For the meantime, just use the Batch Editor for a targeted write.

Closes #2441
This commit is contained in:
Kurt
2019-11-17 09:34:04 -08:00
parent 23c04cf809
commit d077d8549e
5 changed files with 58 additions and 7 deletions

View File

@@ -0,0 +1,13 @@
namespace PKHeX.Core
{
public enum AlcremieDecoration
{
Strawberry = 0,
Berry = 1,
Love = 2,
Star = 3,
Clover = 4,
Flower = 5,
Ribbon = 6,
}
}

View File

@@ -934,5 +934,32 @@ private static string[] GetSingleGigantamax(IReadOnlyList<string> types, IReadOn
forms[Gigantamax], // Gigantamax
};
}
public static string[] GetAlcremieFormList(IReadOnlyList<string> 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;
}
}
}

View File

@@ -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;

View File

@@ -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);
}

View File

@@ -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)