Suppress crash on move request with all actives fainted

There's a weird bug in which it's possible to open a choose-move
screen when the client believes that all your active Pokemon are
fainted (this is not true). It seems to involve having a team
with multiple Pokemon with the same name, multiple Pokemon
with the same species, and/or Illusion (in case it was unclear,
this is a Hackmons-specific bug).

I don't have time to look at it in depth, but this commit
suppresses it enough to make PS playable instead of crashing
in that situation.
This commit is contained in:
Guangcong Luo 2014-02-25 12:28:04 -06:00
parent a38adf728a
commit 24c07d3271
3 changed files with 5376 additions and 1 deletions

5361
js/battle-beta.js Normal file

File diff suppressed because it is too large Load Diff

14
js/battlescene.js Normal file
View File

@ -0,0 +1,14 @@
/**
* Battle Scene library
* Pokemon Showdown - http://pokemonshowdown.com/
*
* @license GPLv2 <http://www.gnu.org/licenses/gpl-2.0.html>
*/
function BattleScene {
//
}
function BattleSprite {
//
}

View File

@ -252,7 +252,7 @@
choices: [],
switchFlags: {}
}
while (switchables[this.choice.choices.length] && switchables[this.choice.choices.length].fainted) {
if (this.choice.choices.length > 1) while (switchables[this.choice.choices.length] && switchables[this.choice.choices.length].fainted) {
this.choice.choices.push('pass');
}
}