From 022e1e77ea46305c811be0e3374e249804090ba5 Mon Sep 17 00:00:00 2001 From: Guangcong Luo Date: Sat, 9 Sep 2017 20:11:32 -0400 Subject: [PATCH] Support >6 Pokemon in Team Preview --- js/battle.js | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/js/battle.js b/js/battle.js index 61495ff2f..3591a2dbd 100644 --- a/js/battle.js +++ b/js/battle.js @@ -1722,12 +1722,14 @@ var Side = (function () { gen: this.battle.gen }), this.x, this.y, this.z, this.battle, this.n); - if (typeof replaceSlot !== 'undefined') { + if (typeof replaceSlot === 'undefined') replaceSlot = -1; + if (replaceSlot >= 0) { this.pokemon[replaceSlot] = poke; } else { this.pokemon.push(poke); } - if (this.pokemon.length == 7 || this.battle.speciesClause) { + if (replaceSlot === -2) this.battle.maxPokemon = this.pokemon.length; + if (this.pokemon.length > this.battle.maxPokemon || this.battle.speciesClause) { // check for Illusion var existingTable = {}; for (var i = 0; i < this.pokemon.length; i++) { @@ -2342,7 +2344,8 @@ var Battle = (function () { this.p2 = null; this.sides = []; this.lastMove = ''; - this.gen = 6; + this.gen = 7; + this.maxPokemon = 6; this.speciesClause = false; this.frameElem = frame; @@ -6185,7 +6188,7 @@ var Battle = (function () { gender: gender, shiny: shiny, slot: slot - }); + }, isNew ? -2 : -1); return pokemon; }; Battle.prototype.getSide = function (sidename) {