CreatureLib/CInterface/Battling/Script.cpp

94 lines
5.3 KiB
C++

#include "../../src/Battling/ScriptHandling/Script.hpp"
#include "../Core.hpp"
using namespace CreatureLib::Battling;
export void CreatureLib_Script_Destruct(Script* p) { delete p; }
export uint8_t CreatureLib_Script_Stack(Script* p) { Try(p->Stack()); }
export uint8_t CreatureLib_Script_OnRemove(Script* p) { Try(p->OnRemove()); }
export const char* CreatureLib_Script_GetName(Script* p) { return p->GetName().c_str(); }
export uint8_t CreatureLib_Script_OnBeforeTurn(Script* p, const BaseTurnChoice* choice) {
Try(p->OnBeforeTurn(choice));
}
export uint8_t CreatureLib_Script_ChangeAttack(Script* p, AttackTurnChoice* choice, const char*& outAttack) {
Try(auto sv = ArbUt::StringView(outAttack); p->ChangeAttack(choice, &sv); outAttack = sv.c_str(););
}
export uint8_t CreatureLib_Script_PreventAttack(Script* p, ExecutingAttack* attack, bool* outResult) {
Try(p->PreventAttack(attack, outResult));
}
export uint8_t CreatureLib_Script_FailAttack(Script* p, ExecutingAttack* attack, bool* outResult) {
Try(p->FailAttack(attack, outResult));
}
export uint8_t CreatureLib_Script_StopBeforeAttack(Script* p, ExecutingAttack* attack, bool* outResult) {
Try(p->StopBeforeAttack(attack, outResult));
}
export uint8_t CreatureLib_Script_OnBeforeAttack(Script* p, ExecutingAttack* attack) { Try(p->OnBeforeAttack(attack)); }
export uint8_t CreatureLib_Script_FailIncomingAttack(Script* p, ExecutingAttack* attack, Creature* target,
bool* outResult) {
Try(p->FailIncomingAttack(attack, target, outResult));
}
export uint8_t CreatureLib_Script_IsInvulnerable(Script* p, ExecutingAttack* attack, Creature* target,
bool* outResult) {
Try(p->IsInvulnerable(attack, target, outResult));
}
export uint8_t CreatureLib_Script_OnAttackMiss(Script* p, ExecutingAttack* attack, Creature* target) {
Try(p->OnAttackMiss(attack, target));
}
export uint8_t CreatureLib_Script_ChangeAttackType(Script* p, ExecutingAttack* attack, Creature* target,
uint8_t hitNumber, uint8_t* outType) {
Try(p->ChangeAttackType(attack, target, hitNumber, outType))
}
export uint8_t CreatureLib_Script_OverrideBasePower(Script* p, ExecutingAttack* attack, Creature* target,
uint8_t hitNumber, uint8_t* basePower) {
Try(p->OverrideBasePower(attack, target, hitNumber, basePower));
}
export uint8_t CreatureLib_Script_ChangeDamageStatsUser(Script* p, ExecutingAttack* attack, Creature* target,
uint8_t hitNumber, Creature** statsUser) {
Try(p->ChangeDamageStatsUser(attack, target, hitNumber, statsUser));
}
export uint8_t CreatureLib_Script_BypassDefensiveStat(Script* p, ExecutingAttack* attack, Creature* target,
uint8_t hitNumber, bool* bypass) {
Try(p->BypassDefensiveStat(attack, target, hitNumber, bypass));
}
export uint8_t CreatureLib_Script_BypassOffensiveStat(Script* p, ExecutingAttack* attack, Creature* target,
uint8_t hitNumber, bool* bypass) {
Try(p->BypassOffensiveStat(attack, target, hitNumber, bypass));
}
export uint8_t CreatureLib_Script_ModifyStatModifier(Script* p, ExecutingAttack* attack, Creature* target,
uint8_t hitNumber, float* modifier) {
Try(p->ModifyStatModifier(attack, target, hitNumber, modifier));
}
export uint8_t CreatureLib_Script_ModifyDamageModifier(Script* p, ExecutingAttack* attack, Creature* target,
uint8_t hitNumber, float* modifier) {
Try(p->ModifyDamageModifier(attack, target, hitNumber, modifier));
}
export uint8_t CreatureLib_Script_OverrideDamage(Script* p, ExecutingAttack* attack, Creature* target,
uint8_t hitNumber, uint32_t* damage) {
Try(p->OverrideDamage(attack, target, hitNumber, damage));
}
export uint8_t CreatureLib_Script_PreventSecondaryEffects(Script* p, ExecutingAttack* attack, Creature* target,
uint8_t hitNumber, bool* outResult) {
Try(p->PreventSecondaryEffects(attack, target, hitNumber, outResult));
}
export uint8_t CreatureLib_Script_OnSecondaryEffect(Script* p, ExecutingAttack* attack, Creature* target,
uint8_t hitNumber) {
Try(p->OnSecondaryEffect(attack, target, hitNumber));
}
export uint8_t CreatureLib_Script_OnAfterHits(Script* p, ExecutingAttack* attack, Creature* target) {
Try(p->OnAfterHits(attack, target));
}
export uint8_t CreatureLib_Script_PreventSelfSwitch(Script* p, const SwitchTurnChoice* choice, bool* outResult) {
Try(p->PreventSelfSwitch(choice, outResult));
}
export uint8_t CreatureLib_Script_ModifyEffectChance(Script* p, const ExecutingAttack* attack, Creature* target,
float* chance) {
Try(p->ModifyEffectChance(attack, target, chance));
}
export uint8_t CreatureLib_Script_ModifyIncomingEffectChance(Script* p, const ExecutingAttack* attack, Creature* target,
float* chance) {
Try(p->ModifyIncomingEffectChance(attack, target, chance));
}