2020-02-29 16:21:36 +00:00
|
|
|
#include "../../src/Library/CreatureData/SpeciesVariant.hpp"
|
2020-03-25 18:07:36 +00:00
|
|
|
#include "../Core.hpp"
|
2020-02-29 16:21:36 +00:00
|
|
|
|
|
|
|
using namespace CreatureLib::Library;
|
|
|
|
using ConstString = Arbutils::CaseInsensitiveConstString;
|
|
|
|
|
|
|
|
export SpeciesVariant* CreatureLib_SpeciesVariant_Construct(
|
|
|
|
const char* name, float height, float weight, uint32_t baseExperience, uint8_t types[], size_t typeLength,
|
|
|
|
uint16_t baseHealth, uint16_t baseAttack, uint16_t baseDefense, uint16_t baseMagicalAttack,
|
2020-03-01 09:19:36 +00:00
|
|
|
uint16_t baseMagicalDefense, uint8_t baseSpeed, const char* talents[], size_t talentsLength,
|
2020-02-29 16:21:36 +00:00
|
|
|
const char* secretTalents[], size_t secretTalentsLength, const LearnableAttacks* attacks) {
|
|
|
|
|
2020-03-22 18:21:40 +00:00
|
|
|
auto talentsWrapped = Arbutils::Collections::List<ConstString>(talentsLength);
|
2020-02-29 16:21:36 +00:00
|
|
|
for (size_t i = 0; i < talentsLength; i++) {
|
|
|
|
talentsWrapped[i] = ConstString(talents[i]);
|
|
|
|
}
|
2020-03-22 18:21:40 +00:00
|
|
|
auto secretTalentsWrapped = Arbutils::Collections::List<ConstString>(secretTalentsLength);
|
2020-02-29 16:21:36 +00:00
|
|
|
for (size_t i = 0; i < secretTalentsLength; i++) {
|
|
|
|
secretTalentsWrapped[i] = ConstString(secretTalents[i]);
|
|
|
|
}
|
|
|
|
|
|
|
|
return new SpeciesVariant(Arbutils::CaseInsensitiveConstString(name), height, weight, baseExperience,
|
2020-03-22 18:21:40 +00:00
|
|
|
Arbutils::Collections::List<uint8_t>(types, types + typeLength),
|
2020-03-22 09:11:53 +00:00
|
|
|
CreatureLib::Library::StatisticSet<uint16_t>(baseHealth, baseAttack, baseDefense,
|
|
|
|
baseMagicalAttack, baseMagicalDefense,
|
|
|
|
baseSpeed),
|
2020-02-29 16:21:36 +00:00
|
|
|
talentsWrapped, secretTalentsWrapped, attacks);
|
|
|
|
}
|
|
|
|
|
2020-03-02 12:59:49 +00:00
|
|
|
export void CreatureLib_SpeciesVariant_Destruct(SpeciesVariant* p) { delete p; }
|
|
|
|
|
|
|
|
#define SIMPLE_GET_FUNC(type, name, returnType) \
|
|
|
|
export returnType CreatureLib_##type##_##name(const CreatureLib::Library::type* p) { return p->name(); }
|
|
|
|
|
|
|
|
export const char* CreatureLib_SpeciesVariant_GetName(SpeciesVariant* p) { return p->GetName().c_str(); }
|
|
|
|
SIMPLE_GET_FUNC(SpeciesVariant, GetHeight, float);
|
|
|
|
SIMPLE_GET_FUNC(SpeciesVariant, GetWeight, float);
|
|
|
|
SIMPLE_GET_FUNC(SpeciesVariant, GetBaseExperience, uint32_t);
|
|
|
|
SIMPLE_GET_FUNC(SpeciesVariant, GetTypeCount, size_t);
|
|
|
|
export uint8_t CreatureLib_SpeciesVariant_GetType(SpeciesVariant* p, size_t index) { return p->GetType(index); }
|
2020-03-22 09:11:53 +00:00
|
|
|
export uint32_t CreatureLib_SpeciesVariant_GetStatistic(SpeciesVariant* p, CreatureLib::Library::Statistic stat) {
|
2020-03-02 12:59:49 +00:00
|
|
|
return p->GetStatistic(stat);
|
|
|
|
}
|
|
|
|
SIMPLE_GET_FUNC(SpeciesVariant, GetTalentCount, size_t);
|
|
|
|
SIMPLE_GET_FUNC(SpeciesVariant, GetSecretTalentCount, size_t);
|
2020-03-02 13:01:56 +00:00
|
|
|
export uint8_t CreatureLib_SpeciesVariant_GetTalent(SpeciesVariant* p, bool secret, uint8_t index) {
|
|
|
|
return p->GetTalent(TalentIndex(secret, index));
|
|
|
|
}
|
2020-03-27 19:46:44 +00:00
|
|
|
export const LearnableAttacks* CreatureLib_SpeciesVariant_GetLearnableAttacks(SpeciesVariant* p) {
|
|
|
|
return p->GetLearnableAttacks().get();
|
|
|
|
}
|
2020-03-02 12:59:49 +00:00
|
|
|
|
|
|
|
#undef SIMPLE_GET_FUNC
|