From c1d2babc5c2c3e51e0f7f3c83f964a08425cffbf Mon Sep 17 00:00:00 2001 From: Kurt Date: Fri, 17 Jan 2025 22:08:38 -0600 Subject: [PATCH] Set all purchased on MoveShop all --- .../Applicators/MoveShopRecordApplicator.cs | 16 ++++++++++++++++ .../Bulk/Suggestion/BatchModifications.cs | 5 +++++ 2 files changed, 21 insertions(+) diff --git a/PKHeX.Core/Editing/Applicators/MoveShopRecordApplicator.cs b/PKHeX.Core/Editing/Applicators/MoveShopRecordApplicator.cs index c56bfaf2f..2b260c2e7 100644 --- a/PKHeX.Core/Editing/Applicators/MoveShopRecordApplicator.cs +++ b/PKHeX.Core/Editing/Applicators/MoveShopRecordApplicator.cs @@ -136,4 +136,20 @@ public static void SetEncounterMasteryFlags(this IMoveShop8Mastery shop, ReadOnl shop.SetMasteredRecordFlag(index, true); } } + + /// + /// Sets the "purchased" move shop flag for all possible moves. + /// + public static void SetPurchasedFlagsAll(this IMoveShop8Mastery shop) + { + var permit = shop.Permit; + var possible = permit.RecordPermitIndexes; + for (int index = 0; index < permit.RecordCountUsed; index++) + { + var allowed = permit.IsRecordPermitted(index); + if (!allowed) + continue; + shop.SetPurchasedRecordFlag(index, true); + } + } } diff --git a/PKHeX.Core/Editing/Bulk/Suggestion/BatchModifications.cs b/PKHeX.Core/Editing/Bulk/Suggestion/BatchModifications.cs index 8426a607e..d0890ff48 100644 --- a/PKHeX.Core/Editing/Bulk/Suggestion/BatchModifications.cs +++ b/PKHeX.Core/Editing/Bulk/Suggestion/BatchModifications.cs @@ -58,9 +58,14 @@ public static ModifyResult SetSuggestedMasteryData(BatchInfo info, ReadOnlySpan< if (e is IMasteryInitialMoveShop8 enc) enc.SetInitialMastery(pk); if (IsAll(propValue)) + { + t.SetPurchasedFlagsAll(); t.SetMoveShopFlagsAll(pk); + } else + { t.SetMoveShopFlags(pk); + } return ModifyResult.Modified; }