PkmnLibSharp/PkmnLibSharp/Battling/History/HistoryHandler.cs

43 lines
1.1 KiB
C#

using System;
using System.Collections;
using System.Collections.Generic;
using PkmnLibSharp.Utilities;
namespace PkmnLibSharp.Battling.History
{
public sealed class HistoryHandler : PointerWrapper
{
internal HistoryHandler(IntPtr ptr) : base(ptr){}
public HistoryElement? TopElement
{
get
{
var ptr = Creaturelib.Generated.HistoryHandler.GetTopElement(Ptr);
return HistoryElement.Construct(ptr);
}
}
public HistoryElement? GetLastUsedMove()
{
var ptr = Creaturelib.Generated.HistoryHandler.GetLastUsedAttack(Ptr);
return HistoryElement.Construct(ptr);
}
public IEnumerable<HistoryElement> GetIterator()
{
var top = TopElement;
if (top == null) yield break;
while (top != null)
{
yield return top;
top = top.GetPrevious();
}
}
protected override void DeletePtr()
{
}
}
}