完成技能目标选取

This commit is contained in:
aozhiwei 2019-07-10 19:08:05 +08:00
parent f07664bf2f
commit ad62d11326

View File

@ -1575,32 +1575,65 @@ void Human::SelectSkillTargets(const a8::Vec2& target_pos, std::set<Entity*>& ta
switch (skill_meta->i->skill_target()) {
case ST_All:
{
for (auto& cell : grid_list) {
for (Human* hum : cell->human_list) {
if (hum->pos.Distance(target_pos) < skill_meta->i->skill_distance()) {
target_list.insert(hum);
}
}
}
}
break;
case ST_Self:
{
target_list.insert(this);
}
break;
case ST_FriendlyIncludeSelf:
{
for (auto& cell : grid_list) {
for (Human* hum : cell->human_list) {
if ((hum == this || hum->team_id == team_id) ||
hum->pos.Distance(target_pos) < skill_meta->i->skill_distance()) {
target_list.insert(hum);
}
}
}
}
break;
case ST_FriendlyExcludeSelf:
{
for (auto& cell : grid_list) {
for (Human* hum : cell->human_list) {
if ((hum != this && hum->team_id == team_id) ||
hum->pos.Distance(target_pos) < skill_meta->i->skill_distance()) {
target_list.insert(hum);
}
}
}
}
break;
case ST_EnemySingle:
{
Entity* entity = room->GetEntityByUniId(skill_target_id);
if (entity && entity->entity_type == ET_Player) {
Human* hum = (Human*)entity;
if (hum->team_id != team_id) {
target_list.insert(hum);
}
}
}
break;
case ST_EnemyGroup:
{
for (auto& cell : grid_list) {
for (Human* hum : cell->human_list) {
if ((hum->team_id != team_id) ||
hum->pos.Distance(target_pos) < skill_meta->i->skill_distance()) {
target_list.insert(hum);
}
}
}
}
break;
case ST_EnemyAndObject:
@ -1610,7 +1643,14 @@ void Human::SelectSkillTargets(const a8::Vec2& target_pos, std::set<Entity*>& ta
break;
case ST_EnemyAndSelf:
{
for (auto& cell : grid_list) {
for (Human* hum : cell->human_list) {
if ((hum == this || hum->team_id != team_id) ||
hum->pos.Distance(target_pos) < skill_meta->i->skill_distance()) {
target_list.insert(hum);
}
}
}
}
break;
}