完成技能目标选取

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()) { switch (skill_meta->i->skill_target()) {
case ST_All: 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; break;
case ST_Self: case ST_Self:
{ {
target_list.insert(this);
} }
break; break;
case ST_FriendlyIncludeSelf: 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; break;
case ST_FriendlyExcludeSelf: 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; break;
case ST_EnemySingle: 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; break;
case ST_EnemyGroup: 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; break;
case ST_EnemyAndObject: case ST_EnemyAndObject:
@ -1610,7 +1643,14 @@ void Human::SelectSkillTargets(const a8::Vec2& target_pos, std::set<Entity*>& ta
break; break;
case ST_EnemyAndSelf: 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; break;
} }