From 47584e294172fcae67e0253614fb1b3f70011455 Mon Sep 17 00:00:00 2001 From: Ritiek Malhotra Date: Mon, 10 May 2021 03:00:40 +0530 Subject: [PATCH 1/2] Set winner when player leaves elimination mid-game Some players immediately leave the game mid-way in elimination maps when they have the final turn in the team and they are about to die/fall off a cliff, which causes the game to draw when the opponent team should have been declared the winner. The game will now check if the player to leave the elimination game was the last player in the team and in case they were so, mark their team score so the opponent team is declared as the winner. --- CHANGELOG.md | 2 ++ assets/src/ba_data/python/bastd/game/elimination.py | 7 +++++++ 2 files changed, 9 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 5eda29cc..bb8ad1e5 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,5 @@ +- Declare opponent team as the winner if a player with their final turn leaves an elimination game. + ### 1.6.0 (20357) - Revamped netcode significantly. We still don't have client-prediction, but things should (hopefully) feel much lower latency now. - Added network debug graphs accessible by hitting F8. diff --git a/assets/src/ba_data/python/bastd/game/elimination.py b/assets/src/ba_data/python/bastd/game/elimination.py index 061ff0b4..aac7d823 100644 --- a/assets/src/ba_data/python/bastd/game/elimination.py +++ b/assets/src/ba_data/python/bastd/game/elimination.py @@ -483,6 +483,13 @@ class EliminationGame(ba.TeamGameActivity[Player, Team]): # list then. ba.timer(0, self._update_icons) + # If the player to leave was the last in spawn order and had + # their final turn currently in-progress, mark the survival time + # for their team. + if self._get_total_team_lives(player.team) == 0: + assert self._start_time is not None + player.team.survival_seconds = int(ba.time() - self._start_time) + def _get_total_team_lives(self, team: Team) -> int: return sum(player.lives for player in team.players) From 625d5a4675d36f8c32ecfc2dcdfbce0d4c37cb8b Mon Sep 17 00:00:00 2001 From: Ritiek Malhotra Date: Mon, 10 May 2021 03:01:25 +0530 Subject: [PATCH 2/2] Add myself to CONTRIBUTORS.md --- CONTRIBUTORS.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/CONTRIBUTORS.md b/CONTRIBUTORS.md index da94cd2f..e49a87ab 100644 --- a/CONTRIBUTORS.md +++ b/CONTRIBUTORS.md @@ -23,3 +23,6 @@ ### Daniil Rakhov - Plugin api additions + +### Ritiek Malhotra +- Just <3 BombSquad