完成刷机器人死机器人逻辑
This commit is contained in:
parent
0de41be867
commit
dfd03eb232
@ -190,9 +190,9 @@ public:
|
|||||||
METAMGR_READ(level0room_shua_robot_max_num, 3);
|
METAMGR_READ(level0room_shua_robot_max_num, 3);
|
||||||
METAMGR_READ(level0room_die_robot_min_time, 10);
|
METAMGR_READ(level0room_die_robot_min_time, 10);
|
||||||
METAMGR_READ(level0room_die_robot_max_time, 20);
|
METAMGR_READ(level0room_die_robot_max_time, 20);
|
||||||
METAMGR_READ(level0room_die_robot_min_num, 2);
|
METAMGR_READ(level0room_die_robot_min_num, 1);
|
||||||
METAMGR_READ(level0room_die_robot_max_num, 5);
|
METAMGR_READ(level0room_die_robot_max_num, 3);
|
||||||
METAMGR_READ(level0room_robot_water, 2);
|
METAMGR_READ(level0room_robot_water, 3);
|
||||||
METAMGR_READ(level0room_robot_autodie_time, 10);
|
METAMGR_READ(level0room_robot_autodie_time, 10);
|
||||||
METAMGR_READ(level0room_robot_autodie_distance, 500);
|
METAMGR_READ(level0room_robot_autodie_distance, 500);
|
||||||
|
|
||||||
|
@ -1757,11 +1757,11 @@ void Room::ShuaNewBieAndroid(Human* target)
|
|||||||
Android* hum = (Android*)pair.second;
|
Android* hum = (Android*)pair.second;
|
||||||
a8::Vec2 pos = target->GetPos();
|
a8::Vec2 pos = target->GetPos();
|
||||||
pos.x -= MetaMgr::Instance()->newbie_first_robot_distance;
|
pos.x -= MetaMgr::Instance()->newbie_first_robot_distance;
|
||||||
if (grid_service->BroderOverFlow(pos.x, pos.y)) {
|
if (OverBorder(pos, hum->GetRadius())) {
|
||||||
a8::Vec2 pos = target->GetPos();
|
a8::Vec2 pos = target->GetPos();
|
||||||
pos.x += MetaMgr::Instance()->newbie_first_robot_distance;
|
pos.x += MetaMgr::Instance()->newbie_first_robot_distance;
|
||||||
if (grid_service->BroderOverFlow(pos.x, pos.y)) {
|
if (OverBorder(pos, hum->GetRadius())) {
|
||||||
break;
|
pos = target->GetPos();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
hum->SetPos(pos);
|
hum->SetPos(pos);
|
||||||
@ -1939,29 +1939,20 @@ void Room::ProcShuaAndroid(int shua_time, int shua_num)
|
|||||||
int refreshed_num = 0;
|
int refreshed_num = 0;
|
||||||
for (auto& pair : human_hash_) {
|
for (auto& pair : human_hash_) {
|
||||||
if (pair.second->entity_subtype == EST_Android &&
|
if (pair.second->entity_subtype == EST_Android &&
|
||||||
a8::HasBitFlag(pair.second->status, HS_Disable)) {
|
!pair.second->real_dead &&
|
||||||
|
a8::HasBitFlag(pair.second->status, HS_Disable)
|
||||||
|
) {
|
||||||
Android* hum = (Android*)pair.second;
|
Android* hum = (Android*)pair.second;
|
||||||
a8::Vec2 pos = target->GetPos();
|
a8::Vec2 pos = target->GetPos();
|
||||||
#if 1
|
|
||||||
a8::Vec2 dir = a8::Vec2::UP;
|
a8::Vec2 dir = a8::Vec2::UP;
|
||||||
pos = pos + dir * 400;
|
|
||||||
dir.Rotate(a8::RandAngle());
|
dir.Rotate(a8::RandAngle());
|
||||||
if (grid_service->BroderOverFlow(pos.x, pos.y)) {
|
pos = pos + dir * 400;
|
||||||
|
if (OverBorder(pos, hum->GetRadius())) {
|
||||||
pos.x = target->GetPos().x;
|
pos.x = target->GetPos().x;
|
||||||
if (grid_service->BroderOverFlow(pos.x, pos.y)) {
|
if (OverBorder(pos, hum->GetRadius())) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#else
|
|
||||||
pos.x -= MetaMgr::Instance()->newbie_first_robot_distance;
|
|
||||||
if (grid_service->BroderOverFlow(pos.x, pos.y)) {
|
|
||||||
a8::Vec2 pos = target->GetPos();
|
|
||||||
pos.x += MetaMgr::Instance()->newbie_first_robot_distance;
|
|
||||||
if (grid_service->BroderOverFlow(pos.x, pos.y)) {
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
hum->SetPos(pos);
|
hum->SetPos(pos);
|
||||||
a8::SetBitFlag(hum->status, HS_NewBieNpc);
|
a8::SetBitFlag(hum->status, HS_NewBieNpc);
|
||||||
EnableHuman(hum);
|
EnableHuman(hum);
|
||||||
@ -2001,12 +1992,47 @@ void Room::ProcDieAndroid(int die_time, int die_num)
|
|||||||
die_num
|
die_num
|
||||||
});
|
});
|
||||||
#endif
|
#endif
|
||||||
|
std::vector<Android*> alive_humans;
|
||||||
|
alive_humans.reserve(human_hash_.size());
|
||||||
for (auto& pair : human_hash_) {
|
for (auto& pair : human_hash_) {
|
||||||
if (pair.second->entity_subtype == EST_Android &&
|
if (pair.second->entity_subtype == EST_Android &&
|
||||||
|
!pair.second->real_dead &&
|
||||||
a8::HasBitFlag(pair.second->status, HS_Disable)) {
|
a8::HasBitFlag(pair.second->status, HS_Disable)) {
|
||||||
Android* hum = (Android*)pair.second;
|
Android* hum = (Android*)pair.second;
|
||||||
|
alive_humans.push_back(hum);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
int dead_num = 0;
|
||||||
|
int try_count = 0;
|
||||||
|
std::vector<Android*> alive_humans_copy = alive_humans;
|
||||||
|
do {
|
||||||
|
for (size_t i = 0; i < alive_humans.size(); ++i) {
|
||||||
|
Android* hum = alive_humans[i];
|
||||||
|
Android* killer = nullptr;
|
||||||
|
for (size_t ii = i + 1; ii < alive_humans_copy.size(); ++ii) {
|
||||||
|
killer = alive_humans_copy[ii];
|
||||||
|
alive_humans.erase(alive_humans.begin() + ii);
|
||||||
|
alive_humans_copy.erase(alive_humans_copy.begin() + ii);
|
||||||
|
alive_humans.erase(alive_humans.begin() + i);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
if (killer && (rand() % 100 < 70)) {
|
||||||
|
a8::UnSetBitFlag(hum->status, HS_Disable);
|
||||||
|
hum->BeKill(killer->entity_uniid,
|
||||||
|
killer->name,
|
||||||
|
killer->curr_weapon->weapon_id);
|
||||||
|
} else {
|
||||||
|
a8::UnSetBitFlag(hum->status, HS_Disable);
|
||||||
|
hum->BeKill(VP_SafeArea,
|
||||||
|
"毒圈",
|
||||||
|
VW_SafeArea);
|
||||||
|
alive_humans.erase(alive_humans.begin() + i);
|
||||||
|
alive_humans_copy.erase(alive_humans_copy.begin() + i);
|
||||||
|
}
|
||||||
|
++dead_num;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
} while(++try_count < 40 && dead_num < die_num && !alive_humans.empty());
|
||||||
}
|
}
|
||||||
|
|
||||||
void Room::CheckAutoDie(Human* target,
|
void Room::CheckAutoDie(Human* target,
|
||||||
@ -2055,6 +2081,7 @@ void Room::CheckAutoDie(Human* target,
|
|||||||
for (auto& pair : human_hash_) {
|
for (auto& pair : human_hash_) {
|
||||||
if (pair.second->entity_uniid != target->entity_uniid &&
|
if (pair.second->entity_uniid != target->entity_uniid &&
|
||||||
pair.second->entity_subtype == EST_Android &&
|
pair.second->entity_subtype == EST_Android &&
|
||||||
|
!pair.second->real_dead &&
|
||||||
a8::HasBitFlag(pair.second->status, HS_Disable)) {
|
a8::HasBitFlag(pair.second->status, HS_Disable)) {
|
||||||
Android* hum = (Android*)pair.second;
|
Android* hum = (Android*)pair.second;
|
||||||
{
|
{
|
||||||
|
Loading…
x
Reference in New Issue
Block a user