This commit is contained in:
aozhiwei 2024-04-30 14:33:49 +08:00
parent 4520463bb0
commit a89dfed350
2 changed files with 49 additions and 26 deletions

View File

@ -143,34 +143,20 @@ void Room::Init()
{
if (a8::TIMER_EXEC_EVENT == event) {
if (!IsGameOver() && !GetVictoryTeam()) {
game_over_ = true;
game_over_frameno_ = GetFrameNo();
if (GetMobaTeamA()->GetKillCount() == GetMobaTeamB()->GetKillCount()) {
if (GetMobaTeamA()->GetLastKillFrameNo() == GetMobaTeamB()->GetLastKillFrameNo()) {
if (GetMobaTeamA()->GetTeamId() < GetMobaTeamA()->GetTeamId()) {
SetVictoryTeam(GetMobaTeamA());
} else {
SetVictoryTeam(GetMobaTeamB());
}
} else if (GetMobaTeamA()->GetLastKillFrameNo() >
GetMobaTeamB()->GetLastKillFrameNo()) {
SetVictoryTeam(GetMobaTeamA());
} else {
SetVictoryTeam(GetMobaTeamB());
}
} if (GetMobaTeamA()->GetKillCount() > GetMobaTeamB()->GetKillCount()) {
SetVictoryTeam(GetMobaTeamA());
} else {
SetVictoryTeam(GetMobaTeamB());
moba_overtime_race_frameno_ = GetFrameNo();
xtimer.SetTimeoutWpEx
(SERVER_FRAME_RATE * GetMapMeta()->GetMobaRoomMeta()->game_time(),
[this] (int event, const a8::Args* args)
{
if (a8::TIMER_EXEC_EVENT == event) {
MobaOver();
}
},
&xtimer_attacher_);
return;
}
if (GetVictoryTeam() == GetMobaTeamA()) {
GetInGameVoice()->Victory(GetMobaTeamA());
GetInGameVoice()->Fail(GetMobaTeamB());
} else {
GetInGameVoice()->Victory(GetMobaTeamB());
GetInGameVoice()->Fail(GetMobaTeamA());
}
OnGameOver();
MobaOver();
}
}
},
@ -4141,3 +4127,37 @@ void Room::CalcMvp()
return true;
});
}
void Room::MobaOver()
{
if (!IsGameOver() && !GetVictoryTeam()) {
game_over_ = true;
game_over_frameno_ = GetFrameNo();
if (GetMobaTeamA()->GetKillCount() == GetMobaTeamB()->GetKillCount()) {
if (GetMobaTeamA()->GetLastKillFrameNo() == GetMobaTeamB()->GetLastKillFrameNo()) {
if (GetMobaTeamA()->GetTeamId() < GetMobaTeamA()->GetTeamId()) {
SetVictoryTeam(GetMobaTeamA());
} else {
SetVictoryTeam(GetMobaTeamB());
}
} else if (GetMobaTeamA()->GetLastKillFrameNo() >
GetMobaTeamB()->GetLastKillFrameNo()) {
SetVictoryTeam(GetMobaTeamA());
} else {
SetVictoryTeam(GetMobaTeamB());
}
} if (GetMobaTeamA()->GetKillCount() > GetMobaTeamB()->GetKillCount()) {
SetVictoryTeam(GetMobaTeamA());
} else {
SetVictoryTeam(GetMobaTeamB());
}
if (GetVictoryTeam() == GetMobaTeamA()) {
GetInGameVoice()->Victory(GetMobaTeamA());
GetInGameVoice()->Fail(GetMobaTeamB());
} else {
GetInGameVoice()->Victory(GetMobaTeamB());
GetInGameVoice()->Fail(GetMobaTeamA());
}
OnGameOver();
}
}

View File

@ -302,6 +302,8 @@ public:
void StartOverTimer();
bool IsNoPlane();
void CalcMvp();
long long GetMobaOvertimeRaceFrameNo () { return moba_overtime_race_frameno_; }
void MobaOver();
std::shared_ptr<InGameVoice> GetInGameVoice() { return ingame_voice_; }
@ -386,6 +388,7 @@ private:
RoomType_e room_type_ = RoomType_NewBrid;
bool already_room_report_battle_ = false;
bool sending_room_report_battle_ = false;
long long moba_overtime_race_frameno_ = 0;
GasData gas_data_;
long long frameno_ = 0;