diff --git a/js/client-battle.js b/js/client-battle.js index c4fbc6d6a..be86d2448 100644 --- a/js/client-battle.js +++ b/js/client-battle.js @@ -959,10 +959,12 @@ text += '
HP: ' + pokemon.hpDisplay() +exacthp+(pokemon.status?' '+pokemon.status.toUpperCase()+'':'')+'
'; if (this.battle.gen > 2) { if (!pokemon.baseAbility && !pokemon.ability) { - text += 'Possible abilities: ' + Tools.getAbility(template.abilities['0']).name; - if (template.abilities['1']) text += ', ' + Tools.getAbility(template.abilities['1']).name; - if (template.abilities['H']) text += ', ' + Tools.getAbility(template.abilities['H']).name; - text += '
'; + if (template.abilities) { + text += 'Possible abilities: ' + Tools.getAbility(template.abilities['0']).name; + if (template.abilities['1']) text += ', ' + Tools.getAbility(template.abilities['1']).name; + if (template.abilities['H']) text += ', ' + Tools.getAbility(template.abilities['H']).name; + text += '
'; + } } else if (pokemon.ability) { text += 'Ability: ' + Tools.getAbility(pokemon.ability).name + '
'; } else if (pokemon.baseAbility) { diff --git a/js/client-teambuilder.js b/js/client-teambuilder.js index 4a3c71ae5..6cc688e41 100644 --- a/js/client-teambuilder.js +++ b/js/client-teambuilder.js @@ -14,9 +14,7 @@ this.update(); }, focus: function() { - if (!Tools.movelists) { - this.buildMovelists(); - } + this.buildMovelists(); }, blur: function() { if (this.saveFlag) { @@ -813,7 +811,7 @@ // cache movelist ref var speciesid = toId(this.curSet.species); var g6 = (this.curTeam.format && this.curTeam.format.substr(0,7) === 'vgc2014'); - this.movelist = (g6 ? Tools.g6movelists[speciesid] : Tools.movelists[speciesid]); + this.applyMovelist(g6, speciesid); this.$chart.html('Loading '+this.curChartType+'...'); var self = this; @@ -829,7 +827,7 @@ // cache movelist ref var speciesid = toId(this.curSet.species); var g6 = (this.curTeam.format && this.curTeam.format.substr(0,7) === 'vgc2014'); - this.movelist = (g6 ? Tools.g6movelists[speciesid] : Tools.movelists[speciesid]); + this.applyMovelist(g6, speciesid); var self = this; if (this.updateChartTimeout) clearTimeout(this.updateChartTimeout); @@ -1911,6 +1909,7 @@ // initialization buildMovelists: function() { + if (Tools.movelists) return; if (!window.BattlePokedex) return; Tools.movelists = {}; Tools.g6movelists = {}; @@ -1939,6 +1938,16 @@ Tools.g6movelists[pokemon] = g6moves; } }, + applyMovelist: function(g6only, speciesid) { + this.buildMovelists(); + if (!Tools.movelists) { + this.movelist = false; + } else if (g6only) { + this.movelist = Tools.g6movelists[speciesid]; + } else { + this.movelist = Tools.movelists[speciesid]; + } + }, destroy: function() { app.clearGlobalListeners(); Room.prototype.destroy.call(this);