BW Battle RNG p4
Code:
Sleep Duration
((SEED>>32)*3>>32)+1 = Sleep Counter (Turns Asleep)
Returns 0-2 value, +1 ==> (1-3) turns asleep.
Custom1: u32*3
Custom2: Custom1 >> 32
Custom3: Custom2 +1
For the move Spore, it calculates Hit and then Turns Asleep.
Confusion Duration -- not completely sure
((SEED>>32)*4>>32)+1 = Confused Counter (Turns Confused)
Returns 0-3 value, +2 ==> (1-4) turns confused.
Custom1: u32*4
Custom2: Custom1 >>32
Custom3: Custom2 +1
For the move Confuse Ray, it calculates Hit and then Turns Confused.
Code:
Paralysis
((SEED>>32)*100>>32) = Paralysis Check
If 0-24, Pokemon is Paralyzed for the Turn.
If 25-99, Pokemon can move for the Turn.
Infatuation
((SEED>>32)*100>>32) = Infatuation Check
If 0-49, Pokemon is Infatuated for the Turn.
If 50-99, Pokemon can move for the Turn.
Confusion
((SEED>>32)*100>>32) = Confusion Check
If 0-49, Pokemon is Confused for the Turn, and receives recoil.
Inflict recoil damage with the next frame (damage).
If 50-99, Pokemon can move for the Turn.
Code:
Protect
((SEED>>32)*(2^p))>>32 = Protect Check
%p = protect counter, initially 0.
If 0, Pokemon succeeds in Protecting.
p = p+1
Else, Protect fails.
p = 0
Code:
Catching and Critical Capture
Depending on how you calculate CC and CV,
you will use different multiplications to the seed.
First it calculates if critical capture, then the shake/capture values.
If result < CV, pass check. Total of 4 for regular catch, 1 for CC.
Escape Calculation
Esc = ((SEED>>32)*0xFF), return 0-254.
If Esc < F, then pass run away.
