Dance/Song hit %

From Final Fantasy Hacktics Wiki
Revision as of 10:50, 18 April 2022 by Orkney (talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search
No Parameters 

Returns r2 = 0x00 if Attack hits
        r2 = 0x00 if Action is not being executed (AI, preview)
        r2 = 0x01 if Attack misses

Uses Ability X as Hit% : Update displayed hit%
                         If Action is being executed : roll ability X versus 100
If Attack misses : Update Target Current Action data to miss
----------------------------------------------------------------------------------------------
00184360: 3c058019 lui r5,0x8019            |
00184364: 8ca52d90 lw r5,0x2d90(r5)         |r5 = Target Current Action (TCA) data pointer
00184368: 3c068019 lui r6,0x8019            |
0018436c: 90c638f9 lbu r6,0x38f9(r6)        |r6 = Current Ability used Ability X             0x801938f9 / 801938f9
00184370: 27bdffe8 addiu r29,r29,-0x0018    |
00184374: afbf0010 sw r31,0x0010(r29)       |
00184378: 84a2002a lh r2,0x002a(r5)         |r2 = TCA Hit% (displayed)
0018437c: 00000000 nop                      |
00184380: 00460018 mult r2,r6               |Hit% * Ability X
00184384: 00001812 mflo r3                  |r3 = TCA Hit% * used Ability X
00184388: 3c0251eb lui r2,0x51eb            |
0018438c: 3442851f ori r2,r2,0x851f         |r2 = 0x51eb851f     (0,32*2^32)
00184390: 00620018 mult r3,r2               |Hit% * Ability X * 0,32 * 2^32
00184394: 3c048019 lui r4,0x8019            |
00184398: 8c84f5fc lw r4,-0x0a04(r4)        |r4 = Action State
0018439c: 00031fc3 sra r3,r3,0x1f           |r3 = higher bit of r3 (should be 0)
001843a0: 00001010 mfhi r2                  |r2 = Hit% * Ability X * 0,32 
001843a4: 00021143 sra r2,r2,0x05           |r2 = Hit% * Ability X/100
001843a8: 00431023 subu r2,r2,r3            |r2 = Hit% * Ability X/100 (down rounded )
001843ac: 14800006 bne r4,r0,0x001843c8     #If Action is being executed
001843b0: a4a2002a sh r2,0x002a(r5)         |Set TCA Hit% to previous Hit% * Ability X%  (Basicaly it's X% since no evasion has been rolled (previous Hit% is set to 100 in preformula setup)
001843b4: 34040064 ori r4,r0,0x0064             |r4 = 100
001843b8: 0c017833 jal 0x0005e0cc               |-->Check_if_Random_is_greater/equal_to_Chance Returns r2 = 0x00 if Random (0 to 100) is < Hit chances (Ability X)
001843bc: 00c02821 addu r5,r6,r0                |r5 = Ability X
001843c0: 14400003 bne r2,r0,0x001843d0         #If Attack hits
001843c4: 00000000 nop                              |
001843c8: 080610f7 j 0x001843dc             #E      >>jump to end (r2 = 0x00)
001843cc: 00001021 addu r2,r0,r0                    |r2 = 0x00 (Attack hits)
                                                #Else : Attack mMiss
001843d0: 0c0610cf jal 0x0018433c                   |-->Force_Attack_Miss TCA hit flag = 0x00, Evade type = 0x07, Hit% = 0%
001843d4: 00000000 nop                              |
001843d8: 34020001 ori r2,r0,0x0001                 |r2 = 0x01
001843dc: 8fbf0010 lw r31,0x0010(r29)       END
001843e0: 27bd0018 addiu r29,r29,0x0018     
001843e4: 03e00008 jr r31                   
001843e8: 00000000 nop        

Return location

Battle.bin
001893b0: Formula 1C - Hit (X)%
0018940c: Formula 1D - Hit (X)%