51 lines
1.4 KiB
C#
51 lines
1.4 KiB
C#
using PkmnLibSharp.Utils;
|
|
using Interface = PkmnLibSharp.FFI.StaticData.Nature;
|
|
|
|
namespace PkmnLibSharp.StaticData
|
|
{
|
|
public class Nature : ExternPointer<Nature.CacheData>
|
|
{
|
|
public class CacheData
|
|
{
|
|
public Statistic? IncreasedStat { get; internal set; }
|
|
public Statistic? DecreasedStat { get; internal set; }
|
|
}
|
|
|
|
public Nature(Statistic increasedStat, Statistic decreasedStat, float increaseModifier = 1.1f,
|
|
float decreaseModifier = 0.9f) : base(
|
|
Interface.nature_new(increasedStat, decreasedStat, increaseModifier, decreaseModifier), true)
|
|
{
|
|
}
|
|
|
|
public static Nature NeutralNature()
|
|
{
|
|
return new Nature(Statistic.HP, Statistic.HP, 1f, 1f);
|
|
}
|
|
|
|
public Statistic IncreasedStat
|
|
{
|
|
get { return Cache.IncreasedStat ??= Interface.nature_increased_stat(Ptr); }
|
|
}
|
|
|
|
public Statistic DecreasedStat
|
|
{
|
|
get { return Cache.DecreasedStat ??= Interface.nature_decreased_stat(Ptr); }
|
|
}
|
|
|
|
public float GetStatModifier(Statistic statistic)
|
|
{
|
|
return Interface.nature_get_stat_modifier(Ptr, statistic);
|
|
}
|
|
|
|
|
|
protected override CacheData CreateCache()
|
|
{
|
|
return new CacheData();
|
|
}
|
|
|
|
protected override void Destructor()
|
|
{
|
|
Interface.nature_drop(Ptr);
|
|
}
|
|
}
|
|
} |