Difference between revisions of "Dance/Song hit %"

From Final Fantasy Hacktics Wiki
Jump to navigation Jump to search
(Created page with "<font face='Courier New'> 00184360: 3c058019 lui r5,0x8019 00184364: 8ca52d90 lw r5,0x2d90(r5) 00184368: 3c068019 lui r6,0x8019 0018436c: 90c638f9 lbu r6,0x38f9(r6) lo...")
 
m
 
(One intermediate revision by the same user not shown)
Line 1: Line 1:
<font face='Courier New'>
+
No Parameters
 
   
 
   
  00184360: 3c058019 lui r5,0x8019
+
Returns r2 = 0x00 if Attack hits
  00184364: 8ca52d90 lw r5,0x2d90(r5)
+
        r2 = 0x00 if Action is not being executed (AI, preview)
  00184368: 3c068019 lui r6,0x8019
+
        r2 = 0x01 if Attack misses
  0018436c: 90c638f9 lbu r6,0x38f9(r6) load ability X
+
  00184370: 27bdffe8 addiu r29,r29,0xffe8
+
Uses Ability X as Hit% : Update displayed hit%
  00184374: afbf0010 sw r31,0x0010(r29)
+
                          If Action is being executed : roll ability X versus 100
  00184378: 84a2002a lh r2,0x002a(r5) load hit %
+
If Attack misses : Update Target Current Action data to miss
  0018437c: 00000000 nop
+
----------------------------------------------------------------------------------------------
  00184380: 00460018 mult r2,r6 hit % * X
+
  00184360: 3c058019 lui r5,0x8019           |
  00184384: 00001812 mflo r3
+
  00184364: 8ca52d90 lw r5,0x2d90(r5)         |{{f/adr|<nowiki>r5 = Target Current Action (TCA) data pointer</nowiki>}}
  00184388: 3c0251eb lui r2,0x51eb
+
  00184368: 3c068019 lui r6,0x8019           |
  0018438c: 3442851f ori r2,r2,0x851f
+
  0018436c: 90c638f9 lbu r6,0x38f9(r6)       |{{f/load|<nowiki>r6 = Current Ability used Ability X</nowiki>}} {{f/std|            0x801938f9 / 801938f9}}
  00184390: 00620018 mult r3,r2
+
  00184370: 27bdffe8 addiu r29,r29,-0x0018    |
  00184394: 3c048019 lui r4,0x8019
+
  00184374: afbf0010 sw r31,0x0010(r29)       |
  00184398: 8c84f5fc lw r4,-0x0a04(r4)
+
  00184378: 84a2002a lh r2,0x002a(r5)         |{{f/load|<nowiki>r2 = TCA Hit% (displayed)</nowiki>}}
  0018439c: 00031fc3 sra r3,r3,0x1f
+
  0018437c: 00000000 nop                     |
  001843a0: 00001010 mfhi r2
+
  00184380: 00460018 mult r2,r6               |{{f/std|Hit% * Ability X}}
  001843a4: 00021143 sra r2,r2,0x05
+
  00184384: 00001812 mflo r3                 |{{f/std|<nowiki>r3 = TCA Hit% * used Ability X</nowiki>}}
  001843a8: 00431023 subu r2,r2,r3
+
  00184388: 3c0251eb lui r2,0x51eb           |
  001843ac: 14800006 bne r4,r0,0x001843c8
+
  0018438c: 3442851f ori r2,r2,0x851f         |{{f/std|<nowiki>r2 = 0x51eb851f    (0,32*2^32)</nowiki>}}
  001843b0: a4a2002a sh r2,0x002a(r5) store Hit %
+
  00184390: 00620018 mult r3,r2               |{{f/std|Hit% * Ability X * 0,32 * 2^32}}
  001843b4: 34040064 ori r4,r0,0x0064
+
  00184394: 3c048019 lui r4,0x8019           |
  001843b8: 0c017833 jal 0x0005e0cc check if attack hits
+
  00184398: 8c84f5fc lw r4,-0x0a04(r4)       |{{f/adr|<nowiki>r4 = Action State</nowiki>}}
  001843bc: 00c02821 addu r5,r6,r0
+
  0018439c: 00031fc3 sra r3,r3,0x1f           |{{f/std|<nowiki>r3 = higher bit of r3 (should be 0)</nowiki>}}
  001843c0: 14400003 bne r2,r0,0x001843d0 branch if
+
  001843a0: 00001010 mfhi r2                 |{{f/std|<nowiki>r2 = Hit% * Ability X * 0,32 </nowiki>}}
  001843c4: 00000000 nop
+
  001843a4: 00021143 sra r2,r2,0x05           |{{f/std|<nowiki>r2 = Hit% * Ability X/100</nowiki>}}
  001843c8: 080610f7 j 0x001843dc jump to end, return attack hit
+
  001843a8: 00431023 subu r2,r2,r3           |{{f/std|<nowiki>r2 = Hit% * Ability X/100 (down rounded )</nowiki>}}
  001843cc: 00001021 addu r2,r0,r0
+
  001843ac: 14800006 bne r4,r0,0x001843c8     {{f/Cond|If Action is being executed}}
  001843d0: 0c0610cf jal 0x0018433c force attack miss
+
  001843b0: a4a2002a sh r2,0x002a(r5)         |{{f/store|Set TCA Hit% to previous Hit% * Ability X% }} {{f/std|(Basicaly it's X% since no evasion has been rolled (previous Hit% is set to 100 in preformula setup)}}
  001843d4: 00000000 nop
+
  001843b4: 34040064 ori r4,r0,0x0064             |{{f/std|<nowiki>r4 = 100</nowiki>}}
  001843d8: 34020001 ori r2,r0,0x0001
+
  001843b8: 0c017833 jal 0x0005e0cc               |{{f/jal|Check_if_Random_is_greater/equal_to_Chance|Check_if_Random_is_greater/equal_to_Chance}} Returns r2 = 0x00 if Random (0 to 100) is < Hit chances (Ability X)
  001843dc: 8fbf0010 lw r31,0x0010(r29)
+
  001843bc: 00c02821 addu r5,r6,r0               |{{f/std|<nowiki>r5 = Ability X</nowiki>}}
  001843e0: 27bd0018 addiu r29,r29,0x0018
+
  001843c0: 14400003 bne r2,r0,0x001843d0         {{f/Cond|If Attack hits}}
  001843e4: 03e00008 jr r31
+
  001843c4: 00000000 nop                             |
  001843e8: 00000000 nop
+
  001843c8: 080610f7 j 0x001843dc             {{f/Cond|E}}      {{f/jump|<nowiki>jump to end (r2 = 0x00)</nowiki>}}
</font>
+
  001843cc: 00001021 addu r2,r0,r0                   |{{f/std|<nowiki>r2 = 0x00 (Attack hits)</nowiki>}}
 +
                                                {{f/Cond|Else : Attack mMiss}}
 +
  001843d0: 0c0610cf jal 0x0018433c                   |{{f/jal|Force_Attack_Miss|Force_Attack_Miss}} TCA hit flag = 0x00, Evade type = 0x07, Hit% = 0%
 +
  001843d4: 00000000 nop                             |
 +
  001843d8: 34020001 ori r2,r0,0x0001                 |{{f/std|<nowiki>r2 = 0x01</nowiki>}}
 +
  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: [[1C_Hit_(X)%25|Formula 1C - Hit (X)%]]
 +
0018940c: [[1D_Hit_(X)%25|Formula 1D - Hit (X)%]]

Latest revision as of 10:50, 18 April 2022

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)%