PKHeX/PKHeX.Core/Legality/Verifiers/Ball/IBallContext.cs
Kurt bced546c63
Memoize Ball Breeding permission tables (#4050)
O(1) lookup for arbitrary species, some edge handling rules for specific game islands/forms. With HOME, there's only 3 islands of permissions. No allocation besides the singletons which aren't really necessary.

No longer need to peek within multiple hashsets, just fetch the "is possible" bit from the species listing and check if the bit is set.

Will be fun if ball shell swaps are added 🤞, get to set all bits for anything that can enter game with that feature (if ever added).

Add unit test for gen67 no-patch exclusion
2023-11-02 15:55:26 -07:00

19 lines
697 B
C#

namespace PKHeX.Core;
/// <summary>
/// Context for determining if a ball can be inherited.
/// </summary>
public interface IBallContext
{
/// <summary>
/// Checks if the <see cref="PKM"/> can be bred with the given <see cref="Ball"/>.
/// </summary>
/// <param name="species">Encounter Species</param>
/// <param name="form">Encounter Form</param>
/// <param name="ball">Encounter Ball</param>
/// <param name="pk">Current Entity</param>
BallInheritanceResult CanBreedWithBall(ushort species, byte form, Ball ball, PKM pk);
/// <inheritdoc cref="CanBreedWithBall(ushort, byte, Ball, PKM)"/>
bool CanBreedWithBall(ushort species, byte form, Ball ball);
}