Many fixes

This commit is contained in:
2020-05-03 16:26:14 +02:00
parent 640451e6d5
commit 8ce1db668e
8 changed files with 42 additions and 1827 deletions

View File

@@ -1,3 +1,4 @@
using System;
using Pkmnlib.Generated;
using PkmnLibSharp.Utilities;
@@ -6,15 +7,22 @@ namespace PkmnLibSharp.Library
public class Species : PointerWrapper
{
// ReSharper disable once SuggestBaseTypeForParameter
public Species(ushort id, string name, Forme defaultForme, float genderRatio, string growthRate,
byte captureRate, byte baseHappiness) : base(PokemonSpecies.Construct(id, name.ToPtr(), defaultForme.Ptr, genderRatio,
growthRate.ToPtr(), captureRate, baseHappiness))
private Species(IntPtr ptr) : base(ptr)
{
}
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);
}
internal override void DeletePtr()
{
Pokemon.Destruct(Ptr);
PokemonSpecies.Destruct(Ptr);
}
}
}