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