Fix wrapper for MiscLibrary ReplacementMove

This commit is contained in:
Deukhoofd 2020-09-01 12:20:54 +02:00
parent a90fb3e481
commit 2ba7dbf6a3
Signed by: Deukhoofd
GPG Key ID: F63E044490819F6F
2 changed files with 12 additions and 2 deletions

View File

@ -1,3 +1,4 @@
using System;
using PkmnLibSharp.Utilities;
namespace PkmnLibSharp.Battling.ChoiceTurn
@ -9,6 +10,8 @@ namespace PkmnLibSharp.Battling.ChoiceTurn
{
}
internal MoveTurnChoice(IntPtr ptr) : base(ptr){}
public LearnedMove Move
{
get

View File

@ -1,5 +1,8 @@
using System;
using Creaturelib.Generated;
using PkmnLibSharp.Battling.ChoiceTurn;
using PkmnLibSharp.Utilities;
using BaseTurnChoice = PkmnLibSharp.Battling.ChoiceTurn.BaseTurnChoice;
namespace PkmnLibSharp.Battling
{
@ -26,12 +29,16 @@ namespace PkmnLibSharp.Battling
return b == MarshalHelper.True;
}
public IntPtr ReplacementAttack(Pokemon user, byte sideTarget, byte creatureTarget)
public BaseTurnChoice ReplacementMove(Pokemon user, byte sideTarget, byte creatureTarget)
{
var b = IntPtr.Zero;
Creaturelib.Generated.MiscLibrary.ReplacementAttack(ref b, Ptr, user.Ptr, sideTarget, creatureTarget)
.Assert();
return b;
if (TryResolvePointer(b, out BaseTurnChoice? choice))
{
return choice!;
}
return new MoveTurnChoice(b);
}