diff --git a/js/battle.js b/js/battle.js index 4f809f9c7..1ceb88769 100644 --- a/js/battle.js +++ b/js/battle.js @@ -202,6 +202,7 @@ var Pokemon = (function () { // [[moveName, ppUsed]] this.moveTrack = []; + this.statusData = {sleepTurns: 0, toxicTurns: 0}; this.name = ''; this.species = ''; @@ -1970,6 +1971,8 @@ var Side = (function () { this.battle.message('' + Tools.escapeHTML(pokemon.side.name) + ' withdrew ' + pokemon.getFullName() + '!'); } } + if (pokemon.statusData.toxicTurns) pokemon.statusData.toxicTurns = 1; + if (this.battle.gen === 5) pokemon.statusData.sleepTurns = 0; this.lastPokemon = pokemon; this.active[slot] = null; @@ -3482,6 +3485,7 @@ var Battle = (function () { break; case 'slp': this.resultAnim(pokemon, 'Asleep', 'slp'); + pokemon.statusData.sleepTurns++; this.message('' + pokemon.getName() + ' is fast asleep.'); break; case 'skydrop': @@ -3611,6 +3615,7 @@ var Battle = (function () { break; case 'psn': if (!this.fastForward) BattleStatusAnims['psn'].anim(this, [poke.sprite]); + if (poke.statusData.toxicTurns) poke.statusData.toxicTurns++; actions += "" + poke.getName() + " was hurt by poison!"; break; case 'lifeorb': @@ -4306,6 +4311,7 @@ var Battle = (function () { case 'tox': this.resultAnim(poke, 'Toxic poison', 'psn'); if (!this.fastForward) BattleStatusAnims['psn'].anim(this, [poke.sprite]); + poke.statusData.toxicTurns = 1; actions += "" + poke.getName() + " was badly poisoned" + effectMessage + "!"; break; case 'psn': @@ -4378,6 +4384,8 @@ var Battle = (function () { else actions += "" + poke.getName() + " healed its burn!"; break; case 'tox': + poke.statusData.toxicTurns = 0; + // falls through case 'psn': this.resultAnim(poke, 'Poison cured', 'good'); if (effect.effectType === 'Item') { @@ -4388,6 +4396,7 @@ var Battle = (function () { break; case 'slp': this.resultAnim(poke, 'Woke up', 'good'); + poke.statusData.sleepTurns = 0; if (effect.effectType === 'Item') { actions += "" + poke.getName() + "'s " + effect.name + " woke it up!"; break; diff --git a/js/client-battle-tooltips.js b/js/client-battle-tooltips.js index 34e2a94c2..e6de413ce 100644 --- a/js/client-battle-tooltips.js +++ b/js/client-battle-tooltips.js @@ -413,7 +413,13 @@ var BattleTooltips = (function () { var exacthp = ''; if (pokemonData) exacthp = ' (' + pokemonData.hp + '/' + pokemonData.maxhp + ')'; else if (pokemon.maxhp == 48) exacthp = ' (' + pokemon.hp + '/' + pokemon.maxhp + ' pixels)'; - text += '
HP: ' + pokemon.hpDisplay() + exacthp + (pokemon.status ? ' ' + pokemon.status.toUpperCase() + '' : '') + '
'; + text += 'HP: ' + pokemon.hpDisplay() + exacthp + (pokemon.status ? ' ' + pokemon.status.toUpperCase() + '' : ''); + if (pokemon.status === 'tox') { + text += ' Next damage: ' + Math.floor(100 / 16) * Math.min(pokemon.statusData.toxicTurns, 15) + '%'; + } else if (pokemon.status === 'slp') { + text += ' Turns asleep: ' + pokemon.statusData.sleepTurns; + } + text += '
'; } var showOtherSees = !this.battle.hardcoreMode && isActive; if (pokemonData) {