C Interface for EvolutionData
continuous-integration/drone/push Build is passing
Details
continuous-integration/drone/push Build is passing
Details
This commit is contained in:
parent
8344f33e95
commit
82e0774b40
|
@ -0,0 +1,64 @@
|
|||
#include "../../src/Library/Evolutions/EvolutionData.hpp"
|
||||
#include "../Core.hpp"
|
||||
using namespace PkmnLib::Library;
|
||||
|
||||
export const EvolutionData* PkmnLib_EvolutionData_CreateLevelEvolution(uint8_t level, const PokemonSpecies* into) {
|
||||
return EvolutionData::CreateLevelEvolution(level, into);
|
||||
}
|
||||
export const EvolutionData* PkmnLib_EvolutionData_CreateFriendshipEvolution(uint8_t friendship,
|
||||
const PokemonSpecies* into) {
|
||||
return EvolutionData::CreateFriendshipEvolution(friendship, into);
|
||||
}
|
||||
export const EvolutionData* PkmnLib_EvolutionData_CreateKnownMoveEvolution(const MoveData* move,
|
||||
const PokemonSpecies* into) {
|
||||
return EvolutionData::CreateKnownMoveEvolution(move, into);
|
||||
}
|
||||
export const EvolutionData* PkmnLib_EvolutionData_CreateLocationEvolution(const char* location,
|
||||
const PokemonSpecies* into) {
|
||||
return EvolutionData::CreateLocationEvolution(Arbutils::CaseInsensitiveConstString(location), into);
|
||||
}
|
||||
export const EvolutionData* PkmnLib_Evolution_CreateTimeEvolution(TimeOfDay time, const PokemonSpecies* into) {
|
||||
return EvolutionData::CreateTimeEvolution(time, into);
|
||||
}
|
||||
export const EvolutionData* PkmnLib_Evolution_CreateItemEvolution(const Item* item, const PokemonSpecies* into) {
|
||||
return EvolutionData::CreateHeldItemEvolution(item, into);
|
||||
}
|
||||
export const EvolutionData* PkmnLib_Evolution_CreateGenderBasedEvolution(CreatureLib::Library::Gender gender,
|
||||
uint8_t level, const PokemonSpecies* into) {
|
||||
return EvolutionData::CreateGenderBasedEvolution(gender, level, into);
|
||||
}
|
||||
export const EvolutionData* PkmnLib_Evolution_CreateItemUseEvolution(const Item* item, const PokemonSpecies* into) {
|
||||
return EvolutionData::CreateItemUseEvolution(item, into);
|
||||
}
|
||||
|
||||
export const EvolutionData* PkmnLib_Evolution_CreateItemUseWithGenderEvolution(const Item* item,
|
||||
CreatureLib::Library::Gender gender,
|
||||
const PokemonSpecies* into) {
|
||||
return EvolutionData::CreateItemUseWithGenderEvolution(item, gender, into);
|
||||
}
|
||||
export const EvolutionData* PkmnLib_Evolution_CreateTradeEvolution(const PokemonSpecies* into) {
|
||||
return EvolutionData::CreateTradeEvolution(into);
|
||||
}
|
||||
export const EvolutionData* PkmnLib_Evolution_CreateTradeWithItemEvolution(const Item* item,
|
||||
const PokemonSpecies* into) {
|
||||
return EvolutionData::CreateTradeWithItemEvolution(item, into);
|
||||
}
|
||||
export const EvolutionData* PkmnLib_Evolution_CreateTradeWithSpeciesEvolution(const PokemonSpecies* traded,
|
||||
const PokemonSpecies* into) {
|
||||
return EvolutionData::CreateTradeWithSpeciesEvolution(traded, into);
|
||||
}
|
||||
export const EvolutionData* PkmnLib_Evolution_CreateCustomEvolution(const CreatureLib::Library::EffectParameter** data,
|
||||
size_t dataLength, const PokemonSpecies* into) {
|
||||
auto list = Arbutils::Collections::List<const CreatureLib::Library::EffectParameter*>(data, data + dataLength);
|
||||
return EvolutionData::CreateCustomEvolution(list, into);
|
||||
}
|
||||
|
||||
export EvolutionMethod PkmnLib_Evolution_GetMethod(const EvolutionData* data) { return data->GetMethod(); }
|
||||
export const PokemonSpecies* PkmnLib_Evolution_GetNewSpecies(const EvolutionData* data) {
|
||||
return data->GetNewSpecies();
|
||||
}
|
||||
export size_t PkmnLib_Evolution_GetDataCount(const EvolutionData* data) { return data->GetDataCount(); }
|
||||
export uint8_t PkmnLib_Evolution_GetData(const EvolutionData* data, size_t index,
|
||||
const CreatureLib::Library::EffectParameter*& out) {
|
||||
Try(out = data->GetData(index));
|
||||
}
|
|
@ -1,5 +1,7 @@
|
|||
#include "EvolutionData.hpp"
|
||||
#include "../Items/Item.hpp"
|
||||
#include "../Moves/MoveData.hpp"
|
||||
#include "../Species/PokemonSpecies.hpp"
|
||||
using namespace PkmnLib::Library;
|
||||
|
||||
const EvolutionData* PkmnLib::Library::EvolutionData::CreateKnownMoveEvolution(const MoveData* move,
|
||||
|
@ -7,3 +9,27 @@ const EvolutionData* PkmnLib::Library::EvolutionData::CreateKnownMoveEvolution(c
|
|||
return new EvolutionData(EvolutionMethod::KnownMove, {new CreatureLib::Library::EffectParameter(move->GetName())},
|
||||
into);
|
||||
}
|
||||
const EvolutionData* EvolutionData::CreateHeldItemEvolution(const Item* item, const PokemonSpecies* into) {
|
||||
return new EvolutionData(EvolutionMethod::HoldsItem, {new CreatureLib::Library::EffectParameter(item->GetName())},
|
||||
into);
|
||||
}
|
||||
const EvolutionData* EvolutionData::CreateItemUseEvolution(const Item* item, const PokemonSpecies* into) {
|
||||
return new EvolutionData(EvolutionMethod::EvolutionItemUse,
|
||||
{new CreatureLib::Library::EffectParameter(item->GetName())}, into);
|
||||
}
|
||||
const EvolutionData* EvolutionData::CreateItemUseWithGenderEvolution(const Item* item,
|
||||
CreatureLib::Library::Gender gender,
|
||||
const PokemonSpecies* into) {
|
||||
return new EvolutionData(EvolutionMethod::EvolutionItemUseWithGender,
|
||||
{new CreatureLib::Library::EffectParameter(item->GetName()),
|
||||
new CreatureLib::Library::EffectParameter((int64_t)gender)},
|
||||
into);
|
||||
}
|
||||
const EvolutionData* EvolutionData::CreateTradeWithItemEvolution(const Item* item, const PokemonSpecies* into) {
|
||||
return new EvolutionData(EvolutionMethod::TradeWithHeldItem,
|
||||
{new CreatureLib::Library::EffectParameter(item->GetName())}, into);
|
||||
}
|
||||
const EvolutionData* EvolutionData::CreateTradeWithSpeciesEvolution(const PokemonSpecies* traded, const PokemonSpecies* into) {
|
||||
return new EvolutionData(EvolutionMethod::TradeWithSpecificPokemon,
|
||||
{new CreatureLib::Library::EffectParameter(traded->GetName())}, into);
|
||||
}
|
||||
|
|
|
@ -49,10 +49,7 @@ namespace PkmnLib::Library {
|
|||
return new EvolutionData(EvolutionMethod::TimeBased,
|
||||
{new CreatureLib::Library::EffectParameter((int64_t)time)}, into);
|
||||
}
|
||||
static inline const EvolutionData* CreateHeldItemEvolution(const Item* item, const PokemonSpecies* into) {
|
||||
return new EvolutionData(EvolutionMethod::HoldsItem, {new CreatureLib::Library::EffectParameter(item)},
|
||||
into);
|
||||
}
|
||||
static const EvolutionData* CreateHeldItemEvolution(const Item* item, const PokemonSpecies* into);
|
||||
static inline const EvolutionData* CreateGenderBasedEvolution(CreatureLib::Library::Gender gender,
|
||||
uint8_t level, const PokemonSpecies* into) {
|
||||
return new EvolutionData(EvolutionMethod::IsGenderAndLevel,
|
||||
|
@ -60,38 +57,25 @@ namespace PkmnLib::Library {
|
|||
new CreatureLib::Library::EffectParameter((int64_t)level)},
|
||||
into);
|
||||
}
|
||||
static inline const EvolutionData* CreateItemUseEvolution(const Item* item, const PokemonSpecies* into) {
|
||||
return new EvolutionData(EvolutionMethod::EvolutionItemUse,
|
||||
{new CreatureLib::Library::EffectParameter(item)}, into);
|
||||
}
|
||||
static inline const EvolutionData* CreateItemUseWithGenderEvolution(const Item* item,
|
||||
CreatureLib::Library::Gender gender,
|
||||
const PokemonSpecies* into) {
|
||||
return new EvolutionData(EvolutionMethod::EvolutionItemUseWithGender,
|
||||
{new CreatureLib::Library::EffectParameter(item),
|
||||
new CreatureLib::Library::EffectParameter((int64_t)gender)},
|
||||
into);
|
||||
}
|
||||
static const EvolutionData* CreateItemUseEvolution(const Item* item, const PokemonSpecies* into);
|
||||
static const EvolutionData* CreateItemUseWithGenderEvolution(const Item* item,
|
||||
CreatureLib::Library::Gender gender,
|
||||
const PokemonSpecies* into);
|
||||
static inline const EvolutionData* CreateTradeEvolution(const PokemonSpecies* into) {
|
||||
return new EvolutionData(EvolutionMethod::Trade, {}, into);
|
||||
}
|
||||
static inline const EvolutionData* CreateTradeWithItemEvolution(const Item* item, const PokemonSpecies* into) {
|
||||
return new EvolutionData(EvolutionMethod::TradeWithHeldItem,
|
||||
{new CreatureLib::Library::EffectParameter(item)}, into);
|
||||
}
|
||||
static inline const EvolutionData* CreateTradeWithSpeciesEvolution(const PokemonSpecies* traded,
|
||||
const PokemonSpecies* into) {
|
||||
return new EvolutionData(EvolutionMethod::TradeWithSpecificPokemon,
|
||||
{new CreatureLib::Library::EffectParameter(traded)}, into);
|
||||
}
|
||||
static const EvolutionData* CreateTradeWithItemEvolution(const Item* item, const PokemonSpecies* into);
|
||||
static const EvolutionData* CreateTradeWithSpeciesEvolution(const PokemonSpecies* traded,
|
||||
const PokemonSpecies* into);
|
||||
static inline const EvolutionData*
|
||||
CreateCustomEvolution(const Arbutils::Collections::List<const CreatureLib::Library::EffectParameter*>& data,
|
||||
const PokemonSpecies* into) {
|
||||
return new EvolutionData(EvolutionMethod::Custom, data, into);
|
||||
}
|
||||
|
||||
[[nodiscard]] inline const PokemonSpecies* GetNewSpecies() const { return _evolvesInto; }
|
||||
[[nodiscard]] inline EvolutionMethod GetMethod() const { return _method; }
|
||||
[[nodiscard]] inline const PokemonSpecies* GetNewSpecies() const noexcept { return _evolvesInto; }
|
||||
[[nodiscard]] inline EvolutionMethod GetMethod() const noexcept { return _method; }
|
||||
[[nodiscard]] inline size_t GetDataCount() const noexcept { return _evolutionData.Count(); }
|
||||
[[nodiscard]] inline const CreatureLib::Library::EffectParameter* GetData(size_t index) const {
|
||||
return _evolutionData.At(index);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue