-
-
Notifications
You must be signed in to change notification settings - Fork 676
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #3382 from kwsch/pla
Update 22.02.04 Individual commits from this PR are not cherry-pickable in a vacuum; these were manually re-committed from a staging repo in order to group together changes for general public viewing. There were over 250 commits on the private development repo for this update.
- Loading branch information
Showing
426 changed files
with
19,646 additions
and
2,664 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
71 changes: 71 additions & 0 deletions
71
PKHeX.Core/Editing/Applicators/MoveShopRecordApplicator.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,71 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
|
||
namespace PKHeX.Core; | ||
|
||
/// <summary> | ||
/// Logic for modifying the Move Shop Record flags of a <see cref="PA8"/>. | ||
/// </summary> | ||
public static class MoveShopRecordApplicator | ||
{ | ||
public static void ClearMoveShopFlags(this IMoveShop8 shop) | ||
{ | ||
var bits = shop.MoveShopPermitFlags; | ||
for (int i = 0; i < bits.Length; i++) | ||
shop.SetPurchasedRecordFlag(i, false); | ||
|
||
if (shop is IMoveShop8Mastery m) | ||
m.ClearMoveShopFlagsMastered(); | ||
} | ||
|
||
public static void ClearMoveShopFlagsMastered(this IMoveShop8Mastery shop) | ||
{ | ||
var bits = shop.MoveShopPermitFlags; | ||
for (int i = 0; i < bits.Length; i++) | ||
shop.SetMasteredRecordFlag(i, false); | ||
} | ||
|
||
public static void SetMoveShopFlags(this IMoveShop8 shop, bool value, int max = 100) | ||
{ | ||
var bits = shop.MoveShopPermitFlags; | ||
max = Math.Min(bits.Length, max); | ||
for (int i = 0; i < max; i++) | ||
shop.SetPurchasedRecordFlag(i, value); | ||
} | ||
|
||
public static void SetMoveShopFlagsMastered(this IMoveShop8Mastery shop) | ||
{ | ||
var bits = shop.MoveShopPermitFlags; | ||
for (int i = 0; i < bits.Length; i++) | ||
shop.SetMasteredRecordFlag(i, shop.GetPurchasedRecordFlag(i)); | ||
} | ||
|
||
public static void SetMoveShopFlags(this IMoveShop8 shop) | ||
{ | ||
var permit = shop.MoveShopPermitFlags; | ||
for (int index = 0; index < permit.Length; index++) | ||
{ | ||
if (permit[index]) | ||
shop.SetPurchasedRecordFlag(index, true); | ||
} | ||
} | ||
|
||
/// <summary> | ||
/// Sets the Shop Record flags for the <see cref="shop"/> based on the current moves. | ||
/// </summary> | ||
/// <param name="shop">Pokémon to modify.</param> | ||
/// <param name="moves">Moves to set flags for. If a move is not a Technical Record, it is skipped.</param> | ||
public static void SetMoveShopFlags(this IMoveShop8 shop, IEnumerable<int> moves) | ||
{ | ||
var permit = shop.MoveShopPermitFlags; | ||
var moveIDs = shop.MoveShopPermitIndexes; | ||
foreach (var m in moves) | ||
{ | ||
var index = moveIDs.IndexOf(m); | ||
if (index == -1) | ||
continue; | ||
if (permit[index]) | ||
shop.SetPurchasedRecordFlag(index, true); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.