This commit is contained in:
aozhiwei 2024-09-05 16:36:54 +08:00
parent 8b81dc8c0d
commit 0c7047a18b

View File

@ -43,11 +43,33 @@ static std::array<std::vector<std::shared_ptr<AttrAddition>>, kAstEnd> s_speed_r
std::vector<std::shared_ptr<AttrAddition>>({}) std::vector<std::shared_ptr<AttrAddition>>({})
}; };
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) { for (auto& itr : s_speed_ratein_list) {
itr.clear(); itr.clear();
} }
return 0.0f;
} }
static bool IsMulCalc(int attr_id) static bool IsMulCalc(int attr_id)
@ -264,13 +286,13 @@ void Ability::RecalcAttrAddition(int attr_id)
} else { } else {
return; return;
} }
list_head* pos = nullptr;
list_head* next = nullptr;
float new_val = 0.0f; float new_val = 0.0f;
bool inited = false;
if (attr_id == kHAT_vSpeedRateIn) { if (attr_id == kHAT_vSpeedRateIn) {
new_val = CalcSpeedRateIn(head);
} else { } else {
list_head* pos = nullptr;
list_head* next = nullptr;
bool inited = false;
list_for_each_safe(pos, next, head) { list_for_each_safe(pos, next, head) {
AttrAddition* e = list_entry(pos, AttrAddition* e = list_entry(pos,
AttrAddition, AttrAddition,