1
This commit is contained in:
parent
bbbffd3c3b
commit
a8b9b8284e
@ -33,6 +33,40 @@ struct AttrAddition : public std::enable_shared_from_this<AttrAddition>
|
||||
|
||||
};
|
||||
|
||||
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,8 +252,12 @@ void Ability::RecalcAttrAddition(int attr_id)
|
||||
AttrAddition* e = list_entry(pos,
|
||||
AttrAddition,
|
||||
entry);
|
||||
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;
|
||||
} else if (IsValidHumanVirtualAttr(attr_id)) {
|
||||
@ -244,36 +282,16 @@ 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;
|
||||
if (IsMulCalc(attr_id)) {
|
||||
new_val *= 1 + e->value;
|
||||
} else {
|
||||
new_val = 1.0f - e->value;
|
||||
inited = true;
|
||||
}
|
||||
}
|
||||
break;
|
||||
default:
|
||||
{
|
||||
new_val += e->value;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (IsValidHumanAttr(attr_id)) {
|
||||
std::get<0>(attr_dec_[attr_id]) = new_val;
|
||||
|
Loading…
x
Reference in New Issue
Block a user