smogon / pokemon-showdown-client

The client for Pokémon Showdown
http://pokemonshowdown.com
GNU Affero General Public License v3.0
555 stars 779 forks source link

Improve support for distinguishing Pokemon in formats without Species Clause #1274

Open scheibo opened 5 years ago

scheibo commented 5 years ago

I have a team with two Necrozma with the same moves (not items or stats). I start with one of them, use Prismatic Laser, then Showdown shows me that I have 15/16 left of this move with this given Necrozma when I hover over it, but also shows me that the other one has 15/16 Prismatic Laser left when I hover over that one, which shouldn't happen.

Then I switch to the other Necrozma (after the recharge turn of Prismatic Laser of the first one), to use Photon Geyser, and after its use, when I hover over the current Necrozma in use, it shows as if I didn't use Photon Geyser, which is a bug. And it also stills shows me the current Necrozma with 15/15 Prismatic Laser left when I hover over it, even though it has 16/16.

Note that this is purely a graphical bug of the hover over feature, since moves have their respective counts right where they are displayed to be clicked.

It seems there are two bugs:

  • the wrong Pokémon is deducted moves when it shouldn't
  • some moves are not deducted

Here are the pics: 1) situation after Prismatic Laser 2) 'first' Necrozma hover over 3) 'second' Necrozma hover over 4) situation after Photon Geyser 5) 'second' Necrozma hover over 6) 'first 'Necrozma hover over

And the replay http://replay.pokemonshowdown.com/gen7anythinggoes-756937150

Originally posted by @penpexgit in https://github.com/Zarel/Pokemon-Showdown/issues/4707

Zarel commented 4 years ago

The problem is in this line:

https://github.com/smogon/pokemon-showdown-client/blob/7fe8ac794babd96e45333aa02c0498cfb0d5d45b/src/battle-tooltips.ts#L774

Since we have no way to tell which of two identical Pokémon is which, we sort of just grab the first one that matches.

A solution would involve carefully matching a server Pokémon to a client Pokémon (which would still break if you refreshed the page), or maybe just letting the server send PP.