1
This commit is contained in:
parent
aa4ff18785
commit
782022e6d6
@ -671,52 +671,52 @@ void Incubator::StartNewBattleMode()
|
||||
if (!selected_player) {
|
||||
return;
|
||||
}
|
||||
std::vector<Human*> invisable_humans;
|
||||
std::vector<Human*> invisable_teammates;
|
||||
auto invisable_humans = std::make_shared<std::vector<Human*>>();
|
||||
auto invisable_teammates = std::make_shared<std::vector<Human*>>();
|
||||
room->xtimer.SetIntervalWpEx
|
||||
(
|
||||
SERVER_FRAME_RATE * (3 + rand() % 2),
|
||||
[this, selected_player, &invisable_humans, &invisable_teammates] (int event, const a8::Args* args)
|
||||
[this, selected_player, invisable_humans, invisable_teammates] (int event, const a8::Args* args)
|
||||
{
|
||||
if (a8::TIMER_EXEC_EVENT == event) {
|
||||
if (room->IsGameOver()) {
|
||||
return;
|
||||
}
|
||||
invisable_humans.clear();
|
||||
invisable_teammates.clear();
|
||||
invisable_humans->clear();
|
||||
invisable_teammates->clear();
|
||||
room->TraverseAliveHumanList
|
||||
(
|
||||
[this, selected_player, &invisable_humans, &invisable_teammates] (Human* hum) -> bool
|
||||
[this, selected_player, invisable_humans, invisable_teammates] (Human* hum) -> bool
|
||||
{
|
||||
if (hum == selected_player) {
|
||||
return true;
|
||||
}
|
||||
if (!CanSee(hum, selected_player)) {
|
||||
if (hum->GetTeam() == selected_player->GetTeam()) {
|
||||
invisable_teammates.push_back(hum);
|
||||
invisable_teammates->push_back(hum);
|
||||
} else {
|
||||
invisable_humans.push_back(hum);
|
||||
invisable_humans->push_back(hum);
|
||||
}
|
||||
}
|
||||
return true;
|
||||
});
|
||||
if (invisable_humans.size() > 0) {
|
||||
std::shuffle(invisable_humans.begin(),
|
||||
invisable_humans.end(),
|
||||
if (invisable_humans->size() > 0) {
|
||||
std::shuffle(invisable_humans->begin(),
|
||||
invisable_humans->end(),
|
||||
std::default_random_engine(a8::XGetTickCount()));
|
||||
Human *killer = nullptr;
|
||||
Human *target = invisable_humans.at(0);
|
||||
for (size_t i = 0; i < invisable_humans.size(); ++i) {
|
||||
if (invisable_humans.at(i)->GetTeam() != target->GetTeam()) {
|
||||
killer = invisable_humans.at(i);
|
||||
Human *target = invisable_humans->at(0);
|
||||
for (size_t i = 0; i < invisable_humans->size(); ++i) {
|
||||
if (invisable_humans->at(i)->GetTeam() != target->GetTeam()) {
|
||||
killer = invisable_humans->at(i);
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (!killer && !invisable_teammates.empty()) {
|
||||
std::shuffle(invisable_teammates.begin(),
|
||||
invisable_teammates.end(),
|
||||
if (!killer && !invisable_teammates->empty()) {
|
||||
std::shuffle(invisable_teammates->begin(),
|
||||
invisable_teammates->end(),
|
||||
std::default_random_engine(a8::XGetTickCount()));
|
||||
killer = invisable_teammates.at(0);
|
||||
killer = invisable_teammates->at(0);
|
||||
}
|
||||
if (killer) {
|
||||
target->BeKill(killer->GetUniId(),
|
||||
|
Loading…
x
Reference in New Issue
Block a user