mirror of
https://github.com/kwsch/PKHeX.git
synced 2026-04-24 23:57:12 -05:00
Flag pp ups on non-PP up move IDs
Previous logic wouldn't flag "None" move w/ ppup>0 Also now flags sketch & revival blessing.
This commit is contained in:
parent
80c856b618
commit
1de869f541
|
|
@ -20,7 +20,12 @@ public static void SetMaximumPPUps(this PKM pk, ReadOnlySpan<ushort> moves)
|
|||
pk.Move4_PPUps = GetPPUpCount(moves[3]);
|
||||
|
||||
pk.SetMaximumPPCurrent(moves);
|
||||
static int GetPPUpCount(ushort moveID) => moveID != 0 ? 3 : 0;
|
||||
static int GetPPUpCount(ushort moveID)
|
||||
{
|
||||
if (Legal.IsPPUpAvailable(moveID))
|
||||
return 3;
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
|
|
|||
|
|
@ -122,6 +122,18 @@ public static bool IsPPUpAvailable(PKM pk)
|
|||
return pk is not PA8;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Indicate if PP Ups are available for use.
|
||||
/// </summary>
|
||||
/// <param name="moveID">Move ID</param>
|
||||
public static bool IsPPUpAvailable(ushort moveID) => moveID switch
|
||||
{
|
||||
0 => false,
|
||||
(int)Move.Sketch => false,
|
||||
(int)Move.RevivalBlessing => false,
|
||||
_ => true,
|
||||
};
|
||||
|
||||
public static int GetMaxLengthOT(int generation, LanguageID language) => language switch
|
||||
{
|
||||
LanguageID.ChineseS or LanguageID.ChineseT => 6,
|
||||
|
|
|
|||
|
|
@ -369,7 +369,7 @@ private static void VerifyMiscMovePP(LegalityAnalysis data)
|
|||
{
|
||||
var pk = data.Entity;
|
||||
|
||||
if (!Legal.IsPPUpAvailable(pk)) // No PP Ups
|
||||
if (!Legal.IsPPUpAvailable(pk)) // No PP Ups for format
|
||||
{
|
||||
if (pk.Move1_PPUps is not 0)
|
||||
data.AddLine(GetInvalid(string.Format(LMovePPUpsTooHigh_0, 1), CurrentMove));
|
||||
|
|
@ -380,6 +380,17 @@ private static void VerifyMiscMovePP(LegalityAnalysis data)
|
|||
if (pk.Move4_PPUps is not 0)
|
||||
data.AddLine(GetInvalid(string.Format(LMovePPUpsTooHigh_0, 4), CurrentMove));
|
||||
}
|
||||
else // Check specific move indexes
|
||||
{
|
||||
if (!Legal.IsPPUpAvailable(pk.Move1) && pk.Move1_PPUps is not 0)
|
||||
data.AddLine(GetInvalid(string.Format(LMovePPUpsTooHigh_0, 1), CurrentMove));
|
||||
if (!Legal.IsPPUpAvailable(pk.Move2) && pk.Move2_PPUps is not 0)
|
||||
data.AddLine(GetInvalid(string.Format(LMovePPUpsTooHigh_0, 2), CurrentMove));
|
||||
if (!Legal.IsPPUpAvailable(pk.Move3) && pk.Move3_PPUps is not 0)
|
||||
data.AddLine(GetInvalid(string.Format(LMovePPUpsTooHigh_0, 3), CurrentMove));
|
||||
if (!Legal.IsPPUpAvailable(pk.Move4) && pk.Move4_PPUps is not 0)
|
||||
data.AddLine(GetInvalid(string.Format(LMovePPUpsTooHigh_0, 4), CurrentMove));
|
||||
}
|
||||
|
||||
if (pk.Move1_PP > pk.GetMovePP(pk.Move1, pk.Move1_PPUps))
|
||||
data.AddLine(GetInvalid(string.Format(LMovePPTooHigh_0, 1), CurrentMove));
|
||||
|
|
|
|||
|
|
@ -604,11 +604,22 @@ private void ClickPP(object sender, EventArgs e)
|
|||
private void ClickPPUps(object sender, EventArgs e)
|
||||
{
|
||||
bool min = (ModifierKeys & Keys.Control) != 0 || !Legal.IsPPUpAvailable(Entity);
|
||||
static int GetValue(ListControl cb, bool zero) => zero || WinFormsUtil.GetIndex(cb) == 0 ? 0 : 3;
|
||||
CB_PPu1.SelectedIndex = GetValue(CB_Move1, min);
|
||||
CB_PPu2.SelectedIndex = GetValue(CB_Move2, min);
|
||||
CB_PPu3.SelectedIndex = GetValue(CB_Move3, min);
|
||||
CB_PPu4.SelectedIndex = GetValue(CB_Move4, min);
|
||||
if (min)
|
||||
{
|
||||
CB_PPu1.SelectedIndex = CB_PPu2.SelectedIndex = CB_PPu3.SelectedIndex = CB_PPu4.SelectedIndex = 0;
|
||||
return;
|
||||
}
|
||||
|
||||
static int GetValue(ListControl cb)
|
||||
{
|
||||
ushort move = (ushort)WinFormsUtil.GetIndex(cb);
|
||||
return Legal.IsPPUpAvailable(move) ? 3 : 0;
|
||||
}
|
||||
|
||||
CB_PPu1.SelectedIndex = GetValue(CB_Move1);
|
||||
CB_PPu2.SelectedIndex = GetValue(CB_Move2);
|
||||
CB_PPu3.SelectedIndex = GetValue(CB_Move3);
|
||||
CB_PPu4.SelectedIndex = GetValue(CB_Move4);
|
||||
}
|
||||
|
||||
private void ClickMarking(object sender, EventArgs e)
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user