This commit is contained in:
aozhiwei 2023-02-24 12:01:02 +08:00
parent cb32437987
commit e0f9efedd1

View File

@ -17,7 +17,7 @@ struct GraspBuff
std::function<void()> on_remove; std::function<void()> on_remove;
a8::Attacher xtimer_attacher; a8::Attacher xtimer_attacher;
void ProcSignet(GunGrasp* gun_grasp, int count) void ProcSignet(GunGrasp* gun_grasp, int count, Creature* enemy)
{ {
const mt::GraspBuff* buff1_meta = std::get<0>(buffs); const mt::GraspBuff* buff1_meta = std::get<0>(buffs);
const mt::GraspBuff* buff2_meta = std::get<1>(buffs); const mt::GraspBuff* buff2_meta = std::get<1>(buffs);
@ -36,15 +36,16 @@ struct GraspBuff
&xtimer_attacher); &xtimer_attacher);
} }
} }
} else {
} }
} }
void Active(GunGrasp* gun_grasp) void Active(GunGrasp* gun_grasp, Creature* enemy)
{ {
std::array<const mt::GraspBuff*, 2> grasp_triggers_ = {std::get<0>(buffs), std::get<1>(buffs)}; std::array<const mt::GraspBuff*, 2> grasp_triggers_ = {std::get<0>(buffs), std::get<1>(buffs)};
for (auto& buff : grasp_triggers_) { for (auto& buff : grasp_triggers_) {
if (buff) { if (buff) {
int buff_time = buff->GetBuffTime(gun_grasp->GetHeroLv());
int attr_num = buff->GetAttrNum(gun_grasp->GetHeroLv());
if (buff->attr_id()) { if (buff->attr_id()) {
switch (buff->attr_add_pattern()) { switch (buff->attr_add_pattern()) {
case 1: case 1:
@ -162,8 +163,9 @@ void GunGrasp::ProcHit(GraspBuff* buff)
kBulletHitEvent, kBulletHitEvent,
[this, buff] (const a8::Args& args) [this, buff] (const a8::Args& args)
{ {
buff->ProcSignet(this, 1); Creature* target = args.Get<Creature*>(0);
buff->Active(this); buff->ProcSignet(this, 1, target);
buff->Active(this, target);
}) })
); );
} }
@ -177,16 +179,17 @@ void GunGrasp::ProcKill(GraspBuff* buff)
kKillEvent, kKillEvent,
[this, buff] (const a8::Args& args) [this, buff] (const a8::Args& args)
{ {
buff->ProcSignet(this, 1); Creature* target = args.Get<Creature*>(1);
buff->Active(this); buff->ProcSignet(this, 1, target);
buff->Active(this, target);
}) })
); );
} }
void GunGrasp::ProcTakeOn(GraspBuff* buff) void GunGrasp::ProcTakeOn(GraspBuff* buff)
{ {
buff->ProcSignet(this, 1); buff->ProcSignet(this, 1, nullptr);
buff->Active(this); buff->Active(this, nullptr);
} }
void GunGrasp::ProcCond(GraspBuff* buff) void GunGrasp::ProcCond(GraspBuff* buff)
@ -203,8 +206,9 @@ void GunGrasp::ProcHitAndEnd(GraspBuff* buff)
kBulletHitEvent, kBulletHitEvent,
[this, buff] (const a8::Args& args) [this, buff] (const a8::Args& args)
{ {
buff->ProcSignet(this, 1); Creature* target = args.Get<Creature*>(1);
buff->Active(this); buff->ProcSignet(this, 1, target);
buff->Active(this, target);
}) })
); );
} }