This commit is contained in:
aozhiwei 2023-03-20 15:30:45 +08:00
parent 0e1917a672
commit 810d59de53

View File

@ -5,6 +5,7 @@
#include "battledatacontext.h"
#include "creature.h"
#include "glmhelper.h"
#include "room.h"
#include "mt/Skill.h"
#include "mt/SkillNumber.h"
@ -29,6 +30,59 @@ public:
result = context_.buff->skill_meta->_number_meta->GetAttrByIdx(idx);
return std::make_shared<a8::lisp::Value>(a8::lisp::Atom(result));
});
RegisterCProc
(
"buff.get_buff_var",
[this] (const a8::lisp::List& params) -> std::shared_ptr<a8::lisp::Value>
{
double result = 0;
if (params->size() != 1) {
abort();
}
a8::lisp::Atom atom = std::any_cast<a8::lisp::Atom>(params->at(0)->value);
int idx = atom.val;
result = context_.buff->buff_vars->at(idx);
return std::make_shared<a8::lisp::Value>(a8::lisp::Atom(result));
});
RegisterCProc
(
"entity.get_pos_x",
[this] (const a8::lisp::List& params) -> std::shared_ptr<a8::lisp::Value>
{
a8::lisp::Atom atom = std::any_cast<a8::lisp::Atom>(params->at(0)->value);
Entity* e = context_.buff->owner->room->GetEntityByUniId(atom.val);
if (!e) {
abort();
}
double result = e->GetPos().GetX();
return std::make_shared<a8::lisp::Value>(a8::lisp::Atom(result));
});
RegisterCProc
(
"entity.get_pos_y",
[this] (const a8::lisp::List& params) -> std::shared_ptr<a8::lisp::Value>
{
a8::lisp::Atom atom = std::any_cast<a8::lisp::Atom>(params->at(0)->value);
Entity* e = context_.buff->owner->room->GetEntityByUniId(atom.val);
if (!e) {
abort();
}
double result = e->GetPos().GetY();
return std::make_shared<a8::lisp::Value>(a8::lisp::Atom(result));
});
RegisterCProc
(
"entity.get_pos_z",
[this] (const a8::lisp::List& params) -> std::shared_ptr<a8::lisp::Value>
{
a8::lisp::Atom atom = std::any_cast<a8::lisp::Atom>(params->at(0)->value);
Entity* e = context_.buff->owner->room->GetEntityByUniId(atom.val);
if (!e) {
abort();
}
double result = e->GetPos().GetZ();
return std::make_shared<a8::lisp::Value>(a8::lisp::Atom(result));
});
RegisterCProc
(
"myself.get_hero_atk",