From 70e35b7599a095d23cd1ef02b7234151bb710941 Mon Sep 17 00:00:00 2001 From: Guangcong Luo Date: Tue, 20 Oct 2020 08:56:37 -0400 Subject: [PATCH] Revert "[WIP] Client changes for multi battle (#1631)" It's causing problems in double battles. This reverts commit 8bd57951e5bde59b7638db3189015b1812632e57. --- js/client-battle.js | 54 +++++++++++++++------------------------ js/client-chat.js | 11 +++----- js/client-mainmenu.js | 18 +------------ src/battle-animations.ts | 5 ---- src/battle-text-parser.ts | 4 +-- src/battle-tooltips.ts | 2 +- src/battle.ts | 44 ++++++++++++++----------------- src/panel-battle.tsx | 6 +---- 8 files changed, 49 insertions(+), 95 deletions(-) diff --git a/js/client-battle.js b/js/client-battle.js index 8405e7467..7e86b712a 100644 --- a/js/client-battle.js +++ b/js/client-battle.js @@ -381,7 +381,7 @@ if (this.request.forceSwitch !== true) { var faintedLength = _.filter(this.request.forceSwitch, function (fainted) {return fainted;}).length; - var freedomDegrees = faintedLength - _.filter(switchables.slice(this.battle.mySide.active.length), function (mon) {return !mon.fainted && !mon.notMine;}).length; + var freedomDegrees = faintedLength - _.filter(switchables.slice(this.battle.mySide.active.length), function (mon) {return !mon.fainted;}).length; this.choice.freedomDegrees = Math.max(freedomDegrees, 0); this.choice.canSwitch = faintedLength - this.choice.freedomDegrees; } @@ -402,9 +402,6 @@ done: 0, count: 1 }; - if (this.battle.gameType === 'multi') { - this.choice.count = 1; - } if (this.battle.gameType === 'doubles') { this.choice.count = 2; } @@ -517,8 +514,7 @@ } var moveTarget = this.choice ? this.choice.moveTarget : ''; - var pos = this.choice.choices.length; - if (type === 'movetarget') pos--; + var pos = this.choice.choices.length - (type === 'movetarget' ? 1 : 0); var hpRatio = switchables[pos].hp / switchables[pos].maxhp; @@ -555,10 +551,6 @@ if (type === 'movetarget') { requestTitle += 'At who? '; - if (this.request && this.request.side) { - pos += Math.floor((parseInt(this.side.charAt(1), 10) - 1) / 2); - } - var targetMenus = ['', '']; var myActive = this.battle.mySide.active; var yourActive = this.battle.yourSide.active; @@ -792,9 +784,8 @@ for (var i = 0; i < switchables.length; i++) { var pokemon = switchables[i]; var tooltipArgs = 'switchpokemon|' + i; - if (pokemon.fainted || i < (this.battle.pokemonControlled || this.battle.mySide.active.length) || pokemon.notMine || this.choice.switchFlags[i]) { - var disabledReason = pokemon.notMine ? ',notMine' : pokemon.fainted ? ',fainted' : i < (this.battle.pokemonControlled || this.battle.mySide.active.length) ? ',active' : ''; - switchMenu += '