diff --git a/server/gameserver/ability.cc b/server/gameserver/ability.cc index 0cf816c2..316af149 100644 --- a/server/gameserver/ability.cc +++ b/server/gameserver/ability.cc @@ -33,6 +33,40 @@ struct AttrAddition : public std::enable_shared_from_this }; +static bool IsMulCalc(int attr_id) +{ + switch (attr_id) { + case kNHAT_pHealthRateIn: + case kNHAT_vHealthRateIn: + case kNHAT_pAttackRateIn: + case kNHAT_vAttackRateIn: + case kNHAT_pDefendRateIn: + case kNHAT_pBlockRateIn: + case kNHAT_pCritRateIn: + case kNHAT_vSpeedRateIn: + case kNHAT_vHaste: + case kNHAT_vDrain: + case kNHAT_vTenacity: + case kNHAT_vDamageTakenRateIn: + case kNHAT_vDamageDealtRateIn: + case kNHAT_vNormalDamageTakenRateIn: + case kNHAT_vNormalDamageDealtRateIn: + case kNHAT_vSkillDamageTakenRateIn: + case kNHAT_vSkillDamageDealtRateIn: + case kNHAT_vHealthGainRateIn: + case kNHAT_vHealDealtRateIn: + { + return true; + } + break; + default: + { + return false; + } + break; + } +} + Ability::Ability(CreatureWeakPtr owner) { for (auto& tuple : attr_add_) { @@ -218,7 +252,11 @@ void Ability::RecalcAttrAddition(int attr_id) AttrAddition* e = list_entry(pos, AttrAddition, entry); - new_val += e->value; + if (IsMulCalc(attr_id)) { + new_val *= 1 + e->value; + } else { + new_val += e->value; + } } if (IsValidHumanAttr(attr_id)) { std::get<0>(attr_add_[attr_id]) = new_val; @@ -244,35 +282,15 @@ void Ability::RecalcAttrRuduce(int attr_id) } list_head* pos = nullptr; list_head* next = nullptr; - bool inited = false; float new_val = 0.0f; list_for_each_safe(pos, next, head) { AttrAddition* e = list_entry(pos, AttrAddition, entry); - switch (attr_id) { - /* - case kHAT_Speed: - { - new_val = std::max(new_val, e->value); - } - break; - */ - case kHVAT_Dmg: - { - if (inited) { - new_val *= 1.0f - e->value; - } else { - new_val = 1.0f - e->value; - inited = true; - } - } - break; - default: - { - new_val += e->value; - } - break; + if (IsMulCalc(attr_id)) { + new_val *= 1 + e->value; + } else { + new_val += e->value; } } if (IsValidHumanAttr(attr_id)) {