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 (a8::TIMER_EXEC_EVENT == event) {
if (!IsGameOver() && !GetVictoryTeam()) { if (!IsGameOver() && !GetVictoryTeam()) {
game_over_ = true;
game_over_frameno_ = GetFrameNo();
if (GetMobaTeamA()->GetKillCount() == GetMobaTeamB()->GetKillCount()) { if (GetMobaTeamA()->GetKillCount() == GetMobaTeamB()->GetKillCount()) {
if (GetMobaTeamA()->GetLastKillFrameNo() == GetMobaTeamB()->GetLastKillFrameNo()) { moba_overtime_race_frameno_ = GetFrameNo();
if (GetMobaTeamA()->GetTeamId() < GetMobaTeamA()->GetTeamId()) { xtimer.SetTimeoutWpEx
SetVictoryTeam(GetMobaTeamA()); (SERVER_FRAME_RATE * GetMapMeta()->GetMobaRoomMeta()->game_time(),
} else { [this] (int event, const a8::Args* args)
SetVictoryTeam(GetMobaTeamB()); {
} if (a8::TIMER_EXEC_EVENT == event) {
} else if (GetMobaTeamA()->GetLastKillFrameNo() > MobaOver();
GetMobaTeamB()->GetLastKillFrameNo()) { }
SetVictoryTeam(GetMobaTeamA()); },
} else { &xtimer_attacher_);
SetVictoryTeam(GetMobaTeamB()); return;
}
} if (GetMobaTeamA()->GetKillCount() > GetMobaTeamB()->GetKillCount()) {
SetVictoryTeam(GetMobaTeamA());
} else {
SetVictoryTeam(GetMobaTeamB());
} }
if (GetVictoryTeam() == GetMobaTeamA()) { MobaOver();
GetInGameVoice()->Victory(GetMobaTeamA());
GetInGameVoice()->Fail(GetMobaTeamB());
} else {
GetInGameVoice()->Victory(GetMobaTeamB());
GetInGameVoice()->Fail(GetMobaTeamA());
}
OnGameOver();
} }
} }
}, },
@ -4141,3 +4127,37 @@ void Room::CalcMvp()
return true; 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(); void StartOverTimer();
bool IsNoPlane(); bool IsNoPlane();
void CalcMvp(); void CalcMvp();
long long GetMobaOvertimeRaceFrameNo () { return moba_overtime_race_frameno_; }
void MobaOver();
std::shared_ptr<InGameVoice> GetInGameVoice() { return ingame_voice_; } std::shared_ptr<InGameVoice> GetInGameVoice() { return ingame_voice_; }
@ -386,6 +388,7 @@ private:
RoomType_e room_type_ = RoomType_NewBrid; RoomType_e room_type_ = RoomType_NewBrid;
bool already_room_report_battle_ = false; bool already_room_report_battle_ = false;
bool sending_room_report_battle_ = false; bool sending_room_report_battle_ = false;
long long moba_overtime_race_frameno_ = 0;
GasData gas_data_; GasData gas_data_;
long long frameno_ = 0; long long frameno_ = 0;