diff --git a/PKHeX.Core/PKM/Editing/CommonEdits.cs b/PKHeX.Core/PKM/Editing/CommonEdits.cs index 077d968ce..ae52e3a0f 100644 --- a/PKHeX.Core/PKM/Editing/CommonEdits.cs +++ b/PKHeX.Core/PKM/Editing/CommonEdits.cs @@ -551,6 +551,29 @@ public static void ForceHatchPKM(this PKM pkm, bool reHatch = false) pkm.SetHatchMemory6(); } + /// + /// Maximizes the . If the , the hatch counter is set to 1. + /// + /// PKM to apply hatch details to + public static void MaximizeFriendship(this PKM pkm) + { + if (pkm.IsEgg) + pkm.OT_Friendship = 1; + else + pkm.CurrentFriendship = byte.MaxValue; + } + + /// + /// Maximizes the . If the , the is ignored. + /// + /// PKM to apply hatch details to + public static void MaximizeLevel(this PKM pkm) + { + if (pkm.IsEgg) + return; + pkm.CurrentLevel = 100; + } + /// /// Sets the Memory details to a Hatched Egg's memories. /// diff --git a/PKHeX.Core/PKM/PKMSorting.cs b/PKHeX.Core/PKM/PKMSorting.cs index 6fc989bac..c774e7588 100644 --- a/PKHeX.Core/PKM/PKMSorting.cs +++ b/PKHeX.Core/PKM/PKMSorting.cs @@ -138,7 +138,7 @@ public static IEnumerable ReverseSort(this IEnumerable list) int i = 0; return list.InitialSortBy() .ThenByDescending(z => i++) - .FinalSortBy(); + ; // can't sort further } /// diff --git a/PKHeX.WinForms/Controls/SAV Editor/Sorter.cs b/PKHeX.WinForms/Controls/SAV Editor/Sorter.cs index 3e970e013..6f2a7fb94 100644 --- a/PKHeX.WinForms/Controls/SAV Editor/Sorter.cs +++ b/PKHeX.WinForms/Controls/SAV Editor/Sorter.cs @@ -14,7 +14,7 @@ public static ContextMenuStrip GetSortStrip(this SAVEditor sav) var sortMenu = new ContextMenuStrip(); foreach (Level z in Enum.GetValues(typeof(Level))) { - var ctrl = new ToolStripMenuItem(z.ToString(), GetImage(z)); + var ctrl = new ToolStripMenuItem {Name = $"mnu_{z}", Text = z.ToString(), Image = GetImage(z)}; sortMenu.Items.Add(ctrl); } @@ -34,6 +34,8 @@ Image GetImage(Level l) AddItem(Level.Delete, GetItem("Eggs", "Eggs", () => Clear(pk => pk.IsEgg), Resources.about)); AddItem(Level.Delete, GetItem("Foreign", "Foreign", () => Clear(pk => !sav.SAV.IsOriginalHandler(pk, pk.Format > 2)), Resources.users)); AddItem(Level.Delete, GetItem("Untrained", "Untrained", () => Clear(pk => pk.EVTotal == 0), Resources.gift)); + AddItem(Level.Delete, GetItem("Itemless", "No Held Item", () => Clear(pk => pk.HeldItem == 0), Resources.main)); + AddItem(Level.Delete, GetItem("Illegal", "Illegal", () => Clear(pk => Control.ModifierKeys == Keys.Control != !new LegalityAnalysis(pk).Valid), Resources.export)); AddItem(Level.SortBox, GetItem("Species", "Pokédex No.", () => Sort(PKMSorting.OrderBySpecies), Resources.numlohi)); AddItem(Level.SortBox, GetItem("SpeciesRev", "Pokédex No. (Reverse)", () => Sort(PKMSorting.OrderByDescendingSpecies), Resources.numhilo)); @@ -44,20 +46,23 @@ Image GetImage(Level l) AddItem(Level.SortBox, GetItem("Random", "Random", () => Sort(list => list.OrderByCustom(_ => Util.Rand32())), Resources.showdown)); AddItem(Level.SortBoxAdvanced, GetItem("Usage", "Usage", () => Sort(PKMSorting.OrderByUsage), Resources.heart)); - AddItem(Level.SortBoxAdvanced, GetItem("Training", "Training", () => Sort(list => list.OrderByCustom(pk => pk.MaxEV * 6 - pk.EVTotal)), Resources.showdown)); + AddItem(Level.SortBoxAdvanced, GetItem("Potential", "IV Potential", () => Sort(list => list.OrderByCustom(pk => pk.MaxIV * 6 - pk.IVTotal)), Resources.numhilo)); + AddItem(Level.SortBoxAdvanced, GetItem("Training", "EV Training", () => Sort(list => list.OrderByCustom(pk => pk.MaxEV * 6 - pk.EVTotal)), Resources.showdown)); AddItem(Level.SortBoxAdvanced, GetItem("Owner", "Ownership", () => Sort(list => list.OrderByOwnership(sav.SAV)), Resources.users)); AddItem(Level.SortBoxAdvanced, GetItem("Type", "Type", () => Sort(list => list.OrderByCustom(pk => pk.PersonalInfo.Type1, pk => pk.PersonalInfo.Type2)), Resources.main)); AddItem(Level.SortBoxAdvanced, GetItem("Version", "Version", () => Sort(list => list.OrderByCustom(pk => pk.GenNumber, pk => pk.Version)), Resources.numlohi)); - AddItem(Level.SortBoxAdvanced, GetItem("BST", "BST", () => Sort(list => list.OrderByCustom(pk => pk.PersonalInfo.BST)), Resources.vallohi)); + AddItem(Level.SortBoxAdvanced, GetItem("BST", "Base Stat Total", () => Sort(list => list.OrderByCustom(pk => pk.PersonalInfo.BST)), Resources.vallohi)); AddItem(Level.SortBoxAdvanced, GetItem("Legal", "Legal", () => Sort(list => list.OrderByCustom(pk => !new LegalityAnalysis(pk).Valid)), Resources.export)); AddItem(Level.Modify, GetItem("HatchEggs", "Hatch Eggs", () => Modify(z => z.ForceHatchPKM()), Resources.about)); - AddItem(Level.Modify, GetItem("MaxFriendship", "Max Friendship", () => Modify(z => z.CurrentFriendship = byte.MaxValue), Resources.heart)); + AddItem(Level.Modify, GetItem("MaxFriendship", "Max Friendship", () => Modify(z => z.MaximizeFriendship()), Resources.heart)); + AddItem(Level.Modify, GetItem("MaxLevel", "Max Level", () => Modify(z => z.MaximizeLevel()), Resources.showdown)); + AddItem(Level.Modify, GetItem("RemoveItem", "Delete Held Item", () => Modify(z => z.HeldItem = 0), Resources.gift)); void AddItem(Level v, ToolStripItem t) { var item = (ToolStripMenuItem)sortMenu.Items[(int) v]; - t.Name = $"mnu_{v}{t.Name}"; + t.Name = $"{item.Name}{t.Name}"; item.DropDownItems.Add(t); }