1
This commit is contained in:
parent
efe851c627
commit
e43ea18c02
@ -150,15 +150,19 @@ AttrHandle Ability::AddAttr(int attr_id, float val)
|
||||
if (p->IsAdd()) {
|
||||
if (IsValidHumanAttr(attr_id)) {
|
||||
list_add_tail(&p->entry, &std::get<1>(attr_add_[attr_id]));
|
||||
list_add_tail(&p->list_entry, &attr_list_[attr_id]);
|
||||
} else {
|
||||
list_add_tail(&p->entry, &std::get<1>(vattr_add_[attr_id - kHVAT_Begin]));
|
||||
list_add_tail(&p->list_entry, &vattr_list_[attr_id - kHVAT_Begin]);
|
||||
}
|
||||
RecalcAttrAddition(attr_id);
|
||||
} else {
|
||||
if (IsValidHumanAttr(attr_id)) {
|
||||
list_add_tail(&p->entry, &std::get<1>(attr_dec_[attr_id]));
|
||||
list_add_tail(&p->list_entry, &attr_list_[attr_id]);
|
||||
} else {
|
||||
list_add_tail(&p->entry, &std::get<1>(vattr_dec_[attr_id - kHVAT_Begin]));
|
||||
list_add_tail(&p->list_entry, &vattr_list_[attr_id - kHVAT_Begin]);
|
||||
}
|
||||
RecalcAttrRuduce(attr_id);
|
||||
}
|
||||
@ -172,6 +176,7 @@ void Ability::RemoveAttr(AttrHandle handle)
|
||||
if (!handle.expired()) {
|
||||
auto p = handle.lock();
|
||||
list_del_init(&p->entry);
|
||||
list_del_init(&p->list_entry);
|
||||
if (p->IsAdd()) {
|
||||
RecalcAttrAddition(p->attr_id);
|
||||
} else {
|
||||
@ -221,18 +226,18 @@ void Ability::RecalcAttrRuduce(int attr_id)
|
||||
list_head* next = nullptr;
|
||||
bool inited = false;
|
||||
float new_val = 0.0f;
|
||||
#ifdef NEW_NUM
|
||||
#else
|
||||
list_for_each_safe(pos, next, head) {
|
||||
AttrRuduce* e = list_entry(pos,
|
||||
AttrRuduce,
|
||||
entry);
|
||||
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) {
|
||||
@ -250,7 +255,6 @@ void Ability::RecalcAttrRuduce(int attr_id)
|
||||
break;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
if (IsValidHumanAttr(attr_id)) {
|
||||
std::get<0>(attr_dec_[attr_id]) = new_val;
|
||||
} else if (IsValidHumanVirtualAttr(attr_id)) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user