46 lines
2.2 KiB
C++
46 lines
2.2 KiB
C++
#include "../../src/Battling/Models/ExecutingAttack.hpp"
|
|
#include "../Core.hpp"
|
|
using namespace CreatureLib::Battling;
|
|
|
|
export uint8_t CreatureLib_ExecutingAttack_Construct(ExecutingAttack*& out, Creature* const* targets,
|
|
size_t targetCount, uint8_t numberHits, Creature* user,
|
|
LearnedAttack* attack, Script* script) {
|
|
Try(auto ls = ArbUt::List<ArbUt::BorrowedPtr<Creature>>(targetCount);
|
|
for (size_t i = 0; i < targetCount; i++) { ls.Append(targets[i]); } auto s = std::unique_ptr<Script>(script);
|
|
out = new ExecutingAttack(ls, numberHits, user, attack, s);)
|
|
}
|
|
|
|
export void CreatureLib_ExecutingAttack_Destruct(ExecutingAttack* p) { delete p; }
|
|
|
|
export uint8_t CreatureLib_ExecutingAttack_GetHitData(ExecutingAttack::HitData*& out, ExecutingAttack* p,
|
|
Creature* target, uint8_t hit) {
|
|
Try(out = &p->GetHitData(target, hit);)
|
|
}
|
|
|
|
export bool CreatureLib_ExecutingAttack_IsCreatureTarget(ExecutingAttack* p, Creature* target) {
|
|
return p->IsCreatureTarget(target);
|
|
}
|
|
|
|
export Creature* CreatureLib_ExecutingAttack_GetUser(ExecutingAttack* p) { return p->GetUser(); }
|
|
export LearnedAttack* CreatureLib_ExecutingAttack_GetAttack(ExecutingAttack* p) { return p->GetAttack().operator->(); }
|
|
|
|
#define HITDATA_GET_FUNC(name, returnType) \
|
|
export returnType CreatureLib_HitData##_##name(const ExecutingAttack::HitData* p) { return p->name(); }
|
|
|
|
HITDATA_GET_FUNC(IsCritical, bool);
|
|
HITDATA_GET_FUNC(GetBasePower, uint8_t);
|
|
HITDATA_GET_FUNC(GetEffectiveness, float);
|
|
HITDATA_GET_FUNC(GetDamage, uint32_t);
|
|
HITDATA_GET_FUNC(GetType, uint8_t);
|
|
|
|
#define HITDATA_SET_FUNC(name, type) \
|
|
export void CreatureLib_HitData##_##name(ExecutingAttack::HitData* p, type val) { p->name(val); }
|
|
|
|
HITDATA_SET_FUNC(SetCritical, bool);
|
|
HITDATA_SET_FUNC(SetBasePower, uint8_t);
|
|
HITDATA_SET_FUNC(SetEffectiveness, float);
|
|
HITDATA_SET_FUNC(SetDamage, uint32_t);
|
|
HITDATA_SET_FUNC(SetType, uint8_t);
|
|
|
|
#undef HITDATA_GET_FUNC
|
|
#undef HITDATA_SET_FUNC |