using PkmnLib.Dynamic.Models; using PkmnLib.Static; namespace PkmnLib.Dynamic.Libraries; /// /// Represents the result of a capture attempt. /// public record struct CaptureResult { /// public CaptureResult(bool IsCaught, int Shakes, bool CriticalCapture) { this.IsCaught = IsCaught; this.Shakes = Shakes; this.CriticalCapture = CriticalCapture; } /// /// Indicates whether the capture was successful. /// public bool IsCaught { get; init; } /// /// The number of shakes the Poké Ball made before the capture attempt was successful or failed. /// public int Shakes { get; init; } /// /// Indicates whether a critical capture occurred. A critical capture is a special case where the Poké Ball /// shakes only once and then captures the Pokémon. /// public bool CriticalCapture { get; init; } /// /// Creates a indicating a failed capture attempt. /// public static CaptureResult Failed => new(false, 0, false); } /// /// Interface for a library that handles Pokémon capture mechanics. /// public interface ICaptureLibrary { /// /// Attempts to capture a Pokémon using a specified item (e.g., Poké Ball). /// CaptureResult TryCapture(IPokemon target, IItem captureItem, IBattleRandom random); }