1
This commit is contained in:
parent
b7f0aae4fa
commit
411b586506
@ -287,6 +287,64 @@ void Incubator::SpawnWaveMon(int wave)
|
||||
#ifdef DEBUG
|
||||
a8::XPrintf("SpawnWaveMon wave:%d \n", {wave});
|
||||
#endif
|
||||
auto cb =
|
||||
[] (const a8::XParams& param)
|
||||
{
|
||||
Incubator* incubator = (Incubator*)param.sender.GetUserData();
|
||||
MetaData::PveGeminiContent* content = (MetaData::PveGeminiContent*)param.param1.GetUserData();
|
||||
Room* room = incubator->room;
|
||||
int wave = param.param2.GetInt();
|
||||
int monIdx = param.param3.GetInt();
|
||||
#ifdef DEBUG
|
||||
a8::XPrintf("wave i:%d enemys_size:%d\n", {wave, content->enemys.size()});
|
||||
#endif
|
||||
if (monIdx < content->enemys.size()) {
|
||||
int enemy_id = content->enemys[monIdx];
|
||||
MetaData::Player* hero_meta = MetaMgr::Instance()->GetPlayer(enemy_id);
|
||||
if (hero_meta) {
|
||||
a8::Vec2 hero_pos = content->spawn_point;
|
||||
|
||||
int team_id = 666;
|
||||
Creature* master = nullptr;
|
||||
|
||||
a8::Vec2 dir = hero_pos;
|
||||
dir.Normalize();
|
||||
|
||||
Hero* hero = room->CreateHero(master,
|
||||
hero_meta,
|
||||
hero_pos,
|
||||
dir,
|
||||
team_id);
|
||||
if (!hero) {
|
||||
A8_ABORT();
|
||||
}
|
||||
#ifdef DEBUG
|
||||
{
|
||||
room->xtimer.AddDeadLineTimerAndAttach
|
||||
(
|
||||
SERVER_FRAME_RATE * (rand() % 3),
|
||||
a8::XParams()
|
||||
.SetSender(hero),
|
||||
[] (const a8::XParams& param)
|
||||
{
|
||||
Hero* hero = (Hero*)param.sender.GetUserData();
|
||||
hero->BeKill(VP_Gas, TEXT("battle_server_killer_gas", "毒圈"), VW_Gas);
|
||||
},
|
||||
&hero->xtimer_attacher.timer_list_);
|
||||
}
|
||||
#endif
|
||||
if (wave + 1 == room->pve_mode_meta->waves.size()) {
|
||||
hero->is_pve_boss = true;
|
||||
#ifdef DEBGU
|
||||
a8::XPrintf("pve_boss appear\n", {});
|
||||
#endif
|
||||
}
|
||||
|
||||
++room->pve_data.mon_num;
|
||||
room->NotifyUiUpdate();
|
||||
}
|
||||
}
|
||||
};
|
||||
auto& mons = room->pve_mode_meta->waves[wave];
|
||||
for (MetaData::PveGeminiContent* content : mons) {
|
||||
for (int i = 0; i < content->enemys.size(); ++i) {
|
||||
@ -298,63 +356,7 @@ void Incubator::SpawnWaveMon(int wave)
|
||||
.SetParam1(content)
|
||||
.SetParam2(wave)
|
||||
.SetParam3(i),
|
||||
[] (const a8::XParams& param)
|
||||
{
|
||||
Incubator* incubator = (Incubator*)param.sender.GetUserData();
|
||||
MetaData::PveGeminiContent* content = (MetaData::PveGeminiContent*)param.param1.GetUserData();
|
||||
Room* room = incubator->room;
|
||||
int wave = param.param2.GetInt();
|
||||
int idx = param.param3.GetInt();
|
||||
#ifdef DEBUG
|
||||
a8::XPrintf("wave i:%d enemys_size:%d\n", {wave, content->enemys.size()});
|
||||
#endif
|
||||
if (idx < content->enemys.size()) {
|
||||
int enemy_id = content->enemys[idx];
|
||||
MetaData::Player* hero_meta = MetaMgr::Instance()->GetPlayer(enemy_id);
|
||||
if (hero_meta) {
|
||||
a8::Vec2 hero_pos = content->spawn_point;
|
||||
|
||||
int team_id = 666;
|
||||
Creature* master = nullptr;
|
||||
|
||||
a8::Vec2 dir = hero_pos;
|
||||
dir.Normalize();
|
||||
|
||||
Hero* hero = room->CreateHero(master,
|
||||
hero_meta,
|
||||
hero_pos,
|
||||
dir,
|
||||
team_id);
|
||||
if (!hero) {
|
||||
A8_ABORT();
|
||||
}
|
||||
#ifdef DEBUG
|
||||
{
|
||||
room->xtimer.AddDeadLineTimerAndAttach
|
||||
(
|
||||
SERVER_FRAME_RATE * (rand() % 3),
|
||||
a8::XParams()
|
||||
.SetSender(hero),
|
||||
[] (const a8::XParams& param)
|
||||
{
|
||||
Hero* hero = (Hero*)param.sender.GetUserData();
|
||||
hero->BeKill(VP_Gas, TEXT("battle_server_killer_gas", "毒圈"), VW_Gas);
|
||||
},
|
||||
&hero->xtimer_attacher.timer_list_);
|
||||
}
|
||||
#endif
|
||||
if (wave + 1 == room->pve_mode_meta->waves.size()) {
|
||||
hero->is_pve_boss = true;
|
||||
#ifdef DEBGU
|
||||
a8::XPrintf("pve_boss appear\n", {});
|
||||
#endif
|
||||
}
|
||||
|
||||
++room->pve_data.mon_num;
|
||||
room->NotifyUiUpdate();
|
||||
}
|
||||
}
|
||||
},
|
||||
cb,
|
||||
&xtimer_attacher_.timer_list_);
|
||||
}
|
||||
room->pve_data.refreshed_mon += content->enemys.size();
|
||||
|
Loading…
x
Reference in New Issue
Block a user