diff --git a/server/gameserver/human.cc b/server/gameserver/human.cc index 6801b61..97b0348 100644 --- a/server/gameserver/human.cc +++ b/server/gameserver/human.cc @@ -1575,32 +1575,65 @@ void Human::SelectSkillTargets(const a8::Vec2& target_pos, std::set& 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& 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; }