1
This commit is contained in:
parent
6156cbd243
commit
949a89eb0e
@ -923,12 +923,21 @@ Human* Room::GetWatchWarTarget(Human* hum)
|
||||
return member;
|
||||
}
|
||||
}
|
||||
std::vector<Human*> players;
|
||||
std::vector<Human*> humans;
|
||||
for (auto& pair : human_hash_) {
|
||||
if (pair.first != hum->GetUniId() && !pair.second->dead) {
|
||||
humans.push_back(pair.second);
|
||||
if (pair.second->IsPlayer()) {
|
||||
players.push_back(pair.second);
|
||||
} else {
|
||||
humans.push_back(pair.second);
|
||||
}
|
||||
}
|
||||
}
|
||||
if (!players.empty()) {
|
||||
Human* target = players[rand() % players.size()];
|
||||
return target;
|
||||
}
|
||||
if (!humans.empty()) {
|
||||
Human* target = humans[rand() % humans.size()];
|
||||
return target;
|
||||
|
Loading…
x
Reference in New Issue
Block a user