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-06-02 11:43:44 +00:00
|
|
|
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);)
|
2020-04-06 15:05:32 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
export void CreatureLib_ExecutingAttack_Destruct(ExecutingAttack* p) { delete p; }
|
|
|
|
|
2020-04-25 18:09:20 +00:00
|
|
|
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);
|
|
|
|
}
|
|
|
|
|
2020-06-02 16:02:37 +00:00
|
|
|
export Creature* CreatureLib_ExecutingAttack_GetUser(ExecutingAttack* p) { return p->GetUser().GetRaw(); }
|
2020-07-07 13:33:43 +00:00
|
|
|
export LearnedAttack* CreatureLib_ExecutingAttack_GetAttack(ExecutingAttack* p) { return p->GetAttack().GetRaw(); }
|
2020-04-06 15:05:32 +00:00
|
|
|
|
|
|
|
#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
|