Skip to content

Commit e8d60f5

Browse files
committed
fix hidden power bug
1 parent c975065 commit e8d60f5

2 files changed

Lines changed: 13 additions & 6 deletions

File tree

pktabs/PKTab.xaml.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ namespace PKHeXMAUI;
1111

1212
public partial class MainPage : ContentPage
1313
{
14-
public static string Version = "v24.10.06";
14+
public static string Version = "v24.10.17";
1515
public bool SkipTextChange = false;
1616
public static int[] NoFormSpriteSpecies = [664, 665, 744, 982, 855, 854, 869,892,1012,1013];
1717
public bool FirstLoad = true;

pktabs/StatsTab.xaml.cs

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,9 @@ public partial class StatsTab : ContentPage
1414
public int maxEV = 252;
1515
public int maxAV = 200;
1616
public int maxGV = 10;
17-
public StatsTab()
17+
public List<ComboItem> types;
18+
19+
public StatsTab()
1820
{
1921
InitializeComponent();
2022
foreach (var ty in Enum.GetNames(typeof(MoveType)))
@@ -23,7 +25,10 @@ public StatsTab()
2325
foreach (var typ in Enum.GetNames(typeof(MoveType)))
2426
MainTeratypepicker.Items.Add(typ);
2527
MainTeratypepicker.Items.Add("Stellar");
26-
HiddenPowerPicker.ItemsSource = Enum.GetValues(typeof(MoveType));
28+
var hptypes = GameInfo.Strings.types.AsSpan(1, HiddenPower.TypeCount);
29+
types = Util.GetCBList(hptypes);
30+
HiddenPowerPicker.ItemsSource = types;
31+
HiddenPowerPicker.ItemDisplayBinding = new Binding("Text");
2732
ICommand refreshCommand = new Command(async () =>
2833
{
2934
await applystatsinfo(pk);
@@ -170,7 +175,7 @@ public async Task applystatsinfo(PKM pkm)
170175
{
171176
HiddenPowerPicker.IsVisible = true;
172177
HiddenPLabel.IsVisible = true;
173-
HiddenPowerPicker.SelectedItem = (MoveType)pkm.HPType;
178+
HiddenPowerPicker.SelectedItem = types.Find(z => z.Value == pkm.HPType);
174179
}
175180
SkipEvent = false;
176181
}
@@ -676,8 +681,10 @@ private void applyHiddenPower(object sender, EventArgs e)
676681
{
677682
if (!SkipEvent)
678683
{
679-
pk.HPType = HiddenPowerPicker.SelectedIndex;
680-
HiddenPower.SetIVs(HiddenPowerPicker.SelectedIndex, pk.IVs, pk.Context);
684+
var hptype = ((ComboItem)HiddenPowerPicker.SelectedItem).Value;
685+
pk.HPType = hptype;
686+
HiddenPower.SetIVs(hptype, pk.IVs, pk.Context);
687+
applystatsinfo(pk);
681688
}
682689
}
683690
}

0 commit comments

Comments
 (0)