Adds ItemTurnChoice interface

master
Deukhoofd 10 months ago
parent 61e48a705a
commit 907e145083
Signed by: Deukhoofd
GPG Key ID: F63E044490819F6F
  1. 40
      PkmnLibSharp/Battling/ChoiceTurn/ItemTurnChoice.cs
  2. 3
      PkmnLibSharp/Battling/ChoiceTurn/SwitchTurnChoice.cs
  3. 2
      PkmnLibSharp/Generated/Creaturelib/FleeTurnChoice.cs
  4. 39
      PkmnLibSharp/Generated/Creaturelib/ItemTurnChoice.cs
  5. 2
      PkmnLibSharp/Generated/Creaturelib/PassTurnChoice.cs
  6. 2
      PkmnLibSharp/Generated/Creaturelib/SwitchTurnChoice.cs
  7. 4
      PkmnLibSharp/Library/Items/Item.cs
  8. BIN
      PkmnLibSharp/Native/Linux/libArbutils.so
  9. BIN
      PkmnLibSharp/Native/Linux/libCreatureLib.so
  10. BIN
      PkmnLibSharp/Native/Linux/libpkmnLib.so
  11. BIN
      PkmnLibSharp/Native/Linux/libpkmnlib_ai.so
  12. BIN
      PkmnLibSharp/Native/Windows/libArbutils.dll
  13. BIN
      PkmnLibSharp/Native/Windows/libCreatureLib.dll
  14. BIN
      PkmnLibSharp/Native/Windows/libangelscript.dll
  15. BIN
      PkmnLibSharp/Native/Windows/libpkmnLib.dll
  16. BIN
      PkmnLibSharp/Native/Windows/libpkmnlib_ai.dll
  17. 2
      PkmnLibSharp/creaturelib.json

@ -0,0 +1,40 @@
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);
}
}
}

@ -1,6 +1,7 @@
using System;
using PkmnLibSharp.Battling.ChoiceTurn;
namespace PkmnLibSharp.Battling.ChoiceTurn
namespace PkmnLibSharp.Battling
{
public class SwitchTurnChoice : BaseTurnChoice
{

@ -11,7 +11,7 @@ namespace Creaturelib.Generated
[DllImport("libCreatureLib", CallingConvention = CallingConvention.Cdecl, EntryPoint= "CreatureLib_FleeTurnChoice_Construct")]
internal static extern IntPtr Construct(IntPtr user);
/// <param name="p">AttackTurnChoice *</param>
/// <param name="p">FleeTurnChoice *</param>
/// <returns>void</returns>
[DllImport("libCreatureLib", CallingConvention = CallingConvention.Cdecl, EntryPoint= "CreatureLib_FleeTurnChoice_Destruct")]
internal static extern void Destruct(IntPtr p);

@ -0,0 +1,39 @@
// AUTOMATICALLY GENERATED, DO NOT EDIT
using System;
using System.Runtime.InteropServices;
namespace Creaturelib.Generated
{
internal static class ItemTurnChoice
{
/// <param name="user">Creature *</param>
/// <param name="item">Item *</param>
/// <returns>ItemTurnChoice *</returns>
[DllImport("libCreatureLib", CallingConvention = CallingConvention.Cdecl, EntryPoint= "CreatureLib_ItemTurnChoice_ConstructWithoutTarget")]
internal static extern IntPtr ConstructWithoutTarget(IntPtr user, IntPtr item);
/// <param name="user">Creature *</param>
/// <param name="item">const Item *</param>
/// <param name="targetSide">unsigned char</param>
/// <param name="targetIndex">unsigned char</param>
/// <returns>ItemTurnChoice *</returns>
[DllImport("libCreatureLib", CallingConvention = CallingConvention.Cdecl, EntryPoint= "CreatureLib_ItemTurnChoice_ConstructWithTarget")]
internal static extern IntPtr ConstructWithTarget(IntPtr user, IntPtr item, byte targetSide, byte targetIndex);
/// <param name="p">SwitchTurnChoice *</param>
/// <returns>void</returns>
[DllImport("libCreatureLib", CallingConvention = CallingConvention.Cdecl, EntryPoint= "CreatureLib_ItemTurnChoice_Destruct")]
internal static extern void Destruct(IntPtr p);
/// <param name="p">const ItemTurnChoice *</param>
/// <returns>TurnChoiceKind</returns>
[DllImport("libCreatureLib", CallingConvention = CallingConvention.Cdecl, EntryPoint= "CreatureLib_ItemTurnChoice_GetKind")]
internal static extern TurnChoiceKind GetKind(IntPtr p);
/// <param name="p">const ItemTurnChoice *</param>
/// <returns>const Item *</returns>
[DllImport("libCreatureLib", CallingConvention = CallingConvention.Cdecl, EntryPoint= "CreatureLib_ItemTurnChoice_GetItem")]
internal static extern IntPtr GetItem(IntPtr p);
}
}

@ -11,7 +11,7 @@ namespace Creaturelib.Generated
[DllImport("libCreatureLib", CallingConvention = CallingConvention.Cdecl, EntryPoint= "CreatureLib_PassTurnChoice_Construct")]
internal static extern IntPtr Construct(IntPtr user);
/// <param name="p">AttackTurnChoice *</param>
/// <param name="p">PassTurnChoice *</param>
/// <returns>void</returns>
[DllImport("libCreatureLib", CallingConvention = CallingConvention.Cdecl, EntryPoint= "CreatureLib_PassTurnChoice_Destruct")]
internal static extern void Destruct(IntPtr p);

@ -12,7 +12,7 @@ namespace Creaturelib.Generated
[DllImport("libCreatureLib", CallingConvention = CallingConvention.Cdecl, EntryPoint= "CreatureLib_SwitchTurnChoice_Construct")]
internal static extern IntPtr Construct(IntPtr user, IntPtr newCreature);
/// <param name="p">AttackTurnChoice *</param>
/// <param name="p">SwitchTurnChoice *</param>
/// <returns>void</returns>
[DllImport("libCreatureLib", CallingConvention = CallingConvention.Cdecl, EntryPoint= "CreatureLib_SwitchTurnChoice_Destruct")]
internal static extern void Destruct(IntPtr p);

@ -22,6 +22,10 @@ namespace PkmnLibSharp.Library.Items
Initialize(p);
}
internal Item(IntPtr p) : base(p)
{
}
public string Name => _name ??= Creaturelib.Generated.Item.GetName(Ptr).PtrString()!;
public ItemCategory Category => (ItemCategory)Creaturelib.Generated.Item.GetCategory(Ptr);

Binary file not shown.

Binary file not shown.

BIN
PkmnLibSharp/Native/Linux/libpkmnLib.so (Stored with Git LFS)

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

File diff suppressed because one or more lines are too long
Loading…
Cancel
Save