PkmnLibSharp/PkmnLibSharp/Battling/Events/EventData/ChangeStatBoostEvent.cs

37 lines
1.2 KiB
C#

using System;
using PkmnLibSharp.Utilities;
using Statistic = PkmnLibSharp.Library.Statistic;
namespace PkmnLibSharp.Battling.Events
{
public class ChangeStatBoostEvent : EventData
{
internal ChangeStatBoostEvent(EventDataKind kind, IntPtr ptr) : base(kind, ptr)
{
}
public Pokemon Pokemon
{
get
{
if (_pokemon != null) return _pokemon;
var ptr = Creaturelib.Generated.ChangeStatBoostEvent.GetCreature(Ptr);
if (TryResolvePointer(ptr, out _pokemon))
return _pokemon!;
_pokemon = Constructor.Active.ConstructPokemon(ptr)!;
return _pokemon;
}
}
public Statistic Statistic => (Statistic) Creaturelib.Generated.ChangeStatBoostEvent.GetStatistic(Ptr);
public sbyte OldValue => Creaturelib.Generated.ChangeStatBoostEvent.GetOldValue(Ptr);
public sbyte NewValue => Creaturelib.Generated.ChangeStatBoostEvent.GetNewValue(Ptr);
private Pokemon? _pokemon;
protected override void DeletePtr()
{
Creaturelib.Generated.ChangeStatBoostEvent.Destruct(Ptr);
}
}
}