diff --git a/server/gameserver/ability.cc b/server/gameserver/ability.cc index 01a5b05a..a3fffa99 100644 --- a/server/gameserver/ability.cc +++ b/server/gameserver/ability.cc @@ -503,7 +503,7 @@ AttrRateHandle Ability::AddAttrRate(int attr_id, float value) return AttrRateHandle(); } -void Ability::RemoveAttrRate(AttrAbsHandle handle) +void Ability::RemoveAttrRate(AttrRateHandle handle) { if (!handle.expired()) { auto p = handle.lock(); diff --git a/server/gameserver/ability.h b/server/gameserver/ability.h index 6bbbba43..aef6c0c5 100644 --- a/server/gameserver/ability.h +++ b/server/gameserver/ability.h @@ -66,7 +66,7 @@ class Ability AttrAbsHandle AddAttrAbs(int attr_id, float value); void RemoveAttrAbs(AttrAbsHandle handle); AttrRateHandle AddAttrRate(int attr_id, float value); - void RemoveAttrRate(AttrAbsHandle handle); + void RemoveAttrRate(AttrRateHandle handle); void RecalcAttrAbs(int attr_id); void RecalcAttrRate(int attr_id); float GetAttrAbs(int attr_id); diff --git a/server/gameserver/buff/modify_base_attr.cc b/server/gameserver/buff/modify_base_attr.cc index 9d6261af..c7aac590 100644 --- a/server/gameserver/buff/modify_base_attr.cc +++ b/server/gameserver/buff/modify_base_attr.cc @@ -10,9 +10,34 @@ void ModifyBaseAttrBuff::Activate() { + int attr_id = meta->_int_buff_param1; + if (IsValidHumanAttr(attr_id)) { + float value = meta->GetBuffParam2(this); + switch (meta->_int_buff_param4) { + case 1: + { + owner->GetAbility()->AddAttrAbs(attr_id, value); + } + break; + case 2: + { + owner->GetAbility()->AddAttrRate(attr_id, value); + } + break; + default: + { + } + break; + } + } } void ModifyBaseAttrBuff::Deactivate() { - + if (!abs_handle_.expired()) { + owner->GetAbility()->RemoveAttrAbs(abs_handle_); + } + if (!rate_handle_.expired()) { + owner->GetAbility()->RemoveAttrRate(rate_handle_); + } } diff --git a/server/gameserver/buff/modify_base_attr.h b/server/gameserver/buff/modify_base_attr.h index 58df96b3..5d74395a 100644 --- a/server/gameserver/buff/modify_base_attr.h +++ b/server/gameserver/buff/modify_base_attr.h @@ -11,6 +11,6 @@ class ModifyBaseAttrBuff : public Buff virtual void Deactivate() override; private: - AttrAdditionHandle add_handle_; - AttrRuduceHandle ruduce_handle_; + AttrAbsHandle abs_handle_; + AttrRateHandle rate_handle_; };