diff --git a/PkmnLibSharp/Battling/Battle/Battle.cs b/PkmnLibSharp/Battling/Battle/Battle.cs index c8988c4..279166e 100644 --- a/PkmnLibSharp/Battling/Battle/Battle.cs +++ b/PkmnLibSharp/Battling/Battle/Battle.cs @@ -155,9 +155,9 @@ namespace PkmnLibSharp.Battling Creaturelib.Generated.Battle.ForceRecall(Ptr, side, index).Assert(); } - public void SwitchPokemon(byte side, byte index, Pokemon newPokemon) + public void SwitchPokemon(byte side, byte index, Pokemon? newPokemon) { - Creaturelib.Generated.Battle.SwitchCreature(Ptr, side, index, newPokemon.Ptr).Assert(); + Creaturelib.Generated.Battle.SwitchCreature(Ptr, side, index, newPokemon?.Ptr ?? IntPtr.Zero).Assert(); } public bool CanSlotBeFilled(byte side, byte index) diff --git a/PkmnLibSharp/Battling/Battle/BattleSide.cs b/PkmnLibSharp/Battling/Battle/BattleSide.cs index a09bde4..a794ab6 100644 --- a/PkmnLibSharp/Battling/Battle/BattleSide.cs +++ b/PkmnLibSharp/Battling/Battle/BattleSide.cs @@ -44,10 +44,12 @@ namespace PkmnLibSharp.Battling Creaturelib.Generated.BattleSide.SetCreature(Ptr, pokemon.Ptr, index); } - public Pokemon GetPokemon(byte index) + public Pokemon? GetPokemon(byte index) { var ptr = IntPtr.Zero; Creaturelib.Generated.BattleSide.GetCreature(ref ptr, Ptr, index); + if (ptr == IntPtr.Zero) + return null; if (TryResolvePointer(ptr, out Pokemon? pokemon)) return pokemon!; return Constructor.Active.ConstructPokemon(ptr)!; diff --git a/PkmnLibSharp/Battling/LearnedMove.cs b/PkmnLibSharp/Battling/LearnedMove.cs index 45ac543..9b752ca 100644 --- a/PkmnLibSharp/Battling/LearnedMove.cs +++ b/PkmnLibSharp/Battling/LearnedMove.cs @@ -42,6 +42,22 @@ namespace PkmnLibSharp.Battling private MoveData? _move; + public void DecreaseUses(byte amount) + { + LearnedAttack.DecreaseUses(Ptr, amount); + } + + public void RestoreUses(byte amount) + { + LearnedAttack.RestoreUses(Ptr, amount); + } + + public void RestoreAllUses() + { + LearnedAttack.RestoreAllUses(Ptr); + } + + public override string ToString() { return base.ToString() + $": {Move.Name} PP: {RemainingUses}/{MaxUses}"; diff --git a/PkmnLibSharp/Battling/Pokemon.cs b/PkmnLibSharp/Battling/Pokemon.cs index 9119679..9d6c63b 100644 --- a/PkmnLibSharp/Battling/Pokemon.cs +++ b/PkmnLibSharp/Battling/Pokemon.cs @@ -31,7 +31,7 @@ namespace PkmnLibSharp.Battling protected static IntPtr CreatePtr(BattleLibrary library, Species species, Forme forme, byte level, uint experience, uint uid, Gender gender, byte coloring, Item? heldItem, string? nickname, - bool hiddenAbility, byte abilityIndex, IReadOnlyCollection moves, StatisticSet ivs, + bool hiddenAbility, byte abilityIndex, IReadOnlyCollection moves, StatisticSet ivs, StatisticSet evs, Nature nature, bool allowedExperienceGain, bool isEgg) { var movesArr = moves.Select(x => x?.Ptr ?? IntPtr.Zero).ToArray(); diff --git a/PkmnLibSharp/Native/Linux/libArbutils.so b/PkmnLibSharp/Native/Linux/libArbutils.so index 7eccb2b..2c1f2e5 100755 --- a/PkmnLibSharp/Native/Linux/libArbutils.so +++ b/PkmnLibSharp/Native/Linux/libArbutils.so @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:4857b0907a1ca90ad9b341afd13daa62bf53a21c9ff986c990024e2d2b64eb17 +oid sha256:614cad1b7e7f75302a8b0e27e3ef26955a0f2d5bc8eab857e451390276de94cc size 2187816 diff --git a/PkmnLibSharp/Native/Linux/libCreatureLib.so b/PkmnLibSharp/Native/Linux/libCreatureLib.so index 0df1b76..0da90d6 100755 --- a/PkmnLibSharp/Native/Linux/libCreatureLib.so +++ b/PkmnLibSharp/Native/Linux/libCreatureLib.so @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:47c5c873224c9fd147f99ad1bc6fc448705016abff2fdd0d66f2be0dc5bd6f5c -size 2128616 +oid sha256:6aa3dc1f716aae214ca8d456890a675d365112cc91ee7be5a4a19cd41d5914dc +size 9840056 diff --git a/PkmnLibSharp/Native/Linux/libpkmnLib.so b/PkmnLibSharp/Native/Linux/libpkmnLib.so index 21a4465..0ce6816 100755 --- a/PkmnLibSharp/Native/Linux/libpkmnLib.so +++ b/PkmnLibSharp/Native/Linux/libpkmnLib.so @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:7253e9daed1eee1333eeda8518bf6bbd6b0402e72fb09f77d719bf77793c8a40 -size 3818992 +oid sha256:ba625bf740931ec18614df8ed8afab3e651be2ba643a7b418eea363ba6fc4c54 +size 15620288 diff --git a/PkmnLibSharp/Native/Windows/libArbutils.dll b/PkmnLibSharp/Native/Windows/libArbutils.dll index 7e44b57..b470926 100755 --- a/PkmnLibSharp/Native/Windows/libArbutils.dll +++ b/PkmnLibSharp/Native/Windows/libArbutils.dll @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:73c7e4fc7cfeb61ba10deecb219fe59ce107b34fb59d67ace7d41ae1daea6e23 +oid sha256:bc7ac8ac8db5a9ad665f33aea901f8f9e991b2df73a5db2889abf74b6fa8d170 size 16128282 diff --git a/PkmnLibSharp/Native/Windows/libCreatureLib.dll b/PkmnLibSharp/Native/Windows/libCreatureLib.dll index d6f7903..345c0e6 100755 --- a/PkmnLibSharp/Native/Windows/libCreatureLib.dll +++ b/PkmnLibSharp/Native/Windows/libCreatureLib.dll @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:8d8313c2ef8ae9d8930cd3f8f61f8b3d210f5b4f33ac24651d416bec584cf1e6 +oid sha256:05f506655d31b5160ee37a66ba8d8a23cbc92933e2f412f5b882185260007e38 size 17787239 diff --git a/PkmnLibSharp/Native/Windows/libangelscript.dll b/PkmnLibSharp/Native/Windows/libangelscript.dll index ded0c59..4f2d693 100755 --- a/PkmnLibSharp/Native/Windows/libangelscript.dll +++ b/PkmnLibSharp/Native/Windows/libangelscript.dll @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:e2ce3428094a5f7e9f21de3f02e676229ad59d5e389a2284b1d1b0f5c23ca1c5 -size 3108869 +oid sha256:b50c93c3af9782a627709b6985db2dc82b6b30ec82e3e9056ebddf0aea39764b +size 3115872 diff --git a/PkmnLibSharp/Native/Windows/libpkmnLib.dll b/PkmnLibSharp/Native/Windows/libpkmnLib.dll index 36fa459..a96393b 100755 --- a/PkmnLibSharp/Native/Windows/libpkmnLib.dll +++ b/PkmnLibSharp/Native/Windows/libpkmnLib.dll @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:7eda059cfc0bab6dbcaec99fe514cb359dcd4715dff0f50431d841652d99a1dd -size 21994086 +oid sha256:ef87821cfedc0c179d4a63adf9e708c7d5cc8cf755f26b00b551b8e29690d062 +size 21999748 diff --git a/PkmnLibSharp/Native/Windows/libpkmnlib_ai.dll b/PkmnLibSharp/Native/Windows/libpkmnlib_ai.dll index abfce95..c6a1635 100755 --- a/PkmnLibSharp/Native/Windows/libpkmnlib_ai.dll +++ b/PkmnLibSharp/Native/Windows/libpkmnlib_ai.dll @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:37cf46b4b3c7e94970a3accfbe9ca552eee1fb02eab394aff2dde0ee5d1c6c26 +oid sha256:cfe6c6e867505e3d9c3ff4ce8eb0268522f44683772bd2ec4f3792e8c895867d size 17463240