mirror of
https://github.com/kwsch/PKHeX
synced 2024-11-22 03:53:08 +00:00
Add expected PP check for stored-healed slots
This commit is contained in:
parent
b60c6e5f14
commit
5955319883
2 changed files with 18 additions and 1 deletions
|
@ -368,6 +368,7 @@ public static class LegalityCheckStrings
|
|||
public static string LMoveNincada { get; set; } = "Only one Ninjask move allowed.";
|
||||
public static string LMoveNincadaEvo { get; set; } = "Learned by evolving Nincada into Ninjask.";
|
||||
public static string LMoveNincadaEvoF_0 { get; set; } = "Learned by evolving Nincada into Ninjask in Generation {0}.";
|
||||
public static string LMovePPExpectHealed_0 { get; set; } = "Move {0} PP is below the amount expected.";
|
||||
public static string LMovePPTooHigh_0 { get; set; } = "Move {0} PP is above the amount allowed.";
|
||||
public static string LMovePPUpsTooHigh_0 { get; set; } = "Move {0} PP Ups is above the amount allowed.";
|
||||
public static string LMoveSourceShared { get; set; } = "Shared Non-Relearn Move.";
|
||||
|
|
|
@ -47,6 +47,8 @@ public sealed class MovePPVerifier : Verifier
|
|||
ReadOnlySpan<ushort> moves = [pk.Move1, pk.Move2, pk.Move3, pk.Move4];
|
||||
ReadOnlySpan<int> pp = [pk.Move1_PP, pk.Move2_PP, pk.Move3_PP, pk.Move4_PP];
|
||||
|
||||
bool expectHeal = !data.IsStoredSlot(StorageSlotType.Party) && GetIsStoredHealed(pk);
|
||||
|
||||
if (!Legal.IsPPUpAvailable(pk)) // No PP Ups for format
|
||||
{
|
||||
for (int i = 0; i < ups.Length; i++)
|
||||
|
@ -66,8 +68,22 @@ public sealed class MovePPVerifier : Verifier
|
|||
|
||||
for (int i = 0; i < pp.Length; i++)
|
||||
{
|
||||
if (pp[i] > pk.GetMovePP(moves[i], ups[i]))
|
||||
var expect = pk.GetMovePP(moves[i], ups[i]);
|
||||
if (pp[i] > expect)
|
||||
data.AddLine(GetInvalid(string.Format(LMovePPTooHigh_0, i + 1)));
|
||||
else if (expectHeal && pp[i] != expect)
|
||||
data.AddLine(GetInvalid(string.Format(LMovePPExpectHealed_0, i + 1)));
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Checks if the format is expected to have the Pokémon healed to full PP.
|
||||
/// </summary>
|
||||
private static bool GetIsStoredHealed(PKM pk) => pk switch
|
||||
{
|
||||
PB7 => false,
|
||||
PK8 or PA8 or PB8 => false,
|
||||
PK9 => false,
|
||||
_ => true,
|
||||
};
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue