Adds a bunch of evolution methods

This commit is contained in:
Deukhoofd 2021-06-27 12:23:26 +02:00
parent ecea85c26a
commit 74bd383093
Signed by: Deukhoofd
GPG Key ID: F63E044490819F6F
6 changed files with 77 additions and 34 deletions

View File

@ -18,6 +18,14 @@ namespace Pkmnlib.Generated
[DllImport("libpkmnLib", CallingConvention = CallingConvention.Cdecl, EntryPoint= "PkmnLib_EvolutionData_CreateFriendshipEvolution")] [DllImport("libpkmnLib", CallingConvention = CallingConvention.Cdecl, EntryPoint= "PkmnLib_EvolutionData_CreateFriendshipEvolution")]
internal static extern IntPtr CreateFriendshipEvolution(byte friendship, IntPtr into); internal static extern IntPtr CreateFriendshipEvolution(byte friendship, IntPtr into);
/// <param name="friendship">unsigned char</param>
/// <param name="startTime">TimeOfDay</param>
/// <param name="endTime">TimeOfDay</param>
/// <param name="into">const PokemonSpecies *</param>
/// <returns>const EvolutionData *</returns>
[DllImport("libpkmnLib", CallingConvention = CallingConvention.Cdecl, EntryPoint= "PkmnLib_EvolutionData_CreateFriendshipTimeEvolution")]
internal static extern IntPtr CreateFriendshipTimeEvolution(byte friendship, TimeOfDay startTime, TimeOfDay endTime, IntPtr into);
/// <param name="move">const MoveData *</param> /// <param name="move">const MoveData *</param>
/// <param name="into">const PokemonSpecies *</param> /// <param name="into">const PokemonSpecies *</param>
/// <returns>const EvolutionData *</returns> /// <returns>const EvolutionData *</returns>
@ -30,17 +38,26 @@ namespace Pkmnlib.Generated
[DllImport("libpkmnLib", CallingConvention = CallingConvention.Cdecl, EntryPoint= "PkmnLib_EvolutionData_CreateLocationEvolution")] [DllImport("libpkmnLib", CallingConvention = CallingConvention.Cdecl, EntryPoint= "PkmnLib_EvolutionData_CreateLocationEvolution")]
internal static extern IntPtr CreateLocationEvolution(IntPtr location, IntPtr into); internal static extern IntPtr CreateLocationEvolution(IntPtr location, IntPtr into);
/// <param name="time">TimeOfDay</param> /// <param name="startTime">TimeOfDay</param>
/// <param name="endTime">TimeOfDay</param>
/// <param name="into">const PokemonSpecies *</param> /// <param name="into">const PokemonSpecies *</param>
/// <returns>const EvolutionData *</returns> /// <returns>const EvolutionData *</returns>
[DllImport("libpkmnLib", CallingConvention = CallingConvention.Cdecl, EntryPoint= "PkmnLib_EvolutionData_CreateTimeEvolution")] [DllImport("libpkmnLib", CallingConvention = CallingConvention.Cdecl, EntryPoint= "PkmnLib_EvolutionData_CreateTimeEvolution")]
internal static extern IntPtr CreateTimeEvolution(TimeOfDay time, IntPtr into); internal static extern IntPtr CreateTimeEvolution(TimeOfDay startTime, TimeOfDay endTime, IntPtr into);
/// <param name="item">const Item *</param> /// <param name="item">const Item *</param>
/// <param name="into">const PokemonSpecies *</param> /// <param name="into">const PokemonSpecies *</param>
/// <returns>const EvolutionData *</returns> /// <returns>const EvolutionData *</returns>
[DllImport("libpkmnLib", CallingConvention = CallingConvention.Cdecl, EntryPoint= "PkmnLib_EvolutionData_CreateItemEvolution")] [DllImport("libpkmnLib", CallingConvention = CallingConvention.Cdecl, EntryPoint= "PkmnLib_EvolutionData_CreateHeldItemEvolution")]
internal static extern IntPtr CreateItemEvolution(IntPtr item, IntPtr into); internal static extern IntPtr CreateHeldItemEvolution(IntPtr item, IntPtr into);
/// <param name="item">const Item *</param>
/// <param name="startTime">TimeOfDay</param>
/// <param name="endTime">TimeOfDay</param>
/// <param name="into">const PokemonSpecies *</param>
/// <returns>const EvolutionData *</returns>
[DllImport("libpkmnLib", CallingConvention = CallingConvention.Cdecl, EntryPoint= "PkmnLib_EvolutionData_CreateHeldItemTimeEvolution")]
internal static extern IntPtr CreateHeldItemTimeEvolution(IntPtr item, TimeOfDay startTime, TimeOfDay endTime, IntPtr into);
/// <param name="gender">Gender</param> /// <param name="gender">Gender</param>
/// <param name="level">unsigned char</param> /// <param name="level">unsigned char</param>

View File

@ -8,16 +8,18 @@ namespace Pkmnlib
{ {
Level = 0, Level = 0,
HighFriendship = 1, HighFriendship = 1,
KnownMove = 2, HighFriendshipTime = 2,
LocationBased = 3, KnownMove = 3,
TimeBased = 4, LocationBased = 4,
HoldsItem = 5, TimeBased = 5,
IsGenderAndLevel = 6, HoldsItem = 6,
EvolutionItemUse = 7, HoldsItemTime = 7,
EvolutionItemUseWithGender = 8, IsGenderAndLevel = 8,
Trade = 9, EvolutionItemUse = 9,
TradeWithHeldItem = 10, EvolutionItemUseWithGender = 10,
TradeWithSpecificPokemon = 11, Trade = 11,
Custom = 12, TradeWithHeldItem = 12,
TradeWithSpecificPokemon = 13,
Custom = 14,
} }
} }

View File

@ -18,58 +18,81 @@ namespace PkmnLibSharp.Library.Evolution
{ {
return new EvolutionData(Pkmnlib.Generated.EvolutionData.CreateLevelEvolution(level, into.Ptr)); return new EvolutionData(Pkmnlib.Generated.EvolutionData.CreateLevelEvolution(level, into.Ptr));
} }
public static EvolutionData CreateFriendshipEvolution(byte level, Species into)
public static EvolutionData CreateFriendshipEvolution(byte friendship, Species into)
{ {
return new EvolutionData(Pkmnlib.Generated.EvolutionData.CreateFriendshipEvolution(level, into.Ptr)); return new EvolutionData(Pkmnlib.Generated.EvolutionData.CreateFriendshipEvolution(friendship, into.Ptr));
} }
public static EvolutionData CreateFriendshipTimeEvolution(byte friendship, TimeOfDay start, TimeOfDay end,
Species into)
{
return new EvolutionData(Pkmnlib.Generated.EvolutionData.CreateFriendshipTimeEvolution(friendship,
(Pkmnlib.TimeOfDay) start, (Pkmnlib.TimeOfDay) end, into.Ptr));
}
public static EvolutionData CreateKnownMoveEvolution(MoveData move, Species into) public static EvolutionData CreateKnownMoveEvolution(MoveData move, Species into)
{ {
return new EvolutionData(Pkmnlib.Generated.EvolutionData.CreateKnownMoveEvolution(move.Ptr, into.Ptr)); return new EvolutionData(Pkmnlib.Generated.EvolutionData.CreateKnownMoveEvolution(move.Ptr, into.Ptr));
} }
public static EvolutionData CreateLocationEvolution(string location, Species into) public static EvolutionData CreateLocationEvolution(string location, Species into)
{ {
return new EvolutionData( return new EvolutionData(
Pkmnlib.Generated.EvolutionData.CreateLocationEvolution(location.ToPtr(), into.Ptr)); Pkmnlib.Generated.EvolutionData.CreateLocationEvolution(location.ToPtr(), into.Ptr));
} }
public static EvolutionData CreateTimeEvolution(TimeOfDay timeOfDay, Species into)
public static EvolutionData CreateTimeEvolution(TimeOfDay start, TimeOfDay end, Species into)
{ {
return new EvolutionData( return new EvolutionData(Pkmnlib.Generated.EvolutionData.CreateTimeEvolution((Pkmnlib.TimeOfDay) start,
Pkmnlib.Generated.EvolutionData.CreateTimeEvolution((Pkmnlib.TimeOfDay) timeOfDay, into.Ptr)); (Pkmnlib.TimeOfDay) end, into.Ptr));
} }
public static EvolutionData CreateItemEvolution(Item item, Species into)
public static EvolutionData CreateHeldItemEvolution(Item item, Species into)
{ {
return new EvolutionData(Pkmnlib.Generated.EvolutionData.CreateItemEvolution(item.Ptr, into.Ptr)); return new EvolutionData(Pkmnlib.Generated.EvolutionData.CreateHeldItemEvolution(item.Ptr, into.Ptr));
} }
public static EvolutionData CreateHeldItemTimeEvolution(Item item, TimeOfDay start, TimeOfDay end, Species into)
{
return new EvolutionData(Pkmnlib.Generated.EvolutionData.CreateHeldItemTimeEvolution(item.Ptr,
(Pkmnlib.TimeOfDay) start, (Pkmnlib.TimeOfDay) end, into.Ptr));
}
public static EvolutionData CreateGenderBasedEvolution(Gender gender, byte level, Species into) public static EvolutionData CreateGenderBasedEvolution(Gender gender, byte level, Species into)
{ {
return new EvolutionData( return new EvolutionData(
Pkmnlib.Generated.EvolutionData.CreateGenderBasedEvolution((Pkmnlib.Gender) gender, level, into.Ptr)); Pkmnlib.Generated.EvolutionData.CreateGenderBasedEvolution((Pkmnlib.Gender) gender, level, into.Ptr));
} }
public static EvolutionData CreateItemUseEvolution(Item item, Species into) public static EvolutionData CreateItemUseEvolution(Item item, Species into)
{ {
return new EvolutionData( return new EvolutionData(Pkmnlib.Generated.EvolutionData.CreateItemUseEvolution(item.Ptr, into.Ptr));
Pkmnlib.Generated.EvolutionData.CreateItemUseEvolution(item.Ptr, into.Ptr));
} }
public static EvolutionData CreateItemUseWithGenderEvolution(Item item, Gender gender, Species into) public static EvolutionData CreateItemUseWithGenderEvolution(Item item, Gender gender, Species into)
{ {
return new EvolutionData( return new EvolutionData(
Pkmnlib.Generated.EvolutionData.CreateItemUseWithGenderEvolution(item.Ptr, (Pkmnlib.Gender) gender, into.Ptr)); Pkmnlib.Generated.EvolutionData.CreateItemUseWithGenderEvolution(item.Ptr, (Pkmnlib.Gender) gender,
into.Ptr));
} }
public static EvolutionData CreateTradeEvolution(Species into) public static EvolutionData CreateTradeEvolution(Species into)
{ {
return new EvolutionData( return new EvolutionData(Pkmnlib.Generated.EvolutionData.CreateTradeEvolution(into.Ptr));
Pkmnlib.Generated.EvolutionData.CreateTradeEvolution(into.Ptr));
} }
public static EvolutionData CreateTradeWithItemEvolution(Item item, Species into) public static EvolutionData CreateTradeWithItemEvolution(Item item, Species into)
{ {
return new EvolutionData( return new EvolutionData(Pkmnlib.Generated.EvolutionData.CreateTradeWithItemEvolution(item.Ptr, into.Ptr));
Pkmnlib.Generated.EvolutionData.CreateTradeWithItemEvolution(item.Ptr, into.Ptr));
} }
public static EvolutionData CreateTradeWithSpeciesEvolution(Species with, Species into) public static EvolutionData CreateTradeWithSpeciesEvolution(Species with, Species into)
{ {
return new EvolutionData( return new EvolutionData(
Pkmnlib.Generated.EvolutionData.CreateTradeWithSpeciesEvolution(with.Ptr, into.Ptr)); Pkmnlib.Generated.EvolutionData.CreateTradeWithSpeciesEvolution(with.Ptr, into.Ptr));
} }
public static EvolutionData CreateCustomEvolution(IList<EffectParameter> parameters, Species into) public static EvolutionData CreateCustomEvolution(IList<EffectParameter> parameters, Species into)
{ {
var parametersPtrs = parameters.Select(x => x.Ptr).ToArray(); var parametersPtrs = parameters.Select(x => x.Ptr).ToArray();
@ -106,6 +129,7 @@ namespace PkmnLibSharp.Library.Evolution
} }
private Species? _species; private Species? _species;
protected override void DeletePtr() protected override void DeletePtr()
{ {
throw new NotImplementedException(); throw new NotImplementedException();

BIN
PkmnLibSharp/Native/Linux/libpkmnLib.so (Stored with Git LFS)

Binary file not shown.

File diff suppressed because one or more lines are too long

View File

@ -15,7 +15,7 @@ namespace PkmnLibSharpTests.Battling
} }
protected override Pokemon Finalize(Species species, Forme forme, Item? heldItem, IReadOnlyCollection<LearnedMove> moves, Nature nature) protected override Pokemon Finalize(Species species, Forme forme, Item heldItem, IReadOnlyCollection<LearnedMove> moves, Nature nature)
{ {
var pkmn = new Pokemon(Library, species, forme, Level, Experience, Uid, Gender, Coloring, heldItem, var pkmn = new Pokemon(Library, species, forme, Level, Experience, Uid, Gender, Coloring, heldItem,
Nickname, HiddenAbility, (byte) AbilityIndex, moves, IVs, EVs, nature, IsAllowedExperienceGain, IsEgg); Nickname, HiddenAbility, (byte) AbilityIndex, moves, IVs, EVs, nature, IsAllowedExperienceGain, IsEgg);