mirror of
https://github.com/smogon/pokemon-showdown-client.git
synced 2026-10-26 04:07:56 -05:00
Tooltips: Track sleep and toxic turns (#1017)
This commit is contained in:
committed by
Guangcong Luo
parent
918e0f8904
commit
36b409d9d9
@@ -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;
|
||||
|
||||
@@ -413,7 +413,13 @@ var BattleTooltips = (function () {
|
||||
var exacthp = '';
|
||||
if (pokemonData) exacthp = ' (' + pokemonData.hp + '/' + pokemonData.maxhp + ')';
|
||||
else if (pokemon.maxhp == 48) exacthp = ' <small>(' + pokemon.hp + '/' + pokemon.maxhp + ' pixels)</small>';
|
||||
text += '<p>HP: ' + pokemon.hpDisplay() + exacthp + (pokemon.status ? ' <span class="status ' + pokemon.status + '">' + pokemon.status.toUpperCase() + '</span>' : '') + '</p>';
|
||||
text += '<p>HP: ' + pokemon.hpDisplay() + exacthp + (pokemon.status ? ' <span class="status ' + pokemon.status + '">' + pokemon.status.toUpperCase() + '</span>' : '');
|
||||
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 += '</p>';
|
||||
}
|
||||
var showOtherSees = !this.battle.hardcoreMode && isActive;
|
||||
if (pokemonData) {
|
||||
|
||||
Reference in New Issue
Block a user