2020-04-04 15:03:06 +00:00
|
|
|
#include "../../src/Battling/Models/BattleSide.hpp"
|
2020-07-31 08:51:03 +00:00
|
|
|
#include "../Core.hpp"
|
2020-04-04 15:03:06 +00:00
|
|
|
using namespace CreatureLib::Battling;
|
|
|
|
|
|
|
|
export BattleSide* CreatureLib_BattleSide_Construct(uint8_t index, Battle* battle, uint8_t creaturesPerSide) {
|
|
|
|
return new BattleSide(index, battle, creaturesPerSide);
|
|
|
|
}
|
|
|
|
|
|
|
|
export void CreatureLib_BattleSide_Destruct(BattleSide* p) { delete p; }
|
|
|
|
|
2021-10-28 13:01:31 +00:00
|
|
|
export Battle* CreatureLib_BattleSide_GetBattle(BattleSide* p) { return p->GetBattle(); }
|
2020-04-04 15:03:06 +00:00
|
|
|
export bool CreatureLib_BattleSide_AllChoicesSet(BattleSide* p) { return p->AllChoicesSet(); }
|
|
|
|
|
|
|
|
export uint8_t CreatureLib_BattleSide_AllPossibleSlotsFilled(bool& out, BattleSide* p) {
|
|
|
|
Try(out = p->AllPossibleSlotsFilled());
|
|
|
|
}
|
|
|
|
|
|
|
|
export uint8_t CreatureLib_BattleSide_SetChoice(BattleSide* p, BaseTurnChoice* choice) { Try(p->SetChoice(choice);) }
|
|
|
|
|
|
|
|
export void CreatureLib_BattleSide_ResetChoices(BattleSide* p) { p->ResetChoices(); }
|
|
|
|
|
|
|
|
export uint8_t CreatureLib_BattleSide_SetCreature(BattleSide* p, Creature* creature, uint8_t index) {
|
|
|
|
Try(p->SetCreature(creature, index));
|
|
|
|
}
|
|
|
|
|
|
|
|
export uint8_t CreatureLib_BattleSide_GetCreature(Creature*& out, BattleSide* p, uint8_t index) {
|
2020-12-12 11:22:48 +00:00
|
|
|
Try(out = p->GetCreature(index).GetValue());
|
2020-04-04 15:03:06 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
export uint8_t CreatureLib_BattleSide_GetSideIndex(BattleSide* p) { return p->GetSideIndex(); }
|
|
|
|
export uint8_t CreatureLib_BattleSide_GetCreatureIndex(uint8_t& out, BattleSide* p, Creature* c) {
|
|
|
|
Try(out = p->GetCreatureIndex(c));
|
|
|
|
}
|
|
|
|
|
|
|
|
export uint8_t CreatureLib_BattleSide_MarkSlotAsUnfillable(BattleSide* p, Creature* c) {
|
|
|
|
Try(p->MarkSlotAsUnfillable(c));
|
|
|
|
}
|
|
|
|
|
|
|
|
export bool CreatureLib_BattleSide_IsDefeated(BattleSide* p) { return p->IsDefeated(); }
|
|
|
|
export bool CreatureLib_BattleSide_HasFled(BattleSide* p) { return p->HasFled(); }
|
2021-03-26 11:01:18 +00:00
|
|
|
export void CreatureLib_BattleSide_MarkAsFled(BattleSide* p) { p->MarkAsFled(); }
|
|
|
|
|
|
|
|
export u8 CreatureLib_BattleSide_SwapPositions(u8& out, BattleSide* p, u8 a, u8 b) {
|
|
|
|
Try(out = p->SwapPositions(a, b);)
|
2021-10-28 12:49:24 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
export BattleScript* CreatureLib_BattleSide_GetVolatileScript(BattleSide* p, const char* key) {
|
|
|
|
auto v = p->GetVolatileScript(ArbUt::StringView::CalculateHash(key));
|
|
|
|
if (!v.HasValue()) {
|
|
|
|
return nullptr;
|
|
|
|
}
|
|
|
|
return v.GetValue();
|
|
|
|
}
|
|
|
|
export uint8_t CreatureLib_BattleSide_AddVolatileScriptByName(BattleSide* p, const char* key) {
|
|
|
|
Try(p->AddVolatileScript(ArbUt::StringView(key));)
|
|
|
|
}
|
|
|
|
export uint8_t CreatureLib_BattleSide_AddVolatileScript(BattleSide* p, BattleScript* script) {
|
|
|
|
Try(p->AddVolatileScript(script);)
|
|
|
|
}
|
|
|
|
|
|
|
|
export uint8_t CreatureLib_BattleSide_RemoveVolatileScript(BattleSide* p, const char* key) {
|
|
|
|
Try(p->RemoveVolatileScript(ArbUt::StringView::CalculateHash(key));)
|
|
|
|
}
|
|
|
|
export uint8_t CreatureLib_BattleSide_RemoveVolatileScriptWithScript(BattleSide* p, BattleScript* script) {
|
|
|
|
Try(p->RemoveVolatileScript(script);)
|
|
|
|
}
|
|
|
|
export bool CreatureLib_BattleSide_HasVolatileScript(BattleSide* p, const char* key) {
|
|
|
|
return p->HasVolatileScript(ArbUt::StringView::CalculateHash(key));
|
|
|
|
}
|