Misc cleanup

The important fixes from pull request #865
This commit is contained in:
小太 2014-10-12 21:32:44 -05:00 committed by Guangcong Luo
parent c7ea3f09fc
commit ae6da14ca0
2 changed files with 6 additions and 20 deletions

View File

@ -389,7 +389,6 @@ BattlePokemon = (function () {
};
BattlePokemon.prototype.calculateStat = function (statName, boost, modifier) {
statName = toId(statName);
// var boost = this.boosts[statName];
if (statName === 'hp') return this.maxhp; // please just read .maxhp directly
@ -712,16 +711,9 @@ BattlePokemon = (function () {
evasion: 0
};
this.moveset = [];
this.moves = [];
// we're copying array contents
// DO NOT "optimize" it to copy just the pointer
// if you don't know what a pointer is, please don't
// touch this code
for (var i = 0; i < this.baseMoveset.length; i++) {
this.moveset.push(this.baseMoveset[i]);
this.moves.push(toId(this.baseMoveset[i].move));
}
this.moveset = this.baseMoveset.slice();
this.moves = this.moveset.map('move');
this.transformed = false;
this.ability = this.baseAbility;
this.set.ivs = this.baseIvs;
@ -760,12 +752,14 @@ BattlePokemon = (function () {
};
// returns the amount of damage actually dealt
BattlePokemon.prototype.faint = function (source, effect) {
// This function only puts the pokemon in the faint queue;
// actually setting of this.fainted comes later when the
// faint queue is resolved.
if (this.fainted || this.status === 'fnt') return 0;
var d = this.hp;
this.hp = 0;
this.switchFlag = false;
this.status = 'fnt';
// this.fainted = true;
this.battle.faintQueue.push({
target: this,
source: source,
@ -2927,9 +2921,6 @@ Battle = (function () {
// randomizer
// this is not a modifier
// gen 1-2
//var randFactor = Math.floor(Math.random() * 39) + 217;
//baseDamage *= Math.floor(randFactor * 100 / 255) / 100;
baseDamage = Math.floor(baseDamage * (100 - this.random(16)) / 100);
// STAB
@ -3366,7 +3357,6 @@ Battle = (function () {
break;
}
this.switchIn(decision.target, decision.pokemon.position);
//decision.target.runSwitchIn();
break;
case 'runSwitch':
decision.pokemon.isStarted = true;

View File

@ -163,10 +163,6 @@ var parse = exports.parse = function (message, room, user, connection, levelsDee
if (!message || !message.trim().length) return;
if (!levelsDeep) {
levelsDeep = 0;
// if (Config.emergencylog && (connection.ip === '62.195.195.62' || connection.ip === '86.141.154.222' || connection.ip === '189.134.175.221' || message.length > 2048 || message.length > 256 && message.substr(0, 5) !== '/utm ' && message.substr(0, 5) !== '/trn ')) {
if (Config.emergencylog && (user.userid === 'pindapinda' || connection.ip === '62.195.195.62' || connection.ip === '86.141.154.222' || connection.ip === '189.134.175.221')) {
Config.emergencylog.write('<' + user.name + '@' + connection.ip + '> ' + message + '\n');
}
} else {
if (levelsDeep > MAX_PARSE_RECURSION) {
return connection.sendTo(room, "Error: Too much recursion");