Jump to content

Pokerus in pkhex


Atmosphaera

Recommended Posts

On 10/7/2020 at 10:38 PM, Kaphotics said:

Technical information
The Pokérus is stored in a Pokémon's data structure as a single byte. In hexadecimal, this can be represented as a two-digit number XY. The upper 4 bits of the byte, X, represent the specific strain of the Pokérus the Pokémon has contracted. The lower 4 bits, Y, represent the number of days remaining before the infected Pokémon is cured of the virus.

A Pokémon is or has been infected if X (the strain) is a nonzero value. If Y (days remaining) is nonzero when X is also nonzero, this means the Pokémon is currently infected. If Y is 0 and X is nonzero, then the Pokémon is "cured" of the Pokérus. If both X and Y are 0, then the Pokémon has never been affected by the Pokérus.

Whenever the game's internal clock strikes midnight, every currently infected Pokémon in the player's party has their Pokérus value decreased by one. Once the Y value reaches 0, the Pokémon will be cured of the Pokérus.

Strains
Whenever the game creates the Pokérus on a Pokémon, the value assigned to Y (days) depends on the value assigned to X (strain). Specifically, the number of days will be set to X modulo 4 + 1. In other words, the higher two bits of X are irrelevant to the "strain".
Whenever the Pokérus spreads from an infected Pokémon to a new Pokémon, the new Pokémon inherits the infected Pokémon's strain of the Pokérus (X) and Y is set to the default value for that strain. As an example, if a Pokémon has the Pokérus with an X value of 7 and a Y value of 2 (2 days remaining before it will be cured) and it infects another Pokémon, the new Pokémon will get the Pokérus with an X value of 7 and a Y value of 4 (4 days before it will be cured).

X values of 0 are not legitimate, since upon being "cured" the Pokémon would appear to have never had the Pokérus at all.

 image.png.845ec3ada73121576c9578f6630ff752.png

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...