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();
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)) {

View File

@ -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});