diff --git a/server/gameserver/buff/callfunc.cc b/server/gameserver/buff/callfunc.cc index 1979d9cb..a07da7eb 100644 --- a/server/gameserver/buff/callfunc.cc +++ b/server/gameserver/buff/callfunc.cc @@ -10,6 +10,8 @@ #include "mapinstance.h" #include "trigger.h" #include "human.h" +#include "team.h" +#include "collision.h" #include "mt/Buff.h" #include "mt/Skill.h" @@ -353,13 +355,12 @@ void CallFuncBuff::ProcLightCircle() context->in_human_infos.erase(itr); }; auto check_cb = - [this, on_enter, on_stay, on_leave] + [this, context, on_enter, on_stay, on_leave] () { -#if 0 + const mt::Skill* curr_skill_meta = context->active_skill_meta ? context->active_skill_meta : skill_meta; if (!owner->dead) { - float range = meta->_number_meta->_float_range2; - float resume_hp = meta->_number_meta->resume(); + float range = curr_skill_meta->_number_meta->_float_range2; int size = 0; std::array hit_humans; owner->GetTeam()->TraverseMembers @@ -376,40 +377,42 @@ void CallFuncBuff::ProcLightCircle() return true; }); std::vector leave_humans; - for (Human* hum : in_range_humans) { + for (auto& pair : context->in_human_infos) { bool found = false; for (int i = 0; i < size; ++i){ - if (hit_humans[i] == hum) { + if (hit_humans[i] == pair.second.c.Get()) { found = true; break; } } if (!found) { - on_leave(hum, active_skill_meta); - leave_humans.push_back(hum); + on_leave(pair.second.c.Get()->AsHuman()); + leave_humans.push_back(pair.second.c.Get()->AsHuman()); } } for (Human* hum : leave_humans) { - in_range_humans.erase(hum); + context->in_human_infos.erase(hum->GetUniId()); } for (int i = 0; i < size; ++i){ - if (in_range_humans.find(hit_humans[i]) == in_range_humans.end()) { - on_enter(hit_humans[i], active_skill_meta); - on_stay(hit_humans[i], active_skill_meta); - in_range_humans.insert(hit_humans[i]); + if (context->in_human_infos.find(hit_humans[i]->GetUniId()) == + context->in_human_infos.end()) { + on_enter(hit_humans[i]); + on_stay(hit_humans[i]); + #if 0 + context->in_human_infos.insert(hit_humans[i]-); + #endif } else { - on_stay(hit_humans[i], active_skill_meta); + on_stay(hit_humans[i]); } } } else { - if (!in_range_humans.empty()) { - for (Human* hum : in_range_humans) { - on_leave(hum, active_skill_meta); + if (!context->in_human_infos.empty()) { + for (auto& pair : context->in_human_infos) { + on_leave(pair.second.c.Get()->AsHuman()); } - in_range_humans.clear(); + context->in_human_infos.clear(); } } -#endif }; context->passive_skill_timer = owner->room->xtimer.SetIntervalWpEx (