Support for specific PkmnLib functions in Scripts, added ModifyCriticalStage function.
This commit is contained in:
@@ -4,10 +4,11 @@
|
||||
#define ANGELSCRIPT_DLL_LIBRARY_IMPORT
|
||||
#include <CreatureLib/Core/Exceptions/NotImplementedException.hpp>
|
||||
#include <angelscript.h>
|
||||
#include "../../Battling/PkmnScript.hpp"
|
||||
#include "AngelScriptTypeInfo.hpp"
|
||||
#include "ContextPool.hpp"
|
||||
|
||||
class AngelScriptScript : public CreatureLib::Battling::Script {
|
||||
class AngelScriptScript : public PkmnLib::Battling::PkmnScript {
|
||||
private:
|
||||
AngelScriptTypeInfo* _type = nullptr;
|
||||
ContextPool* _ctxPool = nullptr;
|
||||
@@ -16,7 +17,7 @@ private:
|
||||
|
||||
public:
|
||||
AngelScriptScript(const std::string& name, AngelScriptTypeInfo* type, asIScriptObject* obj, ContextPool* ctxPool)
|
||||
: CreatureLib::Battling::Script(name), _type(type), _ctxPool(ctxPool), _obj(obj) {}
|
||||
: PkmnLib::Battling::PkmnScript(name), _type(type), _ctxPool(ctxPool), _obj(obj) {}
|
||||
|
||||
~AngelScriptScript() override { _obj->Release(); }
|
||||
|
||||
@@ -251,6 +252,20 @@ public:
|
||||
ctx->SetArgAddress(3, damage);
|
||||
})
|
||||
}
|
||||
|
||||
////////////////////
|
||||
// PkmnLib methods//
|
||||
////////////////////
|
||||
|
||||
void ModifyCriticalStage(CreatureLib::Battling::ExecutingAttack* attack, CreatureLib::Battling::Creature* target,
|
||||
uint8_t hit, uint8_t* critStage) override {
|
||||
CALL_HOOK(ModifyCriticalStage, {
|
||||
ctx->SetArgObject(0, (void*)attack);
|
||||
ctx->SetArgObject(1, (void*)target);
|
||||
ctx->SetArgByte(2, hit);
|
||||
ctx->SetArgAddress(3, critStage);
|
||||
})
|
||||
}
|
||||
};
|
||||
|
||||
#undef CALL_HOOK
|
||||
|
||||
Reference in New Issue
Block a user