Tranfer AI Ability Data and Set Defend flag (00199498)

From Final Fantasy Hacktics Wiki
Revision as of 19:51, 23 June 2024 by Orkney (talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search
BATTLE.BIN :  -  Tranfer Skillset CT Ability ID and Set Defend flag
Set some Data to AI 0x17fc (Selected Action Data). Set destination from AI 0xcc4 (+0xe2d offset) and Skillset (0x2 if defend can be used, else 0x00)
------------------------------------------------------------------------------------------
Parameter : Nothing
Return : Nothing
------------------------------------------------------------------------------------------
00199498: 3c02801a lui r2,0x801a             |
0019949c: 904201f1 lbu r2,0x01f1(r2)         |AI 0xe2d - Movement specification (0x00 for any destination, 0x1 if closer from target, 0x2 if away from target)
001994a0: 3c03801a lui r3,0x801a             |
001994a4: 8c630bbc lw r3,0x0bbc(r3)          |Load Acting Unit's Battle Data Pointer
001994a8: 3c01801a lui r1,0x801a             |
001994ac: a0200bc0 sb r0,0x0bc0(r1)          |Clear AI 0x17fc (default value ?) AI 0x17fc is where the best action setting is stored
001994b0: 00021080 sll r2,r2,0x02            |Word offset based on AI 0xe2d
001994b4: 3c01801a lui r1,0x801a             |
001994b8: 00220821 addu r1,r1,r2             |
001994bc: 8c220088 lw r2,0x0088(r1)          |Coordinates at AI 0xcc4 + 0xe2d offset
001994c0: 94630016 lhu r3,0x0016(r3)         |Acting Unit Equipped Support Ability ID
001994c4: 3c01801a lui r1,0x801a             |
001994c8: ac220bc4 sw r2,0x0bc4(r1)          |Save coordinates from AI 0xcc4 (+0x2ed offset) at AI 0x17fc + 0x04 Destination ?
001994cc: 340201df ori r2,r0,0x01df          |
001994d0: 14620005 bne r3,r2,0x001994e8      #If Acting Unit can use [Defend]
001994d4: 34020002 ori r2,r0,0x0002              |
001994d8: 3c01801a lui r1,0x801a                 |
001994dc: a0220bc9 sb r2,0x0bc9(r1)              |Set Used Skillset as Defend
001994e0: 0806653c j 0x001994f0                  |Exit
001994e4: 00000000 nop                           |
                                             Else : Acting unit cannot use defend
001994e8: 3c01801a lui r1,0x801a                 |
001994ec: a0200bc9 sb r0,0x0bc9(r1)              |Set Skillset to 0x00  Move only ?
001994f0: 03e00008 jr r31
001994f4: 00000000 nop

Return locations

BATTLE.BIN
 00196288: Non-Specific_AI_AutoBattle_(Enemies)      AI 0x2ed = 0x0
 001982bc: Fight_for_Life_-_Auto_Battle_(00197ff4)   AI 0x2ed = 0x2
 00198800: Protect_Allies_-_Auto_Battle_(001984ec)   AI 0x2ed = 0x2
 00199034: AI_Critical_or_Run_Like_Rabbit