2020-03-11 11:22:13 +00:00
|
|
|
#include "../../src/Battling/TurnChoices/AttackTurnChoice.hpp"
|
|
|
|
#include "../../src/Battling/TurnChoices/FleeTurnChoice.hpp"
|
|
|
|
#include "../../src/Battling/TurnChoices/PassTurnChoice.hpp"
|
|
|
|
#include "../../src/Battling/TurnChoices/SwitchTurnChoice.hpp"
|
2020-03-25 18:07:36 +00:00
|
|
|
#include "../Core.hpp"
|
2020-03-11 11:22:13 +00:00
|
|
|
using namespace CreatureLib::Battling;
|
|
|
|
|
|
|
|
export AttackTurnChoice* CreatureLib_AttackTurnChoice_Construct(Creature* user, LearnedAttack* attack,
|
|
|
|
uint8_t sideIndex, uint8_t targetIndex) {
|
|
|
|
return new AttackTurnChoice(user, attack, CreatureIndex(sideIndex, targetIndex));
|
|
|
|
}
|
|
|
|
export FleeTurnChoice* CreatureLib_FleeTurnChoice_Construct(Creature* user) { return new FleeTurnChoice(user); }
|
|
|
|
export PassTurnChoice* CreatureLib_PassTurnChoice_Construct(Creature* user) { return new PassTurnChoice(user); }
|
|
|
|
export SwitchTurnChoice* CreatureLib_SwitchTurnChoice_Construct(Creature* user, Creature* newCreature) {
|
|
|
|
return new SwitchTurnChoice(user, newCreature);
|
|
|
|
}
|
|
|
|
|
|
|
|
export void CreatureLib_BaseTurnChoice_Destruct(const BaseTurnChoice* p) { delete p; }
|
|
|
|
|
|
|
|
#define SIMPLE_GET_FUNC(type, name, returnType) \
|
|
|
|
export returnType CreatureLib_##type##_##name(const type* p) { return p->name(); }
|
2020-05-31 15:26:39 +00:00
|
|
|
#define SIMPLE_GET_FUNC_SMART_PTR(type, name, returnType) \
|
|
|
|
export returnType CreatureLib_##type##_##name(const type* p) { return p->name().operator->(); }
|
2020-03-11 11:22:13 +00:00
|
|
|
|
|
|
|
SIMPLE_GET_FUNC(BaseTurnChoice, GetKind, TurnChoiceKind)
|
2020-06-02 16:30:37 +00:00
|
|
|
SIMPLE_GET_FUNC_SMART_PTR(BaseTurnChoice, GetUser, Creature*)
|
2020-03-11 11:22:13 +00:00
|
|
|
|
2020-05-31 15:26:39 +00:00
|
|
|
SIMPLE_GET_FUNC_SMART_PTR(AttackTurnChoice, GetAttack, LearnedAttack*)
|
2020-03-11 11:22:13 +00:00
|
|
|
SIMPLE_GET_FUNC(AttackTurnChoice, GetKind, TurnChoiceKind)
|
2020-03-25 18:07:36 +00:00
|
|
|
|
|
|
|
export uint8_t CreatureLib_BaseTurnChoice_GetPriority(int8_t& out, AttackTurnChoice* p) { Try(out = p->GetPriority()); }
|
|
|
|
|
2020-06-02 11:43:44 +00:00
|
|
|
SIMPLE_GET_FUNC_SMART_PTR(AttackTurnChoice, GetAttackScript, Script*)
|
2020-03-11 11:22:13 +00:00
|
|
|
export uint8_t CreatureLib_BaseTurnChoice_GetTargetSideIndex(const AttackTurnChoice* p) {
|
|
|
|
return p->GetTarget().GetSideIndex();
|
|
|
|
}
|
|
|
|
export uint8_t CreatureLib_BaseTurnChoice_GetTargetCreatureIndex(const AttackTurnChoice* p) {
|
|
|
|
return p->GetTarget().GetCreatureIndex();
|
|
|
|
}
|
|
|
|
|
2020-06-02 16:30:37 +00:00
|
|
|
SIMPLE_GET_FUNC_SMART_PTR(SwitchTurnChoice, GetNewCreature, Creature*)
|
2020-03-11 11:22:13 +00:00
|
|
|
|
2020-05-31 15:26:39 +00:00
|
|
|
#undef SIMPLE_GET_FUNC
|
|
|
|
#undef SIMPLE_GET_FUNC_SMART_PTR
|