Distribute Usability

From Final Fantasy Hacktics Wiki
Jump to navigation Jump to search
Checks if there's an excedent heal, if yes roll random Vs Brave%. If succesful, store Distribute ID in TCA 0x0e and Excedent heal amount in TCA 0x26

TCA = Targeted Unit Current Action
--------------------------------------------------------------------------------------------------------
0018d2a8: 3c058019 lui r5,0x8019            |
0018d2ac: 8ca52d98 lw r5,0x2d98(r5)         |r5 = Targeted Unit data pointer
0018d2b0: 3c048019 lui r4,0x8019            |
0018d2b4: 8c842d90 lw r4,0x2d90(r4)         |r4 = TCA data pointer
0018d2b8: 27bdffe8 addiu r29,r29,-0x0018    |
0018d2bc: afbf0014 sw r31,0x0014(r29)       |
0018d2c0: afb00010 sw r16,0x0010(r29)       |
0018d2c4: 94a2002a lhu r2,0x002a(r5)        |r2 = Targeted Unit Max HP
0018d2c8: 94a30028 lhu r3,0x0028(r5)        |r3 = Targeted Unit Current HP
0018d2cc: 84840006 lh r4,0x0006(r4)         |r4 = TCA HP recovery (amount)
0018d2d0: 00431023 subu r2,r2,r3            |r2 = Targeted Unit Missing HP
0018d2d4: 00828023 subu r16,r4,r2           |r16 = Excedent Heal (TCA HP recovery - Targeted Unit missing HP)
0018d2d8: 1a00000a blez r16,0x0018d304      #If TCA Excedent Heal > 0x00
0018d2dc: 00000000 nop                          |
0018d2e0: 0c0634e1 jal 0x0018d384               |-->Chance to React Returns r2 = 0x00 If Unit will react (Chances are Br%)
0018d2e4: 00a02021 addu r4,r5,r0                |
0018d2e8: 14400006 bne r2,r0,0x0018d304         #If Targeted Unit is reacting
0018d2ec: 340201bc ori r2,r0,0x01bc                 |r2 = 0x1bc (Distribute ID)
0018d2f0: 3c038019 lui r3,0x8019                    |
0018d2f4: 8c632d90 lw r3,0x2d90(r3)                 |r3 = TCA data pointer
0018d2f8: 00000000 nop                              |
0018d2fc: a4700026 sh r16,0x0026(r3)                |Store Excendent Heal in TCA 0x26 (Uni's 0x1b2)
0018d300: a462000e sh r2,0x000e(r3)                 |Store Distribute Ability ID in TCA 0x0e (Unit's 0x19a)
0018d304: 8fbf0014 lw r31,0x0014(r29)       
0018d308: 8fb00010 lw r16,0x0010(r29)       
0018d30c: 27bd0018 addiu r29,r29,0x0018     
0018d310: 03e00008 jr r31                    
0018d314: 00000000 nop                        

Return location

Battle.bin
0018cca4: MP_Switch,_Distribute,_and_Damage_Split_usability