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-03-23 12:56:45 +00:00
|
|
|
export u8 CreatureLib_ExecutingAttack_Construct(ExecutingAttack*& out, Creature* const* targets, size_t targetCount,
|
|
|
|
u8 numberHits, Creature* user, LearnedAttack* attack,
|
|
|
|
CreatureLib::Library::AttackData* attackData, BattleScript* script) {
|
2020-12-12 11:22:48 +00:00
|
|
|
Try(auto ls = ArbUt::List<ArbUt::OptionalBorrowedPtr<Creature>>(targetCount);
|
2021-03-07 09:26:41 +00:00
|
|
|
for (size_t i = 0; i < targetCount; i++) { ls.Append(targets[i]); } auto s =
|
|
|
|
std::unique_ptr<BattleScript>(script);
|
2021-05-13 11:16:52 +00:00
|
|
|
out = new ExecutingAttack(ls, numberHits, user, attack, attackData, s);)
|
2020-04-06 15:05:32 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
export void CreatureLib_ExecutingAttack_Destruct(ExecutingAttack* p) { delete p; }
|
|
|
|
|
2022-03-23 12:56:45 +00:00
|
|
|
SIMPLE_GET_FUNC(ExecutingAttack, GetNumberOfHits, u8);
|
|
|
|
export 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
|
|
|
}
|
|
|
|
|
|
|
|
export bool CreatureLib_ExecutingAttack_IsCreatureTarget(ExecutingAttack* p, Creature* target) {
|
|
|
|
return p->IsCreatureTarget(target);
|
|
|
|
}
|
2022-03-23 12:56:45 +00:00
|
|
|
export u8 CreatureLib_ExecutingAttack_GetTargetCount(ExecutingAttack* p) { return p->GetTargetCount(); }
|
2020-08-14 15:59:56 +00:00
|
|
|
export 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
|
|
|
|
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(); }
|
2021-05-13 11:16:52 +00:00
|
|
|
export const CreatureLib::Library::AttackData* CreatureLib_ExecutingAttack_GetUseAttack(ExecutingAttack* p) {
|
|
|
|
return p->GetUseAttack().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);
|
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) \
|
|
|
|
export void CreatureLib_HitData##_##name(ExecutingAttack::HitData* p, type val) { p->name(val); }
|
|
|
|
|
|
|
|
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
|