37 lines
968 B
C#
37 lines
968 B
C#
using System;
|
|
using System.Runtime.InteropServices;
|
|
using PkmnLibSharp.Utilities;
|
|
|
|
namespace PkmnLibSharp.Battling
|
|
{
|
|
public class CaptureLibrary : PointerWrapper
|
|
{
|
|
[StructLayout(LayoutKind.Explicit)]
|
|
public struct CaptureResult
|
|
{
|
|
[FieldOffset(0)] private readonly byte _wasCaught;
|
|
[FieldOffset(1)] public readonly byte Shakes;
|
|
[FieldOffset(2)] private readonly byte _wasCritical;
|
|
|
|
public bool WasCaught => _wasCaught == 1;
|
|
public bool WasCritical => _wasCritical == 1;
|
|
}
|
|
|
|
|
|
internal CaptureLibrary(IntPtr ptr) : base(ptr)
|
|
{
|
|
}
|
|
|
|
public CaptureLibrary()
|
|
{
|
|
var ptr = this.Ptr;
|
|
Pkmnlib.Generated.CaptureLibrary.Construct(ref ptr);
|
|
Initialize(ptr);
|
|
}
|
|
|
|
protected override void DeletePtr()
|
|
{
|
|
Pkmnlib.Generated.CaptureLibrary.Destruct(Ptr);
|
|
}
|
|
}
|
|
} |