mirror of
https://github.com/smogon/pokemon-showdown.git
synced 2026-06-19 15:11:30 -05:00
Tournament code no longer overrides BattleRoom.win
Since tournament battle rooms already keep track of the room where the tournament began, it's possible to have the default BattleRoom.win submit the results of the battle instead of having to override the function and still call the old code (very messy).
This commit is contained in:
parent
8d09536d2d
commit
17dcb5274a
12
rooms.js
12
rooms.js
|
|
@ -749,12 +749,12 @@ var BattleRoom = (function () {
|
|||
});
|
||||
}
|
||||
}
|
||||
// if (this.tour) {
|
||||
// var winnerid = toId(winner);
|
||||
// winner = Users.get(winner);
|
||||
// var tour = this.tour.tour;
|
||||
// tour.onBattleWin(this, winner);
|
||||
// }
|
||||
if (this.tour) {
|
||||
var winnerid = toId(winner);
|
||||
winner = Users.get(winner);
|
||||
var tour = this.tour.tour;
|
||||
tour.onBattleWin(this, winner);
|
||||
}
|
||||
rooms.global.battleCount += 0 - (this.active ? 1 : 0);
|
||||
this.active = false;
|
||||
this.update();
|
||||
|
|
|
|||
|
|
@ -138,7 +138,7 @@ Tournament = (function () {
|
|||
Tournament.prototype.forceEnd = function () {
|
||||
if (this.isTournamentStarted) {
|
||||
this.inProgressMatches.forEach(function (match) {
|
||||
if (match) delete match.room.win;
|
||||
if (match) delete match.room.tour;
|
||||
});
|
||||
}
|
||||
this.isEnded = true;
|
||||
|
|
@ -647,12 +647,6 @@ Tournament = (function () {
|
|||
this.isBracketInvalidated = true;
|
||||
this.runAutoDisqualify();
|
||||
this.update();
|
||||
|
||||
var self = this;
|
||||
room.win = function (winner) {
|
||||
self.onBattleWin(this, Users.get(winner));
|
||||
return Object.getPrototypeOf(this).win.call(this, winner);
|
||||
};
|
||||
};
|
||||
Tournament.prototype.onBattleWin = function (room, winner) {
|
||||
var from = Users.get(room.p1);
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user