using System;
namespace PKHeX.Core;
///
/// Logic for forms.
///
public static class ToxtricityUtil
{
/// Amped Nature Table
private static ReadOnlySpan Nature0 => [ 3, 4, 2, 8, 9, 19, 22, 11, 13, 14, 0, 6, 24 ];
/// Low Key Nature Table
private static ReadOnlySpan Nature1 => [ 1, 5, 7, 10, 12, 15, 16, 17, 18, 20, 21, 23 ];
///
/// Gets a random nature for Toxel -> Toxtricity.
///
/// Random number generator
/// Desired Toxtricity form
/// 0 for Amped, 1 for Low Key
public static Nature GetRandomNature(ref Xoroshiro128Plus rand, byte form)
{
var table = form == 0 ? Nature0 : Nature1;
return (Nature)table[(int)rand.NextInt((uint)table.Length)];
}
///
/// Calculates the evolution form for Toxel -> Toxtricity.
///
/// Entity nature
/// 0 for Amped, 1 for Low Key
public static int GetAmpLowKeyResult(Nature nature)
{
var index = nature - 1;
if ((uint)index > 22)
return 0;
return (0b_0101_1011_1100_1010_0101_0001 >> (int)index) & 1;
}
}