1
This commit is contained in:
parent
474ca03650
commit
44a3930eaa
@ -248,11 +248,16 @@ void Ability::RecalcAttrAddition(int attr_id)
|
||||
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;
|
||||
}
|
||||
new_val *= 1 + e->value;
|
||||
} else {
|
||||
new_val += e->value;
|
||||
@ -283,11 +288,16 @@ void Ability::RecalcAttrRuduce(int attr_id)
|
||||
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;
|
||||
}
|
||||
new_val *= 1 + e->value;
|
||||
} else {
|
||||
new_val += e->value;
|
||||
@ -470,13 +480,13 @@ float Ability::GetAttr(int attr_id)
|
||||
}
|
||||
if (IsMulCalc(attr_id)) {
|
||||
if (IsValidHumanAttr(attr_id)) {
|
||||
val = std::get<0>(attr_add_[attr_id]) *
|
||||
std::get<0>(attr_dec_[attr_id]);
|
||||
val = (HasAddAttr(attr_id) ? std::get<0>(attr_add_[attr_id]) : 1) *
|
||||
(HasDecAttr(attr_id) ? std::get<0>(attr_dec_[attr_id]) : 1);
|
||||
} else if (IsValidHumanVirtualAttr(attr_id)) {
|
||||
val = std::get<0>(vattr_add_[attr_id - kHVAT_Begin]) *
|
||||
std::get<0>(vattr_dec_[attr_id - kHVAT_Begin]);
|
||||
val = (HasAddAttr(attr_id) ? std::get<0>(vattr_add_[attr_id - kHVAT_Begin]) : 1) *
|
||||
(HasDecAttr(attr_id) ? std::get<0>(vattr_dec_[attr_id - kHVAT_Begin]) : 1);
|
||||
}
|
||||
val = 1.0f - val;
|
||||
val = val - 1.0f;
|
||||
} else {
|
||||
if (IsValidHumanAttr(attr_id)) {
|
||||
val = std::get<0>(attr_add_[attr_id]) +
|
||||
|
Loading…
x
Reference in New Issue
Block a user