This commit is contained in:
aozhiwei 2023-03-11 14:57:16 +08:00
parent 6b4d8ebc79
commit d1ac2f3f54
3 changed files with 28 additions and 2 deletions

View File

@ -76,12 +76,21 @@ void CallFuncBuff::Activate()
} }
break; break;
case BuffCallFunc_e::kAddEnergyShield: case BuffCallFunc_e::kAddEnergyShield:
default:
{ {
hold_param2_ = meta->GetBuffParam2(this); hold_param2_ = meta->GetBuffParam2(this);
ProcAddEnergyShield(); ProcAddEnergyShield();
} }
break; break;
case BuffCallFunc_e::kAddHp:
{
hold_param2_ = meta->GetBuffParam2(this);
ProcAddHp();
}
break;
default:
{
}
break;
} }
} }
@ -252,3 +261,10 @@ void CallFuncBuff::ProcAddEnergyShield()
{ {
owner->AddEnergyShield(hold_param2_); owner->AddEnergyShield(hold_param2_);
} }
void CallFuncBuff::ProcAddHp()
{
if (!owner->dead) {
owner->AddHp(hold_param2_);
}
}

View File

@ -12,7 +12,8 @@ A8_DECLARE_CLASS_ENUM(BuffCallFunc_e, int,
kRemoveBuff = 7, kRemoveBuff = 7,
kFlashMove = 8, kFlashMove = 8,
kSetSpeed = 9, kSetSpeed = 9,
kAddEnergyShield = 10 kAddEnergyShield = 10,
kAddHp = 11
); );
@ -30,6 +31,7 @@ class CallFuncBuff : public Buff
void ProcRemoveBuff(); void ProcRemoveBuff();
void ProcFlashMove(); void ProcFlashMove();
void ProcAddEnergyShield(); void ProcAddEnergyShield();
void ProcAddHp();
float hold_param2_ = 0.0; float hold_param2_ = 0.0;
}; };

View File

@ -37,6 +37,14 @@ public:
double result = context_.buff->owner->GetBattleContext()->GetHeroTotalAtk(); double result = context_.buff->owner->GetBattleContext()->GetHeroTotalAtk();
return std::make_shared<a8::lisp::Value>(a8::lisp::Atom(result)); return std::make_shared<a8::lisp::Value>(a8::lisp::Atom(result));
}); });
RegisterCProc
(
"myself.get_max_hp",
[this] (const a8::lisp::List& params) -> std::shared_ptr<a8::lisp::Value>
{
double result = context_.buff->owner->GetMaxHP();
return std::make_shared<a8::lisp::Value>(a8::lisp::Atom(result));
});
RegisterCProc RegisterCProc
( (
"caster.get_hero_atk", "caster.get_hero_atk",