mirror of
https://github.com/smogon/pokemon-showdown-client.git
synced 2026-09-11 21:38:42 -05:00
Suppress a few crashes
This commit is contained in:
@@ -959,10 +959,12 @@
|
||||
text += '<p>HP: ' + pokemon.hpDisplay() +exacthp+(pokemon.status?' <span class="status '+pokemon.status+'">'+pokemon.status.toUpperCase()+'</span>':'')+'</p>';
|
||||
if (this.battle.gen > 2) {
|
||||
if (!pokemon.baseAbility && !pokemon.ability) {
|
||||
text += '<p>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 += '</p>';
|
||||
if (template.abilities) {
|
||||
text += '<p>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 += '</p>';
|
||||
}
|
||||
} else if (pokemon.ability) {
|
||||
text += '<p>Ability: ' + Tools.getAbility(pokemon.ability).name + '</p>';
|
||||
} else if (pokemon.baseAbility) {
|
||||
|
||||
@@ -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('<em>Loading '+this.curChartType+'...</em>');
|
||||
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);
|
||||
|
||||
Reference in New Issue
Block a user