Cleanup: remove several unused variables

This commit is contained in:
Ivo Julca 2015-11-07 17:34:21 -05:00
parent 90973d5c0c
commit 04c64c143e
9 changed files with 7 additions and 26 deletions

View File

@ -4389,7 +4389,6 @@ Battle = (function () {
side.emitCallback('trapped', i);
return false;
} else if (side.pokemon[i].maybeTrapped) {
let finalDecision = true;
decisions.finalDecision = decisions.finalDecision || side.pokemon[i].isLastActive();
}
}

View File

@ -12981,7 +12981,6 @@ exports.BattleMovedex = {
this.effectData.layers++;
},
onSwitchIn: function (pokemon) {
var side = pokemon.side;
if (!pokemon.isGrounded()) return;
var damageAmounts = [0, 3, 4, 6]; // 1/8, 1/6, 1/4
this.damage(damageAmounts[this.effectData.layers] * pokemon.maxhp / 24);

View File

@ -82,7 +82,6 @@ exports.BattleScripts = {
if (!move) return false;
let attrs = '';
let missed = false;
if (pokemon.fainted) {
return false;
}
@ -3249,18 +3248,17 @@ exports.BattleScripts = {
let heroes = teams[side];
let pokemonTeam = [];
let hero, heroTemplate, template, pokemon;
for (let i = 0; i < 6; i++) {
hero = this.sampleNoReplace(heroes);
heroTemplate = mons[hero];
let hero = this.sampleNoReplace(heroes);
let heroTemplate = mons[hero];
let template = {};
if (heroTemplate.moves) template.randomBattleMoves = heroTemplate.moves;
if (heroTemplate.required) template.requiredMove = heroTemplate.required;
Object.merge(template, this.getTemplate(heroTemplate.species), false);
pokemon = this.randomSet(template, i, teamDetails);
let pokemon = this.randomSet(template, i, teamDetails);
if (heroTemplate.ability) pokemon.ability = heroTemplate.ability;
if (heroTemplate.gender) pokemon.gender = heroTemplate.gender;

View File

@ -14,7 +14,6 @@
let Ladders = module.exports = getLadder;
const fs = require('fs');
const readline = require('readline');
function getLadder(formatid) {
return new Ladder(formatid);
@ -192,11 +191,9 @@ Ladder.prototype.updateRating = function (p1name, p2name, p1score, room) {
}
let p1newElo, p2newElo;
try {
let p1id = toId(p1name);
let p1index = self.indexOfUser(p1name, true);
let p1elo = self.loadedLadder[p1index][1];
let p2id = toId(p2name);
let p2index = self.indexOfUser(p2name, true);
let p2elo = self.loadedLadder[p2index][1];

View File

@ -181,7 +181,6 @@ exports.BattleScripts = {
if (!move) return false;
let attrs = '';
let missed = false;
if (pokemon.fainted) {
// Removing screens upon faint.
pokemon.side.removeSideCondition('reflect');
@ -940,7 +939,6 @@ exports.BattleScripts = {
// This is random teams making for gen 1.
// Challenge Cup or CC teams are basically fully random teams.
randomCCTeam: function (side) {
let teamdexno = [];
let team = [];
let hasDexNumber = {};
@ -1213,8 +1211,6 @@ exports.BattleScripts = {
let rejected = false;
if (hasMove[moveid]) rejected = true;
if (!template.essentialMove || moveid !== template.essentialMove) {
let isSetup = false;
switch (moveid) {
// bad after setup
case 'seismictoss': case 'nightshade':

View File

@ -457,10 +457,9 @@ exports.BattleMovedex = {
}
},
onSwitchIn: function (pokemon) {
let side = pokemon.side;
if (!pokemon.runImmunity('Ground')) return;
let damageAmounts = [0, 3];
let damage = this.damage(damageAmounts[this.effectData.layers] * pokemon.maxhp / 24);
this.damage(damageAmounts[this.effectData.layers] * pokemon.maxhp / 24);
}
}
},

View File

@ -531,8 +531,7 @@ exports.BattleMovedex = {
return;
}
if (target.hp > 0) {
let source = this.effectData.source;
let damage = target.heal(target.maxhp);
target.heal(target.maxhp);
target.setStatus('');
this.add('-heal', target, target.getHealth, '[from] move: Healing Wish');
target.side.removeSideCondition('healingwish');
@ -682,8 +681,7 @@ exports.BattleMovedex = {
return;
}
if (target.hp > 0) {
let source = this.effectData.source;
let damage = target.heal(target.maxhp);
target.heal(target.maxhp);
target.setStatus('');
for (let m in target.moveset) {
target.moveset[m].pp = target.moveset[m].maxpp;

View File

@ -778,7 +778,7 @@ exports.BattleMovedex = {
onSwitchIn: function (pokemon) {
let factor = 2;
if (pokemon.hasType('Flying')) factor = 4;
let damage = this.damage(pokemon.maxhp * factor / 16);
this.damage(pokemon.maxhp * factor / 16);
}
}
},

View File

@ -108,7 +108,6 @@ describe('XY/ORAS Curse targetting when becoming Ghost the same turn', function
];
function runDoublesTest(battle, curseUser) {
let p1active = battle.p1.active;
let p2active = battle.p2.active;
let cursePartner = curseUser.side.active[1 - curseUser.position];
@ -144,10 +143,6 @@ describe('XY/ORAS Curse targetting when becoming Ghost the same turn', function
assert.ok(curseUser.hasType('Ghost')); // Curse user must be Ghost
assert.ok(curseUser.hp < curseUser.maxhp / 2); // Curse user cut its HP down
let foeHP = [p2active[0].hp, p2active[1].hp];
battle.choose('p1', 'move 2 1, move 2 1');
battle.choose('p2', 'move 2, move 2');
let cursedFoe = false;
for (let i = 0; i < 3; i++) {
let allyPokemon = p1active[i];