This commit is contained in:
aozhiwei 2022-10-28 14:59:57 +08:00
parent 745f5861bd
commit 090cea717b

View File

@ -875,14 +875,17 @@ void Bullet::ProcFlyHook(Entity* target)
buff_uniids.push_back(buff_uniid); buff_uniids.push_back(buff_uniid);
} }
} }
CreatureWeakPtr sender_bk = sender;
int ok_buff_id = gun_meta->int_param1; int ok_buff_id = gun_meta->int_param1;
c->AutoNavigation(born_pos, gun_meta->i->bullet_speed() * 2, c->AutoNavigation(born_pos, gun_meta->i->bullet_speed() * 2,
[buff_uniids, ok_buff_id] (Creature* c) [buff_uniids, ok_buff_id, sender_bk] (Creature* c) mutable
{ {
for (int buff_uniid : buff_uniids) { for (int buff_uniid : buff_uniids) {
c->RemoveBuffByUniId(buff_uniid); c->RemoveBuffByUniId(buff_uniid);
} }
int buff_uniid = c->TryAddBuff(c, ok_buff_id); if (sender_bk.Get()) {
int buff_uniid = sender_bk.Get()->TryAddBuff(sender_bk.Get(), ok_buff_id);
}
} }
); );
} else { } else {