From 0c7047a18b9691b4ea8747df4d34c4c1d9556629 Mon Sep 17 00:00:00 2001 From: aozhiwei Date: Thu, 5 Sep 2024 16:36:54 +0800 Subject: [PATCH] 1 --- server/gameserver/ability.cc | 32 +++++++++++++++++++++++++++----- 1 file changed, 27 insertions(+), 5 deletions(-) diff --git a/server/gameserver/ability.cc b/server/gameserver/ability.cc index c016bfa2..be55ce24 100644 --- a/server/gameserver/ability.cc +++ b/server/gameserver/ability.cc @@ -43,11 +43,33 @@ static std::array>, kAstEnd> s_speed_r std::vector>({}) }; -static void ClearSpeedRateInList() +static float CalcSpeedRateIn(list_head* head) { + list_head* pos = nullptr; + list_head* next = nullptr; + list_for_each_safe(pos, next, head) { + AttrAddition* e = list_entry(pos, + AttrAddition, + entry); + switch (e->source_type) { + case kAstChip: + { + s_speed_ratein_list.at(e->source_type).push_back(e->holder); + } + break; + default: + { + if (e->source_type >= 0 && e->source_type <= s_speed_ratein_list.size()) { + s_speed_ratein_list.at(e->source_type).push_back(e->holder); + } + } + break; + } + } for (auto& itr : s_speed_ratein_list) { itr.clear(); } + return 0.0f; } static bool IsMulCalc(int attr_id) @@ -264,13 +286,13 @@ void Ability::RecalcAttrAddition(int attr_id) } else { return; } - list_head* pos = nullptr; - list_head* next = nullptr; float new_val = 0.0f; - bool inited = false; if (attr_id == kHAT_vSpeedRateIn) { - + new_val = CalcSpeedRateIn(head); } else { + list_head* pos = nullptr; + list_head* next = nullptr; + bool inited = false; list_for_each_safe(pos, next, head) { AttrAddition* e = list_entry(pos, AttrAddition,