CreatureLib/CInterface/Battling/ExecutingAttack.cpp

45 lines
2.1 KiB
C++
Raw Normal View History

2020-04-06 15:05:32 +00:00
#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) {
2020-05-26 16:31:06 +00:00
Try(auto ls = ArbUt::List<Creature*>(targets, targets + targetCount);
2020-04-06 15:05:32 +00:00
out = new ExecutingAttack(ls, numberHits, user, attack, script);)
}
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);)
2020-04-06 15:05:32 +00:00
}
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(); }
#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