Request full team order for duplicate species

Otherwise, the opponent can abuse the data shown in Team Preview to
discriminate them on switch-in.
This commit is contained in:
Ivo Julca
2016-06-17 12:36:20 -05:00
parent 9a17312ca5
commit a7ad0d512e

View File

@@ -591,6 +591,8 @@
}
controls += 'How will you start the battle?</div>';
controls += '<div class="switchcontrols"><div class="switchselect"><button name="selectSwitch">Choose Lead</button></div><div class="switchmenu">';
var speciesTable = {};
for (var i = 0; i < switchables.length; i++) {
var pokemon = switchables[i];
if (i >= 6) {
@@ -598,7 +600,13 @@
}
if (toId(pokemon.baseAbility) === 'illusion') {
this.choice.count = 6;
break;
}
if (speciesTable[pokemon.species]) {
this.choice.count = 6;
break;
}
speciesTable[pokemon.species] = 1;
controls += '<button name="chooseTeamPreview" value="' + i + '"' + this.tooltips.tooltipAttrs(i, 'sidepokemon') + '><span class="picon" style="' + Tools.getPokemonIcon(pokemon) + '"></span>' + Tools.escapeHTML(pokemon.name) + '</button> ';
}
if (this.battle.teamPreviewCount) this.choice.count = parseInt(this.battle.teamPreviewCount, 10);