Skip to content

Commit

Permalink
Fix past gen Pursuit knockouts on the switch
Browse files Browse the repository at this point in the history
  • Loading branch information
Marty-D authored Sep 1, 2018
1 parent 02521f3 commit 3933cf5
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions sim/pokemon.js
Original file line number Diff line number Diff line change
Expand Up @@ -1557,11 +1557,10 @@ class Pokemon {
* @param {Side | boolean} side
*/
getHealthInner(side) {
if (!this.hp) return '0 fnt';
let hpstring;
// side === true in replays
if (!this.hp) {
hpstring = '0';
} else if (side === this.side || side === true) {
if (side === this.side || side === true) {
hpstring = '' + this.hp + '/' + this.maxhp;
} else {
let ratio = this.hp / this.maxhp;
Expand Down

3 comments on commit 3933cf5

@urkerab
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't suppose you would mind telling me what the bug was here, so that I can fix the code for Benjamin Butterfree (which relies on the previous behaviour of getHealthInner) without breaking it?

@Marty-D
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I believe the issue was the fainted Pokemon remained clickable in the Switch menu, causing various bugs including being unable to continue the battle.

@urkerab
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah, I see the problem, the switch succeeds, so the fainted Pokémon is no longer active, so we don't set its status to 'fnt'.

Please sign in to comment.