PKHeX/PKHeX.Core/Editing/PowerPotential.cs
Kurt 9cc36578c5 Add GameConsole enum and EncounterDate pivot
Can now fetch a valid date for a context
2023-10-28 22:01:26 -07:00

48 lines
1.3 KiB
C#

namespace PKHeX.Core;
/// <summary>
/// Logic for determining the hidden potential (overall IV grade) of a Pokémon.
/// </summary>
public static class PowerPotential
{
/// <summary>
/// Gets the Potential evaluation of the input <see cref="ivTotal"/>.
/// </summary>
public static int GetPotential(int ivTotal) => ivTotal switch
{
<= 90 => 0,
<= 120 => 1,
<= 150 => 2,
_ => 3,
};
private static string GetPotentialUnicode(int rating) => rating switch
{
0 => "★☆☆☆",
1 => "★★☆☆",
2 => "★★★☆",
_ => "★★★★",
};
private static string GetPotentialASCII(int rating) => rating switch
{
0 => "+",
1 => "++",
2 => "+++",
_ => "++++",
};
/// <summary>
/// Gets the Potential evaluation of the input <see cref="pk"/>.
/// </summary>
/// <param name="pk">Pokémon to analyze.</param>
/// <param name="unicode">Returned value is unicode or not</param>
/// <returns>Potential string</returns>
public static string GetPotentialString(this PKM pk, bool unicode = true)
{
var rating = pk.PotentialRating;
if (unicode)
return GetPotentialUnicode(rating);
return GetPotentialASCII(rating);
}
}