This commit is contained in:
aozhiwei 2024-09-05 17:42:23 +08:00
parent 6fc087a1fd
commit 857f3ef773
2 changed files with 20 additions and 16 deletions

View File

@ -91,7 +91,7 @@ static float CalcSpeedRateIn(list_head* head)
} }
} }
s_speed_ratein_list.clear(); s_speed_ratein_list.clear();
return result; return result - 1.0f;
} }
static bool IsMulCalc(int attr_id) static bool IsMulCalc(int attr_id)
@ -352,22 +352,26 @@ void Ability::RecalcAttrRuduce(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) {
list_for_each_safe(pos, next, head) { new_val = CalcSpeedRateIn(head);
AttrAddition* e = list_entry(pos, } else {
AttrAddition, list_head* pos = nullptr;
entry); list_head* next = nullptr;
if (IsMulCalc(attr_id)) { bool inited = false;
if (!inited) { list_for_each_safe(pos, next, head) {
new_val = 1; AttrAddition* e = list_entry(pos,
inited = true; 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)) { if (IsValidHumanAttr(attr_id)) {

View File

@ -3498,7 +3498,7 @@ float Creature::InternalGetSpeed()
ruduce = std::max(ruduce, GetAbility()->GetAttrRuduce(kHAT_vSpeedRateIn)); ruduce = std::max(ruduce, GetAbility()->GetAttrRuduce(kHAT_vSpeedRateIn));
#endif #endif
float rate = addition + ruduce; 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 #ifdef MYDEBUG
if (IsPlayer() && finaly_speed > 500) { if (IsPlayer() && finaly_speed > 500) {
a8::XPrintf("player speed:%f\n", {finaly_speed}); a8::XPrintf("player speed:%f\n", {finaly_speed});