Random Process, gives a number between 0-7fff

From Final Fantasy Hacktics Wiki
Revision as of 21:04, 25 March 2022 by Orkney (talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search
No Parameters

Returns r2 = Number between 0x00 and 0x7fff 

Gets a random 16-bit integer (between 0 and 0x7FFF, inclusive), or 0x4000 if this is just damage prediction. The result is stored in r2 as a 32-bit signed number. See RNG.
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
0018eea0: 3c028019 lui r2,0x8019
0018eea4: 8c42f5fc lw r2,-0x0a04(r2)           |r2 = Action State
0018eea8: 27bdffe8 addiu r29,r29,-0x018        |
0018eeac: 14400005 bne r2,r0,0x0018eec4        #If Action is been executed
0018eeb0: afbf0010 sw r31,0x0010(r29)              |
0018eeb4: 0c0088c3 jal 0x0002230c                  |-->Random Number Generator Return r2 = random number between 0x00 and 0x7fff
0018eeb8: 00000000 nop                             |
0018eebc: 08063bb2 j 0x0018eec8                    >>Jump to END
0018eec0: 00000000 nop
                                               #Else - Preview / AI processing
0018eec4: 34024000 ori r2,r0,0x4000		    |Random = 0x4000 (Result is forced to Average value)
0018eec8: 8fbf0010 lw r31,0x0010(r29)          
0018eecc: 27bd0018 addiu r29,r29,0x0018
0018eed0: 03e00008 jr r31                 
0018eed4: 00000000 nop

Return locations

Battle.bin
00185c38: Base_XA_Calculation
00186524: Critical_Hit_Calculation
0018692c: Damage_and_Knockback_Routine_(Dash,_tackle,_throw_stone)
0018698c: Damage_and_Knockback_Routine_(Dash,_tackle,_throw_stone)
0018774c: Magic_Gun_Ability_Decision
0018804c: Apply status (to action)
00189dbc: 32_Dmg_(Rdm(1…X)*(PA*3+Y))
0018a340: 4B Heal (Rdm(1..9)) 100% Status
0018eef4: Random_Process