Skip to content

Commit

Permalink
fix move refresh when changing relearn moves (egg moves)
Browse files Browse the repository at this point in the history
  • Loading branch information
santacrab2 committed Jan 21, 2025
1 parent 0166431 commit b6944eb
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 5 deletions.
26 changes: 22 additions & 4 deletions pktabs/AttacksTab.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,11 @@ public partial class AttacksTab : ContentPage
{
public bool SkipEvent = false;
public bool FirstLoad = true;
public comboBox[] moveboxes = [];
public AttacksTab()
{
InitializeComponent();
moveboxes = [move1, move2, move3, move4, rmove1, rmove2, rmove3, rmove4];
move1ppups.ItemsSource = new List<int>() { 0, 1, 2, 3 };
move2ppups.ItemsSource = new List<int>() { 0, 1, 2, 3 };
move3ppups.ItemsSource = new List<int>() { 0, 1, 2, 3 };
Expand Down Expand Up @@ -205,7 +207,7 @@ private void applyrmove1(object sender, EventArgs e)
}
}
}
applyattackinfo(pk);
refreshmoveboxelist();
}
}
private void applyrmove2(object sender, EventArgs e)
Expand All @@ -224,7 +226,7 @@ private void applyrmove2(object sender, EventArgs e)
}
}
}
applyattackinfo(pk);
refreshmoveboxelist();
}
}
private void applyrmove3(object sender, EventArgs e)
Expand All @@ -243,7 +245,7 @@ private void applyrmove3(object sender, EventArgs e)
}
}
}
applyattackinfo(pk);
refreshmoveboxelist();
}
}
private void applyrmove4(object sender, EventArgs e)
Expand All @@ -262,7 +264,7 @@ private void applyrmove4(object sender, EventArgs e)
}
}
}
applyattackinfo(pk);
refreshmoveboxelist();
}
}

Expand Down Expand Up @@ -384,6 +386,22 @@ private async void DisplayMoveInfo4(object sender, EventArgs e)
var details = $"Category: {(MoveCategory)MoveInfo.GetCategory((ushort)value, EntityContext.Gen9)}\nPower: {MoveInfo.GetPower((ushort)value, EntityContext.Gen9)}\nAccuracy: {MoveInfo.GetAccuracy((ushort)value, EntityContext.Gen9)}\n";
await DisplayAlert($"{(Move)value}", details, "cancel");
}
public void refreshmoveboxelist()
{
movlist = [];
LegalMoveSource<ComboItem> p = new(new LegalMoveComboSource());
p.ChangeMoveSource(datasourcefiltered.Moves);
p.ReloadMoves(new LegalityAnalysis(pk));
foreach (var move in p.Display.DataSource)
{
var valid = p.Info.CanLearn((ushort)move.Value);
movlist.Add(new MoveDisplay(move, valid));
}
foreach (var box in moveboxes)
{
box.ItemSource = movlist;
}
}
}
public enum MoveCategory
{
Expand Down
2 changes: 1 addition & 1 deletion pktabs/PKTab.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ namespace PKHeXMAUI;

public partial class MainPage : ContentPage
{
public static string Version = "v25.01.12";
public static string Version = "v25.01.20";
public static PKM pk = EntityBlank.GetBlank(9);
public static LegalityAnalysis la = new(pk);
public static SaveFile sav = AppShell.AppSaveFile??SaveUtil.GetBlankSAV(EntityContext.Gen9,"");
Expand Down

0 comments on commit b6944eb

Please sign in to comment.