Conditionally set PP Ups and Purchase/Mastery flags on set import

This commit is contained in:
Kurt 2022-02-07 15:40:02 -08:00
parent b20fb39d77
commit a7051107ea
3 changed files with 19 additions and 2 deletions

View file

@ -227,7 +227,9 @@ namespace PKHeX.Core
pk.SetNickname(Set.Nickname);
pk.SetForm(Set.Form);
pk.SetSaneGender(Set.Gender);
pk.SetMaximumPPUps(Set.Moves);
if (Legal.IsPPUpAvailable(pk))
pk.SetMaximumPPUps(Set.Moves);
if (pk.Format >= 3)
{
@ -261,6 +263,11 @@ namespace PKHeX.Core
t.ClearRecordFlags();
t.SetRecordFlags(Set.Moves);
}
if (pk is IMoveShop8 m)
{
m.ClearMoveShopFlags();
m.SetMoveShopFlags(Set.Moves);
}
if (ShowdownSetBehaviorNature && pk.Format >= 8)
pk.Nature = pk.StatNature;

View file

@ -191,6 +191,16 @@ namespace PKHeX.Core
return false;
}
/// <summary>
/// Indicates if PP Ups are available for use.
/// </summary>
/// <param name="pkm">Entity to check</param>
public static bool IsPPUpAvailable(PKM pkm)
{
return pkm is not PA8;
}
/// <summary>
/// Indicates if the moveset is restricted to only the original version.
/// </summary>

View file

@ -276,7 +276,7 @@ namespace PKHeX.Core
{
var pkm = data.pkm;
if (pkm is PA8) // No PP Ups
if (!Legal.IsPPUpAvailable(pkm)) // No PP Ups
{
if (pkm.Move1_PPUps is not 0)
data.AddLine(GetInvalid(string.Format(LMovePPUpsTooHigh_0, 1), CurrentMove));