Steal Gil

From Final Fantasy Hacktics Wiki
Revision as of 20:16, 21 April 2022 by Orkney (talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search
No Parameters - Returns Nothing

Set the amount of stolen gils (Speed * Level)
If Target is in Player Team : If war funds are insufficient, Stole gils = War Funds
                               If War Funds = 0 : force attack to miss
Set Stolen gil value in Attacker Action 0x0c
Set lost gil value (same as above but negative) in Target Action 0x0c
Set both Action Type to pseudostatus (disables other flags)  
--------------------------------------------------------------------------------------------
00186744: 3c028019 lui r2,0x8019            |
00186748: 8c422d94 lw r2,0x2d94(r2)         |r2 = Attacker data pointer
0018674c: 27bdffe8 addiu r29,r29,-0x0018    |
00186750: afbf0014 sw r31,0x0014(r29)       |
00186754: afb00010 sw r16,0x0010(r29)       |
00186758: 90430038 lbu r3,0x0038(r2)        |r3 = Attacker's Speed
0018675c: 90420022 lbu r2,0x0022(r2)        |r2 = Attacker's Level
00186760: 00000000 nop                      |
00186764: 00620018 mult r3,r2               |Speed * Level
00186768: 3c028019 lui r2,0x8019            |
0018676c: 8c422d98 lw r2,0x2d98(r2)         |r2 = Target data pointer
00186770: 00000000 nop                      |
00186774: 90420005 lbu r2,0x0005(r2)        |r2 = Target ENTD flags
00186778: 00000000 nop                      |
0018677c: 30420030 andi r2,r2,0x0030        |r2 = Target Team 
00186780: 00008012 mflo r16                 |r16 = Attacker's Speed*Level
00186784: 14400008 bne r2,r0,0x001867a8     #If Target is in Player Team
00186788: 00000000 nop                          |
0018678c: 0c04ed64 jal 0x0013b590               |-->Get_Script_Variable Returns r2 = War Funds Variable Value
00186790: 3404002c ori r4,r0,0x002c             |r4 = 0x2c (Variable : War Funds)
00186794: 00401821 addu r3,r2,r0                |r3 = War Funds value
00186798: 0070102a slt r2,r3,r16                |r2 = 0x01 if Stolen Gils amount > War Funds
0018679c: 10400002 beq r2,r0,0x001867a8         #If Stolen Gils amount > War Funds
001867a0: 00000000 nop                              |
001867a4: 00608021 addu r16,r3,r0                   |r16 = War Funds Value
001867a8: 16000005 bne r16,r0,0x001867c0    #If Stolen Gils = 0 Gils (No more money in player War funds)
001867ac: 34030001 ori r3,r0,0x0001         |r3 = 0x01 
001867b0: 0c0610c3 jal 0x0018430c                   |-->Force_Attack_Miss Hit Flag = Miss Hit% = 0 - Evade type = 0x07
001867b4: 00000000 nop                              |
001867b8: 08061a00 j 0x00186800                     >>jump to  END
001867bc: 00000000 nop                              |
001867c0: 3c048019 lui r4,0x8019            #Else : Stolen Gils > 0
001867c4: 8c842d8c lw r4,0x2d8c(r4)         |r4 = Attacker Current Action (ACA) data pointer
001867c8: 00000000 nop                      |
001867cc: a0830000 sb r3,0x0000(r4)         |Set ACA hit flag to HIT
001867d0: 3c028019 lui r2,0x8019            |
001867d4: 8c422d8c lw r2,0x2d8c(r2)         |r2 = ACA data pointer
001867d8: a490000c sh r16,0x000c(r4)        |Store Stolen Gils amount in ACA stolen gil (0x0c)
001867dc: a0430025 sb r3,0x0025(r2)         |Set ACA Attack type to pseudo status (disables other flags)
001867e0: 3c028019 lui r2,0x8019            |
001867e4: 8c422d8c lw r2,0x2d8c(r2)         |r2 = ACA data pointer
001867e8: 3c048019 lui r4,0x8019            |
001867ec: 8c842d90 lw r4,0x2d90(r4)         |r4 = TCA data pointer
001867f0: 9442000c lhu r2,0x000c(r2)        |r2 = Gils stolen
001867f4: a0830025 sb r3,0x0025(r4)         |Set TCA Attack type to pseudostatus (disables other flags)
001867f8: 00021023 subu r2,r0,r2            |r2 = Stolen gils (negative value)
001867fc: a482000c sh r2,0x000c(r4)         |Store Lost gils in TCA 0x0c (Stolen/Lost gils)
00186800: 8fbf0014 lw r31,0x0014(r29)       
00186804: 8fb00010 lw r16,0x0010(r29)       
00186808: 27bd0018 addiu r29,r29,0x0018     
0018680c: 03e00008 jr r31                   
00186810: 00000000 nop                      

Return locations

Battle.bin
00186c44: Talk_Skill
00189860: 27_StealGil_(CasLVL*SP)_Hit_(SP+X)%