Store hidden power type

This commit is contained in:
Kurt 2018-12-28 16:54:01 -08:00
parent a133fcd498
commit 3e05e9655e

View File

@ -93,6 +93,11 @@ public class ShowdownSet
/// </summary>
public int[] IVs { get; private set; } = {31, 31, 31, 31, 31, 31};
/// <summary>
/// <see cref="PKM.HPType"/> of the Set entity.
/// </summary>
public int HiddenPowerType { get; set; } = -1;
/// <summary>
/// <see cref="PKM.Moves"/> of the Set entity.
/// </summary>
@ -326,7 +331,11 @@ private IEnumerable<string> GetStringMoves()
{
var str = $"- {Strings.Move[move]}";
if (move == 237) // Hidden Power
str += $" [{Strings.Types[1+HiddenPower.GetType(IVs, Format)]}]";
{
var hpVal = HiddenPower.GetType(IVs, Format);
str += $" [{Strings.Types[1+ hpVal]}]";
HiddenPowerType = hpVal;
}
yield return str;
}
}
@ -509,6 +518,7 @@ private string ParseLineMove(string line)
type = ReplaceAll(type, string.Empty, "[", "]", "(", ")"); // Trim out excess data
int hpVal = Array.IndexOf(Strings.types, type) - 1; // Get HP Type
HiddenPowerType = hpVal;
if (IVs.Any(z => z != 31))
{
if (!HiddenPower.SetIVsForType(hpVal, IVs, Format))