mirror of
https://github.com/kwsch/PKHeX.git
synced 2026-03-21 17:48:28 -05:00
Manual ability ctrl-click suggest
Add control-click for the manual ability entry to auto-apply the corresponding ability based on personal info (try and detect birth ability)
This commit is contained in:
parent
5bdfd4597c
commit
e6a59740bb
|
|
@ -1028,6 +1028,7 @@ private void InitializeComponent()
|
|||
DEV_Ability.Size = new System.Drawing.Size(126, 25);
|
||||
DEV_Ability.TabIndex = 14;
|
||||
DEV_Ability.Visible = false;
|
||||
TB_AbilityNumber.Click += ClickManualAbility;
|
||||
//
|
||||
// TB_AbilityNumber
|
||||
//
|
||||
|
|
@ -1040,6 +1041,7 @@ private void InitializeComponent()
|
|||
TB_AbilityNumber.TabIndex = 14;
|
||||
TB_AbilityNumber.TextAlign = System.Windows.Forms.HorizontalAlignment.Center;
|
||||
TB_AbilityNumber.Visible = false;
|
||||
TB_AbilityNumber.Click += ClickManualAbility;
|
||||
//
|
||||
// FLP_Friendship
|
||||
//
|
||||
|
|
|
|||
|
|
@ -80,6 +80,29 @@ public PKMEditor()
|
|||
TB_Friendship.MouseWheel += WinFormsUtil.MouseWheelIncrement1;
|
||||
}
|
||||
|
||||
private void ClickManualAbility(object sender, EventArgs e)
|
||||
{
|
||||
if (ModifierKeys != Keys.Control)
|
||||
return;
|
||||
var value = Util.ToInt32(TB_AbilityNumber.Text);
|
||||
if (value is not (1 or 2 or 4))
|
||||
return;
|
||||
|
||||
var pk = Entity;
|
||||
IPersonalAbility pi;
|
||||
if (pk is PA9 pa9)
|
||||
{
|
||||
var la = new LegalityAnalysis(pa9);
|
||||
var enc = la.EncounterMatch;
|
||||
pi = PersonalTable.ZA[enc.Species, enc.Form];
|
||||
}
|
||||
else
|
||||
{
|
||||
pi = Entity.PersonalInfo;
|
||||
}
|
||||
DEV_Ability.SelectedValue = pi.GetAbilityAtIndex(value >> 1);
|
||||
}
|
||||
|
||||
private sealed class ValidationRequiredSet(Control[] controls, Func<PKM, bool> shouldCheck, Func<Control, bool> isState)
|
||||
{
|
||||
public Control? IsNotValid(PKM pk)
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user