This commit is contained in:
aozhiwei 2020-06-05 10:15:24 +08:00
parent 223b7fccce
commit 1ad7610ce7

View File

@ -262,23 +262,22 @@ void AndroidAI::UpdateNewBieRoomLogic()
}
});
} else {
std::vector<Human*> alive_humans;
hum->room->TouchHumanList
(
a8::XParams(),
[hum, &alive_humans] (Human* huma, a8::XParams& param)
[hum, &target] (Human* huma, a8::XParams& param)
{
if (!huma->dead &&
huma->IsAndroid() &&
hum->team_id != huma->team_id &&
!a8::HasBitFlag(huma->status, HS_Disable)) {
alive_humans.push_back(huma);
if (hum->GetPos().ManhattanDistance(huma->GetPos()) <
hum->GetPos().ManhattanDistance(target->GetPos())) {
target = huma;
}
}
return true;
});
if (!alive_humans.empty()) {
target = alive_humans[rand() % alive_humans.size()];
}
}
last_target_ = target;
}