Rejected - Inactive Improve the way HP denominators are handled by the client

As it currently stands, the client is hardcoded to give out certain info when an hp denominator is 48 or 100. For 48, it will act like the hp taken is from a vgc match, and for 100, it will act like the hp comes from a standard showdown game with the HP Percent mod. While this is normally not an issue, it can cause really strange problems like in this replay: https://replay.pokemonshowdown.com/gen8doublescustomgame-1296785900.

You can also get things like this (grookey's exact hp stat is 48)
Screen Shot 2021-03-08 at 12.42.57 AM.png

This is more of an issue for parsing replay logs than day to day users, but I think that this could be quickly fixed by having the server include a protocol message for whether or not hps denominators are exact.
 

DaWoblefet

Demonstrably so
is a Battle Simulator Administratoris a Community Leaderis a Programmeris a Community Contributoris a Top Researcheris a Top Tiering Contributoris a Social Media Contributor Alumnus
PS Admin
This is the current implementation:
  • If it is a Custom Game, display exact HP lost.
  • If the format is in Gen 8 or has the HP Percentage Mod, use 100ths.
    • This is calculated by taking the ratio of HP / max HP and applying a ceiling to it (rounding up the result to the nearest whole number).
    • An exception is applied if that subsequent percentage is 100 but the ratio of HP / max HP is less than 1 (then it's displayed as 99%).
    • The change to include Gen 8 formats generally speaking (including Gen 8 VGC) is because the Switch has a much higher pixel count for its HP bar than the DS games.
  • Otherwise, use 48ths.
    • This is calculated by taking the ratio of HP / max HP and applying to floor to it (round down the result to the nearest whole number), with a minimum of 1 pixel.
    • If the number of pixels is 9 but the ratio is bigger than 20%, force a yellow HP bar.
    • Similarly, if the number of pixels is 24 but the ratio is bigger than 50%, force a green HP bar.
So reading the format and assigning a HP count would be one workaround rather than adding a protocol message. A protocol message wouldn't fix your problem if you're planning on using this tool to parse older replays anyway, since they wouldn't get added retroactively.
 
This is the current implementation:
  • If it is a Custom Game, display exact HP lost.
  • If the format is in Gen 8 or has the HP Percentage Mod, use 100ths.
    • This is calculated by taking the ratio of HP / max HP and applying a ceiling to it (rounding up the result to the nearest whole number).
    • An exception is applied if that subsequent percentage is 100 but the ratio of HP / max HP is less than 1 (then it's displayed as 99%).
    • The change to include Gen 8 formats generally speaking (including Gen 8 VGC) is because the Switch has a much higher pixel count for its HP bar than the DS games.
  • Otherwise, use 48ths.
    • This is calculated by taking the ratio of HP / max HP and applying to floor to it (round down the result to the nearest whole number), with a minimum of 1 pixel.
    • If the number of pixels is 9 but the ratio is bigger than 20%, force a yellow HP bar.
    • Similarly, if the number of pixels is 24 but the ratio is bigger than 50%, force a green HP bar.
So reading the format and assigning a HP count would be one workaround rather than adding a protocol message. A protocol message wouldn't fix your problem if you're planning on using this tool to parse older replays anyway, since they wouldn't get added retroactively.
Thanks for the info! So, I'm guessing that this is basically one of those scenarios where the game tier needs to be checked? (for replays, exact hp is shown for randoms, custom battles, and a lot of those front page tournament replay battles)
 

Zarel

Not a Yuyuko fan
is a Site Content Manageris a Battle Simulator Administratoris a Programmeris a Pokemon Researcheris an Administrator
Creator of PS
I've been meaning to fix this for a long time, by having an r/y/g suffix mean "approximate" and no suffix mean exact.
 

Users Who Are Viewing This Thread (Users: 1, Guests: 0)

Top