From 24b3fc65ff35ffec2b2a40e44a1ec0b2a3bc25cf Mon Sep 17 00:00:00 2001 From: aozhiwei Date: Tue, 14 Feb 2023 15:55:27 +0800 Subject: [PATCH] 1 --- server/gameserver/skill.cc | 68 +++++++++----------------------------- third_party/a8 | 2 +- 2 files changed, 17 insertions(+), 53 deletions(-) diff --git a/server/gameserver/skill.cc b/server/gameserver/skill.cc index 7a635517..a6f8f41d 100644 --- a/server/gameserver/skill.cc +++ b/server/gameserver/skill.cc @@ -309,63 +309,27 @@ void Skill::InitPassiveSkill() void Skill::Proc30101XL() { - int shot_times = 0; - std::map hited_objs; - owner->GetTrigger()->AddListener + a8::XTimerWp recover_timer = owner->room->xtimer.SetIntervalWpEx ( - kBulletHitEvent, - [this, shot_times, hited_objs] (const a8::Args& args) mutable + GetCd() / FRAME_RATE_MS, + [this] (int event, const a8::Args* args) { - ++shot_times; - IBullet* bullet = args.Get(0); - Creature* target = args.Get(1); - int rnd = rand(); - bool is_hit = false; - bool is_immune = false; - if (shot_times % meta->_number_meta->_int_ratio == 0) { - if ((rnd % 100) < meta->_number_meta->_float_probability * 100) { - const mt::Buff* buff_meta = mt::Buff::GetById(kVertigoEffectBuffId); - if (buff_meta && target->GetAbility()->CanImmune(buff_meta->_tags)) { - is_immune = true; - } else { - auto itr = hited_objs.find(target->GetUniId()); - if (itr == hited_objs.end()) { - hited_objs[target->GetUniId()] = owner->room->GetFrameNo(); - is_hit = true; - } else { - if ((owner->room->GetFrameNo() - itr->second) >= - meta->_number_meta->_float_cd * SERVER_FRAME_RATE) { - itr->second = owner->room->GetFrameNo(); - is_hit = true; - } - }//endif itr - if (is_hit) { - target->TryAddBuffAndSetTime(owner, - kVertigoEffectBuffId, - meta->_number_meta->_float_time * 1000); - } - } + if (a8::TIMER_EXEC_EVENT == event) { + if (!owner->dead) { + } } -#ifdef DEBUG - { - std::string dbg_msg = a8::Format - ( - "skill_id:%d 射击 shot_times:%d ratio:%d rand:%d probability:%f time:%f 是否眩晕:%d 是否被免疫:%d", - { - meta->skill_id(), - shot_times, - meta->_number_meta->_int_ratio, - rnd % 100, - meta->_number_meta->_float_probability, - meta->_number_meta->_float_time, - is_hit ? 1 : 0, - is_immune ? 1 : 0 - }); - owner->SendDebugMsg(dbg_msg); - a8::XPrintf("%s\n", {dbg_msg}); + }, + &xtimer_attacher); + + owner->GetTrigger()->AddListener + ( + kReceiveDmgEvent, + [this, recover_timer] (const a8::Args& args) mutable + { + if (!recover_timer.expired()) { + owner->room->xtimer.ResetTimer(recover_timer); } -#endif } ); } diff --git a/third_party/a8 b/third_party/a8 index 58dd5bb8..0ea88842 160000 --- a/third_party/a8 +++ b/third_party/a8 @@ -1 +1 @@ -Subproject commit 58dd5bb850143cd6d0b55a99c1d7197e6153fea7 +Subproject commit 0ea88842f5acfefd6c5b966cd941f6b017945234