91 lines
5.0 KiB
C++
91 lines
5.0 KiB
C++
#include "RegisterTurnChoices.hpp"
|
|
#include <CreatureLib/Battling/TurnChoices/AttackTurnChoice.hpp>
|
|
#include <CreatureLib/Battling/TurnChoices/BaseTurnChoice.hpp>
|
|
#include <CreatureLib/Battling/TurnChoices/SwitchTurnChoice.hpp>
|
|
#include "../RefCast.hpp"
|
|
|
|
void RegisterTurnChoices::Register(asIScriptEngine* engine) {
|
|
RegisterTurnChoiceKindEnum(engine);
|
|
RegisterBaseTurnChoice(engine);
|
|
RegisterMoveTurnChoice(engine);
|
|
RegisterSwitchTurnChoice(engine);
|
|
}
|
|
void RegisterTurnChoices::RegisterTurnChoiceKindEnum(asIScriptEngine* engine) {
|
|
[[maybe_unused]] int r = engine->RegisterEnum("TurnChoiceKind");
|
|
Assert(r >= 0);
|
|
r = engine->RegisterEnumValue("TurnChoiceKind", "Pass", (int)CreatureLib::Battling::TurnChoiceKind::Pass);
|
|
Assert(r >= 0);
|
|
r = engine->RegisterEnumValue("TurnChoiceKind", "Attack", (int)CreatureLib::Battling::TurnChoiceKind::Attack);
|
|
Assert(r >= 0);
|
|
r = engine->RegisterEnumValue("TurnChoiceKind", "Item", (int)CreatureLib::Battling::TurnChoiceKind::Item);
|
|
Assert(r >= 0);
|
|
r = engine->RegisterEnumValue("TurnChoiceKind", "Switch", (int)CreatureLib::Battling::TurnChoiceKind::Switch);
|
|
Assert(r >= 0);
|
|
r = engine->RegisterEnumValue("TurnChoiceKind", "Flee", (int)CreatureLib::Battling::TurnChoiceKind::Flee);
|
|
Assert(r >= 0);
|
|
}
|
|
void RegisterTurnChoices::RegisterBaseTurnChoice(asIScriptEngine* engine) {
|
|
[[maybe_unused]] int r = engine->RegisterObjectType("BaseTurnChoice", 0, asOBJ_REF | asOBJ_NOCOUNT);
|
|
Assert(r >= 0);
|
|
r = engine->RegisterObjectMethod("BaseTurnChoice", "TurnChoiceKind get_Kind() const property",
|
|
asMETHOD(CreatureLib::Battling::BaseTurnChoice, GetKind), asCALL_THISCALL);
|
|
Assert(r >= 0);
|
|
r = engine->RegisterObjectMethod("BaseTurnChoice", "Pokemon@ get_User() const property",
|
|
asMETHOD(CreatureLib::Battling::BaseTurnChoice, GetUser), asCALL_THISCALL);
|
|
Assert(r >= 0);
|
|
}
|
|
|
|
void RegisterTurnChoices::RegisterMoveTurnChoice(asIScriptEngine* engine) {
|
|
[[maybe_unused]] int r = engine->RegisterObjectType("MoveTurnChoice", 0, asOBJ_REF | asOBJ_NOCOUNT);
|
|
Assert(r >= 0);
|
|
r = engine->RegisterObjectMethod("MoveTurnChoice", "TurnChoiceKind get_Kind() const property",
|
|
asMETHOD(CreatureLib::Battling::AttackTurnChoice, GetKind), asCALL_THISCALL);
|
|
Assert(r >= 0);
|
|
r = engine->RegisterObjectMethod("MoveTurnChoice", "Pokemon@ get_User() const property",
|
|
asMETHOD(CreatureLib::Battling::AttackTurnChoice, GetUser), asCALL_THISCALL);
|
|
Assert(r >= 0);
|
|
r = engine->RegisterObjectMethod("MoveTurnChoice", "LearnedMove@ get_Move() const property",
|
|
asMETHOD(CreatureLib::Battling::AttackTurnChoice, GetAttack), asCALL_THISCALL);
|
|
Assert(r >= 0);
|
|
r = engine->RegisterObjectMethod("MoveTurnChoice", "int8 get_Priority() const property",
|
|
asMETHOD(CreatureLib::Battling::AttackTurnChoice, GetPriority), asCALL_THISCALL);
|
|
Assert(r >= 0);
|
|
|
|
r = engine->RegisterObjectMethod(
|
|
"BaseTurnChoice", "MoveTurnChoice@ opCast()",
|
|
asFUNCTION((refCast<CreatureLib::Battling::BaseTurnChoice, CreatureLib::Battling::AttackTurnChoice>)),
|
|
asCALL_CDECL_OBJLAST);
|
|
Assert(r >= 0);
|
|
r = engine->RegisterObjectMethod(
|
|
"MoveTurnChoice", "BaseTurnChoice@ opImplCast()",
|
|
asFUNCTION((refCast<CreatureLib::Battling::AttackTurnChoice, CreatureLib::Battling::BaseTurnChoice>)),
|
|
asCALL_CDECL_OBJLAST);
|
|
Assert(r >= 0);
|
|
}
|
|
|
|
void RegisterTurnChoices::RegisterSwitchTurnChoice(asIScriptEngine* engine) {
|
|
[[maybe_unused]] int r = engine->RegisterObjectType("SwitchTurnChoice", 0, asOBJ_REF | asOBJ_NOCOUNT);
|
|
Assert(r >= 0);
|
|
r = engine->RegisterObjectMethod("SwitchTurnChoice", "TurnChoiceKind get_Kind() const property",
|
|
asMETHOD(CreatureLib::Battling::SwitchTurnChoice, GetKind), asCALL_THISCALL);
|
|
Assert(r >= 0);
|
|
r = engine->RegisterObjectMethod("SwitchTurnChoice", "Pokemon@ get_User() const property",
|
|
asMETHOD(CreatureLib::Battling::SwitchTurnChoice, GetUser), asCALL_THISCALL);
|
|
Assert(r >= 0);
|
|
r = engine->RegisterObjectMethod("SwitchTurnChoice", "Pokemon@ get_NewPokemon() const property",
|
|
asMETHOD(CreatureLib::Battling::SwitchTurnChoice, GetNewCreature),
|
|
asCALL_THISCALL);
|
|
Assert(r >= 0);
|
|
|
|
r = engine->RegisterObjectMethod(
|
|
"SwitchTurnChoice", "MoveTurnChoice@ opCast()",
|
|
asFUNCTION((refCast<CreatureLib::Battling::BaseTurnChoice, CreatureLib::Battling::SwitchTurnChoice>)),
|
|
asCALL_CDECL_OBJLAST);
|
|
Assert(r >= 0);
|
|
r = engine->RegisterObjectMethod(
|
|
"SwitchTurnChoice", "BaseTurnChoice@ opImplCast()",
|
|
asFUNCTION((refCast<CreatureLib::Battling::AttackTurnChoice, CreatureLib::Battling::SwitchTurnChoice>)),
|
|
asCALL_CDECL_OBJLAST);
|
|
Assert(r >= 0);
|
|
}
|