diff --git a/js/battle.js b/js/battle.js
index 8ed9d4d7b..b392956db 100755
--- a/js/battle.js
+++ b/js/battle.js
@@ -30,7 +30,7 @@ $.extend($.easing, {
});
var BattleSoundLibrary = (function () {
- function BattleSoundLibrary () {
+ function BattleSoundLibrary() {
// effects
this.effectCache = {};
@@ -113,7 +113,7 @@ var BattleSoundLibrary = (function () {
this.bgm.play();
}
}
- } catch(e) {}
+ } catch (e) {}
};
BattleSoundLibrary.prototype.pauseBgm = function () {
if (this.bgm) {
@@ -156,7 +156,7 @@ var BattleSoundLibrary = (function () {
var BattleSound = new BattleSoundLibrary();
var Pokemon = (function () {
- function Pokemon (species, side) {
+ function Pokemon(species, side) {
this.side = side;
this.atk = 0;
@@ -212,27 +212,27 @@ var Pokemon = (function () {
return '';
};
Pokemon.prototype.getPixelRange = function (pixels, color) {
- var epsilon = 0.5/714;
+ var epsilon = 0.5 / 714;
if (pixels === 0) return [0, 0];
- if (pixels === 1) return [0 + epsilon, 2/48 - epsilon];
+ if (pixels === 1) return [0 + epsilon, 2 / 48 - epsilon];
if (pixels === 9) {
if (color === 'y') { // ratio is > 0.2
- return [0.2 + epsilon, 10/48 - epsilon];
+ return [0.2 + epsilon, 10 / 48 - epsilon];
} else { // ratio is <= 0.2
- return [9/48, 0.2];
+ return [9 / 48, 0.2];
}
}
if (pixels === 24) {
if (color === 'g') { // ratio is > 0.5
- return [0.5 + epsilon, 25/48 - epsilon];
+ return [0.5 + epsilon, 25 / 48 - epsilon];
} else { // ratio is exactly 0.5
return [0.5, 0.5];
}
}
- if (pixels === 48) return [1, 1];
+ if (pixels === 48) return [1, 1];
- return [pixels/48, (pixels + 1)/48 - epsilon];
+ return [pixels / 48, (pixels + 1) / 48 - epsilon];
};
Pokemon.prototype.getFormattedRange = function (range, precision, separator) {
if (range[0] === range[1]) {
@@ -302,10 +302,10 @@ var Pokemon = (function () {
var pixels = Math.ceil(damage * 48 / 100);
return [pixels, 48, percent];
}
- if (hpstring.substr(hpstring.length-1) !== ')') {
+ if (hpstring.substr(hpstring.length - 1) !== ')') {
return false;
}
- hpstring = hpstring.substr(parenIndex+1, hpstring.length-parenIndex-2);
+ hpstring = hpstring.substr(parenIndex + 1, hpstring.length - parenIndex - 2);
}
var hp = hpstring.split(' ');
@@ -370,8 +370,8 @@ var Pokemon = (function () {
return (details === this.details.replace(/-[A-Za-z0-9*]+(, |$)/, '$1'));
};
Pokemon.prototype.getIdent = function () {
- var slots = ['a','b','c','d','e','f'];
- return this.ident.substr(0,2) + slots[this.slot] + this.ident.substr(2);
+ var slots = ['a', 'b', 'c', 'd', 'e', 'f'];
+ return this.ident.substr(0, 2) + slots[this.slot] + this.ident.substr(2);
};
Pokemon.prototype.removeVolatile = function (volatile) {
if (!this.hasVolatile(volatile)) return;
@@ -711,7 +711,7 @@ var Pokemon = (function () {
})();
var Sprite = (function () {
- function Sprite (spriteData, x, y, z, battle, siden) {
+ function Sprite(spriteData, x, y, z, battle, siden) {
this.battle = battle;
this.siden = siden;
this.forme = '';
@@ -776,7 +776,10 @@ var Sprite = (function () {
Sprite.prototype.animTransform = function (species) {
if (!this.oldsp) this.oldsp = this.sp;
if (species.volatiles && species.volatiles.formechange) species = species.volatiles.formechange[2];
- sp = Tools.getSpriteData(species, this.isBackSprite ? 0 : 1, {afd: this.battle.tier === "[Seasonal] Fools Festival", gen: this.battle.gen});
+ sp = Tools.getSpriteData(species, this.isBackSprite ? 0 : 1, {
+ afd: this.battle.tier === "[Seasonal] Fools Festival",
+ gen: this.battle.gen
+ });
this.sp = sp;
var self = this;
var battle = this.battle;
@@ -1155,7 +1158,7 @@ var Sprite = (function () {
})();
var Side = (function () {
- function Side (battle, n) {
+ function Side(battle, n) {
this.battle = battle;
this.name = '';
this.id = '';
@@ -1220,7 +1223,10 @@ var Side = (function () {
for (var i = 0; i < this.pokemon.length; i++) {
var poke = this.pokemon[i];
poke.sprite.destroy();
- poke.sprite = new Sprite(Tools.getSpriteData(poke, this.n, {afd: this.battle.tier === "[Seasonal] Fools Festival", gen: this.battle.gen}), this.x, this.y, this.z, this.battle, this.n);
+ poke.sprite = new Sprite(Tools.getSpriteData(poke, this.n, {
+ afd: this.battle.tier === "[Seasonal] Fools Festival",
+ gen: this.battle.gen
+ }), this.x, this.y, this.z, this.battle, this.n);
}
};
Side.prototype.setSprite = function (spriteid) {
@@ -1228,7 +1234,7 @@ var Side = (function () {
this.updateSidebar();
};
Side.prototype.setName = function (name, spriteid) {
- if (name) this.name = (name||'');
+ if (name) this.name = (name || '');
this.id = toId(this.name);
if (spriteid) {
this.spriteid = spriteid;
@@ -1271,15 +1277,15 @@ var Side = (function () {
pokemonhtml = '
' + pokemonhtml + '
';
if (this.n === 1) {
if (this.initialized) {
- this.battle.rightbarElem.html('' + Tools.escapeHTML(this.name) + '' + pokemonhtml + '
').find('.trainer').css('opacity',1);
+ this.battle.rightbarElem.html('' + Tools.escapeHTML(this.name) + '' + pokemonhtml + '
').find('.trainer').css('opacity', 1);
} else {
- this.battle.rightbarElem.find('.trainer').css('opacity',0.4);
+ this.battle.rightbarElem.find('.trainer').css('opacity', 0.4);
}
} else {
if (this.initialized) {
- this.battle.leftbarElem.html('' + Tools.escapeHTML(this.name) + '' + pokemonhtml + '
').find('.trainer').css('opacity',1);
+ this.battle.leftbarElem.html('' + Tools.escapeHTML(this.name) + '' + pokemonhtml + '
').find('.trainer').css('opacity', 1);
} else {
- this.battle.leftbarElem.find('.trainer').css('opacity',0.4);
+ this.battle.leftbarElem.find('.trainer').css('opacity', 0.4);
}
}
};
@@ -1509,7 +1515,10 @@ var Side = (function () {
if (!poke.ability && poke.baseAbility) poke.ability = poke.baseAbility;
poke.id = id;
poke.reset();
- poke.sprite = new Sprite(Tools.getSpriteData(poke, this.n, {afd: this.battle.tier === "[Seasonal] Fools Festival", gen: this.battle.gen}), this.x, this.y, this.z, this.battle, this.n);
+ poke.sprite = new Sprite(Tools.getSpriteData(poke, this.n, {
+ afd: this.battle.tier === "[Seasonal] Fools Festival",
+ gen: this.battle.gen
+ }), this.x, this.y, this.z, this.battle, this.n);
if (typeof replaceSlot !== 'undefined') {
this.pokemon[replaceSlot] = poke;
@@ -1522,19 +1531,19 @@ var Side = (function () {
// the other possibility is Illusion, which we'll assume
var existingTable = {};
- for (var i=0; i<6; i++) {
+ for (var i = 0; i < 6; i++) {
var poke1 = this.pokemon[i];
if (existingTable[poke1.searchid]) {
var j = existingTable[poke1.searchid];
var poke2 = this.pokemon[j];
if (this.active.indexOf(poke1) >= 0) {
- this.pokemon.splice(j,1);
+ this.pokemon.splice(j, 1);
} else if (this.active.indexOf(poke2) >= 0) {
- this.pokemon.splice(i,1);
+ this.pokemon.splice(i, 1);
} else if (poke1.fainted && !poke2.fainted) {
- this.pokemon.splice(j,1);
+ this.pokemon.splice(j, 1);
} else {
- this.pokemon.splice(i,1);
+ this.pokemon.splice(i, 1);
}
break;
}
@@ -1947,7 +1956,7 @@ var Side = (function () {
var $prevhp = pokemon.statbarElem.find('.prevhp');
$prevhp.css('width', pokemon.hpWidth(150) + 1);
if (hpcolor === 'g') $prevhp.removeClass('prevhp-yellow prevhp-red');
- else if (hpcolor ==='y' ) $prevhp.removeClass('prevhp-red').addClass('prevhp-yellow');
+ else if (hpcolor === 'y') $prevhp.removeClass('prevhp-red').addClass('prevhp-yellow');
else $prevhp.addClass('prevhp-red');
}
var status = '';
@@ -2068,7 +2077,7 @@ var Side = (function () {
})();
var Battle = (function () {
- function Battle (frame, logFrame, noPreload) {
+ function Battle(frame, logFrame, noPreload) {
frame.addClass('battle');
this.turn = 0;
@@ -2200,7 +2209,7 @@ var Battle = (function () {
Battle.prototype.updateGen = function () {
if (this.gen < 3) this.backdropImage = 'bg-gen1.png';
else if (this.gen < 6) this.backdropImage = 'bg.jpg';
- if (this.bgElem) this.bgElem.css('background-image','url(' + Tools.resourcePrefix + 'fx/' + this.backdropImage + ')');
+ if (this.bgElem) this.bgElem.css('background-image', 'url(' + Tools.resourcePrefix + 'fx/' + this.backdropImage + ')');
};
Battle.prototype.reset = function (dontResetSound) {
// battle state
@@ -2351,7 +2360,7 @@ var Battle = (function () {
left += (410 - 190) * (loc.z / 200);
top += (135 - 245) * (loc.z / 200);
left += Math.floor(loc.x * scale);
- top -= Math.floor(loc.y * scale /* - loc.x * scale / 4 */ );
+ top -= Math.floor(loc.y * scale /* - loc.x * scale / 4 */);
width = Math.floor(obj.w * scale * loc.xscale);
height = Math.floor(obj.h * scale * loc.yscale);
left -= Math.floor(width / 2);
@@ -2581,7 +2590,7 @@ var Battle = (function () {
};
Battle.prototype.setTurn = function (turnnum) {
turnnum = parseInt(turnnum);
- if (turnnum == this.turn+1) {
+ if (turnnum == this.turn + 1) {
this.endLastTurnPending = true;
}
this.turn = turnnum;
@@ -2703,7 +2712,7 @@ var Battle = (function () {
this.log('' + newWeather.upkeepMessage + '
');
this.weatherTimeLeft = 0;
this.weatherMinTimeLeft = 0;
- } else if (weather === 'deltastream' || weather === 'desolateland' || weather === 'primordialsea'){
+ } else if (weather === 'deltastream' || weather === 'desolateland' || weather === 'primordialsea') {
this.message('' + newWeather.startMessage + '');
this.weatherTimeLeft = 0;
this.weatherMinTimeLeft = 0;
@@ -2805,7 +2814,7 @@ var Battle = (function () {
}
if (weather) {
if (this.fastForward) {
- this.weatherElem.css({opacity:.4});
+ this.weatherElem.css({opacity: .4});
return;
}
this.weatherElem.animate({
@@ -2928,7 +2937,7 @@ var Battle = (function () {
if (fromeffect.id === 'magiccoat') {
pokemon.addTurnstatus('magiccoat');
}
- this.message(target.getName() + "'s " + move.name + " was bounced back by " + fromeffect.name + "!");
+ this.message(target.getName() + "'s " + move.name + " was bounced back by " + fromeffect.name + "!");
break;
case 'metronome':
this.message('Waggling a finger let it use ' + move.name + '!');
@@ -2975,9 +2984,9 @@ var Battle = (function () {
var buttons = ["A", "B", "START", "SELECT", "UP", "DOWN", "LEFT", "RIGHT", "DEMOCRACY", "ANARCHY"];
var people = ["Zarel", "The Immortal", "Diatom", "Nani Man", "shaymin", "apt-get", "sirDonovan", "Arcticblast", "Goddess Briyella"];
var button;
- for (var i=0; i<10; i++) {
- var name = people[Math.floor(Math.random()*people.length)];
- if (!button) button = buttons[Math.floor(Math.random()*buttons.length)];
+ for (var i = 0; i < 10; i++) {
+ var name = people[Math.floor(Math.random() * people.length)];
+ if (!button) button = buttons[Math.floor(Math.random() * buttons.length)];
this.log('' + Tools.escapeHTML(name) + ': ' + button + '
');
button = (name === 'Diatom' ? "thanks diatom" : null);
}
@@ -3084,7 +3093,7 @@ var Battle = (function () {
this.message('' + pokemon.getName() + (move.name ? ' can\'t use ' + move.name + '' : ' can\'t move') + '!');
break;
}
- pokemon.sprite.anim({time:1});
+ pokemon.sprite.anim({time: 1});
};
Battle.prototype.prepareMove = function (pokemon, move, target) {
if (!move.prepareAnim) return;
@@ -3287,13 +3296,12 @@ var Battle = (function () {
case '-sethp':
var effect = Tools.getEffect(kwargs.from);
var poke, ofpoke;
- for (var k=0; k<2; k++)
- {
- var cpoke = this.getPokemon(args[1+2*k]);
+ for (var k = 0; k < 2; k++) {
+ var cpoke = this.getPokemon(args[1 + 2 * k]);
if (cpoke) {
var oldhp = cpoke.hp;
- cpoke.healthParse(args[2+2*k]);
- var diff = parseFloat(args[2+2*k]);
+ cpoke.healthParse(args[2 + 2 * k]);
+ var diff = parseFloat(args[2 + 2 * k]);
if (isNaN(diff)) {
diff = cpoke.hp - oldhp;
}
@@ -3303,8 +3311,8 @@ var Battle = (function () {
this.damageAnim(cpoke, -diff, animDelay);
}
}
- if (k==0) poke = cpoke;
- if (k==1) ofpoke = cpoke;
+ if (k == 0) poke = cpoke;
+ if (k == 1) ofpoke = cpoke;
}
switch (effect.id) {
case 'painsplit':
@@ -3339,7 +3347,7 @@ var Battle = (function () {
if (effect.effectType === 'Item') {
actions += "The " + effect.name + amountString + " raised " + poke.getLowerName() + "'s " + BattleStats[stat] + "!";
} else {
- actions += "" + poke.getName() + "'s " + effect.name +amountString + " raised its " + BattleStats[stat] + "!";
+ actions += "" + poke.getName() + "'s " + effect.name + amountString + " raised its " + BattleStats[stat] + "!";
}
break;
}
@@ -3387,7 +3395,7 @@ var Battle = (function () {
var effect = Tools.getEffect(kwargs.from);
var ofpoke = this.getPokemon(kwargs.of);
poke.boosts[stat] = amount;
- this.resultAnim(poke, poke.getBoost(stat), (amount>0?'good':'bad'), animDelay);
+ this.resultAnim(poke, poke.getBoost(stat), (amount > 0 ? 'good' : 'bad'), animDelay);
if (kwargs.silent) {
// do nothing
@@ -3405,10 +3413,9 @@ var Battle = (function () {
case '-swapboost':
var poke = this.getPokemon(args[1]);
var poke2 = this.getPokemon(args[2]);
- var stats = args[3]?args[3].split(', '):['atk','def','spa','spd','spe','accuracy','evasion'];
+ var stats = args[3] ? args[3].split(', ') : ['atk', 'def', 'spa', 'spd', 'spe', 'accuracy', 'evasion'];
var effect = Tools.getEffect(kwargs.from);
- for (var i=0; i' + Tools.escapeHTML(ruleArgs[0]) + (ruleArgs[1]?':':'') + ' ' + Tools.escapeHTML(ruleArgs[1]||'') + '');
+ this.log('' + Tools.escapeHTML(ruleArgs[0]) + (ruleArgs[1] ? ':' : '') + ' ' + Tools.escapeHTML(ruleArgs[1] || '') + '
');
break;
case 'rated':
this.rated = true;
@@ -5350,18 +5353,18 @@ var Battle = (function () {
clickableName = Tools.escapeHTML(name);
}
var message = args.join('|');
- if (message.substr(0,2) === '//') {
+ if (message.substr(0, 2) === '//') {
this.log('' + clickableName + ': ' + Tools.parseMessage(message.substr(1)) + '
', preempt);
- } else if (message.substr(0,4).toLowerCase() === '/me ') {
+ } else if (message.substr(0, 4).toLowerCase() === '/me ') {
this.log('• ' + clickableName + ' ' + Tools.parseMessage(message.substr(4)) + '
', preempt);
- } else if (message.substr(0,14).toLowerCase() === '/data-pokemon ') {
- if (window.Chart) this.log('' + Chart.pokemonRow(Tools.getTemplate(message.substr(14)),'',{},false,true) + '
', preempt);
- } else if (message.substr(0,11).toLowerCase() === '/data-item ') {
- if (window.Chart) this.log('' + Chart.itemRow(Tools.getItem(message.substr(11)),'',{},false,true) + '
', preempt);
- } else if (message.substr(0,14).toLowerCase() === '/data-ability ') {
- if (window.Chart) this.log('' + Chart.abilityRow(Tools.getAbility(message.substr(14)),'',{},false,true) + '
', preempt);
- } else if (message.substr(0,11).toLowerCase() === '/data-move ') {
- if (window.Chart) this.log('' + Chart.moveRow(Tools.getMove(message.substr(11)),'',{},false,true) + '
', preempt);
+ } else if (message.substr(0, 14).toLowerCase() === '/data-pokemon ') {
+ if (window.Chart) this.log('' + Chart.pokemonRow(Tools.getTemplate(message.substr(14)), '', {}, false, true) + '
', preempt);
+ } else if (message.substr(0, 11).toLowerCase() === '/data-item ') {
+ if (window.Chart) this.log('' + Chart.itemRow(Tools.getItem(message.substr(11)), '', {}, false, true) + '
', preempt);
+ } else if (message.substr(0, 14).toLowerCase() === '/data-ability ') {
+ if (window.Chart) this.log('' + Chart.abilityRow(Tools.getAbility(message.substr(14)), '', {}, false, true) + '
', preempt);
+ } else if (message.substr(0, 11).toLowerCase() === '/data-move ') {
+ if (window.Chart) this.log('' + Chart.moveRow(Tools.getMove(message.substr(11)), '', {}, false, true) + '
', preempt);
} else {
this.log('' + clickableName + ': ' + Tools.parseMessage(message) + '
', preempt);
}
@@ -5425,7 +5428,7 @@ var Battle = (function () {
case 'clearpoke':
this.p1.pokemon = [];
this.p2.pokemon = [];
- for (var i=0; i' + Tools.escapeHTML(str) + '', preempt);
} else {
@@ -5585,37 +5587,37 @@ var Battle = (function () {
if (str !== '|') {
args = str.substr(1).split('|');
}
- while (args[args.length-1] && args[args.length-1].substr(0,1) === '[') {
- var bracketPos = args[args.length-1].indexOf(']');
+ while (args[args.length - 1] && args[args.length - 1].substr(0, 1) === '[') {
+ var bracketPos = args[args.length - 1].indexOf(']');
if (bracketPos <= 0) break;
var argstr = args.pop();
// default to '.' so it evaluates to boolean true
- kwargs[argstr.substr(1,bracketPos-1)] = ($.trim(argstr.substr(bracketPos+1)) || '.');
+ kwargs[argstr.substr(1, bracketPos - 1)] = ($.trim(argstr.substr(bracketPos + 1)) || '.');
}
// parse the next line if it's a minor: runMinor needs it parsed to determine when to merge minors
var nextLine = '', nextArgs = [''], nextKwargs = {};
- nextLine = this.activityQueue[this.activityStep+1];
- if (nextLine && nextLine.substr(0,2) === '|-') {
+ nextLine = this.activityQueue[this.activityStep + 1];
+ if (nextLine && nextLine.substr(0, 2) === '|-') {
nextLine = $.trim(nextLine.substr(1));
nextArgs = nextLine.split('|');
- while (nextArgs[nextArgs.length-1] && nextArgs[nextArgs.length-1].substr(0,1) === '[') {
- var bracketPos = nextArgs[nextArgs.length-1].indexOf(']');
+ while (nextArgs[nextArgs.length - 1] && nextArgs[nextArgs.length - 1].substr(0, 1) === '[') {
+ var bracketPos = nextArgs[nextArgs.length - 1].indexOf(']');
if (bracketPos <= 0) break;
var argstr = nextArgs.pop();
// default to '.' so it evaluates to boolean true
- nextKwargs[argstr.substr(1,bracketPos-1)] = ($.trim(argstr.substr(bracketPos+1)) || '.');
+ nextKwargs[argstr.substr(1, bracketPos - 1)] = ($.trim(argstr.substr(bracketPos + 1)) || '.');
}
}
if (this.debug) {
- if (args[0].substr(0,1) === '-') {
+ if (args[0].substr(0, 1) === '-') {
this.runMinor(args, kwargs, preempt, nextArgs, nextKwargs);
} else {
this.runMajor(args, kwargs, preempt);
}
} else try {
- if (args[0].substr(0,1) === '-') {
+ if (args[0].substr(0, 1) === '-') {
this.runMinor(args, kwargs, preempt, nextArgs, nextKwargs);
} else {
this.runMajor(args, kwargs, preempt);
@@ -5624,7 +5626,7 @@ var Battle = (function () {
this.log('Error parsing: ' + Tools.escapeHTML(str) + '
', preempt);
if (e.stack) {
var stack = '' + e.stack;
- stack = stack.split("\n").slice(0,2).join("\n");
+ stack = stack.split("\n").slice(0, 2).join("\n");
this.log('' + Tools.escapeHTML(stack) + '
', preempt);
} else {
this.log('Error: ' + Tools.escapeHTML('' + e) + '
', preempt);
diff --git a/js/battledata.js b/js/battledata.js
index 171de1cc6..6f92d788c 100755
--- a/js/battledata.js
+++ b/js/battledata.js
@@ -43,7 +43,7 @@ for (var i=0; i$1');
+ options.hidemonospace ? '$1' : '$1');
// ~~strikethrough~~
str = str.replace(/\~\~([^< ](?:[^<]*?[^< ])??)\~\~/g,
- options.hidestrikethrough ? '$1' : '$1');
+ options.hidestrikethrough ? '$1' : '$1');
// <>
str = str.replace(/<<([a-z0-9-]+)>>/g,
- options.hidelinks ? '«$1»' : '«$1»');
+ options.hidelinks ? '«$1»' : '«$1»');
// linking of URIs
if (!options.hidelinks) {
str = str.replace(linkRegex, function (uri) {
@@ -397,11 +396,11 @@ var Tools = {
} else {
event = 'Interstice link';
fulluri = Tools.escapeHTML(Tools.interstice.getURI(
- Tools.unescapeHTML(fulluri)
+ Tools.unescapeHTML(fulluri)
));
}
onclick = 'if (window.ga) ga(\'send\', \'event\', \'' +
- event + '\', \'' + Tools.escapeQuotes(fulluri) + '\');';
+ event + '\', \'' + Tools.escapeQuotes(fulluri) + '\');';
}
if (uri.substr(0, 24) === 'https://docs.google.com/' || uri.substr(0, 16) === 'docs.google.com/') {
if (uri.slice(0, 5) === 'https') uri = uri.slice(8);
@@ -447,12 +446,12 @@ var Tools = {
str = str.replace(/\[\[([^< ](?:[^<`]*?[^< ])??)\]\]/ig, function (p0, p1) {
var q = Tools.escapeHTML(encodeURIComponent(Tools.unescapeHTML(p1)));
return '' + p1 +'';
+ '" target="_blank">' + p1 + '';
});
}
// __italics__
str = str.replace(/\_\_([^< ](?:[^<]*?[^< ])??)\_\_(?![^<]*?<\/a)/g,
- options.hideitalics ? '$1' : '$1');
+ options.hideitalics ? '$1' : '$1');
// **bold**
str = str.replace(/\*\*([^< ](?:[^<]*?[^< ])??)\*\*/g,
options.hidebold ? '$1' : '$1');
@@ -496,14 +495,14 @@ var Tools = {
},
escapeHTML: function (str, jsEscapeToo) {
- str = (str?'' + str:'');
+ str = (str ? '' + str : '');
str = str.replace(/&/g, '&').replace(//g, '>').replace(/"/g, '"');
if (jsEscapeToo) str = str.replace(/'/g, '\\\'');
return str;
},
unescapeHTML: function (str) {
- str = (str?'' + str:'');
+ str = (str ? '' + str : '');
return str.replace(/"/g, '"').replace(/>/g, '>').
replace(/</g, '<').replace(/&/g, '&');
},
@@ -513,7 +512,7 @@ var Tools = {
},
escapeQuotes: function (str) {
- str = (str?'' + str:'');
+ str = (str ? '' + str : '');
str = str.replace(/'/g, '\\\'');
return str;
},
@@ -668,12 +667,12 @@ var Tools = {
getEffect: function (effect) {
if (!effect || typeof effect === 'string') {
- var name = $.trim(effect||'');
- if (name.substr(0,5) === 'item:') {
+ var name = $.trim(effect || '');
+ if (name.substr(0, 5) === 'item:') {
return Tools.getItem(name.substr(5));
- } else if (name.substr(0,8) === 'ability:') {
+ } else if (name.substr(0, 8) === 'ability:') {
return Tools.getAbility(name.substr(8));
- } else if (name.substr(0,5) === 'move:') {
+ } else if (name.substr(0, 5) === 'move:') {
return Tools.getMove(name.substr(5));
}
var id = toId(name);
@@ -715,12 +714,12 @@ var Tools = {
getMove: function (move) {
if (!move || typeof move === 'string') {
- var name = $.trim(move||'');
+ var name = $.trim(move || '');
var id = toId(name);
move = (window.BattleMovedex && window.BattleMovedex[id]) || {};
if (move.name) move.exists = true;
- if (!move.exists && id.substr(0,11) === 'hiddenpower' && id.length > 11) {
+ if (!move.exists && id.substr(0, 11) === 'hiddenpower' && id.length > 11) {
var matches = /([a-z]*)([0-9]*)/.exec(id);
move = (window.BattleMovedex && window.BattleMovedex[matches[1]]) || {};
move = $.extend({}, move);
@@ -746,7 +745,7 @@ var Tools = {
getItem: function (item) {
if (!item || typeof item === 'string') {
- var name = $.trim(item||'');
+ var name = $.trim(item || '');
var id = toId(name);
item = (window.BattleItems && window.BattleItems[id]) || {};
if (item.name) item.exists = true;
@@ -760,7 +759,7 @@ var Tools = {
getAbility: function (ability) {
if (!ability || typeof ability === 'string') {
- var name = $.trim(ability||'');
+ var name = $.trim(ability || '');
var id = toId(name);
ability = (window.BattleAbilities && window.BattleAbilities[id]) || {};
if (ability.name) ability.exists = true;
@@ -789,12 +788,12 @@ var Tools = {
template.forme = id.substr(k.length);
}
}
- if (id !== 'yanmega' && id.substr(id.length-4) === 'mega') {
- template.baseSpecies = id.substr(0, id.length-4);
- template.forme = id.substr(id.length-4);
- } else if (id.substr(id.length-6) === 'primal') {
- template.baseSpecies = id.substr(0, id.length-6);
- template.forme = id.substr(id.length-6);
+ if (id !== 'yanmega' && id.substr(id.length - 4) === 'mega') {
+ template.baseSpecies = id.substr(0, id.length - 4);
+ template.forme = id.substr(id.length - 4);
+ } else if (id.substr(id.length - 6) === 'primal') {
+ template.baseSpecies = id.substr(0, id.length - 6);
+ template.forme = id.substr(id.length - 6);
}
template.exists = false;
}
@@ -855,7 +854,7 @@ var Tools = {
getType: function (type) {
if (!type || typeof type === 'string') {
var id = toId(type);
- id = id.substr(0,1).toUpperCase() + id.substr(1);
+ id = id.substr(0, 1).toUpperCase() + id.substr(1);
type = (window.BattleTypeChart && window.BattleTypeChart[id]) || {};
if (type.damageTaken) type.exists = true;
if (!type.id) type.id = id;
@@ -936,7 +935,7 @@ var Tools = {
name += '-f';
spriteType += 'f';
}
- if (!Tools.prefs('noanim') && gen in {'bw':1, 'xy':1}) {
+ if (!Tools.prefs('noanim') && gen in {'bw': 1, 'xy': 1}) {
spriteType = 'ani' + spriteType;
dir = gen + 'ani' + dir;
@@ -947,7 +946,7 @@ var Tools = {
}
}
// if there is no entry or enough data in pokedex-mini.js or the animations are disabled or past gen, use the proper sprites
- gen = (gen === 'xy')? 'bw' : gen;
+ gen = (gen === 'xy') ? 'bw' : gen;
dir = gen + dir;
spriteData.url += dir + '/' + name + '.png';
@@ -1047,26 +1046,26 @@ var Tools = {
"kyogreprimal": 909,
"groudonprimal": 910,
"rayquazamega": 911,
- "syclant": 832+0,
- "revenankh": 832+1,
- "pyroak": 832+2,
- "fidgit": 832+3,
- "stratagem": 832+4,
- "arghonaut": 832+5,
- "kitsunoh": 832+6,
- "cyclohm": 832+7,
- "colossoil": 832+8,
- "krilowatt": 832+9,
- "voodoom": 832+10,
- "tomohawk": 832+11,
- "necturna": 832+12,
- "mollux": 832+13,
- "aurumoth": 832+14,
- "malaconda": 832+15,
- "cawmodore": 832+16,
- "volkraken": 832+17,
- "plasmanta": 832+18,
- "naviathan": 832+19
+ "syclant": 832 + 0,
+ "revenankh": 832 + 1,
+ "pyroak": 832 + 2,
+ "fidgit": 832 + 3,
+ "stratagem": 832 + 4,
+ "arghonaut": 832 + 5,
+ "kitsunoh": 832 + 6,
+ "cyclohm": 832 + 7,
+ "colossoil": 832 + 8,
+ "krilowatt": 832 + 9,
+ "voodoom": 832 + 10,
+ "tomohawk": 832 + 11,
+ "necturna": 832 + 12,
+ "mollux": 832 + 13,
+ "aurumoth": 832 + 14,
+ "malaconda": 832 + 15,
+ "cawmodore": 832 + 16,
+ "volkraken": 832 + 17,
+ "plasmanta": 832 + 18,
+ "naviathan": 832 + 19
};
if (altNums[id]) {
num = altNums[id];
@@ -1080,7 +1079,7 @@ var Tools = {
var top = 8 + Math.floor(num / 16) * 32;
var left = (num % 16) * 32;
- var fainted = (pokemon && pokemon.fainted?';opacity:.4':'');
+ var fainted = (pokemon && pokemon.fainted ? ';opacity:.4' : '');
return 'background:transparent url(' + Tools.resourcePrefix + 'sprites/bwicons-sheet.png?g6) no-repeat scroll -' + left + 'px -' + top + 'px' + fainted;
},
@@ -1099,9 +1098,9 @@ var Tools = {
if (Tools.getTemplate(pokemon.species).exists === false) {
return 'background-image:url(' + Tools.resourcePrefix + 'sprites/bw/0.png)';
}
- var shiny = (pokemon.shiny?'-shiny':'');
+ var shiny = (pokemon.shiny ? '-shiny' : '');
if (BattlePokemonSprites && BattlePokemonSprites[id] && BattlePokemonSprites[id].front && BattlePokemonSprites[id].front.anif && pokemon.gender === 'F') {
- id+='-f';
+ id += '-f';
}
return 'background-image:url(' + Tools.resourcePrefix + 'sprites/bw' + shiny + '/' + id + '.png)';
},
@@ -1118,7 +1117,7 @@ var Tools = {
getTypeIcon: function (type, b) { // b is just for utilichart.js
if (!type) return '';
- var sanitizedType = type.replace(/\?/g,'%3f');
- return '
';
+ var sanitizedType = type.replace(/\?/g, '%3f');
+ return '
';
}
};
diff --git a/js/client-battle.js b/js/client-battle.js
index 486d94176..bbf3f30fb 100755
--- a/js/client-battle.js
+++ b/js/client-battle.js
@@ -74,7 +74,7 @@
},
init: function (data) {
var log = data.split('\n');
- if (data.substr(0,6) === '|init|') log.shift();
+ if (data.substr(0, 6) === '|init|') log.shift();
if (log.length && log[0].substr(0, 7) === '|title|') {
this.title = log[0].substr(7);
log.shift();
@@ -87,10 +87,10 @@
},
add: function (data) {
if (!data) return;
- if (data.substr(0,6) === '|init|') {
+ if (data.substr(0, 6) === '|init|') {
return this.init(data);
}
- if (data.substr(0,9) === '|request|') {
+ if (data.substr(0, 9) === '|request|') {
return this.receiveRequest($.parseJSON(data.substr(9)));
}
@@ -295,7 +295,7 @@
this.choice.choices.push('pass');
}
}
- var pos = this.choice.choices.length - (type === 'movetarget'?1:0);
+ var pos = this.choice.choices.length - (type === 'movetarget' ? 1 : 0);
// hp bar
var hpbar = '';
@@ -335,23 +335,23 @@
var myActive = this.battle.mySide.active;
var yourActive = this.battle.yourSide.active;
- var yourSlot = yourActive.length-1-pos;
- for (var i = yourActive.length-1; i >= 0; i--) {
+ var yourSlot = yourActive.length - 1 - pos;
+ for (var i = yourActive.length - 1; i >= 0; i--) {
var pokemon = yourActive[i];
var disabled = false;
if (moveTarget === 'adjacentAlly' || moveTarget === 'adjacentAllyOrSelf') {
disabled = true;
} else if (moveTarget === 'normal' || moveTarget === 'adjacentFoe') {
- if (Math.abs(yourSlot-i) > 1) disabled = true;
+ if (Math.abs(yourSlot - i) > 1) disabled = true;
}
if (disabled) {
controls += ' ';
} else if (!pokemon || pokemon.zerohp) {
- controls += ' ';
+ controls += ' ';
} else {
- controls += ' ';
+ controls += ' ';
}
}
controls += ' ';
@@ -407,7 +407,7 @@
movebuttons += '