1
This commit is contained in:
commit
76f55d1748
@ -187,6 +187,9 @@ void CallFuncBuff::Activate()
|
|||||||
|
|
||||||
void CallFuncBuff::Deactivate()
|
void CallFuncBuff::Deactivate()
|
||||||
{
|
{
|
||||||
|
if (deactivate_cb_) {
|
||||||
|
deactivate_cb_();
|
||||||
|
}
|
||||||
switch ((BuffCallFunc_e)meta->_int_buff_param1) {
|
switch ((BuffCallFunc_e)meta->_int_buff_param1) {
|
||||||
case BuffCallFunc_e::kAddMinorMode:
|
case BuffCallFunc_e::kAddMinorMode:
|
||||||
{
|
{
|
||||||
@ -1044,10 +1047,11 @@ void CallFuncBuff::RangeHoldBuff()
|
|||||||
std::set<Creature*> hit_humans;
|
std::set<Creature*> hit_humans;
|
||||||
owner->room->TraverseAliveHumanList
|
owner->room->TraverseAliveHumanList
|
||||||
(
|
(
|
||||||
[this, range] (Human* hum)
|
[this, range, &hit_humans] (Human* hum) mutable
|
||||||
{
|
{
|
||||||
if (Collision::CheckCC(owner, owner->GetRadius(),
|
if (Collision::CheckCC(owner, owner->GetRadius(),
|
||||||
hum, range)) {
|
hum, range)) {
|
||||||
|
hit_humans.insert(hum);
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
});
|
});
|
||||||
@ -1082,11 +1086,8 @@ void CallFuncBuff::RangeHoldBuff()
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
&owner->xtimer_attacher);
|
&owner->xtimer_attacher);
|
||||||
{
|
auto clear_func =
|
||||||
event_handlers_.push_back(owner->GetTrigger()->AddListener
|
[this, context, check_timer] () mutable
|
||||||
(
|
|
||||||
kDieEvent,
|
|
||||||
[this, context, check_timer] (const a8::Args& args) mutable
|
|
||||||
{
|
{
|
||||||
owner->room->xtimer.Delete(check_timer);
|
owner->room->xtimer.Delete(check_timer);
|
||||||
for (auto& pair : context->in_human_infos) {
|
for (auto& pair : context->in_human_infos) {
|
||||||
@ -1097,7 +1098,20 @@ void CallFuncBuff::RangeHoldBuff()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
context->in_human_infos.clear();
|
context->in_human_infos.clear();
|
||||||
|
};
|
||||||
|
{
|
||||||
|
event_handlers_.push_back(owner->GetTrigger()->AddListener
|
||||||
|
(
|
||||||
|
kDieEvent,
|
||||||
|
[this, clear_func] (const a8::Args& args) mutable
|
||||||
|
{
|
||||||
|
clear_func();
|
||||||
}
|
}
|
||||||
));
|
));
|
||||||
|
deactivate_cb_ =
|
||||||
|
[this, clear_func] () mutable
|
||||||
|
{
|
||||||
|
clear_func();
|
||||||
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -66,4 +66,5 @@ class CallFuncBuff : public Buff
|
|||||||
|
|
||||||
float hold_param2_ = 0.0;
|
float hold_param2_ = 0.0;
|
||||||
Weapon* hold_weapon_ = nullptr;
|
Weapon* hold_weapon_ = nullptr;
|
||||||
|
std::function<void()> deactivate_cb_ = nullptr;
|
||||||
};
|
};
|
||||||
|
Loading…
x
Reference in New Issue
Block a user