mirror of
https://github.com/kwsch/PKHeX
synced 2024-11-15 00:37:11 +00:00
Add current move suggestions
Default levelup only, hold ctrl to add TM/Tutors to a randomized pool which takes 4 from.
This commit is contained in:
parent
faf47d0ef0
commit
c0a478f0cc
3 changed files with 39 additions and 10 deletions
|
@ -208,5 +208,11 @@ namespace PKHeX
|
|||
window.AddRange(new int[4 - window.Count]);
|
||||
return window.Skip(window.Count - 4).Take(4).ToArray();
|
||||
}
|
||||
public int[] getSuggestedMoves(bool tm, bool tutor)
|
||||
{
|
||||
if (pkm.GenNumber < 6)
|
||||
return null;
|
||||
return Legal.getValidMoves(pkm, Tutor: tutor, Machine: tm).Skip(1).ToArray(); // skip move 0
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -152,12 +152,12 @@ namespace PKHeX
|
|||
}
|
||||
|
||||
// Moves
|
||||
internal static IEnumerable<int> getValidMoves(PKM pkm)
|
||||
internal static IEnumerable<int> getValidMoves(PKM pkm, bool Tutor = true, bool Machine = true)
|
||||
{
|
||||
GameVersion version = (GameVersion)pkm.Version;
|
||||
if (!pkm.IsUntraded)
|
||||
version = GameVersion.Any;
|
||||
return getValidMoves(pkm, version, LVL: true, Relearn: false, Tutor: true, Machine: true);
|
||||
return getValidMoves(pkm, version, LVL: true, Relearn: false, Tutor: Tutor, Machine: Machine);
|
||||
}
|
||||
internal static IEnumerable<int> getValidRelearn(PKM pkm, int skipOption)
|
||||
{
|
||||
|
|
|
@ -98,6 +98,7 @@ namespace PKHeX
|
|||
GB_OT.Click += clickGT;
|
||||
GB_nOT.Click += clickGT;
|
||||
GB_Daycare.Click += switchDaycare;
|
||||
GB_CurrentMoves.Click += clickMoves;
|
||||
GB_RelearnMoves.Click += clickMoves;
|
||||
|
||||
TB_Nickname.Font = PKX.getPKXFont(11);
|
||||
|
@ -1779,15 +1780,37 @@ namespace PKHeX
|
|||
private void clickMoves(object sender, EventArgs e)
|
||||
{
|
||||
updateLegality();
|
||||
int[] m = Legality.getSuggestedRelearn();
|
||||
string r = string.Join(Environment.NewLine, m.Select(v => v >= GameStrings.movelist.Length ? "ERROR" : GameStrings.movelist[v]));
|
||||
if (DialogResult.Yes != Util.Prompt(MessageBoxButtons.YesNo, "Apply suggested relearn moves?", r))
|
||||
return;
|
||||
if (sender == GB_CurrentMoves)
|
||||
{
|
||||
bool random = ModifierKeys == Keys.Control;
|
||||
int[] m = Legality.getSuggestedMoves(tm: random, tutor: random);
|
||||
if (random)
|
||||
Util.Shuffle(m);
|
||||
if (m.Length > 4)
|
||||
m = m.Skip(m.Length - 4).ToArray();
|
||||
|
||||
string r = string.Join(Environment.NewLine, m.Select(v => v >= GameStrings.movelist.Length ? "ERROR" : GameStrings.movelist[v]));
|
||||
if (DialogResult.Yes != Util.Prompt(MessageBoxButtons.YesNo, "Apply suggested current moves?", r))
|
||||
return;
|
||||
|
||||
CB_Move1.SelectedValue = m[0];
|
||||
CB_Move2.SelectedValue = m[1];
|
||||
CB_Move3.SelectedValue = m[2];
|
||||
CB_Move4.SelectedValue = m[3];
|
||||
}
|
||||
else if (sender == GB_RelearnMoves)
|
||||
{
|
||||
int[] m = Legality.getSuggestedRelearn();
|
||||
string r = string.Join(Environment.NewLine, m.Select(v => v >= GameStrings.movelist.Length ? "ERROR" : GameStrings.movelist[v]));
|
||||
if (DialogResult.Yes != Util.Prompt(MessageBoxButtons.YesNo, "Apply suggested relearn moves?", r))
|
||||
return;
|
||||
|
||||
CB_RelearnMove1.SelectedValue = m[0];
|
||||
CB_RelearnMove2.SelectedValue = m[1];
|
||||
CB_RelearnMove3.SelectedValue = m[2];
|
||||
CB_RelearnMove4.SelectedValue = m[3];
|
||||
}
|
||||
|
||||
CB_RelearnMove1.SelectedValue = m[0];
|
||||
CB_RelearnMove2.SelectedValue = m[1];
|
||||
CB_RelearnMove3.SelectedValue = m[2];
|
||||
CB_RelearnMove4.SelectedValue = m[3];
|
||||
updateLegality();
|
||||
}
|
||||
// Prompted Updates of PKX Functions //
|
||||
|
|
Loading…
Reference in a new issue