1
This commit is contained in:
commit
517ce546e1
@ -607,7 +607,11 @@ void Human::FillMFPlayerStats(cs::MFPlayerStats* stats_pb)
|
||||
stats_pb->set_history_heal_amount(stats.history_heal_amount);
|
||||
|
||||
stats_pb->set_gold(stats.gold);
|
||||
#if 1
|
||||
stats_pb->set_score(stats.pve_rank_score);
|
||||
#else
|
||||
stats_pb->set_score(stats.score);
|
||||
#endif
|
||||
stats_pb->set_pass_score(stats.pass_score);
|
||||
stats_pb->set_rank_score(stats.rank_score);
|
||||
stats_pb->set_has_pass(has_pass);
|
||||
@ -1037,7 +1041,7 @@ void Human::FillSMGameOver(cs::SMGameOver& msg)
|
||||
{
|
||||
msg.set_total_team_num(room->GetTeamNum());
|
||||
if (room->IsPveRoom()) {
|
||||
msg.set_pve_wave(room->pve_data.wave);
|
||||
msg.set_pve_wave(room->pve_data.GetWave() + 1);
|
||||
msg.set_pve_max_wave(room->pve_data.max_wave);
|
||||
msg.set_pve_instance_id(room->pve_instance->pb->gemini_id());
|
||||
}
|
||||
@ -1058,7 +1062,7 @@ void Human::FillSMGameOver(cs::SMGameOver& msg)
|
||||
{
|
||||
if (room->IsPveRoom()) {
|
||||
msg.set_mode(GetTeam()->GetMemberNum() <= 1 ? 1 : 2);
|
||||
msg.set_my_rank(room->pve_data.wave);
|
||||
msg.set_my_rank(room->pve_data.GetWave() + 1);
|
||||
msg.set_max_rank(room->pve_data.max_wave);
|
||||
} else {
|
||||
if (GetTeam()->GetMemberNum() <= 1) {
|
||||
@ -1918,7 +1922,7 @@ void Human::SendUIUpdate()
|
||||
room->FillSMUiUpdate(notifymsg);
|
||||
if (room->IsPveRoom()) {
|
||||
notifymsg.set_score(stats.pve_rank_score);
|
||||
notifymsg.set_wave(room->pve_data.wave + 1);
|
||||
notifymsg.set_wave(room->pve_data.GetWave() + 1);
|
||||
notifymsg.set_max_wave(room->pve_data.max_wave);
|
||||
notifymsg.set_mon_num(room->pve_data.mon_num);
|
||||
notifymsg.set_boss_state(room->pve_data.boss_state);
|
||||
|
@ -255,7 +255,7 @@ void Incubator::ActiveAndroid(Human* hum, Human* android)
|
||||
void Incubator::OnEnterNewWave(int wave)
|
||||
{
|
||||
#ifdef DEBUG
|
||||
a8::XPrintf("OnEnterNewWave2 wave:%d \n", {wave});
|
||||
a8::XPrintf("OnEnterNewWave2 wave:%d \n", {wave + 1});
|
||||
#endif
|
||||
if (room->IsGameOver()) {
|
||||
return;
|
||||
@ -270,7 +270,7 @@ void Incubator::OnEnterNewWave(int wave)
|
||||
timeout_ = true;
|
||||
return;
|
||||
}
|
||||
room->pve_data.wave = wave + 1;
|
||||
room->pve_data.SetWave(wave + 1);
|
||||
room->OnEnterNewWave(wave + 1);
|
||||
if (wave < 0) {
|
||||
abort();
|
||||
@ -331,6 +331,7 @@ void Incubator::SpawnWaveMon(int wave)
|
||||
Hero* hero = (Hero*)param.sender.GetUserData();
|
||||
Human* hum = hero->room->GetOneAlivePlayer();
|
||||
if (hum) {
|
||||
hum->room->pve_data.AddDamageInfo(hum->GetUniId(), hero->GetUniId(), 1);
|
||||
hero->BeKill(hum->GetUniId(), hum->name, hum->GetCurrWeapon()->weapon_id);
|
||||
} else {
|
||||
hero->BeKill(VP_Gas, TEXT("battle_server_killer_gas", "毒圈"), VW_Gas);
|
||||
@ -371,11 +372,11 @@ void Incubator::SpawnWaveMon(int wave)
|
||||
|
||||
int Incubator::GetPveLeftTime()
|
||||
{
|
||||
if (room->pve_data.wave >= wave_timers_.size() ||
|
||||
room->pve_data.wave < 0) {
|
||||
if (room->pve_data.GetWave() >= wave_timers_.size() ||
|
||||
room->pve_data.GetWave() < 0) {
|
||||
return 0;
|
||||
}
|
||||
xtimer_list* timer = wave_timers_[room->pve_data.wave];
|
||||
xtimer_list* timer = wave_timers_[room->pve_data.GetWave()];
|
||||
if (!timer) {
|
||||
return 0;
|
||||
}
|
||||
@ -383,23 +384,17 @@ int Incubator::GetPveLeftTime()
|
||||
return remain_time * FRAME_RATE_MS;
|
||||
}
|
||||
|
||||
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()) {
|
||||
if (room->pve_data.GetWave() < wave_timers_.size()) {
|
||||
int acc_time = 0;
|
||||
{
|
||||
xtimer_list* timer = wave_timers_[room->pve_data.wave];
|
||||
xtimer_list* timer = wave_timers_[room->pve_data.GetWave()];
|
||||
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) {
|
||||
for (int i = room->pve_data.GetWave(); 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);
|
||||
|
@ -16,7 +16,6 @@ class Incubator
|
||||
void ActiveAndroid(Human* hum, Human* android);
|
||||
bool IsTimeOut() { return timeout_; };
|
||||
int GetPveLeftTime();
|
||||
bool IsLastWave();
|
||||
void NextWave();
|
||||
|
||||
private:
|
||||
|
@ -86,6 +86,11 @@ void Player::Initialize()
|
||||
}
|
||||
}
|
||||
}
|
||||
#ifdef DEBUG
|
||||
{
|
||||
|
||||
}
|
||||
#endif
|
||||
need_sync_active_player = true;
|
||||
}
|
||||
}
|
||||
|
@ -44,6 +44,9 @@ void PveData::OnBeKill(Hero* hero)
|
||||
Human* hum = room->GetHumanByUniId(pair.first);
|
||||
if (hum) {
|
||||
int win_score = pair.second / total_dmg * base_score;
|
||||
#ifdef DEBUG
|
||||
a8::XPrintf("kill_score:%f \n", {win_score});
|
||||
#endif
|
||||
hum->WinPveScore(win_score);
|
||||
}
|
||||
}
|
||||
@ -71,7 +74,7 @@ void PveData::OnBeKill(Hero* hero)
|
||||
#ifdef DEBUG
|
||||
a8::XPrintf("PveData::OnBeKill wave:%d refreshed_mon:%d killed_num:%d\n",
|
||||
{
|
||||
wave,
|
||||
GetWave(),
|
||||
refreshed_mon,
|
||||
killed_num
|
||||
});
|
||||
@ -79,27 +82,36 @@ void PveData::OnBeKill(Hero* hero)
|
||||
|
||||
if (refreshed_mon > 0) {
|
||||
if (killed_num >= refreshed_mon) {
|
||||
if (wave < room->pve_mode_meta->round_score.size()) {
|
||||
int win_score = room->pve_mode_meta->round_score[wave];
|
||||
if (GetWave() < room->pve_mode_meta->round_score.size()) {
|
||||
int win_score = room->pve_mode_meta->round_score[GetWave()];
|
||||
room->TraverseHumanList
|
||||
(
|
||||
a8::XParams(),
|
||||
[this, win_score] (Human* hum, a8::XParams& param)
|
||||
{
|
||||
hum->WinPveScore(win_score);
|
||||
if (!hum->dead) {
|
||||
#ifdef DEBUG
|
||||
a8::XPrintf("round_score:%f \n", {win_score});
|
||||
#endif
|
||||
hum->WinPveScore(win_score);
|
||||
}
|
||||
return true;
|
||||
});
|
||||
}
|
||||
if (room->IsDestoryRoom()) {
|
||||
if (wave < room->pve_mode_meta->next_door.size()) {
|
||||
a8::Vec2 point = room->pve_mode_meta->next_door[room->pve_data.wave];
|
||||
#if 0
|
||||
room->CreateObstacle(PVE_DOOR_THING_ID, point.x, point.y);
|
||||
#endif
|
||||
FlyDoor(room, point, 50);
|
||||
if (GetWave() + 1 < max_wave) {
|
||||
if (GetWave() < room->pve_mode_meta->next_door.size()) {
|
||||
a8::Vec2 point = room->pve_mode_meta->next_door[room->pve_data.GetWave()];
|
||||
#if 0
|
||||
room->CreateObstacle(PVE_DOOR_THING_ID, point.x, point.y);
|
||||
#endif
|
||||
FlyDoor(room, point, 50);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
room->GetIncubator()->NextWave();
|
||||
if (GetWave() + 1 < max_wave) {
|
||||
room->GetIncubator()->NextWave();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -110,7 +122,7 @@ void PveData::FlyDoor(Room* room, a8::Vec2& point, int radius)
|
||||
#ifdef DEBUG
|
||||
a8::XPrintf("FlyDoor wave:%d refreshed_mon:%d killed_num:%d\n",
|
||||
{
|
||||
wave,
|
||||
GetWave(),
|
||||
refreshed_mon,
|
||||
killed_num
|
||||
});
|
||||
|
@ -3,7 +3,6 @@
|
||||
class Hero;
|
||||
struct PveData
|
||||
{
|
||||
int wave = 0;
|
||||
int max_wave = 0;
|
||||
int mon_num = 0;
|
||||
int boss_state = 0;
|
||||
@ -13,6 +12,8 @@ struct PveData
|
||||
|
||||
bool pve_kill_boss = false;
|
||||
|
||||
int GetWave() { return wave_; };
|
||||
void SetWave(int wave) { wave_ = wave; };
|
||||
void AddDamageInfo(int sender_id, int receiver_id, float dmg);
|
||||
void OnBeKill(Hero* hero);
|
||||
|
||||
@ -21,6 +22,7 @@ private:
|
||||
void FlyDoor(Room* room, a8::Vec2& point, int radius);
|
||||
|
||||
private:
|
||||
int wave_ = 0;
|
||||
|
||||
std::map<int, std::map<int, float>> damage_hash_;
|
||||
|
||||
|
@ -1193,13 +1193,8 @@ void Room::UpdateGas()
|
||||
(
|
||||
pve_data.pve_kill_boss ||
|
||||
IsAllRealDead() ||
|
||||
incubator_->IsTimeOut() ||
|
||||
(
|
||||
incubator_->IsLastWave() &&
|
||||
pve_data.refreshed_mon > 0 &&
|
||||
pve_data.killed_num >= pve_data.refreshed_mon)
|
||||
)
|
||||
) {
|
||||
incubator_->IsTimeOut()
|
||||
)) {
|
||||
game_over_ = true;
|
||||
game_over_frameno_ = GetFrameNo();
|
||||
OnGameOver();
|
||||
|
@ -359,6 +359,7 @@ void RoomObstacle::Active()
|
||||
break;
|
||||
}
|
||||
if (meta->i->life_time() > 0) {
|
||||
#if 1
|
||||
room->xtimer.AddDeadLineTimerAndAttach
|
||||
(
|
||||
meta->i->life_time() / FRAME_RATE_MS,
|
||||
@ -375,6 +376,7 @@ void RoomObstacle::Active()
|
||||
},
|
||||
&xtimer_attacher.timer_list_
|
||||
);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user