From 857f3ef7730d99633c1474895c4a5f0a998696a4 Mon Sep 17 00:00:00 2001 From: aozhiwei Date: Thu, 5 Sep 2024 17:42:23 +0800 Subject: [PATCH] 1 --- server/gameserver/ability.cc | 34 +++++++++++++++++++--------------- server/gameserver/creature.cc | 2 +- 2 files changed, 20 insertions(+), 16 deletions(-) diff --git a/server/gameserver/ability.cc b/server/gameserver/ability.cc index c460fd0c..f8586956 100644 --- a/server/gameserver/ability.cc +++ b/server/gameserver/ability.cc @@ -91,7 +91,7 @@ static float CalcSpeedRateIn(list_head* head) } } s_speed_ratein_list.clear(); - return result; + return result - 1.0f; } static bool IsMulCalc(int attr_id) @@ -352,22 +352,26 @@ void Ability::RecalcAttrRuduce(int attr_id) } else { return; } - list_head* pos = nullptr; - list_head* next = nullptr; float new_val = 0.0f; - bool inited = false; - list_for_each_safe(pos, next, head) { - AttrAddition* e = list_entry(pos, - AttrAddition, - entry); - if (IsMulCalc(attr_id)) { - if (!inited) { - new_val = 1; - inited = true; + 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, + entry); + if (IsMulCalc(attr_id)) { + if (!inited) { + new_val = 1; + inited = true; + } + new_val *= 1 + e->value; + } else { + new_val += e->value; } - new_val *= 1 + e->value; - } else { - new_val += e->value; } } if (IsValidHumanAttr(attr_id)) { diff --git a/server/gameserver/creature.cc b/server/gameserver/creature.cc index 87f22062..f20f6a2e 100644 --- a/server/gameserver/creature.cc +++ b/server/gameserver/creature.cc @@ -3498,7 +3498,7 @@ float Creature::InternalGetSpeed() ruduce = std::max(ruduce, GetAbility()->GetAttrRuduce(kHAT_vSpeedRateIn)); #endif float rate = addition + ruduce; - finaly_speed *= 1.0f + std::min(mt::Param::s().speed_rate_max, rate / mt::Param::s().speed_rf); + finaly_speed *= 1.0f + rate; #ifdef MYDEBUG if (IsPlayer() && finaly_speed > 500) { a8::XPrintf("player speed:%f\n", {finaly_speed});