1
This commit is contained in:
parent
35d3ae5343
commit
a4f826ec22
@ -206,6 +206,7 @@ void Incubator::RecycleAndroid(Human* hum)
|
||||
hum->RemoveBuffByEffectId(kBET_BeRecycle);
|
||||
hold_humans_.push_back(hum);
|
||||
room->DisableHuman(hum);
|
||||
Rearrangement();
|
||||
#ifdef DEBUG
|
||||
room->BroadcastDebugMsg(a8::Format("回收机器人 %d:%s:%d 添加到回收列表",
|
||||
{hum->GetUniId(),
|
||||
@ -516,14 +517,11 @@ void Incubator::ShowHand()
|
||||
room->EnableHuman(hum);
|
||||
hum->MustBeAddBuff(hum, kTraceBuffId);
|
||||
a8::SetBitFlag(hum->status, CS_CrazeMode);
|
||||
#if 0
|
||||
a8::SetBitFlag(hum->status, CS_DisableAttackAndroid);
|
||||
#endif
|
||||
}
|
||||
#if 0
|
||||
room->xtimer.SetIntervalEx
|
||||
(
|
||||
SERVER_FRAME_RATE,
|
||||
SERVER_FRAME_RATE * 40,
|
||||
[room = room] (int event, const a8::Args* args) mutable
|
||||
{
|
||||
if (a8::TIMER_EXEC_EVENT == event) {
|
||||
@ -540,7 +538,6 @@ void Incubator::ShowHand()
|
||||
}
|
||||
},
|
||||
&room->xtimer_attacher_);
|
||||
#endif
|
||||
hold_humans_.clear();
|
||||
}
|
||||
|
||||
@ -556,3 +553,48 @@ void Incubator::Clear(int save_num)
|
||||
hold_humans_.erase(hold_humans_.begin());
|
||||
}
|
||||
}
|
||||
|
||||
void Incubator::Rearrangement()
|
||||
{
|
||||
if (hold_humans_.size() < 6) {
|
||||
return;
|
||||
}
|
||||
std::vector<int> teams2;
|
||||
std::vector<int> teams3;
|
||||
std::vector<int> teams4;
|
||||
{
|
||||
std::map<int, int> team_num_hash;
|
||||
for (auto hum : hold_humans_) {
|
||||
if (team_num_hash.find(hum->team_id) != team_num_hash.end()) {
|
||||
++team_num_hash[hum->team_id];
|
||||
} else {
|
||||
team_num_hash[hum->team_id];
|
||||
}
|
||||
}
|
||||
for (auto& pair : team_num_hash) {
|
||||
if (pair.second > 1) {
|
||||
teams2.push_back(pair.first);
|
||||
}
|
||||
if (pair.second > 2) {
|
||||
teams3.push_back(pair.first);
|
||||
}
|
||||
if (pair.second > 3) {
|
||||
teams4.push_back(pair.first);
|
||||
}
|
||||
}
|
||||
}
|
||||
int team_id = 0;
|
||||
if (!teams3.empty() || !teams4.empty()) {
|
||||
if (a8::RandEx(1, 99) < 10 && !teams4.empty()) {
|
||||
team_id = teams4.at(rand() % teams4.size());
|
||||
} else {
|
||||
if (!teams3.empty()) {
|
||||
team_id = teams3.at(rand() % teams3.size());
|
||||
} else if (!teams4.empty()) {
|
||||
team_id = teams4.at(rand() % teams4.size());
|
||||
}
|
||||
}
|
||||
} else if (!teams2.empty()) {
|
||||
team_id = teams2.at(rand() % teams2.size());
|
||||
}
|
||||
}
|
||||
|
@ -26,6 +26,7 @@ private:
|
||||
void AutoAllocAndroid();
|
||||
void OnEnterNewWave(int wave);
|
||||
void SpawnWaveMon(int wave);
|
||||
void Rearrangement();
|
||||
|
||||
private:
|
||||
int wait_alloc_time_ = 0;
|
||||
|
Loading…
x
Reference in New Issue
Block a user