Pokérus: Difference between revisions

195 bytes added ,  21 June 2014
→‎In Generation V: From Kaphotics' source in edit summary: http://pastebin.com/UNq9MPke . Some wording/specifics/apparent interpretation mistakes
m (Naked speculation/head canon. Also, I really don't think we need an incredibly specific journal reference; anyone really interested/dubious can search Google for any number of examples)
(→‎In Generation V: From Kaphotics' source in edit summary: http://pastebin.com/UNq9MPke . Some wording/specifics/apparent interpretation mistakes)
Line 87: Line 87:
The mechanics remain more or less the same, sharing similarity to the strain phenomenon in [[Generation II]]. However, a difference would be that the icon that would appear if a Pokémon has previously had Pokérus would be a pinkish color instead of the former yellow/orange color.
The mechanics remain more or less the same, sharing similarity to the strain phenomenon in [[Generation II]]. However, a difference would be that the icon that would appear if a Pokémon has previously had Pokérus would be a pinkish color instead of the former yellow/orange color.


To determine if any Pokémon in the player's party is to be infected, the game calls the {{wp|Mersenne twister}} table (random-number generator) and then discards the lower half (16 bits) of the 32 bit number, then does & 0x3FFF (a bitwise ''and'') on the result (i.e. it discards the first two bits). If the result is 0, a Pokémon in the party will be infected.
To determine if any Pokémon in the player's party is to be infected, the game calls the {{wp|Mersenne twister}} table to get a 32-bit random number, discards the lowest 16 bits, and then discards the highest two bits (a bitwise ''and'' with 0x3FFF). If this number is 0, the game will choose a Pokémon in the party to be infected.
To determine what party member is to be infected, the game takes another value from the Mersenne Twister table, multiplies it by the party count, then discards the lowest 32 bits of the result. If that party member already has been infected, nothing else will happen.


Now that the given Pokémon is to be infected, the game takes the next value from the Mersenne Twister table, discards the lower 24 bits, then enters a loop to determine the strain. The strains are biased towards the lower number strains. Once a strain has been determined, the duration the infection will last is determined. For a given strain ''s'', the duration is ''s''+''s''%4.  
To determine what party member is to be infected, the game takes another value from the Mersenne Twister table, multiplies it by the party count, then discards the lowest 32 bits of the result. If this number is an Egg, the calculation is repeated. Otherwise, if that party member has already been infected, nothing else will happen.


Refer to the Generation II table for strains and duration, as it is exactly the same. However, strains 0x0 and 0x8 are not obtainable legitimately.
If a Pokémon will be infected, the game takes the next value from the Mersenne Twister table and discards the lowest 24 bits (if the lowest three bits of this result are all 0, another number is chosen). If any of the highest four bits are nonzero, the highest five bits are discarded. The resulting number will be '''X''', the Pokérus strain; the duration of the virus will be set to '''X''' modulo 4 + 1. (The duration for any strain is the same as in the table in the Generation II section.)
 
These calculations mean that the strains 0 and 8 will never occur, and that the remaining strains are biased towards the lower numbers (with 1 through 7 being much more common than 9 through 15).


====Nurse's comments====
====Nurse's comments====