diff --git a/js/battle.js b/js/battle.js index b62f42b79..6023b8ab4 100644 --- a/js/battle.js +++ b/js/battle.js @@ -2647,6 +2647,7 @@ var Battle = (function () { if (this.turnCallback) this.turnCallback(this); if (this.fastForward > -1 && turnnum >= this.fastForward) { this.fastForwardOff(); + if (this.endCallback) this.endCallback(this); } return; } diff --git a/js/client-battle.js b/js/client-battle.js index 6579dbf4b..554f52d5f 100644 --- a/js/client-battle.js +++ b/js/client-battle.js @@ -189,7 +189,12 @@ } else if (this.battle.playbackState === 2 || this.battle.playbackState === 3) { // battle is playing or paused - this.$controls.html('
'); + if (this.side) { + // is a player + this.$controls.html(''); + } else { + this.$controls.html(''); + } return; } @@ -225,7 +230,7 @@ // was a player this.$controls.html('
Waiting for players...
'); + this.$controls.html('Waiting for players...
'); } @@ -704,6 +709,19 @@ saveReplay: function () { this.send('/savereplay'); }, + switchSides: function () { + if (this.battle.done) { + this.battle.reset(true); + this.battle.switchSides(); + this.battle.fastForwardTo(-1); + } else { + var turn = this.battle.turn; + this.battle.reset(); + this.battle.switchSides(); + if (turn) this.battle.fastForwardTo(turn); + this.battle.play(); + } + }, instantReplay: function () { this.hideTooltip(); this.request = null;