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