This commit is contained in:
aozhiwei 2023-02-28 11:10:01 +08:00
parent 778a894a66
commit 0ae31ebc0d
2 changed files with 31 additions and 14 deletions

View File

@ -612,24 +612,39 @@ void Skill::Proc30601DJS()
{ {
a8::XTimerWp passive_skill_timer; a8::XTimerWp passive_skill_timer;
{ {
auto context = A8_MAKE_ANON_STRUCT_SHARED( struct InnerObject
int a = 0; {
); CreatureWeakPtr c;
auto in_human_infos = std::make_shared<std::map<Human*, std::tuple<int, std::vector<int>>>>();
auto on_enter = void OnEnter()
[this, in_human_infos] (Human* hum, const mt::Skill* active_skill_meta)
{ {
if (in_human_infos->find(hum) != in_human_infos->end()) {
}
void OnLeave()
{
}
};
auto context = A8_MAKE_ANON_STRUCT_SHARED
(
std::map<int, InnerObject> in_human_infos;
);
auto on_enter =
[this, context] (Human* hum, const mt::Skill* active_skill_meta)
{
if (context->in_human_infos.find(hum->GetUniId()) != context->in_human_infos.end()) {
abort(); abort();
} }
if (active_skill_meta) { if (active_skill_meta) {
hum->GetAbility()->AddSpeedRuduce(active_skill_meta->_number_meta->_float_speed); hum->GetAbility()->AddSpeedRuduce(active_skill_meta->_number_meta->_float_speed);
} }
std::vector<int> buff_list; context->in_human_infos[hum->GetUniId()] = InnerObject();
(*in_human_infos)[hum] = std::make_tuple(1, buff_list); context->in_human_infos[hum->GetUniId()].OnEnter();
}; };
auto on_stay = auto on_stay =
[this] (Human* hum, const mt::Skill* active_skill_meta) [this, context] (Human* hum, const mt::Skill* active_skill_meta)
{ {
if (hum->GetHP() < hum->GetMaxHP()) { if (hum->GetHP() < hum->GetMaxHP()) {
if (active_skill_meta) { if (active_skill_meta) {
@ -641,15 +656,17 @@ void Skill::Proc30601DJS()
} }
}; };
auto on_leave = auto on_leave =
[this, in_human_infos] (Human* hum, const mt::Skill* active_skill_meta) [this, context] (Human* hum, const mt::Skill* active_skill_meta)
{ {
if (in_human_infos->find(hum) == in_human_infos->end()) { auto itr = context->in_human_infos.find(hum->GetUniId());
if (itr == context->in_human_infos.end()) {
abort(); abort();
} }
if (active_skill_meta) { if (active_skill_meta) {
hum->GetAbility()->DelSpeedRuduce(active_skill_meta->_number_meta->_float_speed); hum->GetAbility()->DelSpeedRuduce(active_skill_meta->_number_meta->_float_speed);
} }
in_human_infos->erase(hum); itr->second.OnLeave();
context->in_human_infos.erase(itr);
}; };
auto check_cb = auto check_cb =
[this, on_enter, on_stay, on_leave] [this, on_enter, on_stay, on_leave]

2
third_party/a8 vendored

@ -1 +1 @@
Subproject commit e7505277a1c15c785d6194dfee51e1dd2e6b84ec Subproject commit ee8724d50b4487d8684b9ad47942c5e622ce93b8