This commit is contained in:
aozhiwei 2022-10-12 19:19:06 +08:00
parent 1ab1f274ee
commit 76945abb1b
2 changed files with 5 additions and 2 deletions

View File

@ -1008,7 +1008,7 @@ void Buff::ProcMachineGun()
{ {
owner->room->xtimer.ModifyTimer owner->room->xtimer.ModifyTimer
(remover_timer, (remover_timer,
skill_meta->number_meta->float_time * 1000 / FRAME_RATE_MS); skill_meta->number_meta->float_time * 1000 * 10/ FRAME_RATE_MS);
} }
break; break;
case MAGIC_HJHX: case MAGIC_HJHX:
@ -1016,6 +1016,7 @@ void Buff::ProcMachineGun()
owner->room->xtimer.ModifyTimer owner->room->xtimer.ModifyTimer
(remover_timer, (remover_timer,
skill_meta->number_meta->float_time * 1000 / FRAME_RATE_MS); skill_meta->number_meta->float_time * 1000 / FRAME_RATE_MS);
owner->GetTrigger()->DispatchEvent(kStartSwitchWeaponBuffEvent, {this});
} }
break; break;
case MAGIC_FG: case MAGIC_FG:
@ -1108,6 +1109,7 @@ void Buff::ProcMachineGun()
void Buff::ProcRemoveMachineGun() void Buff::ProcRemoveMachineGun()
{ {
owner->GetTrigger()->DispatchEvent(kEndSwitchWeaponBuffEvent, {this});
RecoverHoldWeapons(); RecoverHoldWeapons();
} }

View File

@ -74,6 +74,7 @@ public:
std::weak_ptr<EventHandlerPtr> AddListener(int event_id, CommonCbProc cb); std::weak_ptr<EventHandlerPtr> AddListener(int event_id, CommonCbProc cb);
void RemoveEventHandler(std::weak_ptr<EventHandlerPtr> handler_ptr); void RemoveEventHandler(std::weak_ptr<EventHandlerPtr> handler_ptr);
void DispatchEvent(int event_id, const std::vector<std::any>& params);
private: private:
void TraverseCondBuffs(int cond, std::function<void (Buff*, bool&)> func); void TraverseCondBuffs(int cond, std::function<void (Buff*, bool&)> func);
@ -81,7 +82,7 @@ public:
void TryAddBuffs(int cond, std::vector<int>& buffids); void TryAddBuffs(int cond, std::vector<int>& buffids);
void AddBuffs(int cond, std::vector<int>& buffids); void AddBuffs(int cond, std::vector<int>& buffids);
void RemoveBuffs(int cond, std::vector<int>& buffids); void RemoveBuffs(int cond, std::vector<int>& buffids);
void DispatchEvent(int event_id, const std::vector<std::any>& params);
private: private:
Creature* owner_ = nullptr; Creature* owner_ = nullptr;