Skip to content

Commit

Permalink
fix hidden power bug
Browse files Browse the repository at this point in the history
  • Loading branch information
santacrab2 committed Oct 18, 2024
1 parent c975065 commit e8d60f5
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 6 deletions.
2 changes: 1 addition & 1 deletion pktabs/PKTab.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ namespace PKHeXMAUI;

public partial class MainPage : ContentPage
{
public static string Version = "v24.10.06";
public static string Version = "v24.10.17";
public bool SkipTextChange = false;
public static int[] NoFormSpriteSpecies = [664, 665, 744, 982, 855, 854, 869,892,1012,1013];
public bool FirstLoad = true;
Expand Down
17 changes: 12 additions & 5 deletions pktabs/StatsTab.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,9 @@ public partial class StatsTab : ContentPage
public int maxEV = 252;
public int maxAV = 200;
public int maxGV = 10;
public StatsTab()
public List<ComboItem> types;

public StatsTab()
{
InitializeComponent();
foreach (var ty in Enum.GetNames(typeof(MoveType)))
Expand All @@ -23,7 +25,10 @@ public StatsTab()
foreach (var typ in Enum.GetNames(typeof(MoveType)))
MainTeratypepicker.Items.Add(typ);
MainTeratypepicker.Items.Add("Stellar");
HiddenPowerPicker.ItemsSource = Enum.GetValues(typeof(MoveType));
var hptypes = GameInfo.Strings.types.AsSpan(1, HiddenPower.TypeCount);
types = Util.GetCBList(hptypes);
HiddenPowerPicker.ItemsSource = types;
HiddenPowerPicker.ItemDisplayBinding = new Binding("Text");
ICommand refreshCommand = new Command(async () =>
{
await applystatsinfo(pk);
Expand Down Expand Up @@ -170,7 +175,7 @@ public async Task applystatsinfo(PKM pkm)
{
HiddenPowerPicker.IsVisible = true;
HiddenPLabel.IsVisible = true;
HiddenPowerPicker.SelectedItem = (MoveType)pkm.HPType;
HiddenPowerPicker.SelectedItem = types.Find(z => z.Value == pkm.HPType);
}
SkipEvent = false;
}
Expand Down Expand Up @@ -676,8 +681,10 @@ private void applyHiddenPower(object sender, EventArgs e)
{
if (!SkipEvent)
{
pk.HPType = HiddenPowerPicker.SelectedIndex;
HiddenPower.SetIVs(HiddenPowerPicker.SelectedIndex, pk.IVs, pk.Context);
var hptype = ((ComboItem)HiddenPowerPicker.SelectedItem).Value;
pk.HPType = hptype;
HiddenPower.SetIVs(hptype, pk.IVs, pk.Context);
applystatsinfo(pk);
}
}
}

0 comments on commit e8d60f5

Please sign in to comment.