This commit is contained in:
aozhiwei 2024-05-10 19:35:54 +08:00
parent e1b944a54d
commit 38864c9bf4

View File

@ -93,10 +93,11 @@ void Buff::InternalTimerAddBuff()
auto caster_state = std::make_shared<SkillCasterState>();
caster_.Get()->FillSkillCasterState(caster_state.get());
auto add_buff_id = std::make_shared<int>(0);
const mt::Skill* skill = skill_meta;
auto timer_func =
[this, caster_state, skill] (int event, const a8::Args* args)
[this, caster_state, skill, add_buff_id] (int event, const a8::Args* args)
{
if (a8::TIMER_EXEC_EVENT == event) {
if (!caster_state->caster.Get()) {
@ -112,8 +113,8 @@ void Buff::InternalTimerAddBuff()
receiver->context_pos = receiver->GetPos();
#endif
int buff_id = meta->_int_buff_param2;
const mt::Buff* buff_meta = mt::Buff::GetById(buff_id);
//int buff_id = meta->_int_buff_param2;
const mt::Buff* buff_meta = mt::Buff::GetById(*add_buff_id);
if (buff_meta) {
SkillCasterState old_caster_state;
caster.Get()->FillSkillCasterState(&old_caster_state);
@ -135,6 +136,7 @@ void Buff::InternalTimerAddBuff()
switch (meta->buff_effect() ) {
case kBET_DelayAddBuff:
{
*add_buff_id = meta->_int_buff_param2;
owner->room->xtimer.SetTimeoutEx
(
param1 * SERVER_FRAME_RATE,
@ -145,6 +147,7 @@ void Buff::InternalTimerAddBuff()
break;
case kBET_IntervalAddBuff:
{
*add_buff_id = meta->_int_buff_param2;
owner->room->xtimer.SetIntervalEx
(
param1 * SERVER_FRAME_RATE,
@ -155,10 +158,11 @@ void Buff::InternalTimerAddBuff()
break;
case kBET_PhaseAddBuff:
{
*add_buff_id = meta->_int_buff_param1;
meta->TraverseParams
(
[this, timer_func] (int idx, const std::string& val) -> bool {
if (!val.empty()) {
if (!val.empty() && idx > 0) {
float param = meta->GetBuffParam(this, idx);
owner->room->xtimer.SetTimeoutEx
(