From 9394e33bfca1b594f1c0217899809c9b49ca8399 Mon Sep 17 00:00:00 2001 From: urkerab Date: Wed, 11 Nov 2015 21:47:27 +0000 Subject: [PATCH] Fix HP display for fainted Pokemon --- js/client-battle.js | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/js/client-battle.js b/js/client-battle.js index bcab30cdb..a9448616c 100644 --- a/js/client-battle.js +++ b/js/client-battle.js @@ -1122,10 +1122,14 @@ text += 'Types unknown'; } text += ''; - var exacthp = ''; - if (pokemon.maxhp != 100 && pokemon.maxhp != 1000 && pokemon.maxhp != 48) exacthp = ' (' + pokemon.hp + '/' + pokemon.maxhp + ')'; - if (pokemon.maxhp == 48 && isActive) exacthp = ' (' + pokemon.hp + '/' + pokemon.maxhp + ' pixels)'; - text += '

HP: ' + pokemon.hpDisplay() + exacthp + (pokemon.status ? ' ' + pokemon.status.toUpperCase() + '' : '') + '

'; + if (pokemon.fainted) { + text += '

HP: (fainted)

'; + } else { + var exacthp = ''; + if (pokemon.maxhp != 100 && pokemon.maxhp != 1000 && pokemon.maxhp != 48) exacthp = ' (' + pokemon.hp + '/' + pokemon.maxhp + ')'; + if (pokemon.maxhp == 48 && isActive) exacthp = ' (' + pokemon.hp + '/' + pokemon.maxhp + ' pixels)'; + text += '

HP: ' + pokemon.hpDisplay() + exacthp + (pokemon.status ? ' ' + pokemon.status.toUpperCase() + '' : '') + '

'; + } if (myPokemon) { if (this.battle.gen > 2) { text += '

Ability: ' + Tools.getAbility(myPokemon.baseAbility).name;