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