2018-08-28 22:10:04 +00:00
|
|
|
namespace PKHeX.Core
|
|
|
|
{
|
|
|
|
/// <summary>
|
|
|
|
/// Coordinate / Index Relationship for a Generation 2 Headbutt Tree
|
|
|
|
/// </summary>
|
2020-11-28 22:55:09 +00:00
|
|
|
internal readonly struct TreeCoordinates
|
2018-08-28 22:10:04 +00:00
|
|
|
{
|
2020-11-28 22:55:09 +00:00
|
|
|
#if DEBUG
|
|
|
|
private readonly int X;
|
|
|
|
private readonly int Y;
|
|
|
|
#endif
|
|
|
|
public readonly byte Index;
|
2018-08-28 22:10:04 +00:00
|
|
|
|
2020-11-28 22:55:09 +00:00
|
|
|
public TreeCoordinates(in int x, in int y)
|
2018-08-28 22:10:04 +00:00
|
|
|
{
|
2020-11-28 22:55:09 +00:00
|
|
|
#if DEBUG
|
2018-08-28 22:10:04 +00:00
|
|
|
X = x;
|
|
|
|
Y = y;
|
2020-11-28 22:55:09 +00:00
|
|
|
#endif
|
|
|
|
Index = (byte)(((x * y) + x + y) / 5 % 10);
|
2018-08-28 22:10:04 +00:00
|
|
|
}
|
2020-11-28 22:55:09 +00:00
|
|
|
|
|
|
|
#if DEBUG
|
|
|
|
public override string ToString() => $"{Index} @ ({X:D2},{Y:D2})";
|
|
|
|
#endif
|
2018-08-28 22:10:04 +00:00
|
|
|
}
|
2020-11-28 22:55:09 +00:00
|
|
|
}
|