mirror of
https://github.com/kwsch/PKHeX.git
synced 2026-06-03 02:14:10 -05:00
parent
8a434be443
commit
186e6f1196
|
|
@ -196,6 +196,21 @@ public static partial class Legal
|
|||
719,
|
||||
};
|
||||
|
||||
internal static readonly int[] Legends =
|
||||
{
|
||||
150, 151, 249, 250, 251, 382, 383, 384, 385, 386, 483,
|
||||
484, 487, 489, 490, 491, 492, 493, 494, 643, 644, 646,
|
||||
647, 648, 649, 716, 717, 718, 719, 720, 721, 789, 790,
|
||||
791, 792, 800, 801, 802
|
||||
};
|
||||
internal static readonly int[] SubLegends =
|
||||
{
|
||||
144, 145, 146, 243, 244, 245, 377, 378, 379, 380, 381,
|
||||
480, 481, 482, 485, 486, 488, 638, 639, 640, 641, 642,
|
||||
645, 772, 773, 787, 788, 785, 786, 793, 794, 795, 796,
|
||||
797, 798, 799
|
||||
};
|
||||
|
||||
#region Games
|
||||
|
||||
internal static readonly int[] Games_7sm = { 30, 31 };
|
||||
|
|
|
|||
|
|
@ -2045,12 +2045,17 @@ 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();
|
||||
bool IV3 = Legal.Legends.Contains(pkm.Species) || Legal.SubLegends.Contains(pkm.Species);
|
||||
int[] IVs = new int[6];
|
||||
do
|
||||
{
|
||||
for (int i = 0; i < 6; i++)
|
||||
IVs[i] = (int)(Util.rnd32() & SAV.MaxIV);
|
||||
} while (IV3 && IVs.Where(i => i == SAV.MaxIV).Count() < 3);
|
||||
|
||||
var IVBoxes = new[] {TB_HPIV, TB_ATKIV, TB_DEFIV, TB_SPAIV, TB_SPDIV, TB_SPEIV};
|
||||
for (int i = 0; i < 6; i++)
|
||||
IVBoxes[i].Text = IVs[i].ToString();
|
||||
}
|
||||
changingFields = false;
|
||||
updateIVs(null, e);
|
||||
|
|
|
|||
|
|
@ -332,11 +332,20 @@ private static ModifyResult ProcessPKM(PKM PKM, IEnumerable<StringInstruction> F
|
|||
}
|
||||
private static void setRandomIVs(PKM PKM, StringInstruction cmd)
|
||||
{
|
||||
int MaxIVs = PKM.Format <= 2 ? 15 : 31;
|
||||
int MaxIV = PKM.Format <= 2 ? 15 : 31;
|
||||
if (cmd.PropertyName == "IVs")
|
||||
ReflectUtil.SetValue(PKM, cmd.PropertyName, new byte[6].Select(i => (int)Util.rnd32() & MaxIVs).ToArray());
|
||||
{
|
||||
bool IV3 = Legal.Legends.Contains(PKM.Species) || Legal.SubLegends.Contains(PKM.Species);
|
||||
int[] IVs = new int[6];
|
||||
do
|
||||
{
|
||||
for (int i = 0; i < 6; i++)
|
||||
IVs[i] = (int)(Util.rnd32() & MaxIV);
|
||||
} while (IV3 && IVs.Where(i => i == MaxIV).Count() < 3);
|
||||
ReflectUtil.SetValue(PKM, cmd.PropertyName, IVs);
|
||||
}
|
||||
else
|
||||
ReflectUtil.SetValue(PKM, cmd.PropertyName, Util.rnd32() & MaxIVs);
|
||||
ReflectUtil.SetValue(PKM, cmd.PropertyName, Util.rnd32() & MaxIV);
|
||||
}
|
||||
|
||||
private void B_Add_Click(object sender, EventArgs e)
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user