This commit is contained in:
aozhiwei 2022-08-17 19:37:25 +08:00
parent 2e1d0585e8
commit 136fab84a0
4 changed files with 40 additions and 5 deletions

View File

@ -24,7 +24,7 @@ void Incubator::Init()
for (int time : room->pve_mode_meta->mode_time) {
room->xtimer.AddDeadLineTimerAndAttach
(
time * SERVER_FRAME_RATE,
time * SERVER_FRAME_RATE / 10,
a8::XParams()
.SetSender(this)
.SetParam1(wave),
@ -239,5 +239,32 @@ void Incubator::ActiveAndroid(Human* hum, Human* android)
void Incubator::SpawnWaveMon(int wave)
{
if (wave < 0) {
abort();
}
if (wave >= room->pve_mode_meta->waves.size()) {
abort();
}
auto& mons = room->pve_mode_meta->waves[wave];
for (MetaData::PveGeminiContent* content : mons) {
MetaData::Player* hero_meta = MetaMgr::Instance()->GetPlayer(content->pb->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();
}
}
}
}

View File

@ -1650,6 +1650,7 @@ namespace MetaData
}
spawn_point = a8::Vec2(a8::XValue(strings[0]).GetDouble(),
a8::XValue(strings[1]).GetDouble());
spawn_point.y = 7680 - spawn_point.y;
}
}
@ -1687,9 +1688,13 @@ namespace MetaData
);
}
}
waves = MetaMgr::Instance()->GetPveGeminiContents(pb->id());
if (waves->size() != mode_time.size()) {
abort();
waves.resize(mode_time.size());
for (auto& content : *MetaMgr::Instance()->GetPveGeminiContents(pb->id())) {
if (content.pb->round() <= 0 ||
content.pb->round() > mode_time.size()) {
abort();
}
waves[content.pb->round() - 1].push_back(&content);
}
}

View File

@ -413,7 +413,7 @@ namespace MetaData
const metatable::PveGeminiMode* pb = nullptr;
std::vector<int> mode_time;
std::vector<std::tuple<float, float, int>> area;
std::vector<PveGeminiContent>* waves;
std::vector<std::vector<PveGeminiContent*>> waves;
void Init();
};

View File

@ -946,6 +946,7 @@ private:
for (auto& meta : pve_gemini_meta_list) {
MetaData::PveGemini item;
item.pb = &meta;
item.Init();
pve_gemini_hash[meta.gemini_id()] = item;
}
@ -955,12 +956,14 @@ private:
if (pve_gemini_content_hash.find(meta.mode_id()) == pve_gemini_content_hash.end()) {
pve_gemini_content_hash[meta.mode_id()] = std::vector<MetaData::PveGeminiContent>();
}
item.Init();
pve_gemini_content_hash[meta.mode_id()].push_back(item);
}
for (auto& meta : pve_gemini_mode_meta_list) {
MetaData::PveGeminiMode item;
item.pb = &meta;
item.Init();
pve_gemini_mode_hash[meta.id()] = item;
}