Updates pkmnlib, adds wrappers for PkmnLib_ai

This commit is contained in:
2021-04-23 10:53:50 +02:00
parent ced4524737
commit 12850e3771
28 changed files with 211 additions and 18 deletions

View File

@@ -0,0 +1,9 @@
namespace PkmnLibSharp.AI
{
public class DepthSearchAI : PokemonAI
{
public DepthSearchAI() : base(PkmnLibAI.Generated.DepthSearchAI.Create())
{
}
}
}

View File

@@ -0,0 +1,11 @@
using System;
namespace PkmnLibSharp.AI
{
public class NaiveAI : PokemonAI
{
public NaiveAI() : base(PkmnLibAI.Generated.NaiveAI.Create())
{
}
}
}

View File

@@ -0,0 +1,27 @@
using System;
using PkmnLibSharp.Battling;
using PkmnLibSharp.Utilities;
using BaseTurnChoice = PkmnLibSharp.Battling.ChoiceTurn.BaseTurnChoice;
namespace PkmnLibSharp.AI
{
public abstract class PokemonAI : PointerWrapper
{
protected PokemonAI(IntPtr ptr) : base(ptr)
{
}
public BaseTurnChoice GetChoice(Battle battle, Pokemon user)
{
var ptr = IntPtr.Zero;
PkmnLibAI.Generated.PokemonAI.GetChoice(ref ptr, Ptr, battle.Ptr, user.Ptr).Assert();
return BaseTurnChoice.GetFromPointer(ptr);
}
protected override void DeletePtr()
{
PkmnLibAI.Generated.PokemonAI.Delete(Ptr);
}
}
}

View File

@@ -0,0 +1,11 @@
using System;
namespace PkmnLibSharp.AI
{
public class RandomAI : PokemonAI
{
public RandomAI() : base(PkmnLibAI.Generated.RandomAI.Create())
{
}
}
}