From e6a59740bb30634f67eeaab06e24677f2b9d623d Mon Sep 17 00:00:00 2001 From: Kurt Date: Wed, 29 Oct 2025 01:48:13 -0500 Subject: [PATCH] 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) --- .../Controls/PKM Editor/PKMEditor.Designer.cs | 2 ++ .../Controls/PKM Editor/PKMEditor.cs | 23 +++++++++++++++++++ 2 files changed, 25 insertions(+) diff --git a/PKHeX.WinForms/Controls/PKM Editor/PKMEditor.Designer.cs b/PKHeX.WinForms/Controls/PKM Editor/PKMEditor.Designer.cs index 97dc5de3c..9177cb49c 100644 --- a/PKHeX.WinForms/Controls/PKM Editor/PKMEditor.Designer.cs +++ b/PKHeX.WinForms/Controls/PKM Editor/PKMEditor.Designer.cs @@ -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 // diff --git a/PKHeX.WinForms/Controls/PKM Editor/PKMEditor.cs b/PKHeX.WinForms/Controls/PKM Editor/PKMEditor.cs index 84060eb31..0c65ccddd 100644 --- a/PKHeX.WinForms/Controls/PKM Editor/PKMEditor.cs +++ b/PKHeX.WinForms/Controls/PKM Editor/PKMEditor.cs @@ -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 shouldCheck, Func isState) { public Control? IsNotValid(PKM pk)