This commit is contained in:
aozhiwei 2023-03-14 19:16:56 +08:00
parent b5a83afaeb
commit f38f703210

View File

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