Update movepp sig to use ushort

This commit is contained in:
Kurt 2022-09-18 23:06:02 -07:00
parent 3a5aa22c6f
commit f1dcc33168
3 changed files with 11 additions and 10 deletions

View file

@ -794,14 +794,14 @@ public abstract class PKM : ISpeciesForm, ITrainerID, IGeneration, IShiny, ILang
/// <param name="move">Move ID</param>
/// <param name="ppUpCount">PP Ups count</param>
/// <returns>Current PP for the move.</returns>
public virtual int GetMovePP(int move, int ppUpCount) => GetBasePP(move) * (5 + ppUpCount) / 5;
public virtual int GetMovePP(ushort move, int ppUpCount) => GetBasePP(move) * (5 + ppUpCount) / 5;
/// <summary>
/// Gets the base PP of a move ID depending on the <see cref="PKM"/>'s format.
/// </summary>
/// <param name="move">Move ID</param>
/// <returns>Amount of PP the move has by default (no PP Ups).</returns>
private int GetBasePP(int move) => MoveInfo.GetPP(Context, (ushort)move);
private int GetBasePP(ushort move) => MoveInfo.GetPP(Context, move);
/// <summary>
/// Applies a shiny <see cref="PID"/> to the <see cref="PKM"/>.

View file

@ -217,7 +217,7 @@ public abstract class GBPKM : PKM
return (ushort)((((2 * (baseStat + iv)) + effort) * level / 100) + 5);
}
public sealed override int GetMovePP(int move, int ppUpCount)
public sealed override int GetMovePP(ushort move, int ppUpCount)
{
var pp = base.GetMovePP(move, 0);
return pp + (ppUpCount * Math.Min(7, pp / 5));

View file

@ -1003,18 +1003,19 @@ public sealed partial class PKMEditor : UserControl, IMainEditor
private void RefreshMovePP(int index)
{
var cb = Moves[index];
int move = WinFormsUtil.GetIndex(cb);
var ppUpControl = PPUps[index];
int ppUpCount = ppUpControl.SelectedIndex;
var moveCB = Moves[index];
var ppText = MovePP[index];
var ppUps = PPUps[index];
int move = WinFormsUtil.GetIndex(moveCB);
if (move <= 0)
{
ppUpControl.SelectedIndex = 0;
MovePP[index].Text = 0.ToString();
ppUps.SelectedIndex = 0;
ppText.Text = 0.ToString();
}
else
{
MovePP[index].Text = Entity.GetMovePP(move, ppUpCount).ToString();
int ppUpCount = ppUps.SelectedIndex;
ppText.Text = Entity.GetMovePP((ushort)move, ppUpCount).ToString();
}
}