This commit is contained in:
aozhiwei 2023-03-06 14:37:30 +08:00
parent 8af5bec0a4
commit 2ab1f4b904
2 changed files with 9 additions and 5 deletions

View File

@ -26,7 +26,7 @@ void BatchAddBuff::Activate()
if (rnd < std::get<1>(items[0])){ if (rnd < std::get<1>(items[0])){
const mt::Buff* buff_meta = mt::Buff::GetById(std::get<0>(items[0])); const mt::Buff* buff_meta = mt::Buff::GetById(std::get<0>(items[0]));
if (buff_meta) { if (buff_meta) {
owner->AddBuff(caster_.Get(), buff_meta, nullptr); owner->AddBuff(caster_.Get(), buff_meta, skill_meta);
} }
} }
} else { } else {
@ -36,7 +36,7 @@ void BatchAddBuff::Activate()
if (rnd <= std::get<1>(item)) { if (rnd <= std::get<1>(item)) {
const mt::Buff* buff_meta = mt::Buff::GetById(std::get<0>(item)); const mt::Buff* buff_meta = mt::Buff::GetById(std::get<0>(item));
if (buff_meta) { if (buff_meta) {
owner->AddBuff(caster_.Get(), buff_meta, nullptr); owner->AddBuff(caster_.Get(), buff_meta, skill_meta);
} }
break; break;
} }

View File

@ -30,7 +30,7 @@ public:
}); });
RegisterCProc RegisterCProc
( (
"myself.get_hero_atk", "!myself.get_hero_atk",
[this] (const a8::lisp::List& params) -> std::shared_ptr<a8::lisp::Value> [this] (const a8::lisp::List& params) -> std::shared_ptr<a8::lisp::Value>
{ {
double result = context_.buff->owner->GetBattleContext()->GetHeroTotalAtk(); double result = context_.buff->owner->GetBattleContext()->GetHeroTotalAtk();
@ -38,7 +38,7 @@ public:
}); });
RegisterCProc RegisterCProc
( (
"caster.get_hero_atk", "!caster.get_hero_atk",
[this] (const a8::lisp::List& params) -> std::shared_ptr<a8::lisp::Value> [this] (const a8::lisp::List& params) -> std::shared_ptr<a8::lisp::Value>
{ {
double result = 0.0f; double result = 0.0f;
@ -78,6 +78,7 @@ public:
abort(); abort();
} }
Transform(nullptr, expr); Transform(nullptr, expr);
a8::XPrintf("script:%s ast:%s\n", {script, expr->ToXObject().ToJsonStr()});
return expr; return expr;
} }
@ -89,10 +90,13 @@ public:
auto&& symbol = std::any_cast<a8::lisp::Symbol>(node->value); auto&& symbol = std::any_cast<a8::lisp::Symbol>(node->value);
int idx = mt::SkillNumber::GetAttrIdxByName(symbol.name); int idx = mt::SkillNumber::GetAttrIdxByName(symbol.name);
if (idx < 0) { if (idx < 0) {
auto cproc = Find(symbol.name); auto cproc = Find("!" + symbol.name);
if (!cproc) { if (!cproc) {
abort(); abort();
} }
if (!cproc->IsType(a8::lisp::ValueType::kCProc)) {
abort();
}
func_call_exprs->push_back(cproc); func_call_exprs->push_back(cproc);
} else { } else {
{ {