This commit is contained in:
aozhiwei 2022-08-26 10:19:59 +08:00
parent db896f6a32
commit 8943161bb6
3 changed files with 27 additions and 0 deletions

View File

@ -333,3 +333,22 @@ bool Incubator::IsLastWave()
{
return room->pve_data.wave >= room->pve_mode_meta->waves.size();
}
void Incubator::NextWave()
{
if (room->pve_data.wave < wave_timers_.size() && room->IsSurvivalRoom()) {
int acc_time = 0;
{
xtimer_list* timer = wave_timers_[room->pve_data.wave];
int remain_time = room->xtimer.GetRemainTime(timer);
room->xtimer.ModifyTimer(timer, 0);
acc_time = remain_time;
}
for (int i = room->pve_data.wave; i < wave_timers_.size(); ++i) {
xtimer_list* timer = wave_timers_[i];
int remain_time = room->xtimer.GetRemainTime(timer);
room->xtimer.ModifyTimer(timer, remain_time - acc_time);
}
}
}

View File

@ -17,6 +17,7 @@ class Incubator
bool IsTimeOut() { return timeout_; };
int GetPveLeftTime();
bool IsLastWave();
void NextWave();
private:
bool CanSee(Human* hum, Human* exclude_hum);

View File

@ -3,6 +3,7 @@
#include "room.h"
#include "human.h"
#include "metadata.h"
#include "incubator.h"
#include "pvedata.h"
@ -47,4 +48,10 @@ void PveData::OnBeKill(Hero* hero)
}
room->NotifyUiUpdate();
}
if (refreshed_mon > 0) {
if (killed_num >= refreshed_mon) {
room->GetIncubator()->NextWave();
}
}
}