Split PPMax & PPCurrent edit methods

As noted in #1866
This commit is contained in:
Kurt 2018-03-19 16:21:29 -07:00
parent dc0cf34ed5
commit e4c2b5d77a
2 changed files with 23 additions and 6 deletions

View file

@ -148,19 +148,36 @@ namespace PKHeX.Core
/// </summary> /// </summary>
/// <param name="pk">Pokémon to modify.</param> /// <param name="pk">Pokémon to modify.</param>
/// <param name="Moves"><see cref="PKM.Moves"/> to use (if already known). Will fetch the current <see cref="PKM.Moves"/> if not provided.</param> /// <param name="Moves"><see cref="PKM.Moves"/> to use (if already known). Will fetch the current <see cref="PKM.Moves"/> if not provided.</param>
public static void SetPPUps(this PKM pk, int[] Moves = null) public static void SetMaximumPPUps(this PKM pk, int[] Moves = null)
{ {
if (Moves == null) if (Moves == null)
Moves = pk.Moves; Moves = pk.Moves;
pk.Move1_PP = pk.GetMovePP(Moves[0], pk.Move1_PPUps = GetPPUpCount(Moves[0])); pk.Move1_PPUps = GetPPUpCount(Moves[0]);
pk.Move2_PP = pk.GetMovePP(Moves[1], pk.Move2_PPUps = GetPPUpCount(Moves[1])); pk.Move2_PPUps = GetPPUpCount(Moves[1]);
pk.Move3_PP = pk.GetMovePP(Moves[2], pk.Move3_PPUps = GetPPUpCount(Moves[2])); pk.Move3_PPUps = GetPPUpCount(Moves[2]);
pk.Move4_PP = pk.GetMovePP(Moves[3], pk.Move4_PPUps = GetPPUpCount(Moves[3])); pk.Move4_PPUps = GetPPUpCount(Moves[3]);
pk.SetMaximumPPCurrent(Moves);
int GetPPUpCount(int moveID) => moveID > 0 ? 3 : 0; int GetPPUpCount(int moveID) => moveID > 0 ? 3 : 0;
} }
/// <summary>
/// Updates the individual PP count values for each moveslot based on the maximum possible value.
/// </summary>
/// <param name="pk">Pokémon to modify.</param>
/// <param name="Moves"><see cref="PKM.Moves"/> to use (if already known). Will fetch the current <see cref="PKM.Moves"/> if not provided.</param>
public static void SetMaximumPPCurrent(this PKM pk, int[] Moves = null)
{
if (Moves == null)
Moves = pk.Moves;
pk.Move1_PP = pk.GetMovePP(Moves[0], pk.Move1_PPUps);
pk.Move2_PP = pk.GetMovePP(Moves[1], pk.Move2_PPUps);
pk.Move3_PP = pk.GetMovePP(Moves[2], pk.Move3_PPUps);
pk.Move4_PP = pk.GetMovePP(Moves[3], pk.Move4_PPUps);
}
/// <summary> /// <summary>
/// Sets the <see cref="PKM.Gender"/> value, with special consideration for the <see cref="PKM.Format"/> values which derive the <see cref="PKM.Gender"/> value. /// Sets the <see cref="PKM.Gender"/> value, with special consideration for the <see cref="PKM.Format"/> values which derive the <see cref="PKM.Gender"/> value.
/// </summary> /// </summary>

View file

@ -669,7 +669,7 @@ namespace PKHeX.WinForms.Controls
} }
pkm.Moves = m; pkm.Moves = m;
pkm.SetPPUps(m); pkm.SetMaximumPPCurrent(m);
FieldsLoaded = false; FieldsLoaded = false;
LoadMoves(pkm); LoadMoves(pkm);
FieldsLoaded = true; FieldsLoaded = true;