Fixes to ensure compatibility

This commit is contained in:
2020-05-03 11:38:49 +02:00
parent d5305b1ac2
commit 640451e6d5
126 changed files with 195 additions and 70 deletions

View File

@@ -10,7 +10,7 @@ namespace PkmnLibSharp.Library
{
}
public EffectParameter(bool b) : base(Creatureliblibrary.Generated.EffectParameter.FromBool(b))
public EffectParameter(bool b) : base(Creatureliblibrary.Generated.EffectParameter.FromBool(b.ToNative()))
{
}
@@ -27,9 +27,9 @@ namespace PkmnLibSharp.Library
public bool AsBool()
{
bool b = false;
byte b = 0;
Creatureliblibrary.Generated.EffectParameter.AsBool(Ptr, ref b).Assert();
return b;
return b == 1;
}
public long AsInt()

View File

@@ -59,7 +59,7 @@ namespace PkmnLibSharp.Library
for (byte i = 0; i < abilityCount; i++)
{
IntPtr s = IntPtr.Zero;
SpeciesVariant.GetTalent(Ptr, false, i, ref s).Assert();
SpeciesVariant.GetTalent(Ptr, MarshalHelper.False, i, ref s).Assert();
abilities[i] = s.PtrString();
}
@@ -80,7 +80,7 @@ namespace PkmnLibSharp.Library
for (byte i = 0; i < abilityCount; i++)
{
IntPtr s = IntPtr.Zero;
SpeciesVariant.GetTalent(Ptr, true, i, ref s).Assert();
SpeciesVariant.GetTalent(Ptr, MarshalHelper.True, i, ref s).Assert();
abilities[i] = s.PtrString();
}

View File

@@ -19,9 +19,9 @@ namespace PkmnLibSharp.Library
public byte BasePower => AttackData.GetBasePower(Ptr);
public byte Accuracy => AttackData.GetAccuracy(Ptr);
public byte BaseUsages => AttackData.GetBaseUsages(Ptr);
public AttackTarget Target => AttackData.GetTarget(Ptr);
public AttackTarget Target => (AttackTarget) AttackData.GetTarget(Ptr);
public sbyte Priority => AttackData.GetPriority(Ptr);
public bool HasSecondaryEffect => AttackData.HasSecondaryEffect(Ptr);
public bool HasSecondaryEffect => AttackData.HasSecondaryEffect(Ptr) == 1;
public float SecondaryEffectChance => AttackData.GetSecondaryEffectChance(Ptr);
public string SecondaryEffectName =>
@@ -29,7 +29,7 @@ namespace PkmnLibSharp.Library
public bool HasFlag(string s)
{
return AttackData.HasFlag(Ptr, s.ToPtr());
return AttackData.HasFlag(Ptr, s.ToPtr()) == 1;
}
public static MoveData Create(string name, byte type, MoveCategory category, byte power, byte accuracy,

View File

@@ -1,5 +1,3 @@
using System;
using System.Runtime.InteropServices;
using Pkmnlib.Generated;
using PkmnLibSharp.Utilities;
@@ -9,8 +7,7 @@ namespace PkmnLibSharp.Library
{
// 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,
byte captureRate, byte baseHappiness) : base(PokemonSpecies.Construct(id, name.ToPtr(), defaultForme.Ptr, genderRatio,
growthRate.ToPtr(), captureRate, baseHappiness))
{
}