CreatureLib/CInterface/Battling/TurnChoices.cpp

38 lines
2.1 KiB
C++

#include "../../src/Battling/TurnChoices/AttackTurnChoice.hpp"
#include "../../src/Battling/TurnChoices/FleeTurnChoice.hpp"
#include "../../src/Battling/TurnChoices/PassTurnChoice.hpp"
#include "../../src/Battling/TurnChoices/SwitchTurnChoice.hpp"
#include "../Core.hpp"
using namespace CreatureLib::Battling;
export_func AttackTurnChoice* CreatureLib_AttackTurnChoice_Construct(Creature* user, LearnedAttack* attack,
u8 sideIndex, u8 targetIndex) {
return new AttackTurnChoice(user, attack, CreatureIndex(sideIndex, targetIndex));
}
export_func void CreatureLib_AttackTurnChoice_Destruct(AttackTurnChoice* p) { delete p; }
export_func FleeTurnChoice* CreatureLib_FleeTurnChoice_Construct(Creature* user) { return new FleeTurnChoice(user); }
export_func void CreatureLib_FleeTurnChoice_Destruct(AttackTurnChoice* p) { delete p; }
export_func PassTurnChoice* CreatureLib_PassTurnChoice_Construct(Creature* user) { return new PassTurnChoice(user); }
export_func void CreatureLib_PassTurnChoice_Destruct(AttackTurnChoice* p) { delete p; }
export_func SwitchTurnChoice* CreatureLib_SwitchTurnChoice_Construct(Creature* user, Creature* newCreature) {
return new SwitchTurnChoice(user, newCreature);
}
export_func void CreatureLib_SwitchTurnChoice_Destruct(AttackTurnChoice* p) { delete p; }
SIMPLE_GET_FUNC(BaseTurnChoice, GetKind, TurnChoiceKind)
BORROWED_GET_FUNC(BaseTurnChoice, GetUser, Creature*)
BORROWED_GET_FUNC(AttackTurnChoice, GetAttack, LearnedAttack*)
SIMPLE_GET_FUNC(AttackTurnChoice, GetKind, TurnChoiceKind)
export_func u8 CreatureLib_AttackTurnChoice_GetPriority(i8& out, AttackTurnChoice* p) { Try(out = p->GetPriority()); }
SMART_GET_FUNC(AttackTurnChoice, GetAttackScript, BattleScript*)
export_func u8 CreatureLib_AttackTurnChoice_GetTargetSideIndex(const AttackTurnChoice* p) {
return p->GetTarget().GetSideIndex();
}
export_func u8 CreatureLib_AttackTurnChoice_GetTargetCreatureIndex(const AttackTurnChoice* p) {
return p->GetTarget().GetCreatureIndex();
}
OPTIONAL_GET_FUNC(SwitchTurnChoice, GetNewCreature, Creature*)