From dde2f2930af7e29e22f0c22c40862e1dbaf66533 Mon Sep 17 00:00:00 2001 From: "Cathy J. Fitzpatrick" Date: Tue, 9 Apr 2013 03:50:25 -0600 Subject: [PATCH] Revert unnecessary client changes for exact HP display --- js/battle.js | 14 +++++--------- js/sim.js | 4 +--- 2 files changed, 6 insertions(+), 12 deletions(-) diff --git a/js/battle.js b/js/battle.js index b29bb2f4d..d957c90e2 100644 --- a/js/battle.js +++ b/js/battle.js @@ -141,9 +141,8 @@ function Pokemon(species) { return [oldrange[0] - newrange[1], oldrange[1] - newrange[0]]; }; // returns [delta, denominator, percent(, oldnum, oldcolor)] or false - this.healthParse = function (hpstring, parsedamage, heal, exacthealth) { + this.healthParse = function (hpstring, parsedamage, heal) { if (!hpstring || !hpstring.length) return false; - if (exacthealth) hpstring = selfP.side.battle.exactHealth.shift() || hpstring; var parenIndex = hpstring.lastIndexOf('('); if (parenIndex >= 0) { // old style damage and health reporting @@ -598,8 +597,6 @@ function Battle(frame, logFrame, noPreload) { self.backdropImage = BattleBackdrops[Math.floor(Math.random() * BattleBackdrops.length)]; - this.exactHealth = []; - // 0 = uninitialized // 1 = ready // 2 = playing @@ -647,7 +644,6 @@ function Battle(frame, logFrame, noPreload) { self.weatherMinTimeLeft = 0; self.pseudoWeather = []; self.lastMove = ''; - self.exactHealth = []; // DOM state self.frameElem.empty(); @@ -2656,7 +2652,7 @@ function Battle(frame, logFrame, noPreload) { switch (args[0]) { case '-damage': var poke = this.getPokemon(args[1]); - var damage = poke.healthParse(args[2], true, false, true); + var damage = poke.healthParse(args[2], true); if (damage === false) break; self.lastDamage = (damage[2] || 1); // not sure if this is used for anything var range = poke.getDamageRange(damage); @@ -2744,7 +2740,7 @@ function Battle(frame, logFrame, noPreload) { break; case '-heal': var poke = this.getPokemon(args[1]); - var damage = poke.healthParse(args[2], true, true, true); + var damage = poke.healthParse(args[2], true, true); if (damage === false) break; var range = poke.getDamageRange(damage); self.healAnim(poke, poke.getFormattedRange(range, 0, ' to '), animDelay); @@ -2806,7 +2802,7 @@ function Battle(frame, logFrame, noPreload) { var cpoke = self.getPokemon(args[1+2*k]); if (cpoke) { var oldhp = cpoke.hp; - cpoke.healthParse(args[2+2*k], false, false, true); + cpoke.healthParse(args[2+2*k]); var diff = parseFloat(args[2+2*k]); if (isNaN(diff)) { diff = cpoke.hp - oldhp; @@ -4589,7 +4585,7 @@ function Battle(frame, logFrame, noPreload) { if (self.waitForResult()) return; var poke = self.getPokemon('other: '+args[1], args[2]); var slot = poke.slot; - poke.healthParse(args[3], false, false, true); + poke.healthParse(args[3]); if (args[0] === 'switch') { if (poke.side.active[slot]) { diff --git a/js/sim.js b/js/sim.js index a6c202653..85d9dc865 100644 --- a/js/sim.js +++ b/js/sim.js @@ -392,14 +392,12 @@ function BattleRoom(id, elem) { selfR.battle.instantAdd(update.updates[i]); } else { if (update.updates[i].substr(0,10) === '|callback|') selfR.controlsElem.html(''); + if (update.updates[i].substr(0,12) === '| callback | ') selfR.controlsElem.html(''); selfR.battle.add(update.updates[i]); } } } if (update.request) { - if (update.request.side) { - selfR.battle.exactHealth = (update.request.side.exactHealth || '').split(','); - } selfR.me.request = update.request; // currently unused selfR.me.request.requestType = 'move'; var notifyObject = null;