Update to latest Arbutils.
continuous-integration/drone/push Build is passing
Details
continuous-integration/drone/push Build is passing
Details
This commit is contained in:
parent
ecf8582c59
commit
bbb2691b91
|
@ -83,7 +83,7 @@ float PkmnLib::Battling::DamageLibrary::GetDamageModifier(CreatureLib::Battling:
|
||||||
PKMN_HOOK(OverrideCriticalModifier, attack, attack, target, hitIndex, &critModifier);
|
PKMN_HOOK(OverrideCriticalModifier, attack, attack, target, hitIndex, &critModifier);
|
||||||
mod *= critModifier;
|
mod *= critModifier;
|
||||||
}
|
}
|
||||||
Assert(attack->GetUser()->GetBattle().GetValue());
|
Ensure(attack->GetUser()->GetBattle().GetValue());
|
||||||
float randPercentage = 85 + attack->GetUser()->GetBattle().GetValue()->GetRandom()->Get(0, 16);
|
float randPercentage = 85 + attack->GetUser()->GetBattle().GetValue()->GetRandom()->Get(0, 16);
|
||||||
mod *= randPercentage / 100.0;
|
mod *= randPercentage / 100.0;
|
||||||
if (attack->GetUser()->HasType(hitData.GetType())) {
|
if (attack->GetUser()->HasType(hitData.GetType())) {
|
||||||
|
|
|
@ -20,9 +20,8 @@ void PkmnLib::Battling::ExperienceLibrary::HandleExperienceGain(
|
||||||
const std::unordered_set<ArbUt::BorrowedPtr<CreatureLib::Battling::Creature>>& opponents) const {
|
const std::unordered_set<ArbUt::BorrowedPtr<CreatureLib::Battling::Creature>>& opponents) const {
|
||||||
|
|
||||||
auto fainted = dynamic_cast<Pokemon*>(faintedMon);
|
auto fainted = dynamic_cast<Pokemon*>(faintedMon);
|
||||||
AssertNotNull(fainted);
|
EnsureNotNull(fainted);
|
||||||
auto& forme = fainted->GetForme();
|
auto& forme = fainted->GetForme();
|
||||||
AssertNotNull(forme);
|
|
||||||
auto expGain = forme->GetBaseExperience();
|
auto expGain = forme->GetBaseExperience();
|
||||||
auto level = fainted->GetLevel();
|
auto level = fainted->GetLevel();
|
||||||
|
|
||||||
|
|
|
@ -7,7 +7,7 @@ bool PkmnLib::Battling::MiscLibrary::IsCritical(CreatureLib::Battling::Executing
|
||||||
CreatureLib::Battling::Creature* target, uint8_t hit) const {
|
CreatureLib::Battling::Creature* target, uint8_t hit) const {
|
||||||
uint8_t critStage = 0;
|
uint8_t critStage = 0;
|
||||||
PKMN_HOOK(ModifyCriticalStage, attack, attack, target, hit, &critStage);
|
PKMN_HOOK(ModifyCriticalStage, attack, attack, target, hit, &critStage);
|
||||||
Assert(target->GetBattle().HasValue());
|
Ensure(target->GetBattle().HasValue());
|
||||||
auto rand = target->GetBattle().GetValue()->GetRandom();
|
auto rand = target->GetBattle().GetValue()->GetRandom();
|
||||||
switch (critStage) {
|
switch (critStage) {
|
||||||
case 0: return rand->Get(24) == 0;
|
case 0: return rand->Get(24) == 0;
|
||||||
|
|
|
@ -5,8 +5,6 @@
|
||||||
auto aggregator = source->GetScriptIterator(); \
|
auto aggregator = source->GetScriptIterator(); \
|
||||||
while (aggregator.HasNext()) { \
|
while (aggregator.HasNext()) { \
|
||||||
auto next = aggregator.GetNext(); \
|
auto next = aggregator.GetNext(); \
|
||||||
if (next == nullptr) \
|
|
||||||
continue; \
|
|
||||||
auto castNext = next.ForceAs<PkmnLib::Battling::PkmnScript>(); \
|
auto castNext = next.ForceAs<PkmnLib::Battling::PkmnScript>(); \
|
||||||
castNext->hookName(__VA_ARGS__); \
|
castNext->hookName(__VA_ARGS__); \
|
||||||
} \
|
} \
|
||||||
|
|
|
@ -49,7 +49,6 @@ namespace PkmnLib::Battling {
|
||||||
err << "Invalid forme '" << _forme << "' for species '" << _forme << "'.";
|
err << "Invalid forme '" << _forme << "' for species '" << _forme << "'.";
|
||||||
throw ArbUt::Exception(err.str());
|
throw ArbUt::Exception(err.str());
|
||||||
}
|
}
|
||||||
AssertNotNull(forme);
|
|
||||||
CreatureLib::Library::TalentIndex ability;
|
CreatureLib::Library::TalentIndex ability;
|
||||||
if (this->_ability.IsEmpty()) {
|
if (this->_ability.IsEmpty()) {
|
||||||
ability = forme.value()->GetRandomTalent(rand);
|
ability = forme.value()->GetRandomTalent(rand);
|
||||||
|
@ -79,10 +78,7 @@ namespace PkmnLib::Battling {
|
||||||
for (size_t i = 0; i < _attacks.Count(); i++) {
|
for (size_t i = 0; i < _attacks.Count(); i++) {
|
||||||
auto& kv = _attacks[i];
|
auto& kv = _attacks[i];
|
||||||
auto move = kv.Move;
|
auto move = kv.Move;
|
||||||
if (move != nullptr)
|
|
||||||
attacks[i] = new LearnedMove(move, kv.LearnMethod);
|
attacks[i] = new LearnedMove(move, kv.LearnMethod);
|
||||||
else
|
|
||||||
attacks[i] = nullptr;
|
|
||||||
}
|
}
|
||||||
auto ivs = CreatureLib::Library::ClampedStatisticSet<uint8_t, 0, 31>(_ivHp, _ivAttack, _ivDefense, _ivSpAtt,
|
auto ivs = CreatureLib::Library::ClampedStatisticSet<uint8_t, 0, 31>(_ivHp, _ivAttack, _ivDefense, _ivSpAtt,
|
||||||
_ivSpDef, _ivSpeed);
|
_ivSpDef, _ivSpeed);
|
||||||
|
@ -156,7 +152,6 @@ namespace PkmnLib::Battling {
|
||||||
if (_currentMove >= _library->GetSettings()->GetMaximalAttacks()) {
|
if (_currentMove >= _library->GetSettings()->GetMaximalAttacks()) {
|
||||||
throw ArbUt::Exception("This pokemon already has the maximal allowed moves.");
|
throw ArbUt::Exception("This pokemon already has the maximal allowed moves.");
|
||||||
}
|
}
|
||||||
Assert(v.value() != nullptr);
|
|
||||||
_attacks.Append(ToLearnMethod(v.value(), method));
|
_attacks.Append(ToLearnMethod(v.value(), method));
|
||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
|
|
|
@ -111,7 +111,7 @@ void AngelScriptResolver::RegisterTypes() {
|
||||||
RegisterBattleClass::Register(_engine);
|
RegisterBattleClass::Register(_engine);
|
||||||
[[maybe_unused]] int r = _engine->RegisterObjectMethod("Pokemon", "const Battle@ get_Battle() const property",
|
[[maybe_unused]] int r = _engine->RegisterObjectMethod("Pokemon", "const Battle@ get_Battle() const property",
|
||||||
asFUNCTION(GetBattleWrapper), asCALL_CDECL_OBJFIRST);
|
asFUNCTION(GetBattleWrapper), asCALL_CDECL_OBJFIRST);
|
||||||
assert(r >= 0);
|
Ensure(r >= 0);
|
||||||
|
|
||||||
// Register base script
|
// Register base script
|
||||||
BasicScriptClass::Register(_engine);
|
BasicScriptClass::Register(_engine);
|
||||||
|
@ -223,7 +223,7 @@ void AngelScriptResolver::WriteByteCodeToFile(const char* file, bool stripDebugI
|
||||||
// Open file in write binary mode.
|
// Open file in write binary mode.
|
||||||
wFile = fopen(file, "wb");
|
wFile = fopen(file, "wb");
|
||||||
// Ensure we opened it.
|
// Ensure we opened it.
|
||||||
AssertNotNull(wFile);
|
EnsureNotNull(wFile);
|
||||||
// Save the initial position, as we need to write here later.
|
// Save the initial position, as we need to write here later.
|
||||||
fpos_t startPos;
|
fpos_t startPos;
|
||||||
fgetpos(wFile, &startPos);
|
fgetpos(wFile, &startPos);
|
||||||
|
@ -248,7 +248,7 @@ void AngelScriptResolver::WriteByteCodeToFile(const char* file, bool stripDebugI
|
||||||
fwrite(byteCodeSizeArr, sizeof(uint64_t), 1, wFile);
|
fwrite(byteCodeSizeArr, sizeof(uint64_t), 1, wFile);
|
||||||
|
|
||||||
// Close the file
|
// Close the file
|
||||||
Assert(fclose(wFile) == 0);
|
Ensure(fclose(wFile) == 0);
|
||||||
delete stream;
|
delete stream;
|
||||||
}
|
}
|
||||||
void AngelScriptResolver::LoadByteCodeFromFile(const char* file) {
|
void AngelScriptResolver::LoadByteCodeFromFile(const char* file) {
|
||||||
|
@ -256,7 +256,7 @@ void AngelScriptResolver::LoadByteCodeFromFile(const char* file) {
|
||||||
// Open the file in read binary mode
|
// Open the file in read binary mode
|
||||||
rFile = fopen(file, "rb");
|
rFile = fopen(file, "rb");
|
||||||
// Ensure it opened
|
// Ensure it opened
|
||||||
AssertNotNull(rFile);
|
EnsureNotNull(rFile);
|
||||||
// the first 8 bytes are position of the types database, everything before that is the angelscript byte code.
|
// the first 8 bytes are position of the types database, everything before that is the angelscript byte code.
|
||||||
uint64_t byteCodeSize[]{0};
|
uint64_t byteCodeSize[]{0};
|
||||||
fread(byteCodeSize, sizeof(uint64_t), 1, rFile);
|
fread(byteCodeSize, sizeof(uint64_t), 1, rFile);
|
||||||
|
@ -265,13 +265,13 @@ void AngelScriptResolver::LoadByteCodeFromFile(const char* file) {
|
||||||
// And load the angelscript byte code.
|
// And load the angelscript byte code.
|
||||||
int result = _mainModule->LoadByteCode(stream);
|
int result = _mainModule->LoadByteCode(stream);
|
||||||
// Ensure we succeeded in this.
|
// Ensure we succeeded in this.
|
||||||
Assert(result == asSUCCESS);
|
Ensure(result == asSUCCESS);
|
||||||
|
|
||||||
// Begin loading the type database
|
// Begin loading the type database
|
||||||
auto types = stream->ReadTypes();
|
auto types = stream->ReadTypes();
|
||||||
|
|
||||||
InitializeByteCode(types);
|
InitializeByteCode(types);
|
||||||
Assert(fclose(rFile) == 0);
|
Ensure(fclose(rFile) == 0);
|
||||||
delete stream;
|
delete stream;
|
||||||
}
|
}
|
||||||
uint8_t* AngelScriptResolver::WriteByteCodeToMemory(size_t& size, bool stripDebugInfo) {
|
uint8_t* AngelScriptResolver::WriteByteCodeToMemory(size_t& size, bool stripDebugInfo) {
|
||||||
|
@ -279,7 +279,7 @@ uint8_t* AngelScriptResolver::WriteByteCodeToMemory(size_t& size, bool stripDebu
|
||||||
size_t byteCodeSize[]{0};
|
size_t byteCodeSize[]{0};
|
||||||
stream->Write(byteCodeSize, sizeof(uint64_t));
|
stream->Write(byteCodeSize, sizeof(uint64_t));
|
||||||
auto result = _mainModule->SaveByteCode(stream, stripDebugInfo);
|
auto result = _mainModule->SaveByteCode(stream, stripDebugInfo);
|
||||||
Assert(result == asSUCCESS);
|
Ensure(result == asSUCCESS);
|
||||||
byteCodeSize[0] = (uint64_t)stream->GetWrittenSize();
|
byteCodeSize[0] = (uint64_t)stream->GetWrittenSize();
|
||||||
stream->WriteTypes(_typeDatabase);
|
stream->WriteTypes(_typeDatabase);
|
||||||
stream->WriteToPosition(byteCodeSize, sizeof(uint64_t), 0);
|
stream->WriteToPosition(byteCodeSize, sizeof(uint64_t), 0);
|
||||||
|
@ -297,7 +297,7 @@ void AngelScriptResolver::LoadByteCodeFromMemory(uint8_t* byte, size_t size) {
|
||||||
// And load the angelscript byte code.
|
// And load the angelscript byte code.
|
||||||
int result = _mainModule->LoadByteCode(stream);
|
int result = _mainModule->LoadByteCode(stream);
|
||||||
// Ensure we succeeded in this.
|
// Ensure we succeeded in this.
|
||||||
Assert(result == asSUCCESS);
|
Ensure(result == asSUCCESS);
|
||||||
|
|
||||||
// Begin loading the type database
|
// Begin loading the type database
|
||||||
auto types = stream->ReadTypes();
|
auto types = stream->ReadTypes();
|
||||||
|
|
|
@ -58,15 +58,15 @@ public:
|
||||||
|
|
||||||
void RegisterType(const char* type) {
|
void RegisterType(const char* type) {
|
||||||
int r = _engine->RegisterObjectType(type, 0, asOBJ_REF | asOBJ_NOCOUNT);
|
int r = _engine->RegisterObjectType(type, 0, asOBJ_REF | asOBJ_NOCOUNT);
|
||||||
Assert(r >= 0);
|
Ensure(r >= 0);
|
||||||
}
|
}
|
||||||
void RegisterTypeMethod(const char* type, const char* decl, void*(func)(void*)) {
|
void RegisterTypeMethod(const char* type, const char* decl, void*(func)(void*)) {
|
||||||
int r = _engine->RegisterObjectMethod(type, decl, asFunctionPtr(func), asCALL_CDECL_OBJFIRST);
|
int r = _engine->RegisterObjectMethod(type, decl, asFunctionPtr(func), asCALL_CDECL_OBJFIRST);
|
||||||
Assert(r >= 0);
|
Ensure(r >= 0);
|
||||||
}
|
}
|
||||||
void RegisterGlobalMethod(const char*, void*(func)(void*)) {
|
void RegisterGlobalMethod(const char*, void*(func)(void*)) {
|
||||||
auto r = _engine->RegisterGlobalFunction("decl", asFunctionPtr(func), asCALL_CDECL);
|
auto r = _engine->RegisterGlobalFunction("decl", asFunctionPtr(func), asCALL_CDECL);
|
||||||
Assert(r >= 0);
|
Ensure(r >= 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
asITypeInfo* GetBaseType(const ArbUt::StringView& name) {
|
asITypeInfo* GetBaseType(const ArbUt::StringView& name) {
|
||||||
|
|
|
@ -45,5 +45,5 @@ shared abstract class PkmnScript {
|
||||||
void DoesShareExperience(Pokemon@ faintedMon, Pokemon@ winningMon, bool& shareExperience){};
|
void DoesShareExperience(Pokemon@ faintedMon, Pokemon@ winningMon, bool& shareExperience){};
|
||||||
}
|
}
|
||||||
)");
|
)");
|
||||||
Assert(r >= 0);
|
Ensure(r >= 0);
|
||||||
}
|
}
|
||||||
|
|
|
@ -11,75 +11,75 @@ void RegisterBattleClass::Register(asIScriptEngine* engine) {
|
||||||
|
|
||||||
void RegisterBattleClass::RegisterChoiceQueue(asIScriptEngine* engine) {
|
void RegisterBattleClass::RegisterChoiceQueue(asIScriptEngine* engine) {
|
||||||
[[maybe_unused]] int r = engine->RegisterObjectType("ChoiceQueue", 0, asOBJ_REF | asOBJ_NOCOUNT);
|
[[maybe_unused]] int r = engine->RegisterObjectType("ChoiceQueue", 0, asOBJ_REF | asOBJ_NOCOUNT);
|
||||||
Assert(r >= 0);
|
Ensure(r >= 0);
|
||||||
r = engine->RegisterObjectMethod("ChoiceQueue", "bool MovePokemonChoiceNext(Pokemon@ target)",
|
r = engine->RegisterObjectMethod("ChoiceQueue", "bool MovePokemonChoiceNext(Pokemon@ target)",
|
||||||
asMETHOD(CreatureLib::Battling::ChoiceQueue, MoveCreatureChoiceNext),
|
asMETHOD(CreatureLib::Battling::ChoiceQueue, MoveCreatureChoiceNext),
|
||||||
asCALL_THISCALL);
|
asCALL_THISCALL);
|
||||||
Assert(r >= 0);
|
Ensure(r >= 0);
|
||||||
r = engine->RegisterObjectMethod("ChoiceQueue", "const BaseTurnChoice@ Peek() const",
|
r = engine->RegisterObjectMethod("ChoiceQueue", "const BaseTurnChoice@ Peek() const",
|
||||||
asMETHOD(CreatureLib::Battling::ChoiceQueue, Peek), asCALL_THISCALL);
|
asMETHOD(CreatureLib::Battling::ChoiceQueue, Peek), asCALL_THISCALL);
|
||||||
Assert(r >= 0);
|
Ensure(r >= 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
void RegisterBattleClass::RegisterBattleRandom(asIScriptEngine* engine) {
|
void RegisterBattleClass::RegisterBattleRandom(asIScriptEngine* engine) {
|
||||||
[[maybe_unused]] int r = engine->RegisterObjectType("BattleRandom", 0, asOBJ_REF | asOBJ_NOCOUNT);
|
[[maybe_unused]] int r = engine->RegisterObjectType("BattleRandom", 0, asOBJ_REF | asOBJ_NOCOUNT);
|
||||||
Assert(r >= 0);
|
Ensure(r >= 0);
|
||||||
r = engine->RegisterObjectMethod("BattleRandom",
|
r = engine->RegisterObjectMethod("BattleRandom",
|
||||||
"bool EffectChance(float chance, ExecutingMove@ move, Pokemon@ target )",
|
"bool EffectChance(float chance, ExecutingMove@ move, Pokemon@ target )",
|
||||||
asMETHOD(CreatureLib::Battling::BattleRandom, EffectChance), asCALL_THISCALL);
|
asMETHOD(CreatureLib::Battling::BattleRandom, EffectChance), asCALL_THISCALL);
|
||||||
Assert(r >= 0);
|
Ensure(r >= 0);
|
||||||
r = engine->RegisterObjectMethod("BattleRandom", "int Get()",
|
r = engine->RegisterObjectMethod("BattleRandom", "int Get()",
|
||||||
asMETHODPR(CreatureLib::Battling::BattleRandom, Get, (), int32_t),
|
asMETHODPR(CreatureLib::Battling::BattleRandom, Get, (), int32_t),
|
||||||
asCALL_THISCALL);
|
asCALL_THISCALL);
|
||||||
Assert(r >= 0);
|
Ensure(r >= 0);
|
||||||
r = engine->RegisterObjectMethod("BattleRandom", "int Get(int max)",
|
r = engine->RegisterObjectMethod("BattleRandom", "int Get(int max)",
|
||||||
asMETHODPR(CreatureLib::Battling::BattleRandom, Get, (int32_t), int32_t),
|
asMETHODPR(CreatureLib::Battling::BattleRandom, Get, (int32_t), int32_t),
|
||||||
asCALL_THISCALL);
|
asCALL_THISCALL);
|
||||||
Assert(r >= 0);
|
Ensure(r >= 0);
|
||||||
r = engine->RegisterObjectMethod("BattleRandom", "int Get(int min, int max)",
|
r = engine->RegisterObjectMethod("BattleRandom", "int Get(int min, int max)",
|
||||||
asMETHODPR(CreatureLib::Battling::BattleRandom, Get, (int32_t, int32_t), int32_t),
|
asMETHODPR(CreatureLib::Battling::BattleRandom, Get, (int32_t, int32_t), int32_t),
|
||||||
asCALL_THISCALL);
|
asCALL_THISCALL);
|
||||||
Assert(r >= 0);
|
Ensure(r >= 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
BORROWED_PTR_GETTER_FUNC(PkmnLib::Battling::Battle, CreatureLib::Battling::ChoiceQueue, GetCurrentTurnQueue);
|
BORROWED_PTR_GETTER_FUNC(PkmnLib::Battling::Battle, CreatureLib::Battling::ChoiceQueue, GetCurrentTurnQueue);
|
||||||
|
|
||||||
void RegisterBattleClass::RegisterBattle(asIScriptEngine* engine) {
|
void RegisterBattleClass::RegisterBattle(asIScriptEngine* engine) {
|
||||||
[[maybe_unused]] int r = engine->RegisterObjectType("Battle", 0, asOBJ_REF | asOBJ_NOCOUNT);
|
[[maybe_unused]] int r = engine->RegisterObjectType("Battle", 0, asOBJ_REF | asOBJ_NOCOUNT);
|
||||||
Assert(r >= 0);
|
Ensure(r >= 0);
|
||||||
r = engine->RegisterObjectMethod("Battle", "const BattleLibrary@ get_Library() const property",
|
r = engine->RegisterObjectMethod("Battle", "const BattleLibrary@ get_Library() const property",
|
||||||
asMETHOD(PkmnLib::Battling::Battle, GetLibrary), asCALL_THISCALL);
|
asMETHOD(PkmnLib::Battling::Battle, GetLibrary), asCALL_THISCALL);
|
||||||
Assert(r >= 0);
|
Ensure(r >= 0);
|
||||||
r = engine->RegisterObjectMethod("Battle", "bool CanUse(BaseTurnChoice@ choice)",
|
r = engine->RegisterObjectMethod("Battle", "bool CanUse(BaseTurnChoice@ choice)",
|
||||||
asMETHOD(PkmnLib::Battling::Battle, CanUse), asCALL_THISCALL);
|
asMETHOD(PkmnLib::Battling::Battle, CanUse), asCALL_THISCALL);
|
||||||
Assert(r >= 0);
|
Ensure(r >= 0);
|
||||||
r = engine->RegisterObjectMethod("Battle", "bool get_CanFlee() const property",
|
r = engine->RegisterObjectMethod("Battle", "bool get_CanFlee() const property",
|
||||||
asMETHOD(PkmnLib::Battling::Battle, CanFlee), asCALL_THISCALL);
|
asMETHOD(PkmnLib::Battling::Battle, CanFlee), asCALL_THISCALL);
|
||||||
Assert(r >= 0);
|
Ensure(r >= 0);
|
||||||
r = engine->RegisterObjectMethod("Battle", "BattleRandom@ get_Random() const property",
|
r = engine->RegisterObjectMethod("Battle", "BattleRandom@ get_Random() const property",
|
||||||
asMETHOD(PkmnLib::Battling::Battle, GetRandom), asCALL_THISCALL);
|
asMETHOD(PkmnLib::Battling::Battle, GetRandom), asCALL_THISCALL);
|
||||||
Assert(r >= 0);
|
Ensure(r >= 0);
|
||||||
r = engine->RegisterObjectMethod("Battle", "ChoiceQueue@ get_TurnQueue() const property",
|
r = engine->RegisterObjectMethod("Battle", "ChoiceQueue@ get_TurnQueue() const property",
|
||||||
asFUNCTION(GetCurrentTurnQueueWrapper), asCALL_CDECL_OBJFIRST);
|
asFUNCTION(GetCurrentTurnQueueWrapper), asCALL_CDECL_OBJFIRST);
|
||||||
Assert(r >= 0);
|
Ensure(r >= 0);
|
||||||
r = engine->RegisterObjectMethod(
|
r = engine->RegisterObjectMethod(
|
||||||
"Battle", "void AddVolatile(const constString &in name) const",
|
"Battle", "void AddVolatile(const constString &in name) const",
|
||||||
asMETHODPR(PkmnLib::Battling::Battle, AddVolatileScript, (const ArbUt::StringView&), void), asCALL_THISCALL);
|
asMETHODPR(PkmnLib::Battling::Battle, AddVolatileScript, (const ArbUt::StringView&), void), asCALL_THISCALL);
|
||||||
Assert(r >= 0);
|
Ensure(r >= 0);
|
||||||
r = engine->RegisterObjectMethod(
|
r = engine->RegisterObjectMethod(
|
||||||
"Battle", "void RemoveVolatile(const constString &in name) const",
|
"Battle", "void RemoveVolatile(const constString &in name) const",
|
||||||
asMETHODPR(PkmnLib::Battling::Battle, RemoveVolatileScript, (const ArbUt::BasicStringView&), void),
|
asMETHODPR(PkmnLib::Battling::Battle, RemoveVolatileScript, (const ArbUt::BasicStringView&), void),
|
||||||
asCALL_THISCALL);
|
asCALL_THISCALL);
|
||||||
Assert(r >= 0);
|
Ensure(r >= 0);
|
||||||
r = engine->RegisterObjectMethod(
|
r = engine->RegisterObjectMethod(
|
||||||
"Battle", "void SetWeather(const constString &in name) const",
|
"Battle", "void SetWeather(const constString &in name) const",
|
||||||
asMETHODPR(PkmnLib::Battling::Battle, SetWeather, (const ArbUt::StringView&), void), asCALL_THISCALL);
|
asMETHODPR(PkmnLib::Battling::Battle, SetWeather, (const ArbUt::StringView&), void), asCALL_THISCALL);
|
||||||
Assert(r >= 0);
|
Ensure(r >= 0);
|
||||||
r = engine->RegisterObjectMethod("Battle", "void ClearWeather(const constString &in name) const",
|
r = engine->RegisterObjectMethod("Battle", "void ClearWeather(const constString &in name) const",
|
||||||
asMETHODPR(PkmnLib::Battling::Battle, ClearWeather, (), void), asCALL_THISCALL);
|
asMETHODPR(PkmnLib::Battling::Battle, ClearWeather, (), void), asCALL_THISCALL);
|
||||||
Assert(r >= 0);
|
Ensure(r >= 0);
|
||||||
r = engine->RegisterObjectMethod(
|
r = engine->RegisterObjectMethod(
|
||||||
"Battle", "const constString& GetWeatherName() const",
|
"Battle", "const constString& GetWeatherName() const",
|
||||||
asMETHODPR(PkmnLib::Battling::Battle, GetWeatherName, (), const ArbUt::StringView&), asCALL_THISCALL);
|
asMETHODPR(PkmnLib::Battling::Battle, GetWeatherName, (), const ArbUt::StringView&), asCALL_THISCALL);
|
||||||
Assert(r >= 0);
|
Ensure(r >= 0);
|
||||||
}
|
}
|
||||||
|
|
|
@ -15,42 +15,42 @@ GetHitDataWrapper(CreatureLib::Battling::ExecutingAttack* obj, CreatureLib::Batt
|
||||||
|
|
||||||
void RegisterExecutingAttack::RegisterHitData(asIScriptEngine* engine) {
|
void RegisterExecutingAttack::RegisterHitData(asIScriptEngine* engine) {
|
||||||
[[maybe_unused]] int r = engine->RegisterObjectType("HitData", 0, asOBJ_REF | asOBJ_NOCOUNT);
|
[[maybe_unused]] int r = engine->RegisterObjectType("HitData", 0, asOBJ_REF | asOBJ_NOCOUNT);
|
||||||
Assert(r >= 0);
|
Ensure(r >= 0);
|
||||||
r = engine->RegisterObjectMethod("HitData", "bool get_IsCritical() const property",
|
r = engine->RegisterObjectMethod("HitData", "bool get_IsCritical() const property",
|
||||||
asMETHOD(CreatureLib::Battling::ExecutingAttack::HitData, IsCritical),
|
asMETHOD(CreatureLib::Battling::ExecutingAttack::HitData, IsCritical),
|
||||||
asCALL_THISCALL);
|
asCALL_THISCALL);
|
||||||
Assert(r >= 0);
|
Ensure(r >= 0);
|
||||||
r = engine->RegisterObjectMethod("HitData", "uint8 get_BasePower() const property",
|
r = engine->RegisterObjectMethod("HitData", "uint8 get_BasePower() const property",
|
||||||
asMETHOD(CreatureLib::Battling::ExecutingAttack::HitData, GetBasePower),
|
asMETHOD(CreatureLib::Battling::ExecutingAttack::HitData, GetBasePower),
|
||||||
asCALL_THISCALL);
|
asCALL_THISCALL);
|
||||||
Assert(r >= 0);
|
Ensure(r >= 0);
|
||||||
r = engine->RegisterObjectMethod("HitData", "float get_Effectiveness() const property",
|
r = engine->RegisterObjectMethod("HitData", "float get_Effectiveness() const property",
|
||||||
asMETHOD(CreatureLib::Battling::ExecutingAttack::HitData, GetEffectiveness),
|
asMETHOD(CreatureLib::Battling::ExecutingAttack::HitData, GetEffectiveness),
|
||||||
asCALL_THISCALL);
|
asCALL_THISCALL);
|
||||||
Assert(r >= 0);
|
Ensure(r >= 0);
|
||||||
r = engine->RegisterObjectMethod("HitData", "uint get_Damage() const property",
|
r = engine->RegisterObjectMethod("HitData", "uint get_Damage() const property",
|
||||||
asMETHOD(CreatureLib::Battling::ExecutingAttack::HitData, GetDamage),
|
asMETHOD(CreatureLib::Battling::ExecutingAttack::HitData, GetDamage),
|
||||||
asCALL_THISCALL);
|
asCALL_THISCALL);
|
||||||
Assert(r >= 0);
|
Ensure(r >= 0);
|
||||||
r = engine->RegisterObjectMethod("HitData", "uint8 get_Type() const property",
|
r = engine->RegisterObjectMethod("HitData", "uint8 get_Type() const property",
|
||||||
asMETHOD(CreatureLib::Battling::ExecutingAttack::HitData, GetType),
|
asMETHOD(CreatureLib::Battling::ExecutingAttack::HitData, GetType),
|
||||||
asCALL_THISCALL);
|
asCALL_THISCALL);
|
||||||
Assert(r >= 0);
|
Ensure(r >= 0);
|
||||||
}
|
}
|
||||||
void RegisterExecutingAttack::RegisterExecutingAttackType(asIScriptEngine* engine) {
|
void RegisterExecutingAttack::RegisterExecutingAttackType(asIScriptEngine* engine) {
|
||||||
[[maybe_unused]] int r = engine->RegisterObjectType("ExecutingMove", 0, asOBJ_REF | asOBJ_NOCOUNT);
|
[[maybe_unused]] int r = engine->RegisterObjectType("ExecutingMove", 0, asOBJ_REF | asOBJ_NOCOUNT);
|
||||||
Assert(r >= 0);
|
Ensure(r >= 0);
|
||||||
r = engine->RegisterObjectMethod("ExecutingMove", "HitData@ GetHitData(Pokemon@ target, uint8 hit) const",
|
r = engine->RegisterObjectMethod("ExecutingMove", "HitData@ GetHitData(Pokemon@ target, uint8 hit) const",
|
||||||
asFUNCTION(GetHitDataWrapper), asCALL_CDECL_OBJFIRST);
|
asFUNCTION(GetHitDataWrapper), asCALL_CDECL_OBJFIRST);
|
||||||
Assert(r >= 0);
|
Ensure(r >= 0);
|
||||||
r = engine->RegisterObjectMethod("ExecutingMove", "bool IsPokemonTarget(Pokemon@ pkmn) const",
|
r = engine->RegisterObjectMethod("ExecutingMove", "bool IsPokemonTarget(Pokemon@ pkmn) const",
|
||||||
asMETHOD(CreatureLib::Battling::ExecutingAttack, IsCreatureTarget),
|
asMETHOD(CreatureLib::Battling::ExecutingAttack, IsCreatureTarget),
|
||||||
asCALL_THISCALL);
|
asCALL_THISCALL);
|
||||||
Assert(r >= 0);
|
Ensure(r >= 0);
|
||||||
r = engine->RegisterObjectMethod("ExecutingMove", "Pokemon@ get_User() const property", asFUNCTION(GetUserWrapper),
|
r = engine->RegisterObjectMethod("ExecutingMove", "Pokemon@ get_User() const property", asFUNCTION(GetUserWrapper),
|
||||||
asCALL_CDECL_OBJFIRST);
|
asCALL_CDECL_OBJFIRST);
|
||||||
Assert(r >= 0);
|
Ensure(r >= 0);
|
||||||
r = engine->RegisterObjectMethod("ExecutingMove", "LearnedMove@ get_Move() const property",
|
r = engine->RegisterObjectMethod("ExecutingMove", "LearnedMove@ get_Move() const property",
|
||||||
asFUNCTION(GetAttackWrapper), asCALL_CDECL_OBJFIRST);
|
asFUNCTION(GetAttackWrapper), asCALL_CDECL_OBJFIRST);
|
||||||
Assert(r >= 0);
|
Ensure(r >= 0);
|
||||||
}
|
}
|
||||||
|
|
|
@ -18,7 +18,7 @@ void RegisterPokemonClass::Register(asIScriptEngine* engine) {
|
||||||
|
|
||||||
void RegisterPokemonClass::RegisterDamageSource(asIScriptEngine* engine) {
|
void RegisterPokemonClass::RegisterDamageSource(asIScriptEngine* engine) {
|
||||||
[[maybe_unused]] int r = engine->RegisterEnum("DamageSource");
|
[[maybe_unused]] int r = engine->RegisterEnum("DamageSource");
|
||||||
Assert(r >= 0);
|
Ensure(r >= 0);
|
||||||
for (auto v : CreatureLib::Battling::DamageSourceHelper::GetValues()) {
|
for (auto v : CreatureLib::Battling::DamageSourceHelper::GetValues()) {
|
||||||
r = engine->RegisterEnumValue("DamageSource", CreatureLib::Battling::DamageSourceHelper::ToString(v).c_str(),
|
r = engine->RegisterEnumValue("DamageSource", CreatureLib::Battling::DamageSourceHelper::ToString(v).c_str(),
|
||||||
(int)v);
|
(int)v);
|
||||||
|
@ -27,16 +27,16 @@ void RegisterPokemonClass::RegisterDamageSource(asIScriptEngine* engine) {
|
||||||
r = engine->RegisterEnumValue("DamageSource", PkmnDamageSourceHelper::ToString(v).c_str(), (int)v);
|
r = engine->RegisterEnumValue("DamageSource", PkmnDamageSourceHelper::ToString(v).c_str(), (int)v);
|
||||||
}
|
}
|
||||||
|
|
||||||
Assert(r >= 0);
|
Ensure(r >= 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
void RegisterPokemonClass::RegisterMoveLearnMethod(asIScriptEngine* engine) {
|
void RegisterPokemonClass::RegisterMoveLearnMethod(asIScriptEngine* engine) {
|
||||||
[[maybe_unused]] int r = engine->RegisterEnum("MoveLearnMethod");
|
[[maybe_unused]] int r = engine->RegisterEnum("MoveLearnMethod");
|
||||||
Assert(r >= 0);
|
Ensure(r >= 0);
|
||||||
r = engine->RegisterEnumValue("MoveLearnMethod", "Unknown", (int)CreatureLib::Battling::AttackLearnMethod::Unknown);
|
r = engine->RegisterEnumValue("MoveLearnMethod", "Unknown", (int)CreatureLib::Battling::AttackLearnMethod::Unknown);
|
||||||
Assert(r >= 0);
|
Ensure(r >= 0);
|
||||||
r = engine->RegisterEnumValue("MoveLearnMethod", "Level", (int)CreatureLib::Battling::AttackLearnMethod::Level);
|
r = engine->RegisterEnumValue("MoveLearnMethod", "Level", (int)CreatureLib::Battling::AttackLearnMethod::Level);
|
||||||
Assert(r >= 0);
|
Ensure(r >= 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
ENUM__SIZE_WRAPPER(LearnedMove_LearnMethodWrapper, CreatureLib::Battling::LearnedAttack, GetLearnMethod)
|
ENUM__SIZE_WRAPPER(LearnedMove_LearnMethodWrapper, CreatureLib::Battling::LearnedAttack, GetLearnMethod)
|
||||||
|
@ -44,19 +44,19 @@ BORROWED_PTR_GETTER_FUNC(CreatureLib::Battling::LearnedAttack, const CreatureLib
|
||||||
|
|
||||||
void RegisterPokemonClass::RegisterLearnedAttack(asIScriptEngine* engine) {
|
void RegisterPokemonClass::RegisterLearnedAttack(asIScriptEngine* engine) {
|
||||||
[[maybe_unused]] int r = engine->RegisterObjectType("LearnedMove", 0, asOBJ_REF | asOBJ_NOCOUNT);
|
[[maybe_unused]] int r = engine->RegisterObjectType("LearnedMove", 0, asOBJ_REF | asOBJ_NOCOUNT);
|
||||||
Assert(r >= 0);
|
Ensure(r >= 0);
|
||||||
r = engine->RegisterObjectMethod("LearnedMove", "const MoveData@ get_MoveData() const property",
|
r = engine->RegisterObjectMethod("LearnedMove", "const MoveData@ get_MoveData() const property",
|
||||||
asFUNCTION(GetAttackWrapper), asCALL_CDECL_OBJFIRST);
|
asFUNCTION(GetAttackWrapper), asCALL_CDECL_OBJFIRST);
|
||||||
Assert(r >= 0);
|
Ensure(r >= 0);
|
||||||
r = engine->RegisterObjectMethod("LearnedMove", "uint8 get_MaxUses() const property",
|
r = engine->RegisterObjectMethod("LearnedMove", "uint8 get_MaxUses() const property",
|
||||||
asMETHOD(CreatureLib::Battling::LearnedAttack, GetMaxUses), asCALL_THISCALL);
|
asMETHOD(CreatureLib::Battling::LearnedAttack, GetMaxUses), asCALL_THISCALL);
|
||||||
Assert(r >= 0);
|
Ensure(r >= 0);
|
||||||
r = engine->RegisterObjectMethod("LearnedMove", "uint8 get_RemainingUses() const property",
|
r = engine->RegisterObjectMethod("LearnedMove", "uint8 get_RemainingUses() const property",
|
||||||
asMETHOD(CreatureLib::Battling::LearnedAttack, GetRemainingUses), asCALL_THISCALL);
|
asMETHOD(CreatureLib::Battling::LearnedAttack, GetRemainingUses), asCALL_THISCALL);
|
||||||
Assert(r >= 0);
|
Ensure(r >= 0);
|
||||||
r = engine->RegisterObjectMethod("LearnedMove", "Gender get_LearnMethod() const property",
|
r = engine->RegisterObjectMethod("LearnedMove", "Gender get_LearnMethod() const property",
|
||||||
asFUNCTION(LearnedMove_LearnMethodWrapper), asCALL_CDECL_OBJLAST);
|
asFUNCTION(LearnedMove_LearnMethodWrapper), asCALL_CDECL_OBJLAST);
|
||||||
Assert(r >= 0);
|
Ensure(r >= 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
ENUM__SIZE_WRAPPER(Pkmn_GenderWrapper, PkmnLib::Battling::Pokemon, GetGender)
|
ENUM__SIZE_WRAPPER(Pkmn_GenderWrapper, PkmnLib::Battling::Pokemon, GetGender)
|
||||||
|
@ -87,101 +87,101 @@ OPTIONAL_BORROWED_PTR_GETTER_FUNC(PkmnLib::Battling::Pokemon, const CreatureLib:
|
||||||
|
|
||||||
void RegisterPokemonClass::RegisterPokemonType(asIScriptEngine* engine) {
|
void RegisterPokemonClass::RegisterPokemonType(asIScriptEngine* engine) {
|
||||||
[[maybe_unused]] int r = engine->RegisterObjectType("Pokemon", 0, asOBJ_REF | asOBJ_NOCOUNT);
|
[[maybe_unused]] int r = engine->RegisterObjectType("Pokemon", 0, asOBJ_REF | asOBJ_NOCOUNT);
|
||||||
Assert(r >= 0);
|
Ensure(r >= 0);
|
||||||
r = engine->RegisterObjectMethod("Pokemon", "const Species@ get_Species() const property",
|
r = engine->RegisterObjectMethod("Pokemon", "const Species@ get_Species() const property",
|
||||||
asFUNCTION(GetSpeciesWrapper), asCALL_CDECL_OBJLAST);
|
asFUNCTION(GetSpeciesWrapper), asCALL_CDECL_OBJLAST);
|
||||||
Assert(r >= 0);
|
Ensure(r >= 0);
|
||||||
r = engine->RegisterObjectMethod("Pokemon", "const Forme@ get_Forme() const property", asFUNCTION(GetFormeWrapper),
|
r = engine->RegisterObjectMethod("Pokemon", "const Forme@ get_Forme() const property", asFUNCTION(GetFormeWrapper),
|
||||||
asCALL_CDECL_OBJFIRST);
|
asCALL_CDECL_OBJFIRST);
|
||||||
Assert(r >= 0);
|
Ensure(r >= 0);
|
||||||
r = engine->RegisterObjectMethod("Pokemon", "uint8 get_Level() const property",
|
r = engine->RegisterObjectMethod("Pokemon", "uint8 get_Level() const property",
|
||||||
asMETHOD(PkmnLib::Battling::Pokemon, GetLevel), asCALL_THISCALL);
|
asMETHOD(PkmnLib::Battling::Pokemon, GetLevel), asCALL_THISCALL);
|
||||||
Assert(r >= 0);
|
Ensure(r >= 0);
|
||||||
r = engine->RegisterObjectMethod("Pokemon", "uint32 get_Experience() const property",
|
r = engine->RegisterObjectMethod("Pokemon", "uint32 get_Experience() const property",
|
||||||
asMETHOD(PkmnLib::Battling::Pokemon, GetExperience), asCALL_THISCALL);
|
asMETHOD(PkmnLib::Battling::Pokemon, GetExperience), asCALL_THISCALL);
|
||||||
Assert(r >= 0);
|
Ensure(r >= 0);
|
||||||
r = engine->RegisterObjectMethod("Pokemon", "Gender get_Gender() const property", asFUNCTION(Pkmn_GenderWrapper),
|
r = engine->RegisterObjectMethod("Pokemon", "Gender get_Gender() const property", asFUNCTION(Pkmn_GenderWrapper),
|
||||||
asCALL_CDECL_OBJFIRST);
|
asCALL_CDECL_OBJFIRST);
|
||||||
Assert(r >= 0);
|
Ensure(r >= 0);
|
||||||
r = engine->RegisterObjectMethod("Pokemon", "uint8 get_Coloring() const property",
|
r = engine->RegisterObjectMethod("Pokemon", "uint8 get_Coloring() const property",
|
||||||
asMETHOD(PkmnLib::Battling::Pokemon, GetColoring), asCALL_THISCALL);
|
asMETHOD(PkmnLib::Battling::Pokemon, GetColoring), asCALL_THISCALL);
|
||||||
Assert(r >= 0);
|
Ensure(r >= 0);
|
||||||
r = engine->RegisterObjectMethod("Pokemon", "bool get_Shiny() const property",
|
r = engine->RegisterObjectMethod("Pokemon", "bool get_Shiny() const property",
|
||||||
asMETHOD(PkmnLib::Battling::Pokemon, IsShiny), asCALL_THISCALL);
|
asMETHOD(PkmnLib::Battling::Pokemon, IsShiny), asCALL_THISCALL);
|
||||||
Assert(r >= 0);
|
Ensure(r >= 0);
|
||||||
r = engine->RegisterObjectMethod("Pokemon", "const Item@ get_HeldItem() const property",
|
r = engine->RegisterObjectMethod("Pokemon", "const Item@ get_HeldItem() const property",
|
||||||
asFUNCTION(GetHeldItemWrapper), asCALL_CDECL_OBJFIRST);
|
asFUNCTION(GetHeldItemWrapper), asCALL_CDECL_OBJFIRST);
|
||||||
Assert(r >= 0);
|
Ensure(r >= 0);
|
||||||
r = engine->RegisterObjectMethod("Pokemon", "bool HasHeldItem(const constString &in name) const",
|
r = engine->RegisterObjectMethod("Pokemon", "bool HasHeldItem(const constString &in name) const",
|
||||||
asFUNCTION(HasHeldItem), asCALL_CDECL_OBJFIRST);
|
asFUNCTION(HasHeldItem), asCALL_CDECL_OBJFIRST);
|
||||||
Assert(r >= 0);
|
Ensure(r >= 0);
|
||||||
r = engine->RegisterObjectMethod(
|
r = engine->RegisterObjectMethod(
|
||||||
"Pokemon", "void SetHeldItem(const string &in name)",
|
"Pokemon", "void SetHeldItem(const string &in name)",
|
||||||
asMETHODPR(PkmnLib::Battling::Pokemon, SetHeldItem, (const ArbUt::BasicStringView&), void), asCALL_THISCALL);
|
asMETHODPR(PkmnLib::Battling::Pokemon, SetHeldItem, (const ArbUt::BasicStringView&), void), asCALL_THISCALL);
|
||||||
Assert(r >= 0);
|
Ensure(r >= 0);
|
||||||
r = engine->RegisterObjectMethod("Pokemon", "void SetHeldItem(const Item@ item)",
|
r = engine->RegisterObjectMethod("Pokemon", "void SetHeldItem(const Item@ item)",
|
||||||
asMETHODPR(PkmnLib::Battling::Pokemon, SetHeldItem,
|
asMETHODPR(PkmnLib::Battling::Pokemon, SetHeldItem,
|
||||||
(const ArbUt::BorrowedPtr<const CreatureLib::Library::Item>&), void),
|
(const ArbUt::BorrowedPtr<const CreatureLib::Library::Item>&), void),
|
||||||
asCALL_THISCALL);
|
asCALL_THISCALL);
|
||||||
Assert(r >= 0);
|
Ensure(r >= 0);
|
||||||
r = engine->RegisterObjectMethod("Pokemon", "uint32 get_CurrentHealth() const property",
|
r = engine->RegisterObjectMethod("Pokemon", "uint32 get_CurrentHealth() const property",
|
||||||
asMETHOD(PkmnLib::Battling::Pokemon, GetCurrentHealth), asCALL_THISCALL);
|
asMETHOD(PkmnLib::Battling::Pokemon, GetCurrentHealth), asCALL_THISCALL);
|
||||||
Assert(r >= 0);
|
Ensure(r >= 0);
|
||||||
r = engine->RegisterObjectMethod("Pokemon", "const string& get_Nickname() const property",
|
r = engine->RegisterObjectMethod("Pokemon", "const string& get_Nickname() const property",
|
||||||
asFUNCTION(NicknameWrapper), asCALL_CDECL_OBJFIRST);
|
asFUNCTION(NicknameWrapper), asCALL_CDECL_OBJFIRST);
|
||||||
Assert(r >= 0);
|
Ensure(r >= 0);
|
||||||
r = engine->RegisterObjectMethod("Pokemon", "const constString& get_ActiveAbility() const property",
|
r = engine->RegisterObjectMethod("Pokemon", "const constString& get_ActiveAbility() const property",
|
||||||
asMETHOD(PkmnLib::Battling::Pokemon, GetActiveTalent), asCALL_THISCALL);
|
asMETHOD(PkmnLib::Battling::Pokemon, GetActiveTalent), asCALL_THISCALL);
|
||||||
Assert(r >= 0);
|
Ensure(r >= 0);
|
||||||
r = engine->RegisterObjectMethod("Pokemon", "bool get_IsFainted() const property",
|
r = engine->RegisterObjectMethod("Pokemon", "bool get_IsFainted() const property",
|
||||||
asMETHOD(PkmnLib::Battling::Pokemon, IsFainted), asCALL_THISCALL);
|
asMETHOD(PkmnLib::Battling::Pokemon, IsFainted), asCALL_THISCALL);
|
||||||
Assert(r >= 0);
|
Ensure(r >= 0);
|
||||||
r = engine->RegisterObjectMethod("Pokemon", "bool HasType(uint8 type) const",
|
r = engine->RegisterObjectMethod("Pokemon", "bool HasType(uint8 type) const",
|
||||||
asMETHOD(PkmnLib::Battling::Pokemon, HasType), asCALL_THISCALL);
|
asMETHOD(PkmnLib::Battling::Pokemon, HasType), asCALL_THISCALL);
|
||||||
Assert(r >= 0);
|
Ensure(r >= 0);
|
||||||
r = engine->RegisterObjectMethod("Pokemon", "uint32 get_MaxHealth() const property",
|
r = engine->RegisterObjectMethod("Pokemon", "uint32 get_MaxHealth() const property",
|
||||||
asMETHOD(PkmnLib::Battling::Pokemon, GetMaxHealth), asCALL_THISCALL);
|
asMETHOD(PkmnLib::Battling::Pokemon, GetMaxHealth), asCALL_THISCALL);
|
||||||
Assert(r >= 0);
|
Ensure(r >= 0);
|
||||||
r = engine->RegisterObjectMethod("Pokemon", "void Damage(uint32 type, DamageSource source)",
|
r = engine->RegisterObjectMethod("Pokemon", "void Damage(uint32 type, DamageSource source)",
|
||||||
asMETHOD(PkmnLib::Battling::Pokemon, Damage), asCALL_THISCALL);
|
asMETHOD(PkmnLib::Battling::Pokemon, Damage), asCALL_THISCALL);
|
||||||
Assert(r >= 0);
|
Ensure(r >= 0);
|
||||||
r = engine->RegisterObjectMethod("Pokemon", "void Heal(uint32 type)", asMETHOD(PkmnLib::Battling::Pokemon, Heal),
|
r = engine->RegisterObjectMethod("Pokemon", "void Heal(uint32 type)", asMETHOD(PkmnLib::Battling::Pokemon, Heal),
|
||||||
asCALL_THISCALL);
|
asCALL_THISCALL);
|
||||||
Assert(r >= 0);
|
Ensure(r >= 0);
|
||||||
r = engine->RegisterObjectMethod("Pokemon", "void OverrideActiveAbility(const string &in ability)",
|
r = engine->RegisterObjectMethod("Pokemon", "void OverrideActiveAbility(const string &in ability)",
|
||||||
asMETHOD(PkmnLib::Battling::Pokemon, OverrideActiveTalent), asCALL_THISCALL);
|
asMETHOD(PkmnLib::Battling::Pokemon, OverrideActiveTalent), asCALL_THISCALL);
|
||||||
Assert(r >= 0);
|
Ensure(r >= 0);
|
||||||
r = engine->RegisterObjectMethod("Pokemon", "LearnedMove@[]@ GetMoves() const", asFUNCTION(GetMoves),
|
r = engine->RegisterObjectMethod("Pokemon", "LearnedMove@[]@ GetMoves() const", asFUNCTION(GetMoves),
|
||||||
asCALL_CDECL_OBJFIRST);
|
asCALL_CDECL_OBJFIRST);
|
||||||
Assert(r >= 0);
|
Ensure(r >= 0);
|
||||||
r = engine->RegisterObjectMethod("Pokemon", "void ChangeStatBoost(Statistic stat, int8 amount)",
|
r = engine->RegisterObjectMethod("Pokemon", "void ChangeStatBoost(Statistic stat, int8 amount)",
|
||||||
asMETHOD(PkmnLib::Battling::Pokemon, ChangeStatBoost), asCALL_THISCALL);
|
asMETHOD(PkmnLib::Battling::Pokemon, ChangeStatBoost), asCALL_THISCALL);
|
||||||
Assert(r >= 0);
|
Ensure(r >= 0);
|
||||||
r = engine->RegisterObjectMethod("Pokemon", "const Species@ get_DisplaySpecies() const property",
|
r = engine->RegisterObjectMethod("Pokemon", "const Species@ get_DisplaySpecies() const property",
|
||||||
asMETHOD(PkmnLib::Battling::Pokemon, GetDisplaySpecies), asCALL_THISCALL);
|
asMETHOD(PkmnLib::Battling::Pokemon, GetDisplaySpecies), asCALL_THISCALL);
|
||||||
Assert(r >= 0);
|
Ensure(r >= 0);
|
||||||
r = engine->RegisterObjectMethod("Pokemon", "const Species@ get_DisplayForme() const property",
|
r = engine->RegisterObjectMethod("Pokemon", "const Species@ get_DisplayForme() const property",
|
||||||
asMETHOD(PkmnLib::Battling::Pokemon, GetDisplayVariant), asCALL_THISCALL);
|
asMETHOD(PkmnLib::Battling::Pokemon, GetDisplayVariant), asCALL_THISCALL);
|
||||||
Assert(r >= 0);
|
Ensure(r >= 0);
|
||||||
r = engine->RegisterObjectMethod("Pokemon", "uint32 GetFlatStat(Statistic stat) const",
|
r = engine->RegisterObjectMethod("Pokemon", "uint32 GetFlatStat(Statistic stat) const",
|
||||||
asMETHOD(PkmnLib::Battling::Pokemon, GetFlatStat), asCALL_THISCALL);
|
asMETHOD(PkmnLib::Battling::Pokemon, GetFlatStat), asCALL_THISCALL);
|
||||||
Assert(r >= 0);
|
Ensure(r >= 0);
|
||||||
r = engine->RegisterObjectMethod("Pokemon", "uint32 GetBoostedStat(Statistic stat) const",
|
r = engine->RegisterObjectMethod("Pokemon", "uint32 GetBoostedStat(Statistic stat) const",
|
||||||
asMETHOD(PkmnLib::Battling::Pokemon, GetBoostedStat), asCALL_THISCALL);
|
asMETHOD(PkmnLib::Battling::Pokemon, GetBoostedStat), asCALL_THISCALL);
|
||||||
Assert(r >= 0);
|
Ensure(r >= 0);
|
||||||
r = engine->RegisterObjectMethod("Pokemon", "uint32 GetBaseStat(Statistic stat) const",
|
r = engine->RegisterObjectMethod("Pokemon", "uint32 GetBaseStat(Statistic stat) const",
|
||||||
asMETHOD(PkmnLib::Battling::Pokemon, GetBaseStat), asCALL_THISCALL);
|
asMETHOD(PkmnLib::Battling::Pokemon, GetBaseStat), asCALL_THISCALL);
|
||||||
Assert(r >= 0);
|
Ensure(r >= 0);
|
||||||
r = engine->RegisterObjectMethod("Pokemon", "int8 GetStatBoost(Statistic stat) const",
|
r = engine->RegisterObjectMethod("Pokemon", "int8 GetStatBoost(Statistic stat) const",
|
||||||
asMETHOD(PkmnLib::Battling::Pokemon, GetStatBoost), asCALL_THISCALL);
|
asMETHOD(PkmnLib::Battling::Pokemon, GetStatBoost), asCALL_THISCALL);
|
||||||
Assert(r >= 0);
|
Ensure(r >= 0);
|
||||||
r = engine->RegisterObjectMethod(
|
r = engine->RegisterObjectMethod(
|
||||||
"Pokemon", "void AddVolatile(const constString &in name) const",
|
"Pokemon", "void AddVolatile(const constString &in name) const",
|
||||||
asMETHODPR(PkmnLib::Battling::Pokemon, AddVolatileScript, (const ArbUt::StringView&), void), asCALL_THISCALL);
|
asMETHODPR(PkmnLib::Battling::Pokemon, AddVolatileScript, (const ArbUt::StringView&), void), asCALL_THISCALL);
|
||||||
Assert(r >= 0);
|
Ensure(r >= 0);
|
||||||
r = engine->RegisterObjectMethod(
|
r = engine->RegisterObjectMethod(
|
||||||
"Pokemon", "void RemoveVolatile(const constString &in name) const",
|
"Pokemon", "void RemoveVolatile(const constString &in name) const",
|
||||||
asMETHODPR(PkmnLib::Battling::Pokemon, RemoveVolatileScript, (const ArbUt::BasicStringView&), void),
|
asMETHODPR(PkmnLib::Battling::Pokemon, RemoveVolatileScript, (const ArbUt::BasicStringView&), void),
|
||||||
asCALL_THISCALL);
|
asCALL_THISCALL);
|
||||||
Assert(r >= 0);
|
Ensure(r >= 0);
|
||||||
}
|
}
|
|
@ -12,79 +12,79 @@ void RegisterTurnChoices::Register(asIScriptEngine* engine) {
|
||||||
}
|
}
|
||||||
void RegisterTurnChoices::RegisterTurnChoiceKindEnum(asIScriptEngine* engine) {
|
void RegisterTurnChoices::RegisterTurnChoiceKindEnum(asIScriptEngine* engine) {
|
||||||
[[maybe_unused]] int r = engine->RegisterEnum("TurnChoiceKind");
|
[[maybe_unused]] int r = engine->RegisterEnum("TurnChoiceKind");
|
||||||
Assert(r >= 0);
|
Ensure(r >= 0);
|
||||||
r = engine->RegisterEnumValue("TurnChoiceKind", "Pass", (int)CreatureLib::Battling::TurnChoiceKind::Pass);
|
r = engine->RegisterEnumValue("TurnChoiceKind", "Pass", (int)CreatureLib::Battling::TurnChoiceKind::Pass);
|
||||||
Assert(r >= 0);
|
Ensure(r >= 0);
|
||||||
r = engine->RegisterEnumValue("TurnChoiceKind", "Attack", (int)CreatureLib::Battling::TurnChoiceKind::Attack);
|
r = engine->RegisterEnumValue("TurnChoiceKind", "Attack", (int)CreatureLib::Battling::TurnChoiceKind::Attack);
|
||||||
Assert(r >= 0);
|
Ensure(r >= 0);
|
||||||
r = engine->RegisterEnumValue("TurnChoiceKind", "Item", (int)CreatureLib::Battling::TurnChoiceKind::Item);
|
r = engine->RegisterEnumValue("TurnChoiceKind", "Item", (int)CreatureLib::Battling::TurnChoiceKind::Item);
|
||||||
Assert(r >= 0);
|
Ensure(r >= 0);
|
||||||
r = engine->RegisterEnumValue("TurnChoiceKind", "Switch", (int)CreatureLib::Battling::TurnChoiceKind::Switch);
|
r = engine->RegisterEnumValue("TurnChoiceKind", "Switch", (int)CreatureLib::Battling::TurnChoiceKind::Switch);
|
||||||
Assert(r >= 0);
|
Ensure(r >= 0);
|
||||||
r = engine->RegisterEnumValue("TurnChoiceKind", "Flee", (int)CreatureLib::Battling::TurnChoiceKind::Flee);
|
r = engine->RegisterEnumValue("TurnChoiceKind", "Flee", (int)CreatureLib::Battling::TurnChoiceKind::Flee);
|
||||||
Assert(r >= 0);
|
Ensure(r >= 0);
|
||||||
}
|
}
|
||||||
void RegisterTurnChoices::RegisterBaseTurnChoice(asIScriptEngine* engine) {
|
void RegisterTurnChoices::RegisterBaseTurnChoice(asIScriptEngine* engine) {
|
||||||
[[maybe_unused]] int r = engine->RegisterObjectType("BaseTurnChoice", 0, asOBJ_REF | asOBJ_NOCOUNT);
|
[[maybe_unused]] int r = engine->RegisterObjectType("BaseTurnChoice", 0, asOBJ_REF | asOBJ_NOCOUNT);
|
||||||
Assert(r >= 0);
|
Ensure(r >= 0);
|
||||||
r = engine->RegisterObjectMethod("BaseTurnChoice", "TurnChoiceKind get_Kind() const property",
|
r = engine->RegisterObjectMethod("BaseTurnChoice", "TurnChoiceKind get_Kind() const property",
|
||||||
asMETHOD(CreatureLib::Battling::BaseTurnChoice, GetKind), asCALL_THISCALL);
|
asMETHOD(CreatureLib::Battling::BaseTurnChoice, GetKind), asCALL_THISCALL);
|
||||||
Assert(r >= 0);
|
Ensure(r >= 0);
|
||||||
r = engine->RegisterObjectMethod("BaseTurnChoice", "Pokemon@ get_User() const property",
|
r = engine->RegisterObjectMethod("BaseTurnChoice", "Pokemon@ get_User() const property",
|
||||||
asMETHOD(CreatureLib::Battling::BaseTurnChoice, GetUser), asCALL_THISCALL);
|
asMETHOD(CreatureLib::Battling::BaseTurnChoice, GetUser), asCALL_THISCALL);
|
||||||
Assert(r >= 0);
|
Ensure(r >= 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
void RegisterTurnChoices::RegisterMoveTurnChoice(asIScriptEngine* engine) {
|
void RegisterTurnChoices::RegisterMoveTurnChoice(asIScriptEngine* engine) {
|
||||||
[[maybe_unused]] int r = engine->RegisterObjectType("MoveTurnChoice", 0, asOBJ_REF | asOBJ_NOCOUNT);
|
[[maybe_unused]] int r = engine->RegisterObjectType("MoveTurnChoice", 0, asOBJ_REF | asOBJ_NOCOUNT);
|
||||||
Assert(r >= 0);
|
Ensure(r >= 0);
|
||||||
r = engine->RegisterObjectMethod("MoveTurnChoice", "TurnChoiceKind get_Kind() const property",
|
r = engine->RegisterObjectMethod("MoveTurnChoice", "TurnChoiceKind get_Kind() const property",
|
||||||
asMETHOD(CreatureLib::Battling::AttackTurnChoice, GetKind), asCALL_THISCALL);
|
asMETHOD(CreatureLib::Battling::AttackTurnChoice, GetKind), asCALL_THISCALL);
|
||||||
Assert(r >= 0);
|
Ensure(r >= 0);
|
||||||
r = engine->RegisterObjectMethod("MoveTurnChoice", "Pokemon@ get_User() const property",
|
r = engine->RegisterObjectMethod("MoveTurnChoice", "Pokemon@ get_User() const property",
|
||||||
asMETHOD(CreatureLib::Battling::AttackTurnChoice, GetUser), asCALL_THISCALL);
|
asMETHOD(CreatureLib::Battling::AttackTurnChoice, GetUser), asCALL_THISCALL);
|
||||||
Assert(r >= 0);
|
Ensure(r >= 0);
|
||||||
r = engine->RegisterObjectMethod("MoveTurnChoice", "LearnedMove@ get_Move() const property",
|
r = engine->RegisterObjectMethod("MoveTurnChoice", "LearnedMove@ get_Move() const property",
|
||||||
asMETHOD(CreatureLib::Battling::AttackTurnChoice, GetAttack), asCALL_THISCALL);
|
asMETHOD(CreatureLib::Battling::AttackTurnChoice, GetAttack), asCALL_THISCALL);
|
||||||
Assert(r >= 0);
|
Ensure(r >= 0);
|
||||||
r = engine->RegisterObjectMethod("MoveTurnChoice", "int8 get_Priority() const property",
|
r = engine->RegisterObjectMethod("MoveTurnChoice", "int8 get_Priority() const property",
|
||||||
asMETHOD(CreatureLib::Battling::AttackTurnChoice, GetPriority), asCALL_THISCALL);
|
asMETHOD(CreatureLib::Battling::AttackTurnChoice, GetPriority), asCALL_THISCALL);
|
||||||
Assert(r >= 0);
|
Ensure(r >= 0);
|
||||||
|
|
||||||
r = engine->RegisterObjectMethod(
|
r = engine->RegisterObjectMethod(
|
||||||
"BaseTurnChoice", "MoveTurnChoice@ opCast()",
|
"BaseTurnChoice", "MoveTurnChoice@ opCast()",
|
||||||
asFUNCTION((refCast<CreatureLib::Battling::BaseTurnChoice, CreatureLib::Battling::AttackTurnChoice>)),
|
asFUNCTION((refCast<CreatureLib::Battling::BaseTurnChoice, CreatureLib::Battling::AttackTurnChoice>)),
|
||||||
asCALL_CDECL_OBJLAST);
|
asCALL_CDECL_OBJLAST);
|
||||||
Assert(r >= 0);
|
Ensure(r >= 0);
|
||||||
r = engine->RegisterObjectMethod(
|
r = engine->RegisterObjectMethod(
|
||||||
"MoveTurnChoice", "BaseTurnChoice@ opImplCast()",
|
"MoveTurnChoice", "BaseTurnChoice@ opImplCast()",
|
||||||
asFUNCTION((refCast<CreatureLib::Battling::AttackTurnChoice, CreatureLib::Battling::BaseTurnChoice>)),
|
asFUNCTION((refCast<CreatureLib::Battling::AttackTurnChoice, CreatureLib::Battling::BaseTurnChoice>)),
|
||||||
asCALL_CDECL_OBJLAST);
|
asCALL_CDECL_OBJLAST);
|
||||||
Assert(r >= 0);
|
Ensure(r >= 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
void RegisterTurnChoices::RegisterSwitchTurnChoice(asIScriptEngine* engine) {
|
void RegisterTurnChoices::RegisterSwitchTurnChoice(asIScriptEngine* engine) {
|
||||||
[[maybe_unused]] int r = engine->RegisterObjectType("SwitchTurnChoice", 0, asOBJ_REF | asOBJ_NOCOUNT);
|
[[maybe_unused]] int r = engine->RegisterObjectType("SwitchTurnChoice", 0, asOBJ_REF | asOBJ_NOCOUNT);
|
||||||
Assert(r >= 0);
|
Ensure(r >= 0);
|
||||||
r = engine->RegisterObjectMethod("SwitchTurnChoice", "TurnChoiceKind get_Kind() const property",
|
r = engine->RegisterObjectMethod("SwitchTurnChoice", "TurnChoiceKind get_Kind() const property",
|
||||||
asMETHOD(CreatureLib::Battling::SwitchTurnChoice, GetKind), asCALL_THISCALL);
|
asMETHOD(CreatureLib::Battling::SwitchTurnChoice, GetKind), asCALL_THISCALL);
|
||||||
Assert(r >= 0);
|
Ensure(r >= 0);
|
||||||
r = engine->RegisterObjectMethod("SwitchTurnChoice", "Pokemon@ get_User() const property",
|
r = engine->RegisterObjectMethod("SwitchTurnChoice", "Pokemon@ get_User() const property",
|
||||||
asMETHOD(CreatureLib::Battling::SwitchTurnChoice, GetUser), asCALL_THISCALL);
|
asMETHOD(CreatureLib::Battling::SwitchTurnChoice, GetUser), asCALL_THISCALL);
|
||||||
Assert(r >= 0);
|
Ensure(r >= 0);
|
||||||
r = engine->RegisterObjectMethod("SwitchTurnChoice", "Pokemon@ get_NewPokemon() const property",
|
r = engine->RegisterObjectMethod("SwitchTurnChoice", "Pokemon@ get_NewPokemon() const property",
|
||||||
asMETHOD(CreatureLib::Battling::SwitchTurnChoice, GetNewCreature),
|
asMETHOD(CreatureLib::Battling::SwitchTurnChoice, GetNewCreature),
|
||||||
asCALL_THISCALL);
|
asCALL_THISCALL);
|
||||||
Assert(r >= 0);
|
Ensure(r >= 0);
|
||||||
|
|
||||||
r = engine->RegisterObjectMethod(
|
r = engine->RegisterObjectMethod(
|
||||||
"SwitchTurnChoice", "MoveTurnChoice@ opCast()",
|
"SwitchTurnChoice", "MoveTurnChoice@ opCast()",
|
||||||
asFUNCTION((refCast<CreatureLib::Battling::BaseTurnChoice, CreatureLib::Battling::SwitchTurnChoice>)),
|
asFUNCTION((refCast<CreatureLib::Battling::BaseTurnChoice, CreatureLib::Battling::SwitchTurnChoice>)),
|
||||||
asCALL_CDECL_OBJLAST);
|
asCALL_CDECL_OBJLAST);
|
||||||
Assert(r >= 0);
|
Ensure(r >= 0);
|
||||||
r = engine->RegisterObjectMethod(
|
r = engine->RegisterObjectMethod(
|
||||||
"SwitchTurnChoice", "BaseTurnChoice@ opImplCast()",
|
"SwitchTurnChoice", "BaseTurnChoice@ opImplCast()",
|
||||||
asFUNCTION((refCast<CreatureLib::Battling::AttackTurnChoice, CreatureLib::Battling::SwitchTurnChoice>)),
|
asFUNCTION((refCast<CreatureLib::Battling::AttackTurnChoice, CreatureLib::Battling::SwitchTurnChoice>)),
|
||||||
asCALL_CDECL_OBJLAST);
|
asCALL_CDECL_OBJLAST);
|
||||||
Assert(r >= 0);
|
Ensure(r >= 0);
|
||||||
}
|
}
|
||||||
|
|
|
@ -15,41 +15,41 @@ static uint32_t ImplConstStringHashConv(const ArbUt::StringView& s) { return s.G
|
||||||
void ConstStringRegister::Register(asIScriptEngine* engine) {
|
void ConstStringRegister::Register(asIScriptEngine* engine) {
|
||||||
auto r = engine->RegisterObjectType("constString", sizeof(ArbUt::StringView),
|
auto r = engine->RegisterObjectType("constString", sizeof(ArbUt::StringView),
|
||||||
asOBJ_VALUE | asGetTypeTraits<ArbUt::StringView>());
|
asOBJ_VALUE | asGetTypeTraits<ArbUt::StringView>());
|
||||||
Assert(r >= 0);
|
Ensure(r >= 0);
|
||||||
|
|
||||||
r = engine->RegisterObjectBehaviour("constString", asBEHAVE_CONSTRUCT, "void f()", asFUNCTION(ConstructConstString),
|
r = engine->RegisterObjectBehaviour("constString", asBEHAVE_CONSTRUCT, "void f()", asFUNCTION(ConstructConstString),
|
||||||
asCALL_CDECL_OBJFIRST);
|
asCALL_CDECL_OBJFIRST);
|
||||||
Assert(r >= 0);
|
Ensure(r >= 0);
|
||||||
r = engine->RegisterObjectBehaviour("constString", asBEHAVE_CONSTRUCT, "void f(const string &in s)",
|
r = engine->RegisterObjectBehaviour("constString", asBEHAVE_CONSTRUCT, "void f(const string &in s)",
|
||||||
asFUNCTION(ConstructConstStringFromStd), asCALL_CDECL_OBJFIRST);
|
asFUNCTION(ConstructConstStringFromStd), asCALL_CDECL_OBJFIRST);
|
||||||
Assert(r >= 0);
|
Ensure(r >= 0);
|
||||||
|
|
||||||
r = engine->RegisterObjectBehaviour("constString", asBEHAVE_CONSTRUCT, "void f(const constString &in)",
|
r = engine->RegisterObjectBehaviour("constString", asBEHAVE_CONSTRUCT, "void f(const constString &in)",
|
||||||
asFUNCTION(CopyConstructConstString), asCALL_CDECL_OBJFIRST);
|
asFUNCTION(CopyConstructConstString), asCALL_CDECL_OBJFIRST);
|
||||||
Assert(r >= 0);
|
Ensure(r >= 0);
|
||||||
|
|
||||||
r = engine->RegisterObjectBehaviour("constString", asBEHAVE_DESTRUCT, "void f()", asFUNCTION(DestructConstString),
|
r = engine->RegisterObjectBehaviour("constString", asBEHAVE_DESTRUCT, "void f()", asFUNCTION(DestructConstString),
|
||||||
asCALL_CDECL_OBJFIRST);
|
asCALL_CDECL_OBJFIRST);
|
||||||
Assert(r >= 0);
|
Ensure(r >= 0);
|
||||||
|
|
||||||
r = engine->RegisterObjectMethod(
|
r = engine->RegisterObjectMethod(
|
||||||
"constString", "constString &opAssign(const constString &in)",
|
"constString", "constString &opAssign(const constString &in)",
|
||||||
asMETHODPR(ArbUt::StringView, operator=, (const ArbUt::StringView&), ArbUt::StringView&), asCALL_THISCALL);
|
asMETHODPR(ArbUt::StringView, operator=, (const ArbUt::StringView&), ArbUt::StringView&), asCALL_THISCALL);
|
||||||
Assert(r >= 0);
|
Ensure(r >= 0);
|
||||||
|
|
||||||
r = engine->RegisterObjectMethod(
|
r = engine->RegisterObjectMethod(
|
||||||
"constString", "bool opEquals(const constString &in) const",
|
"constString", "bool opEquals(const constString &in) const",
|
||||||
asFUNCTIONPR(ConstStringEquality, (const ArbUt::StringView&, const ArbUt::StringView&), bool),
|
asFUNCTIONPR(ConstStringEquality, (const ArbUt::StringView&, const ArbUt::StringView&), bool),
|
||||||
asCALL_CDECL_OBJFIRST);
|
asCALL_CDECL_OBJFIRST);
|
||||||
Assert(r >= 0);
|
Ensure(r >= 0);
|
||||||
r = engine->RegisterObjectMethod(
|
r = engine->RegisterObjectMethod(
|
||||||
"constString", "bool opEquals(const string &in) const",
|
"constString", "bool opEquals(const string &in) const",
|
||||||
asFUNCTIONPR(ConstStringStdStringEquality, (const ArbUt::StringView&, const std::string&), bool),
|
asFUNCTIONPR(ConstStringStdStringEquality, (const ArbUt::StringView&, const std::string&), bool),
|
||||||
asCALL_CDECL_OBJFIRST);
|
asCALL_CDECL_OBJFIRST);
|
||||||
Assert(r >= 0);
|
Ensure(r >= 0);
|
||||||
|
|
||||||
r = engine->RegisterObjectMethod("constString", "uint opImplConv()",
|
r = engine->RegisterObjectMethod("constString", "uint opImplConv()",
|
||||||
asFUNCTIONPR(ImplConstStringHashConv, (const ArbUt::StringView&), uint32_t),
|
asFUNCTIONPR(ImplConstStringHashConv, (const ArbUt::StringView&), uint32_t),
|
||||||
asCALL_CDECL_OBJFIRST);
|
asCALL_CDECL_OBJFIRST);
|
||||||
Assert(r >= 0);
|
Ensure(r >= 0);
|
||||||
}
|
}
|
||||||
|
|
|
@ -7,35 +7,35 @@ static const ArbUt::StringView& AsString(const CreatureLib::Library::EffectParam
|
||||||
|
|
||||||
void RegisterEffectParameter::Register(asIScriptEngine* engine) {
|
void RegisterEffectParameter::Register(asIScriptEngine* engine) {
|
||||||
[[maybe_unused]] int r = engine->RegisterEnum("EffectParameterType");
|
[[maybe_unused]] int r = engine->RegisterEnum("EffectParameterType");
|
||||||
Assert(r >= 0);
|
Ensure(r >= 0);
|
||||||
for (auto val : CreatureLib::Library::EffectParameterTypeHelper::GetValues()) {
|
for (auto val : CreatureLib::Library::EffectParameterTypeHelper::GetValues()) {
|
||||||
r = engine->RegisterEnumValue("EffectParameterType",
|
r = engine->RegisterEnumValue("EffectParameterType",
|
||||||
CreatureLib::Library::EffectParameterTypeHelper::ToString(val).c_str(), (int)val);
|
CreatureLib::Library::EffectParameterTypeHelper::ToString(val).c_str(), (int)val);
|
||||||
Assert(r >= 0);
|
Ensure(r >= 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
r = engine->RegisterObjectType("EffectParameter", 0, asOBJ_REF | asOBJ_NOCOUNT);
|
r = engine->RegisterObjectType("EffectParameter", 0, asOBJ_REF | asOBJ_NOCOUNT);
|
||||||
Assert(r >= 0);
|
Ensure(r >= 0);
|
||||||
|
|
||||||
r = engine->RegisterObjectBehaviour("EffectParameter", asBEHAVE_FACTORY, "EffectParameter@ f()",
|
r = engine->RegisterObjectBehaviour("EffectParameter", asBEHAVE_FACTORY, "EffectParameter@ f()",
|
||||||
asFUNCTION(Ref_Factory), asCALL_CDECL);
|
asFUNCTION(Ref_Factory), asCALL_CDECL);
|
||||||
Assert(r >= 0);
|
Ensure(r >= 0);
|
||||||
r = engine->RegisterObjectMethod("EffectParameter", "EffectParameterType GetType() const",
|
r = engine->RegisterObjectMethod("EffectParameter", "EffectParameterType GetType() const",
|
||||||
asMETHOD(CreatureLib::Library::EffectParameter, GetType), asCALL_THISCALL);
|
asMETHOD(CreatureLib::Library::EffectParameter, GetType), asCALL_THISCALL);
|
||||||
Assert(r >= 0);
|
Ensure(r >= 0);
|
||||||
|
|
||||||
r = engine->RegisterObjectMethod("EffectParameter", "bool AsBool() const",
|
r = engine->RegisterObjectMethod("EffectParameter", "bool AsBool() const",
|
||||||
asMETHOD(CreatureLib::Library::EffectParameter, AsBool), asCALL_THISCALL);
|
asMETHOD(CreatureLib::Library::EffectParameter, AsBool), asCALL_THISCALL);
|
||||||
Assert(r >= 0);
|
Ensure(r >= 0);
|
||||||
r = engine->RegisterObjectMethod("EffectParameter", "int64 AsInt() const",
|
r = engine->RegisterObjectMethod("EffectParameter", "int64 AsInt() const",
|
||||||
asMETHOD(CreatureLib::Library::EffectParameter, AsInt), asCALL_THISCALL);
|
asMETHOD(CreatureLib::Library::EffectParameter, AsInt), asCALL_THISCALL);
|
||||||
Assert(r >= 0);
|
Ensure(r >= 0);
|
||||||
r = engine->RegisterObjectMethod("EffectParameter", "float AsFloat() const",
|
r = engine->RegisterObjectMethod("EffectParameter", "float AsFloat() const",
|
||||||
asMETHOD(CreatureLib::Library::EffectParameter, AsFloat), asCALL_THISCALL);
|
asMETHOD(CreatureLib::Library::EffectParameter, AsFloat), asCALL_THISCALL);
|
||||||
Assert(r >= 0);
|
Ensure(r >= 0);
|
||||||
r = engine->RegisterObjectMethod(
|
r = engine->RegisterObjectMethod(
|
||||||
"EffectParameter", "const constString& AsString() const",
|
"EffectParameter", "const constString& AsString() const",
|
||||||
asFUNCTIONPR(AsString, (const CreatureLib::Library::EffectParameter*), const ArbUt::StringView&),
|
asFUNCTIONPR(AsString, (const CreatureLib::Library::EffectParameter*), const ArbUt::StringView&),
|
||||||
asCALL_CDECL_OBJFIRST);
|
asCALL_CDECL_OBJFIRST);
|
||||||
Assert(r >= 0);
|
Ensure(r >= 0);
|
||||||
}
|
}
|
||||||
|
|
|
@ -8,13 +8,13 @@ void RegisterGrowthRateTypes::Register(asIScriptEngine* engine) {
|
||||||
}
|
}
|
||||||
void RegisterGrowthRateTypes::RegisterGrowthRateType(asIScriptEngine* engine) {
|
void RegisterGrowthRateTypes::RegisterGrowthRateType(asIScriptEngine* engine) {
|
||||||
[[maybe_unused]] int r = engine->RegisterObjectType("GrowthRate", 0, asOBJ_REF | asOBJ_NOCOUNT);
|
[[maybe_unused]] int r = engine->RegisterObjectType("GrowthRate", 0, asOBJ_REF | asOBJ_NOCOUNT);
|
||||||
Assert(r >= 0);
|
Ensure(r >= 0);
|
||||||
r = engine->RegisterObjectMethod("GrowthRate", "uint8 CalculateLevel(uint experience) const",
|
r = engine->RegisterObjectMethod("GrowthRate", "uint8 CalculateLevel(uint experience) const",
|
||||||
asMETHOD(CreatureLib::Library::GrowthRate, CalculateLevel), asCALL_THISCALL);
|
asMETHOD(CreatureLib::Library::GrowthRate, CalculateLevel), asCALL_THISCALL);
|
||||||
Assert(r >= 0);
|
Ensure(r >= 0);
|
||||||
r = engine->RegisterObjectMethod("GrowthRate", "uint CalculateExperience(uint8 level) const",
|
r = engine->RegisterObjectMethod("GrowthRate", "uint CalculateExperience(uint8 level) const",
|
||||||
asMETHOD(CreatureLib::Library::GrowthRate, CalculateExperience), asCALL_THISCALL);
|
asMETHOD(CreatureLib::Library::GrowthRate, CalculateExperience), asCALL_THISCALL);
|
||||||
Assert(r >= 0);
|
Ensure(r >= 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
static uint8_t CalculateLevel(const CreatureLib::Library::GrowthRateLibrary* obj, const ArbUt::StringView& str,
|
static uint8_t CalculateLevel(const CreatureLib::Library::GrowthRateLibrary* obj, const ArbUt::StringView& str,
|
||||||
|
@ -28,13 +28,13 @@ static uint32_t CalculateExperience(const CreatureLib::Library::GrowthRateLibrar
|
||||||
|
|
||||||
void RegisterGrowthRateTypes::RegisterGrowthRateLibrary(asIScriptEngine* engine) {
|
void RegisterGrowthRateTypes::RegisterGrowthRateLibrary(asIScriptEngine* engine) {
|
||||||
[[maybe_unused]] int r = engine->RegisterObjectType("GrowthRateLibrary", 0, asOBJ_REF | asOBJ_NOCOUNT);
|
[[maybe_unused]] int r = engine->RegisterObjectType("GrowthRateLibrary", 0, asOBJ_REF | asOBJ_NOCOUNT);
|
||||||
Assert(r >= 0);
|
Ensure(r >= 0);
|
||||||
r = engine->RegisterObjectMethod("GrowthRateLibrary",
|
r = engine->RegisterObjectMethod("GrowthRateLibrary",
|
||||||
"uint8 CalculateLevel(const constString &in growthRate, uint experience) const",
|
"uint8 CalculateLevel(const constString &in growthRate, uint experience) const",
|
||||||
asFUNCTION(CalculateLevel), asCALL_CDECL_OBJLAST);
|
asFUNCTION(CalculateLevel), asCALL_CDECL_OBJLAST);
|
||||||
Assert(r >= 0);
|
Ensure(r >= 0);
|
||||||
r = engine->RegisterObjectMethod(
|
r = engine->RegisterObjectMethod(
|
||||||
"GrowthRateLibrary", "uint CalculateExperience(const constString &in growthRate, uint8 experience) const",
|
"GrowthRateLibrary", "uint CalculateExperience(const constString &in growthRate, uint8 experience) const",
|
||||||
asFUNCTION(CalculateExperience), asCALL_CDECL_OBJLAST);
|
asFUNCTION(CalculateExperience), asCALL_CDECL_OBJLAST);
|
||||||
Assert(r >= 0);
|
Ensure(r >= 0);
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +1,4 @@
|
||||||
#include "RegisterMoveTypes.hpp"
|
#include "RegisterMoveTypes.hpp"
|
||||||
#include <Arbutils/Assert.hpp>
|
|
||||||
#include "../../../../Library/Moves/MoveData.hpp"
|
#include "../../../../Library/Moves/MoveData.hpp"
|
||||||
#include "../../../../Library/Moves/MoveLibrary.hpp"
|
#include "../../../../Library/Moves/MoveLibrary.hpp"
|
||||||
|
|
||||||
|
@ -12,11 +11,11 @@ void RegisterMoveTypes::Register(asIScriptEngine* engine) {
|
||||||
|
|
||||||
#define REGISTER_ENUM_VALUE(asName, cName, valueName) \
|
#define REGISTER_ENUM_VALUE(asName, cName, valueName) \
|
||||||
r = engine->RegisterEnumValue(#asName, #valueName, (int)cName::valueName); \
|
r = engine->RegisterEnumValue(#asName, #valueName, (int)cName::valueName); \
|
||||||
Assert(r >= 0);
|
Ensure(r >= 0);
|
||||||
|
|
||||||
void RegisterMoveTypes::RegisterMoveCategory(asIScriptEngine* engine) {
|
void RegisterMoveTypes::RegisterMoveCategory(asIScriptEngine* engine) {
|
||||||
[[maybe_unused]] int r = engine->RegisterEnum("MoveCategory");
|
[[maybe_unused]] int r = engine->RegisterEnum("MoveCategory");
|
||||||
Assert(r >= 0);
|
Ensure(r >= 0);
|
||||||
REGISTER_ENUM_VALUE(MoveCategory, PkmnLib::Library::MoveCategory, Physical)
|
REGISTER_ENUM_VALUE(MoveCategory, PkmnLib::Library::MoveCategory, Physical)
|
||||||
REGISTER_ENUM_VALUE(MoveCategory, PkmnLib::Library::MoveCategory, Special)
|
REGISTER_ENUM_VALUE(MoveCategory, PkmnLib::Library::MoveCategory, Special)
|
||||||
REGISTER_ENUM_VALUE(MoveCategory, PkmnLib::Library::MoveCategory, Status)
|
REGISTER_ENUM_VALUE(MoveCategory, PkmnLib::Library::MoveCategory, Status)
|
||||||
|
@ -24,7 +23,7 @@ void RegisterMoveTypes::RegisterMoveCategory(asIScriptEngine* engine) {
|
||||||
|
|
||||||
void RegisterMoveTypes::RegisterMoveTarget(asIScriptEngine* engine) {
|
void RegisterMoveTypes::RegisterMoveTarget(asIScriptEngine* engine) {
|
||||||
[[maybe_unused]] int r = engine->RegisterEnum("MoveTarget");
|
[[maybe_unused]] int r = engine->RegisterEnum("MoveTarget");
|
||||||
Assert(r >= 0);
|
Ensure(r >= 0);
|
||||||
REGISTER_ENUM_VALUE(MoveTarget, CreatureLib::Library::AttackTarget, Adjacent)
|
REGISTER_ENUM_VALUE(MoveTarget, CreatureLib::Library::AttackTarget, Adjacent)
|
||||||
REGISTER_ENUM_VALUE(MoveTarget, CreatureLib::Library::AttackTarget, AdjacentAlly)
|
REGISTER_ENUM_VALUE(MoveTarget, CreatureLib::Library::AttackTarget, AdjacentAlly)
|
||||||
REGISTER_ENUM_VALUE(MoveTarget, CreatureLib::Library::AttackTarget, AdjacentAllySelf)
|
REGISTER_ENUM_VALUE(MoveTarget, CreatureLib::Library::AttackTarget, AdjacentAllySelf)
|
||||||
|
@ -52,41 +51,41 @@ static bool HasFlag(const PkmnLib::Library::MoveData* obj, const ArbUt::BasicStr
|
||||||
|
|
||||||
void RegisterMoveTypes::RegisterMoveType(asIScriptEngine* engine) {
|
void RegisterMoveTypes::RegisterMoveType(asIScriptEngine* engine) {
|
||||||
[[maybe_unused]] int r = engine->RegisterObjectType("MoveData", 0, asOBJ_REF | asOBJ_NOCOUNT);
|
[[maybe_unused]] int r = engine->RegisterObjectType("MoveData", 0, asOBJ_REF | asOBJ_NOCOUNT);
|
||||||
Assert(r >= 0);
|
Ensure(r >= 0);
|
||||||
r = engine->RegisterObjectMethod("MoveData", "const constString& get_Name() const property",
|
r = engine->RegisterObjectMethod("MoveData", "const constString& get_Name() const property",
|
||||||
asMETHOD(PkmnLib::Library::MoveData, GetName), asCALL_THISCALL);
|
asMETHOD(PkmnLib::Library::MoveData, GetName), asCALL_THISCALL);
|
||||||
Assert(r >= 0);
|
Ensure(r >= 0);
|
||||||
r = engine->RegisterObjectMethod("MoveData", "uint8 get_Type() const property",
|
r = engine->RegisterObjectMethod("MoveData", "uint8 get_Type() const property",
|
||||||
asMETHOD(PkmnLib::Library::MoveData, GetType), asCALL_THISCALL);
|
asMETHOD(PkmnLib::Library::MoveData, GetType), asCALL_THISCALL);
|
||||||
Assert(r >= 0);
|
Ensure(r >= 0);
|
||||||
r = engine->RegisterObjectMethod("MoveData", "MoveCategory get_Category() const property",
|
r = engine->RegisterObjectMethod("MoveData", "MoveCategory get_Category() const property",
|
||||||
asFUNCTION(Move_CategoryWrapper), asCALL_CDECL_OBJLAST);
|
asFUNCTION(Move_CategoryWrapper), asCALL_CDECL_OBJLAST);
|
||||||
Assert(r >= 0);
|
Ensure(r >= 0);
|
||||||
r = engine->RegisterObjectMethod("MoveData", "uint8 get_BasePower() const property",
|
r = engine->RegisterObjectMethod("MoveData", "uint8 get_BasePower() const property",
|
||||||
asMETHOD(PkmnLib::Library::MoveData, GetBasePower), asCALL_THISCALL);
|
asMETHOD(PkmnLib::Library::MoveData, GetBasePower), asCALL_THISCALL);
|
||||||
Assert(r >= 0);
|
Ensure(r >= 0);
|
||||||
r = engine->RegisterObjectMethod("MoveData", "uint8 get_Accuracy() const property",
|
r = engine->RegisterObjectMethod("MoveData", "uint8 get_Accuracy() const property",
|
||||||
asMETHOD(PkmnLib::Library::MoveData, GetAccuracy), asCALL_THISCALL);
|
asMETHOD(PkmnLib::Library::MoveData, GetAccuracy), asCALL_THISCALL);
|
||||||
Assert(r >= 0);
|
Ensure(r >= 0);
|
||||||
r = engine->RegisterObjectMethod("MoveData", "uint8 get_BaseUsages() const property",
|
r = engine->RegisterObjectMethod("MoveData", "uint8 get_BaseUsages() const property",
|
||||||
asMETHOD(PkmnLib::Library::MoveData, GetBaseUsages), asCALL_THISCALL);
|
asMETHOD(PkmnLib::Library::MoveData, GetBaseUsages), asCALL_THISCALL);
|
||||||
Assert(r >= 0);
|
Ensure(r >= 0);
|
||||||
r = engine->RegisterObjectMethod("MoveData", "MoveTarget get_Target() const property",
|
r = engine->RegisterObjectMethod("MoveData", "MoveTarget get_Target() const property",
|
||||||
asFUNCTION(Move_TargetWrapper), asCALL_CDECL_OBJLAST);
|
asFUNCTION(Move_TargetWrapper), asCALL_CDECL_OBJLAST);
|
||||||
Assert(r >= 0);
|
Ensure(r >= 0);
|
||||||
r = engine->RegisterObjectMethod("MoveData", "int8 get_Priority() const property",
|
r = engine->RegisterObjectMethod("MoveData", "int8 get_Priority() const property",
|
||||||
asMETHOD(PkmnLib::Library::MoveData, GetPriority), asCALL_THISCALL);
|
asMETHOD(PkmnLib::Library::MoveData, GetPriority), asCALL_THISCALL);
|
||||||
Assert(r >= 0);
|
Ensure(r >= 0);
|
||||||
r = engine->RegisterObjectMethod("MoveData", "bool HasFlag(const constString &in flag) const", asFUNCTION(HasFlag),
|
r = engine->RegisterObjectMethod("MoveData", "bool HasFlag(const constString &in flag) const", asFUNCTION(HasFlag),
|
||||||
asCALL_CDECL_OBJLAST);
|
asCALL_CDECL_OBJLAST);
|
||||||
Assert(r >= 0);
|
Ensure(r >= 0);
|
||||||
}
|
}
|
||||||
void RegisterMoveTypes::RegisterMoveLibrary(asIScriptEngine* engine) {
|
void RegisterMoveTypes::RegisterMoveLibrary(asIScriptEngine* engine) {
|
||||||
[[maybe_unused]] int r = engine->RegisterObjectType("MoveLibrary", 0, asOBJ_REF | asOBJ_NOCOUNT);
|
[[maybe_unused]] int r = engine->RegisterObjectType("MoveLibrary", 0, asOBJ_REF | asOBJ_NOCOUNT);
|
||||||
Assert(r >= 0);
|
Ensure(r >= 0);
|
||||||
r = engine->RegisterObjectMethod("MoveLibrary", "const MoveData@ Get(const constString &in name) const",
|
r = engine->RegisterObjectMethod("MoveLibrary", "const MoveData@ Get(const constString &in name) const",
|
||||||
asMETHOD(PkmnLib::Library::MoveLibrary, Get), asCALL_THISCALL);
|
asMETHOD(PkmnLib::Library::MoveLibrary, Get), asCALL_THISCALL);
|
||||||
Assert(r >= 0);
|
Ensure(r >= 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
#undef REGISTER_ENUM_VALUE
|
#undef REGISTER_ENUM_VALUE
|
|
@ -9,13 +9,13 @@ static bool GetTypeId(const CreatureLib::Library::TypeLibrary* obj, const ArbUt:
|
||||||
|
|
||||||
void RegisterTypeLibrary::RegisterTypeLibraryType(asIScriptEngine* engine) {
|
void RegisterTypeLibrary::RegisterTypeLibraryType(asIScriptEngine* engine) {
|
||||||
[[maybe_unused]] int r = engine->RegisterObjectType("TypeLibrary", 0, asOBJ_REF | asOBJ_NOCOUNT);
|
[[maybe_unused]] int r = engine->RegisterObjectType("TypeLibrary", 0, asOBJ_REF | asOBJ_NOCOUNT);
|
||||||
Assert(r >= 0);
|
Ensure(r >= 0);
|
||||||
r = engine->RegisterObjectMethod("TypeLibrary", "uint8 GetTypeId(const constString &in name) const",
|
r = engine->RegisterObjectMethod("TypeLibrary", "uint8 GetTypeId(const constString &in name) const",
|
||||||
asFUNCTION(GetTypeId), asCALL_CDECL_OBJLAST);
|
asFUNCTION(GetTypeId), asCALL_CDECL_OBJLAST);
|
||||||
Assert(r >= 0);
|
Ensure(r >= 0);
|
||||||
r = engine->RegisterObjectMethod(
|
r = engine->RegisterObjectMethod(
|
||||||
"TypeLibrary", "float GetSingleEffectiveness(uint8 attacking, uint8 defensive) const",
|
"TypeLibrary", "float GetSingleEffectiveness(uint8 attacking, uint8 defensive) const",
|
||||||
asMETHOD(CreatureLib::Library::TypeLibrary, GetSingleEffectiveness), asCALL_THISCALL);
|
asMETHOD(CreatureLib::Library::TypeLibrary, GetSingleEffectiveness), asCALL_THISCALL);
|
||||||
Assert(r >= 0);
|
Ensure(r >= 0);
|
||||||
// TODO: Register get full effectiveness method.
|
// TODO: Register get full effectiveness method.
|
||||||
}
|
}
|
||||||
|
|
|
@ -22,9 +22,7 @@ TEST_CASE("Able to get default forme") {
|
||||||
new PkmnLib::Library::LearnableMoves(100)),
|
new PkmnLib::Library::LearnableMoves(100)),
|
||||||
0.5f, "testGrowthRate"_cnc, 100, 100, {"testEggGroup"_cnc});
|
0.5f, "testGrowthRate"_cnc, 100, 100, {"testEggGroup"_cnc});
|
||||||
|
|
||||||
auto forme = species->GetDefaultForme();
|
[[maybe_unused]] auto forme = species->GetDefaultForme();
|
||||||
REQUIRE(forme != nullptr);
|
|
||||||
|
|
||||||
delete species;
|
delete species;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -38,7 +36,6 @@ TEST_CASE("Able to get default forme name") {
|
||||||
0.5f, "testGrowthRate"_cnc, 100, 100, {"testEggGroup"_cnc});
|
0.5f, "testGrowthRate"_cnc, 100, 100, {"testEggGroup"_cnc});
|
||||||
|
|
||||||
auto forme = species->GetDefaultForme();
|
auto forme = species->GetDefaultForme();
|
||||||
REQUIRE(forme != nullptr);
|
|
||||||
REQUIRE(forme->GetName() == "default");
|
REQUIRE(forme->GetName() == "default");
|
||||||
|
|
||||||
delete species;
|
delete species;
|
||||||
|
|
Loading…
Reference in New Issue