This commit is contained in:
aozhiwei 2024-08-30 11:50:51 +08:00
parent c0570832a6
commit f64cda608d
2 changed files with 46 additions and 7 deletions

View File

@ -54,7 +54,7 @@ void Incubator::Init()
if (room->IsNewBieBattle()) {
room->xtimer.SetTimeoutEx
(
SERVER_FRAME_RATE * (50),
SERVER_FRAME_RATE * (60),
[this] (int event, const a8::Args* args)
{
if (a8::TIMER_EXEC_EVENT == event) {
@ -152,6 +152,7 @@ void Incubator::AllocAndroid(Human* target, int num, std::vector<Human*>* androi
App::Instance()->verify_set_pos = 0;
if (!CanSee(hum, target)) {
room->EnableHuman(hum);
room->grid_service->MoveCreature(hum);
#ifdef MYDEBUG
#if 0
if (!target->InNewObjects(hum)) {
@ -281,7 +282,7 @@ void Incubator::AutoAllocAndroid()
if (!hold_humans_.empty() && hold_humans_.size() > 0) {
int rnd_space = 70;
if (room->IsNewBieBattle()) {
rnd_space = 0;
rnd_space = 20;
}
Human* hum = hold_humans_[0];
if (room->GetGasData().GetGasMode() == GasWaiting &&
@ -308,7 +309,9 @@ void Incubator::AutoAllocAndroid()
return;
}
hold_humans_.erase(hold_humans_.begin());
if (!room->IsNewBieBattle()) {
if (room->IsNewBieBattle()) {
room->xtimer.ModifyTime(alloc_timer_, SERVER_FRAME_RATE * (6 + rand() % 4));
} else {
room->xtimer.ModifyTime(alloc_timer_, SERVER_FRAME_RATE * (30 + rand() % 5));
}
}
@ -671,12 +674,15 @@ void Incubator::StartNewBattleMode()
if (!selected_player) {
return;
}
auto startno = std::make_shared<long long>();
*startno = room->GetFrameNo();
auto invisable_humans = std::make_shared<std::vector<Human*>>();
auto invisable_teammates = std::make_shared<std::vector<Human*>>();
room->xtimer.SetIntervalWpEx
(
SERVER_FRAME_RATE * (4 + rand() % 3),
[this, selected_player, invisable_humans, invisable_teammates] (int event, const a8::Args* args)
SERVER_FRAME_RATE * (5 + rand() % 3),
[this, selected_player, invisable_humans, invisable_teammates, startno]
(int event, const a8::Args* args)
{
if (a8::TIMER_EXEC_EVENT == event) {
if (room->IsGameOver()) {
@ -686,7 +692,8 @@ void Incubator::StartNewBattleMode()
invisable_teammates->clear();
room->TraverseAliveHumanList
(
[this, selected_player, invisable_humans, invisable_teammates] (Human* hum) -> bool
[this, selected_player, invisable_humans, invisable_teammates, startno]
(Human* hum) -> bool
{
if (hum == selected_player) {
return true;
@ -700,6 +707,38 @@ void Incubator::StartNewBattleMode()
}
return true;
});
if (invisable_humans->size() == 1) {
if (room->GetFrameNo() - *startno < SERVER_FRAME_RATE * 30) {
Human *target = invisable_humans->at(0);
glm::vec3 dir = GlmHelper::UP;
GlmHelper::RotateY(dir, a8::RandAngle());
int rand_len = rand() % mt::Param::s().incubator_rand_length;
glm::vec3 center = selected_player->GetPos().ToGlmVec3() + dir * (float)(mt::Param::s().incubator_base_length + rand_len);
room->map_instance->Scale(center);
glm::vec3 point;
if (room->map_instance->FindRandomPointAroundCircle
(
center,
10 * room->GetMapMeta()->scale(),
point
)) {
room->map_instance->UnScale(point);
glm::vec3 old_pos = target->GetPos().ToGlmVec3();
App::Instance()->verify_set_pos = 1;
target->GetMutablePos().FromGlmVec3(point);
App::Instance()->verify_set_pos = 0;
if (CanSee(target, selected_player)) {
App::Instance()->verify_set_pos = 1;
target->GetMutablePos().FromGlmVec3(old_pos);
App::Instance()->verify_set_pos = 0;
} else {
room->grid_service->MoveCreature(target);
}
}
return;
}
}
if (invisable_humans->size() > 0) {
std::shuffle(invisable_humans->begin(),
invisable_humans->end(),

View File

@ -172,7 +172,7 @@ void Player::Initialize()
if (room->IsNewBieBattle()) {
GetAbility()->AddAttr(kHAT_vAttackRateSe, 5.0f);
GetAbility()->AddAttr(kHAT_pDefendRateSe, 2.0f);
GetAbility()->AddAttr(kHAT_vHealthRateSe, 2.0f);
GetAbility()->AddAttr(kHAT_vHealthRateSe, 3.0f);
}
}