Random Process
(Redirected from Random Process 2)
Jump to navigation
Jump to search
Same as Check_if_Random_is_greater/equal_to_Chance Parameters : r4 = Random Max Limit r5 = Threshold value Returns : r2 = 0x00 if Random number between 0x00 and r4 is < r5 r2 = 0x01 if Random number between 0x00 and r4 is > r5 -------------------------------------------------------------------------------------------------- 0018eed8: 27bdffe0 addiu r29,r29,-0x0020 | 0018eedc: afb00010 sw r16,0x0010(r29) | 0018eee0: 00808021 addu r16,r4,r0 |r16 = Random limit (max value) 0018eee4: afb10014 sw r17,0x0014(r29) | 0018eee8: afbf0018 sw r31,0x0018(r29) | 0018eeec: 0c063ba8 jal 0x0018eea0 |-->Random Number Returns r2 = Random number between 0x00 and 0x7fff (see RNG) 0018eef0: 00a08821 addu r17,r5,r0 |r17 = Threshold value 0018eef4: 00500018 mult r2,r16 |Random * Limit 0018eef8: 00001012 mflo r2 |r2 = Random * Limit 0018eefc: 04410002 bgez r2,0x0018ef08 #If Random * Limit < 0x00 0018ef00: 00000000 nop | 0018ef04: 24427fff addiu r2,r2,0x7fff |r2 = Positive Random*limit 0018ef08: 000213c3 sra r2,r2,0x0f |r2 = Random Number between 0x00 and Limit = Limit * Random/0x8000 (Max random) 0018ef0c: 0051102a slt r2,r2,r17 |r2 = 0x01 if Random is < Threshold value 0018ef10: 38420001 xori r2,r2,0x0001 |r2 = 0x00 if Random is < Threshold value / Else = 0x01 0018ef14: 8fbf0018 lw r31,0x0018(r29) 0018ef18: 8fb10014 lw r17,0x0014(r29) 0018ef1c: 8fb00010 lw r16,0x0010(r29) 0018ef20: 27bd0020 addiu r29,r29,0x0020 0018ef24: 03e00008 jr r31 0018ef28: 00000000 nop
Return location
Battle.bin 0018650c: Critical_Hit_Calculation