1
This commit is contained in:
parent
46cdd93d4a
commit
8ed1576d97
@ -1938,20 +1938,23 @@ void CallFuncBuff::BulletDmgCalcProc()
|
||||
int attr_id = meta->GetBuffParam3(this);
|
||||
float attr_val = meta->GetBuffParam4(this);
|
||||
float cond = meta->GetBuffParam5(this);
|
||||
AttrHandle attr_handle;
|
||||
auto context = A8_MAKE_ANON_STRUCT_SHARED
|
||||
(
|
||||
AttrHandle attr_handle;
|
||||
);
|
||||
auto clear_func =
|
||||
[this, target_type, &attr_handle] (Creature* c)
|
||||
[this, target_type, context] (Creature* c)
|
||||
{
|
||||
if (target_type == 0) {
|
||||
owner->GetAbility()->RemoveAttr(attr_handle);
|
||||
owner->GetAbility()->RemoveAttr(context->attr_handle);
|
||||
} else if (target_type == 1) {
|
||||
c->GetAbility()->RemoveAttr(attr_handle);
|
||||
c->GetAbility()->RemoveAttr(context->attr_handle);
|
||||
}
|
||||
};
|
||||
auto start_handle = owner->GetTrigger()->AddListener
|
||||
(
|
||||
kBulletDmgStartEvent,
|
||||
[this, &attr_handle, target_type, attr_id, attr_val, cond, clear_func]
|
||||
[this, context, target_type, attr_id, attr_val, cond, clear_func]
|
||||
(const a8::Args& args) mutable
|
||||
{
|
||||
Creature* target = args.Get<Creature*>(0);
|
||||
@ -1962,9 +1965,9 @@ void CallFuncBuff::BulletDmgCalcProc()
|
||||
bool match = target->GetHP() / target->GetMaxHP() < cond;
|
||||
if (match) {
|
||||
if (target_type == 0) {
|
||||
attr_handle = owner->GetAbility()->AddAttr(attr_id, attr_val);
|
||||
context->attr_handle = owner->GetAbility()->AddAttr(attr_id, attr_val);
|
||||
} else if (target_type == 1) {
|
||||
attr_handle = target->GetAbility()->AddAttr(attr_id, attr_val);
|
||||
context->attr_handle = target->GetAbility()->AddAttr(attr_id, attr_val);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user