2020-04-06 15:05:32 +00:00
|
|
|
#include "../../src/Battling/Models/ExecutingAttack.hpp"
|
2020-07-31 08:51:03 +00:00
|
|
|
#include "../Core.hpp"
|
2020-04-06 15:05:32 +00:00
|
|
|
using namespace CreatureLib::Battling;
|
|
|
|
|
2022-04-02 10:33:26 +00:00
|
|
|
export_func u8 CreatureLib_ExecutingAttack_Construct(ExecutingAttack*& out, Creature* const* targets,
|
|
|
|
size_t targetCount, u8 numberHits, Creature* user,
|
|
|
|
LearnedAttack* attack,
|
|
|
|
CreatureLib::Library::AttackData* attackData,
|
|
|
|
BattleScript* script) {
|
2022-05-14 14:07:32 +00:00
|
|
|
Try({
|
|
|
|
auto ls = ArbUt::List<ArbUt::OptionalBorrowedPtr<Creature>>(targetCount);
|
|
|
|
for (size_t i = 0; i < targetCount; i++) {
|
|
|
|
ls.Append(targets[i]);
|
|
|
|
}
|
2022-05-14 15:36:38 +00:00
|
|
|
out = new ExecutingAttack(ls, numberHits, user, attack, attackData, script);
|
2022-05-14 14:07:32 +00:00
|
|
|
})
|
2020-04-06 15:05:32 +00:00
|
|
|
}
|
|
|
|
|
2022-04-02 10:33:26 +00:00
|
|
|
export_func void CreatureLib_ExecutingAttack_Destruct(ExecutingAttack* p) { delete p; }
|
2020-04-06 15:05:32 +00:00
|
|
|
|
2022-03-23 12:56:45 +00:00
|
|
|
SIMPLE_GET_FUNC(ExecutingAttack, GetNumberOfHits, u8);
|
2022-04-02 10:33:26 +00:00
|
|
|
export_func u8 CreatureLib_ExecutingAttack_GetHitData(ExecutingAttack::HitData*& out, ExecutingAttack* p,
|
|
|
|
Creature* target, u8 hit) {
|
2020-04-25 18:09:20 +00:00
|
|
|
Try(out = &p->GetHitData(target, hit);)
|
2020-04-06 15:05:32 +00:00
|
|
|
}
|
|
|
|
|
2022-04-02 10:33:26 +00:00
|
|
|
export_func bool CreatureLib_ExecutingAttack_IsCreatureTarget(ExecutingAttack* p, Creature* target) {
|
2020-04-06 15:05:32 +00:00
|
|
|
return p->IsCreatureTarget(target);
|
|
|
|
}
|
2022-04-02 10:33:26 +00:00
|
|
|
export_func u8 CreatureLib_ExecutingAttack_GetTargetCount(ExecutingAttack* p) { return p->GetTargetCount(); }
|
|
|
|
export_func const Creature* const* CreatureLib_ExecutingAttack_GetTargets(ExecutingAttack* p) {
|
2020-08-15 13:10:48 +00:00
|
|
|
return reinterpret_cast<const Creature* const*>(p->GetTargets().RawData());
|
2020-08-14 15:59:56 +00:00
|
|
|
}
|
2020-04-06 15:05:32 +00:00
|
|
|
|
2022-04-02 10:33:26 +00:00
|
|
|
export_func Creature* CreatureLib_ExecutingAttack_GetUser(ExecutingAttack* p) { return p->GetUser().GetRaw(); }
|
|
|
|
export_func LearnedAttack* CreatureLib_ExecutingAttack_GetAttack(ExecutingAttack* p) { return p->GetAttack().GetRaw(); }
|
|
|
|
export_func const CreatureLib::Library::AttackData* CreatureLib_ExecutingAttack_GetUseAttack(ExecutingAttack* p) {
|
2021-05-13 11:16:52 +00:00
|
|
|
return p->GetUseAttack().GetRaw();
|
|
|
|
}
|
2020-04-06 15:05:32 +00:00
|
|
|
|
|
|
|
#define HITDATA_GET_FUNC(name, returnType) \
|
2022-04-02 10:33:26 +00:00
|
|
|
export_func returnType CreatureLib_HitData##_##name(const ExecutingAttack::HitData* p) { return p->name(); }
|
2020-04-06 15:05:32 +00:00
|
|
|
|
|
|
|
HITDATA_GET_FUNC(IsCritical, bool);
|
2022-03-23 12:56:45 +00:00
|
|
|
HITDATA_GET_FUNC(GetBasePower, u8);
|
2020-04-06 15:05:32 +00:00
|
|
|
HITDATA_GET_FUNC(GetEffectiveness, float);
|
2022-03-23 12:56:45 +00:00
|
|
|
HITDATA_GET_FUNC(GetDamage, u32);
|
|
|
|
HITDATA_GET_FUNC(GetType, u8);
|
2020-04-06 15:05:32 +00:00
|
|
|
|
|
|
|
#define HITDATA_SET_FUNC(name, type) \
|
2022-04-02 10:33:26 +00:00
|
|
|
export_func void CreatureLib_HitData##_##name(ExecutingAttack::HitData* p, type val) { p->name(val); }
|
2020-04-06 15:05:32 +00:00
|
|
|
|
|
|
|
HITDATA_SET_FUNC(SetCritical, bool);
|
2022-03-23 12:56:45 +00:00
|
|
|
HITDATA_SET_FUNC(SetBasePower, u8);
|
2020-04-06 15:05:32 +00:00
|
|
|
HITDATA_SET_FUNC(SetEffectiveness, float);
|
2022-03-23 12:56:45 +00:00
|
|
|
HITDATA_SET_FUNC(SetDamage, u32);
|
|
|
|
HITDATA_SET_FUNC(SetType, u8);
|
2020-04-06 15:05:32 +00:00
|
|
|
|
|
|
|
#undef HITDATA_GET_FUNC
|
|
|
|
#undef HITDATA_SET_FUNC
|