PkmnLibSharp/PkmnLibSharp/Library/Species.cs

28 lines
825 B
C#
Raw Normal View History

2020-05-03 14:26:14 +00:00
using System;
2020-05-02 17:54:07 +00:00
using Pkmnlib.Generated;
2020-05-02 20:58:08 +00:00
using PkmnLibSharp.Utilities;
2020-05-02 17:54:07 +00:00
namespace PkmnLibSharp.Library
{
public class Species : PointerWrapper
{
// ReSharper disable once SuggestBaseTypeForParameter
2020-05-03 14:26:14 +00:00
private Species(IntPtr ptr) : base(ptr)
2020-05-02 17:54:07 +00:00
{
}
2020-05-03 14:26:14 +00:00
public static Species Create(ushort id, string name, Forme defaultForme, float genderRatio, string growthRate,
byte captureRate, byte baseHappiness)
{
var ptr = IntPtr.Zero;
PokemonSpecies.Construct(ref ptr, id, name.ToPtr(), defaultForme.Ptr, genderRatio,
growthRate.ToPtr(), captureRate, baseHappiness).Assert();
return new Species(ptr);
}
2020-05-02 17:54:07 +00:00
internal override void DeletePtr()
{
2020-05-03 14:26:14 +00:00
PokemonSpecies.Destruct(Ptr);
2020-05-02 17:54:07 +00:00
}
}
}