PkmnLibSharp/PkmnLibSharp/Battling/ChoiceTurn/MoveTurnChoice.cs

47 lines
1.4 KiB
C#

using PkmnLibSharp.Utilities;
namespace PkmnLibSharp.Battling.ChoiceTurn
{
public class MoveTurnChoice : BaseTurnChoice
{
public MoveTurnChoice(Pokemon user, LearnedMove move, byte side, byte index)
: base(Creaturelibbattling.Generated.AttackTurnChoice.Construct(user.Ptr, move.Ptr, side, index))
{
}
public LearnedMove Move
{
get
{
if (_move != null) return _move;
var ptr = Creaturelibbattling.Generated.AttackTurnChoice.GetAttack(Ptr);
if (TryResolvePointer(ptr, out _move))
return _move;
_move = new LearnedMove(ptr);
return _move;
}
}
public sbyte Priority
{
get
{
sbyte b = 0;
Creaturelibbattling.Generated.AttackTurnChoice.GetPriority(ref b, Ptr).Assert();
return b;
}
}
public byte TargetSide => Creaturelibbattling.Generated.AttackTurnChoice.GetTargetSideIndex(Ptr);
public byte TargetIndex => Creaturelibbattling.Generated.AttackTurnChoice.GetTargetCreatureIndex(Ptr);
// TODO: Move Script getter
private LearnedMove _move;
protected override void DeletePtr()
{
Creaturelibbattling.Generated.AttackTurnChoice.Destruct(Ptr);
}
}
}