Fix wrapper for MiscLibrary ReplacementMove
This commit is contained in:
parent
a90fb3e481
commit
2ba7dbf6a3
|
@ -1,3 +1,4 @@
|
|||
using System;
|
||||
using PkmnLibSharp.Utilities;
|
||||
|
||||
namespace PkmnLibSharp.Battling.ChoiceTurn
|
||||
|
@ -8,6 +9,8 @@ namespace PkmnLibSharp.Battling.ChoiceTurn
|
|||
: base(Creaturelib.Generated.AttackTurnChoice.Construct(user.Ptr, move.Ptr, targetSide, targetIndex))
|
||||
{
|
||||
}
|
||||
|
||||
internal MoveTurnChoice(IntPtr ptr) : base(ptr){}
|
||||
|
||||
public LearnedMove Move
|
||||
{
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue