Counter, Counter Tackle, Counter Flood, Brave Up, Dragon Spirit, Sunken State, and Caution Usability usability

From Final Fantasy Hacktics Wiki
Revision as of 21:21, 14 March 2022 by Orkney (talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search
Counter, Counter Tackle, Counter Magic, Counter Flood, Brave Up, Dragon Spirit,  Sunken State, and Caution Usability:

Parameters : r4 = Target Reaction Ability ID (determined from Target reaction set)
             r5 = Ability flag to check (0x80 = Counterflood flag - 0x40 = counter Magic flag / 0x10 = Counter Grasp flag)

If Used skillset ( 0x801938d4 ) is Math skill : skip the routine (no reaction)
Checks if Used Ability has desired flag enable (using 0x801938f6) if not, skip the routine (no reaction)
Test Unit Brave% as chance to react : skip the routine if failed

If Targeted Unit react :
- Store Reaction Ability ID in Target Data 0x19e (= current action 0x0e)
- Store Used Ability ID (from 0x801938d6) in Target data 0x1b2 (current action 0x26) - last attack received ?
--------------------------------------------------------------------------------------------
0018ce04: 27bdffe8 addiu r29,r29,-0x0018    |
0018ce08: afb00010 sw r16,0x0010(r29)       |
0018ce0c: 00808021 addu r16,r4,r0           |r16 = Targeted Unit's Reaction Ability ID
0018ce10: 3c038019 lui r3,0x8019            |
0018ce14: 906338d4 lbu r3,0x38d4(r3)        |r3 = Current action used skillset (by Attacker)  0x801938d4 / 801938d4
0018ce18: 34020015 ori r2,r0,0x0015         |r2 = 0x15
0018ce1c: 10620015 beq r3,r2,0x0018ce74     #If Attacker used skillset is NOT math skill /Else branch to END (no reaction)
0018ce20: afbf0014 sw r31,0x0014(r29)           |
0018ce24: 3c028019 lui r2,0x8019                |r2 = 0x8019
0018ce28: 904238f6 lbu r2,0x38f6(r2)            |r2 = Attacker's used ability flags 4
0018ce2c: 00000000 nop                          |
0018ce30: 00451024 and r2,r2,r5                 |r2 <> 0x00 if Desired Ability Flag is enabled
0018ce34: 1040000f beq r2,r0,0x0018ce74         #If Desired Ability Flag is enabled /Else branch to END (no reaction)
0018ce38: 00000000 nop                              | 
0018ce3c: 3c048019 lui r4,0x8019                    | 
0018ce40: 8c842d98 lw r4,0x2d98(r4)                 |r4 = Targeted Unit data pointer
0018ce44: 0c0634e1 jal 0x0018d384                   |-->Chance_to_React  Returns r2 = 0x00 if Unit is reacting ( chances are Brave%)
0018ce48: 00000000 nop                              |
0018ce4c: 14400009 bne r2,r0,0x0018ce74             #If Targeted unit is reacting /Else branch to END (no reaction)
0018ce50: 00000000 nop                                  |
0018ce54: 3c038019 lui r3,0x8019                        | 
0018ce58: 8c632d90 lw r3,0x2d90(r3)                     |r3 = Targeted Unit current action data pointer
0018ce5c: 00000000 nop                                  |
0018ce60: a470000e sh r16,0x000e(r3)                    |Store Reaction Ability ID in Unit 0x19a
0018ce64: 3c028019 lui r2,0x8019                        |
0018ce68: 944238d6 lhu r2,0x38d6(r2)                    |r2 = Current Ability Attacker used Ability ID  0x801938d6
0018ce6c: 00000000 nop                                  |
0018ce70: a4620026 sh r2,0x0026(r3)                     |Target last attack received = Current Ability last used Ability ID  Unit 0x1b2
0018ce74: 8fbf0014 lw r31,0x0014(r29)       END                  
0018ce78: 8fb00010 lw r16,0x0010(r29)                   
0018ce7c: 27bd0018 addiu r29,r29,0x0018                 
0018ce80: 03e00008 jr r31                               
0018ce84: 00000000 nop

Return locations

Battle.bin
0018cc24: Sunken_State,_Caution,_Dragon_Spirit,_counters,_absorbs_usability