Add consistent ctrl/alt modifiers for IV/EV/AV

Closes #3132
This commit is contained in:
Kurt 2021-01-20 22:09:25 -08:00
parent 803b8675fe
commit ceb14c8468
2 changed files with 31 additions and 5 deletions

View file

@ -213,10 +213,30 @@ namespace PKHeX.WinForms.Controls
private void UpdateRandomEVs(object sender, EventArgs e)
{
bool zero = (ModifierKeys & Keys.Control) != 0;
var evs = zero ? new int[6] : PKX.GetRandomEVs(Entity.Format);
var evs = ModifierKeys switch
{
Keys.Control => SetMaxEVs(Entity),
Keys.Alt => new int[6],
_ => PKX.GetRandomEVs(Entity.Format),
};
LoadEVs(evs);
UpdateEVs(sender, EventArgs.Empty);
static int[] SetMaxEVs(PKM entity)
{
if (entity.Format < 3)
return Enumerable.Repeat((int) ushort.MaxValue, 6).ToArray();
var stats = entity.PersonalInfo.Stats;
var ordered = stats.Select((z, i) => new {Stat = z, Index = i}).OrderByDescending(z => z.Stat).ToArray();
var result = new int[6];
result[ordered[0].Index] = 252;
result[ordered[1].Index] = 252;
result[ordered[2].Index] = 6;
return result;
}
}
private void UpdateHackedStats(object sender, EventArgs e)
@ -354,8 +374,12 @@ namespace PKHeX.WinForms.Controls
public void UpdateRandomIVs(object sender, EventArgs e)
{
var flawless = (ModifierKeys & Keys.Control) != 0;
var IVs = flawless ? Entity.SetRandomIVs(6) : Entity.SetRandomIVs();
var IVs = ModifierKeys switch
{
Keys.Control => Entity.SetRandomIVs(6),
Keys.Alt => new int[6],
_ => Entity.SetRandomIVs(),
};
LoadIVs(IVs);
}

View file

@ -27,7 +27,7 @@ Control + Click on...
- Individual EVs: Set EV to max.
- Randomize IVs: Set all IVs to max.
- Randomize AVs: Set all AVs to max.
- Randomize EVs: Set all EVs to 0.
- Randomize EVs: Set all EVs to max (if appropriate).
- PP Ups Label: Set all PP Ups to 0. (Click = 3)
- Friendship Label: Set Friendship to 0. (Click = 255 or Base)
- Level box: Set Level to 100.
@ -36,7 +36,9 @@ Control + Click on...
Alt + Click on...
- Preview Sprite to load from a QR url on your clipboard.
- Species: Export Showdown/Smogon set to Clipboard.
- Randomize IVs: Set all IVs to 0.
- Randomize AVs: Set all AVs to 0.
- Randomize EVs: Set all EVs to 0.
- Individual IVs: Set IV to 0.
- Individual AVs: Set AV to 0.
- Individual EVs: Set EV to 0.