CreatureLib/CInterface/Battling/BattleScript.cpp

96 lines
5.2 KiB
C++

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