40 lines
1.2 KiB
C#
40 lines
1.2 KiB
C#
using System;
|
|
using PkmnLibSharp.Battling.ChoiceTurn;
|
|
using PkmnLibSharp.Library.Items;
|
|
|
|
namespace PkmnLibSharp.Battling
|
|
{
|
|
public class ItemTurnChoice : BaseTurnChoice
|
|
{
|
|
public ItemTurnChoice(Pokemon user, Item item) : base(
|
|
Creaturelib.Generated.ItemTurnChoice.ConstructWithoutTarget(user.Ptr, item.Ptr))
|
|
{
|
|
}
|
|
|
|
public ItemTurnChoice(Pokemon user, Item item, byte targetSide, byte targetIndex) : base(
|
|
Creaturelib.Generated.ItemTurnChoice.ConstructWithTarget(user.Ptr, item.Ptr, targetSide, targetIndex))
|
|
{
|
|
}
|
|
|
|
internal ItemTurnChoice(IntPtr ptr) : base(ptr){}
|
|
|
|
private Item? _item;
|
|
public Item Item
|
|
{
|
|
get
|
|
{
|
|
if (_item != null) return _item;
|
|
var ptr = Creaturelib.Generated.ItemTurnChoice.GetItem(Ptr);
|
|
if (TryResolvePointer(ptr, out _item))
|
|
return _item!;
|
|
_item = new Item(ptr);
|
|
return _item;
|
|
}
|
|
}
|
|
|
|
protected override void DeletePtr()
|
|
{
|
|
Creaturelib.Generated.ItemTurnChoice.Destruct(Ptr);
|
|
}
|
|
}
|
|
} |