Add unown form editing gen2

Also add in some sun/moon form info (may not trigger)
Passing eventargs feels janky but works.

Should resolve query in #334
This commit is contained in:
Kaphotics
2016-10-22 10:38:33 -07:00
parent 897e05800e
commit 58981dcaab
2 changed files with 51 additions and 15 deletions

View File

@@ -1620,10 +1620,6 @@ private void setForms()
return;
CB_Form.DataSource = PKX.getFormList(species, types, forms, gendersymbols, SAV.Generation).ToList();
if (SAV.Generation < 3)
{
Label_Form.Visible = CB_Form.Visible = CB_Form.Enabled = false;
}
}
private void setAbilityList()
{
@@ -1980,7 +1976,8 @@ private void updateIVs(object sender, EventArgs e)
Label_Gender.ForeColor = pkm.Gender == 2
? Label_Species.ForeColor
: (pkm.Gender == 1 ? Color.Red : Color.Blue);
CB_Form.SelectedIndex = pkm.AltForm;
if (pkm.Species == 201 && e != null) // Unown
CB_Form.SelectedIndex = pkm.AltForm;
setIsShiny(null);
getQuickFiller(dragout);
}
@@ -2052,15 +2049,15 @@ private void updateRandomIVs(object sender, EventArgs e)
}
else
{
TB_HPIV.Text = (Util.rnd32() & SAV.MaxIV).ToString();
TB_ATKIV.Text = (Util.rnd32() & SAV.MaxIV).ToString();
TB_DEFIV.Text = (Util.rnd32() & SAV.MaxIV).ToString();
TB_SPAIV.Text = (Util.rnd32() & SAV.MaxIV).ToString();
TB_SPDIV.Text = (Util.rnd32() & SAV.MaxIV).ToString();
TB_SPEIV.Text = (Util.rnd32() & SAV.MaxIV).ToString();
TB_HPIV.Text = (Util.rnd32() % SAV.MaxIV).ToString();
TB_ATKIV.Text = (Util.rnd32() % SAV.MaxIV).ToString();
TB_DEFIV.Text = (Util.rnd32() % SAV.MaxIV).ToString();
TB_SPAIV.Text = (Util.rnd32() % SAV.MaxIV).ToString();
TB_SPDIV.Text = (Util.rnd32() % SAV.MaxIV).ToString();
TB_SPEIV.Text = (Util.rnd32() % SAV.MaxIV).ToString();
}
changingFields = false;
updateIVs(null, null);
updateIVs(null, e);
}
private void updateRandomEVs(object sender, EventArgs e)
{
@@ -2163,13 +2160,19 @@ private void updateForm(object sender, EventArgs e)
setAbilityList();
// Gender Forms
if (Util.getIndex(CB_Species) == 201)
if (Util.getIndex(CB_Species) == 201 && fieldsLoaded)
{
if (fieldsLoaded && SAV.Generation == 3)
if (SAV.Generation == 3)
{
pkm.setPIDUnown3(CB_Form.SelectedIndex);
TB_PID.Text = pkm.PID.ToString("X8");
}
else if (SAV.Generation == 2)
{
int desiredForm = CB_Form.SelectedIndex;
while (pkm.AltForm != desiredForm)
updateRandomIVs(null, null);
}
}
else if (PKX.getGender(CB_Form.Text) < 2)
Label_Gender.Text = CB_Form.Text;

View File

@@ -624,6 +624,17 @@ public static string[] getFormList(int species, string[] t, string[] f, string[]
f[000], // Spiky
};
case 201:
if (generation == 2)
return new[]
{
"A", "B", "C", "D", "E",
"F", "G", "H", "I", "J",
"K", "L", "M", "N", "O",
"P", "Q", "R", "S", "T",
"U", "V", "W", "X", "Y",
"Z",
// "!", "?", not in Gen II
};
return new[]
{
"A", "B", "C", "D", "E",
@@ -708,7 +719,8 @@ public static string[] getFormList(int species, string[] t, string[] f, string[]
f[823], // Sky
};
case 493:
case 493: // Arceus
case 773: // Silvally
if (generation == 4)
return new[]
{
@@ -940,6 +952,27 @@ public static string[] getFormList(int species, string[] t, string[] f, string[]
t[000], // Normal
f[912], // Unbound
};
case 741: // Oricorio
return new[]
{
"RED", // Baile
"YLW", // Pom-Pom
"PNK", // Pa'u
"BLU", // Sensu
};
case 744: // Minior
return new[]
{
"R", // Red
"O", // Orange
"Y", // Yellow
"G", // Green
"B", // Blue
"I", // Indigo
"V", // Violet
};
}
return new[] {""};
}